Author: mareshkau
Date: 2007-07-23 04:27:44 -0400 (Mon, 23 Jul 2007)
New Revision: 2588
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
Log:
bug fixing JBIDE 528, CTRL+M was resolved,
[
http://jira.jboss.com/jira/browse/JBIDE-528?page=all ]
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2007-07-22
07:10:11 UTC (rev 2587)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2007-07-23
08:27:44 UTC (rev 2588)
@@ -10,9 +10,9 @@
******************************************************************************/
package org.jboss.tools.vpe.editor;
+import java.util.Iterator;
import java.util.List;
import java.util.Properties;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -22,6 +22,9 @@
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.bindings.Binding;
+import org.eclipse.jface.bindings.keys.KeySequence;
+import org.eclipse.jface.bindings.keys.KeyStroke;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.viewers.ISelection;
@@ -51,7 +54,10 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.internal.keys.WorkbenchKeyboard;
+import org.eclipse.ui.keys.IBindingService;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
import org.eclipse.wst.sse.core.internal.model.ModelLifecycleEvent;
import org.eclipse.wst.sse.core.internal.provisional.IModelLifecycleListener;
@@ -147,6 +153,9 @@
import org.w3c.dom.Text;
public class VpeController implements INodeAdapter, IModelLifecycleListener,
INodeSelectionListener, ITextSelectionListener, SelectionListener, EditorDomEventListener,
VpeTemplateListener, XModelTreeListener, ResourceReferenceListListener,
ISelectionChangedListener, IVisualController {
+ //id of command which is maximazed/minimazed editor
+ private static final String
MAXIMAZE_PART_ID="org.eclipse.ui.window.maximizePart";
+
StructuredTextEditor sourceEditor;
private MozillaEditor visualEditor;
MozillaBrowser browser;
@@ -786,7 +795,7 @@
selectionBuilder.setClickContentAreaSelection();
}
}
- switcher.stopActiveEditor();
+ switcher.stopActiveEditor();
}
public void mouseDblClick(nsIDOMMouseEvent mouseEvent) {
@@ -846,12 +855,17 @@
if (VpeDebug.printVisualKeyEvent) {
System.out.println("<<< keyPress type: " + keyEvent.getType() +
" Ctrl: " + keyEvent.isCtrlKey() + " Shift: " +
keyEvent.isShiftKey() + " CharCode: " + keyEvent.getCharCode() + "
KeyCode: " + keyEvent.getKeyCode()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
//$NON-NLS-4$ //$NON-NLS-5$
}
+
if (!switcher.startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
+ switcher.stopActiveEditor();
return;
}
+
visualEditor.hideResizer();
+ //TODO with this behaviour isn't works 'CTRL+M'
switcher.stopActiveEditor();
+
try {
if (visualKeyHandler.keyPressHandler(keyEvent)) {
switcher.startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL);
@@ -882,21 +896,47 @@
keyboardEvent.stateMask = (aAltKey[0] ? SWT.ALT : 0) | (aCtrlKey[0] ? SWT.CTRL : 0) |
(aShiftKey[0] ? SWT.SHIFT : 0) | (aMetaKey[0] ? SWT.MOD1 : 0);
keyboardEvent.x=0;
keyboardEvent.y=0;
- keyboardEvent.type=1;
+ keyboardEvent.type=SWT.KeyDown;
if(keyEvent.getKeyCode()==0) {
- keyboardEvent.keyCode=keyEvent.getCharCode();
+ keyboardEvent.keyCode=keyEvent.getCharCode();
} else{
- keyboardEvent.keyCode=keyEvent.getKeyCode();
+ keyboardEvent.keyCode=keyEvent.getKeyCode();
}
+ //for maximaze/minimaze command(CTRL+M), we shouldn't call event listeners
+ List possibleKeyStrokes =
WorkbenchKeyboard.generatePossibleKeyStrokes(keyboardEvent);
+ IWorkbench iWorkbench = VpePlugin.getDefault().getWorkbench();
+ if(iWorkbench.hasService(IBindingService.class)){
+ IBindingService iBindingService = (IBindingService)
iWorkbench.getService(IBindingService.class);
+
+ KeySequence sequenceBeforeKeyStroke = KeySequence.getInstance();
+ for (Iterator iterator = possibleKeyStrokes.iterator(); iterator
+ .hasNext();){
+ KeySequence sequenceAfterKeyStroke = KeySequence.getInstance(
+ sequenceBeforeKeyStroke, (KeyStroke) iterator.next());
+ if(iBindingService.isPerfectMatch(sequenceAfterKeyStroke)){
+ final Binding binding = iBindingService.getPerfectMatch(sequenceAfterKeyStroke);
+
+ if((binding!=null)
+ && (binding.getParameterizedCommand()!=null)
+ && (binding.getParameterizedCommand().getCommand()!=null)
+ && (binding.getParameterizedCommand().getCommand().getId()!=null)
+ &&binding.getParameterizedCommand().getCommand().getId().equals(VpeController.MAXIMAZE_PART_ID)){
+ keyboardEvent.type = SWT.NONE;
+ }
+ }
+ }
+ }
browser.notifyListeners(keyboardEvent.type, keyboardEvent);
+
}
} catch (Exception e) {
VpePlugin.getPluginLog().logError(e);
visualRefresh();
}
+
}
public void elementResized(Element element, int resizerConstrains, int top, int left,
int width, int height) {