Author: snjeza
Date: 2008-04-14 21:25:29 -0400 (Mon, 14 Apr 2008)
New Revision: 7525
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-14 17:43:36 UTC (rev
7524)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/plugin.properties 2008-04-15 01:25:29 UTC (rev
7525)
@@ -1,2 +1,7 @@
providerName=Red Hat, Inc.
pluginName=JBoss Tools UI Plugin
+vpe.editor.binding.context.description=The Visual Page Editor
+editor.binding.context.name=Visual Page Editor
+vpe.category=Visual Page Editor
+source.maxmin=Maximize/Restore Source Part
+visual.maxmin=Maximize/Restore Visual Part
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml 2008-04-14 17:43:36 UTC (rev 7524)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml 2008-04-15 01:25:29 UTC (rev 7525)
@@ -33,5 +33,33 @@
</extension>
<extension point="org.eclipse.ui.preferencePages">
<page category="org.jboss.tools.common.xstudio.editors"
class="org.jboss.tools.vpe.editor.preferences.VpeEditorPreferencesPage"
id="org.jboss.tools.vpe.editor" name="Visual Page
Editor"></page>
- </extension>
+ </extension>
+ <extension
+ point="org.eclipse.ui.contexts">
+ <context
+ description="%vpe.editor.binding.context.description"
+ id="org.jboss.tools.vpe.editorContext"
+ name="%editor.binding.context.name"
+ parentId="org.eclipse.ui.textEditorScope">
+ </context>
+ </extension>
+ <extension id="org.jboss.tools.vpe.commands"
point="org.eclipse.ui.commands">
+ <category id="org.jboss.tools.vpe.category"
name="%vpe.category"/>
+ <command categoryId="org.jboss.tools.vpe.category"
+ id="org.jboss.tools.vpe.source.maxmin"
+ name="%source.maxmin"/>
+ <command categoryId="org.jboss.tools.vpe.category"
+ id="org.jboss.tools.vpe.visual.maxmin"
+ name="%visual.maxmin"/>
+ </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"/>
+ <key commandId="org.jboss.tools.vpe.visual.maxmin"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ contextId="org.jboss.tools.vpe.editorContext"
+ sequence="M1+M2+F6"/>
+ </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-14
17:43:36 UTC (rev 7524)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2008-04-15
01:25:29 UTC (rev 7525)
@@ -13,6 +13,10 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.QualifiedName;
@@ -43,11 +47,16 @@
import org.eclipse.ui.IPropertyListener;
import org.eclipse.ui.IReusableEditor;
import org.eclipse.ui.IStorageEditorInput;
+import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartConstants;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.contexts.IContextActivation;
+import org.eclipse.ui.contexts.IContextService;
+import org.eclipse.ui.handlers.IHandlerActivation;
+import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.part.EditorPart;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.texteditor.IDocumentProvider;
@@ -75,6 +84,9 @@
public class VpeEditorPart extends EditorPart implements ITextEditor,
ITextEditorExtension, IReusableEditor, IVisualEditor {
+ private IContextActivation fContextActivation;
+ private IHandlerActivation sourceActivation,visualActivation;
+ private IHandler sourceMaxmin,visualMaxmin;
private CustomSashForm container;
protected EditorSettings editorSettings;
private StructuredTextEditor sourceEditor = null;
@@ -652,6 +664,30 @@
// ///////////////////////////////////////
cmpEd.layout();
+ 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();
+ }
+ return null;
+ }
+ };
+ 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();
+ }
+ return null;
+ }
+ };
}
public void createVisualEditor() {
@@ -761,6 +797,9 @@
private class ActivationListener extends ShellAdapter implements
IPartListener {
+ 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 IWorkbenchPart fActivePart;
private boolean fIsHandlingActivation = false;
@@ -777,6 +816,21 @@
public void partDeactivated(IWorkbenchPart part) {
fActivePart = null;
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ if (fContextActivation != null) {
+ IContextService contextService = (IContextService) workbench
+ .getAdapter(IContextService.class);
+ contextService.deactivateContext(fContextActivation);
+ }
+
+ IHandlerService handlerService = (IHandlerService) workbench
+ .getService(IHandlerService.class);
+ if (handlerService != null) {
+ if (sourceActivation != null)
+ handlerService.deactivateHandler(sourceActivation);
+ if (visualActivation != null)
+ handlerService.deactivateHandler(visualActivation);
+ }
}
public void partOpened(IWorkbenchPart part) {
@@ -804,6 +858,21 @@
}
sourceEditor.safelySanityCheckState(getEditorInput());
}
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ IContextService contextService = (IContextService) workbench
+ .getAdapter(IContextService.class);
+ fContextActivation = contextService
+ .activateContext(VPE_EDITOR_CONTEXT); //$NON-NLS-1$
+ IHandlerService handlerService = (IHandlerService) workbench
+ .getService(IHandlerService.class);
+ if (handlerService != null) {
+ sourceActivation = handlerService.activateHandler(
+ VPE_SOURCE_MAXMIN,
+ sourceMaxmin);
+ visualActivation = handlerService.activateHandler(
+ VPE_VISUAL_MAXMIN,
+ visualMaxmin);
+ }
} 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-14
17:43:36 UTC (rev 7524)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java 2008-04-15
01:25:29 UTC (rev 7525)
@@ -177,6 +177,14 @@
}
+ public void upClicked() {
+ upClicked(currentSashInfo);
+ }
+
+ public void downClicked() {
+ downClicked(currentSashInfo);
+ }
+
/**
* Call to set to max down
*/
Show replies by date