Author: snjeza
Date: 2008-04-15 17:17:42 -0400 (Tue, 15 Apr 2008)
New Revision: 7541
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/plugin.properties
trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java
Log:
JBIDE-2055 hotkeys to "jump" between source and visual part of split vpe editor
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/plugin.properties
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/plugin.properties 2008-04-15 16:33:53 UTC (rev
7540)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/plugin.properties 2008-04-15 21:17:42 UTC (rev
7541)
@@ -5,3 +5,4 @@
vpe.category=Visual Page Editor
source.maxmin=Maximize/Restore Source Part
visual.maxmin=Maximize/Restore Visual Part
+visual.jumping=Jump
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml 2008-04-15 16:33:53 UTC (rev 7540)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml 2008-04-15 21:17:42 UTC (rev 7541)
@@ -51,15 +51,22 @@
<command categoryId="org.jboss.tools.vpe.category"
id="org.jboss.tools.vpe.visual.maxmin"
name="%visual.maxmin"/>
+ <command categoryId="org.jboss.tools.vpe.category"
+ id="org.jboss.tools.vpe.jumping"
+ name="%visual.jumping"/>
</extension>
<extension point="org.eclipse.ui.bindings">
<key commandId="org.jboss.tools.vpe.source.maxmin"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
contextId="org.jboss.tools.vpe.editorContext"
- sequence="M1+F6"/>
+ sequence="M2+F6"/>
<key commandId="org.jboss.tools.vpe.visual.maxmin"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
contextId="org.jboss.tools.vpe.editorContext"
- sequence="M1+M2+F6"/>
+ sequence="M2+M3+F6"/>
+ <key commandId="org.jboss.tools.vpe.jumping"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ contextId="org.jboss.tools.vpe.editorContext"
+ sequence="M1+M2+Tab"/>
</extension>
</plugin>
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2008-04-15
16:33:53 UTC (rev 7540)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2008-04-15
21:17:42 UTC (rev 7541)
@@ -25,6 +25,7 @@
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.DisposeEvent;
@@ -64,6 +65,7 @@
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.ITextEditorExtension;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.event.XModelTreeEvent;
import org.jboss.tools.common.model.event.XModelTreeListener;
@@ -85,8 +87,8 @@
public class VpeEditorPart extends EditorPart implements ITextEditor,
ITextEditorExtension, IReusableEditor, IVisualEditor {
private IContextActivation fContextActivation;
- private IHandlerActivation sourceActivation,visualActivation;
- private IHandler sourceMaxmin,visualMaxmin;
+ private IHandlerActivation sourceActivation,visualActivation, jumpingActivation;
+ private IHandler sourceMaxmin,visualMaxmin, jumping;
private CustomSashForm container;
protected EditorSettings editorSettings;
private StructuredTextEditor sourceEditor = null;
@@ -667,11 +669,13 @@
sourceMaxmin = new AbstractHandler() {
public Object execute(ExecutionEvent event)
throws ExecutionException {
- Point p = visualContent.getSize();
- if (p.x == 0 || p.y == 0) {
- container.upClicked();
- } else {
- container.maxDown();
+ if (getVisualMode() == IVisualEditor.VISUALSOURCE_MODE) {
+ Point p = visualContent.getSize();
+ if (p.x == 0 || p.y == 0) {
+ container.upClicked();
+ } else {
+ container.maxDown();
+ }
}
return null;
}
@@ -679,15 +683,48 @@
visualMaxmin = new AbstractHandler() {
public Object execute(ExecutionEvent event)
throws ExecutionException {
- Point p = sourceContent.getSize();
- if (p.x == 0 || p.y == 0) {
- container.downClicked();
- } else {
- container.maxUp();
+ if (getVisualMode() == IVisualEditor.VISUALSOURCE_MODE) {
+ Point p = sourceContent.getSize();
+ if (p.x == 0 || p.y == 0) {
+ container.downClicked();
+ } else {
+ container.maxUp();
+ }
}
return null;
}
};
+ jumping = new AbstractHandler() {
+ public Object execute(ExecutionEvent event)
+ throws ExecutionException {
+ if (getVisualMode() == IVisualEditor.VISUALSOURCE_MODE) {
+ StructuredTextEditor editor = getSourceEditor();
+ if (editor == null)
+ return null;
+ StructuredTextViewer viewer = editor.getTextViewer();
+ if (viewer == null)
+ return null;
+ StyledText widget = viewer.getTextWidget();
+ if (widget == null || widget.isDisposed())
+ return null;
+ if (widget.isFocusControl()) {
+ if (visualEditor != null
+ && activeEditor != visualEditor) {
+ activeEditor = visualEditor;
+ setFocus();
+ //visualContent.setFocus();
+ }
+ } else {
+ if (activeEditor != sourceEditor) {
+ activeEditor = sourceEditor;
+ setFocus();
+ }
+ }
+
+ }
+ return null;
+ }
+ };
}
public void createVisualEditor() {
@@ -800,6 +837,7 @@
private static final String VPE_EDITOR_CONTEXT =
"org.jboss.tools.vpe.editorContext";
private static final String VPE_VISUAL_MAXMIN =
"org.jboss.tools.vpe.visual.maxmin";
private static final String VPE_SOURCE_MAXMIN =
"org.jboss.tools.vpe.source.maxmin";
+ private static final String VPE_JUMPING = "org.jboss.tools.vpe.jumping";
private IWorkbenchPart fActivePart;
private boolean fIsHandlingActivation = false;
@@ -830,6 +868,8 @@
handlerService.deactivateHandler(sourceActivation);
if (visualActivation != null)
handlerService.deactivateHandler(visualActivation);
+ if (jumpingActivation != null)
+ handlerService.deactivateHandler(jumpingActivation);
}
}
@@ -872,6 +912,9 @@
visualActivation = handlerService.activateHandler(
VPE_VISUAL_MAXMIN,
visualMaxmin);
+ jumpingActivation = handlerService.activateHandler(
+ VPE_JUMPING,
+ jumping);
}
} finally {
fIsHandlingActivation = false;
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java 2008-04-15
16:33:53 UTC (rev 7540)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java 2008-04-15
21:17:42 UTC (rev 7541)
@@ -178,11 +178,13 @@
public void upClicked() {
- upClicked(currentSashInfo);
+ if (currentSashInfo != null)
+ upClicked(currentSashInfo);
}
public void downClicked() {
- downClicked(currentSashInfo);
+ if (currentSashInfo != null)
+ downClicked(currentSashInfo);
}
/**
Show replies by date