Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 179419 Details for
Bug 321701
[api] Support common keyboard commands for textual navigation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch that adds common delete/cut commands
patch.txt (text/plain), 17.54 KB, created by
David Green
on 2010-09-22 17:22:41 EDT
(
hide
)
Description:
patch that adds common delete/cut commands
Filename:
MIME Type:
Creator:
David Green
Created:
2010-09-22 17:22:41 EDT
Size:
17.54 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.wikitext.tasks.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.wikitext.tasks.ui/plugin.xml,v >retrieving revision 1.17 >diff -u -r1.17 plugin.xml >--- plugin.xml 29 Jul 2010 14:26:18 -0000 1.17 >+++ plugin.xml 22 Sep 2010 21:20:57 -0000 >@@ -224,4 +224,87 @@ > schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"> > </key> > </extension> >+ <extension >+ point="org.eclipse.ui.handlers"> >+ <handler >+ class="org.eclipse.mylyn.internal.wikitext.tasks.ui.commands.DeleteLineHandler" >+ commandId="org.eclipse.ui.edit.text.delete.line"> >+ <activeWhen> >+ <with variable="activeContexts"> >+ <iterate operator="or" ifEmpty="false"> >+ <equals >+ value="org.eclipse.mylyn.wikitext.tasks.ui.markupSourceContext"/> >+ </iterate> >+ </with> >+ </activeWhen> >+ </handler> >+ >+ <handler >+ class="org.eclipse.mylyn.internal.wikitext.tasks.ui.commands.CutLineHandler" >+ commandId="org.eclipse.ui.edit.text.cut.line"> >+ <activeWhen> >+ <with variable="activeContexts"> >+ <iterate operator="or" ifEmpty="false"> >+ <equals >+ value="org.eclipse.mylyn.wikitext.tasks.ui.markupSourceContext"/> >+ </iterate> >+ </with> >+ </activeWhen> >+ </handler> >+ >+ <handler >+ class="org.eclipse.mylyn.internal.wikitext.tasks.ui.commands.DeleteLineToBeginningHandler" >+ commandId="org.eclipse.ui.edit.text.delete.line.to.beginning"> >+ <activeWhen> >+ <with variable="activeContexts"> >+ <iterate operator="or" ifEmpty="false"> >+ <equals >+ value="org.eclipse.mylyn.wikitext.tasks.ui.markupSourceContext"/> >+ </iterate> >+ </with> >+ </activeWhen> >+ </handler> >+ >+ <handler >+ class="org.eclipse.mylyn.internal.wikitext.tasks.ui.commands.CutLineToBeginningHandler" >+ commandId="org.eclipse.ui.edit.text.cut.line.to.beginning"> >+ <activeWhen> >+ <with variable="activeContexts"> >+ <iterate operator="or" ifEmpty="false"> >+ <equals >+ value="org.eclipse.mylyn.wikitext.tasks.ui.markupSourceContext"/> >+ </iterate> >+ </with> >+ </activeWhen> >+ </handler> >+ >+ >+ <handler >+ class="org.eclipse.mylyn.internal.wikitext.tasks.ui.commands.DeleteLineToEndHandler" >+ commandId="org.eclipse.ui.edit.text.delete.line.to.end"> >+ <activeWhen> >+ <with variable="activeContexts"> >+ <iterate operator="or" ifEmpty="false"> >+ <equals >+ value="org.eclipse.mylyn.wikitext.tasks.ui.markupSourceContext"/> >+ </iterate> >+ </with> >+ </activeWhen> >+ </handler> >+ >+ >+ <handler >+ class="org.eclipse.mylyn.internal.wikitext.tasks.ui.commands.CutLineToEndHandler" >+ commandId="org.eclipse.ui.edit.text.cut.line.to.end"> >+ <activeWhen> >+ <with variable="activeContexts"> >+ <iterate operator="or" ifEmpty="false"> >+ <equals >+ value="org.eclipse.mylyn.wikitext.tasks.ui.markupSourceContext"/> >+ </iterate> >+ </with> >+ </activeWhen> >+ </handler> >+ >+ </extension> > </plugin> >Index: src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/AbstractDeleteLineHandler.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/AbstractDeleteLineHandler.java >diff -N src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/AbstractDeleteLineHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/AbstractDeleteLineHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,53 @@ >+/******************************************************************************* >+ * Copyright (c) 2007, 2010 David Green and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * David Green - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.wikitext.tasks.ui.commands; >+ >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.ExecutionException; >+import org.eclipse.core.commands.IHandler; >+import org.eclipse.jface.text.BadLocationException; >+import org.eclipse.jface.text.ITextSelection; >+import org.eclipse.jface.text.source.ISourceViewer; >+import org.eclipse.ui.texteditor.TextViewerDeleteLineTarget; >+ >+/** >+ * Abstract command handler that uses {@link TextViewerDeleteLineTarget}. Subclasses can specify the type of delete line >+ * and copyToClipboard. >+ * >+ * @author David Green >+ */ >+public class AbstractDeleteLineHandler extends AbstractMarkupSourceViewerHandler implements IHandler { >+ protected final int type; >+ >+ protected final boolean copyToClipboard; >+ >+ protected AbstractDeleteLineHandler(int type, boolean copyToClipboard) { >+ this.type = type; >+ this.copyToClipboard = copyToClipboard; >+ } >+ >+ public Object execute(ExecutionEvent event) throws ExecutionException { >+ ISourceViewer viewer = getSourceViewer(event); >+ if (viewer != null) { >+ TextViewerDeleteLineTarget target = new TextViewerDeleteLineTarget(viewer); >+ >+ try { >+ target.deleteLine(viewer.getDocument(), (ITextSelection) viewer.getSelectionProvider().getSelection(), >+ type, copyToClipboard); >+ } catch (BadLocationException e) { >+ throw new ExecutionException(e.getMessage(), e); >+ } >+ } >+ return null; >+ } >+ >+} >Index: src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/AbstractMarkupSourceViewerHandler.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/AbstractMarkupSourceViewerHandler.java >diff -N src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/AbstractMarkupSourceViewerHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/AbstractMarkupSourceViewerHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,37 @@ >+/******************************************************************************* >+ * Copyright (c) 2007, 2010 David Green and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * David Green - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.wikitext.tasks.ui.commands; >+ >+import org.eclipse.core.commands.AbstractHandler; >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.ExecutionException; >+import org.eclipse.jface.text.source.ISourceViewer; >+import org.eclipse.swt.custom.StyledText; >+import org.eclipse.ui.handlers.HandlerUtil; >+ >+/** >+ * Abstract command handler that can get the current source viewer >+ * >+ * @author David Green >+ */ >+public abstract class AbstractMarkupSourceViewerHandler extends AbstractHandler { >+ >+ protected ISourceViewer getSourceViewer(ExecutionEvent event) throws ExecutionException { >+ Object activeFocusControl = HandlerUtil.getVariable(event, "activeFocusControl"); //$NON-NLS-1$ >+ if (activeFocusControl instanceof StyledText) { >+ StyledText textWidget = (StyledText) activeFocusControl; >+ ISourceViewer viewer = (ISourceViewer) textWidget.getData(ISourceViewer.class.getName()); >+ return viewer; >+ } >+ return null; >+ } >+} >\ No newline at end of file >Index: src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/CutLineHandler.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/CutLineHandler.java >diff -N src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/CutLineHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/CutLineHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,25 @@ >+/******************************************************************************* >+ * Copyright (c) 2007, 2010 David Green and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * David Green - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.wikitext.tasks.ui.commands; >+ >+import org.eclipse.ui.texteditor.DeleteLineAction; >+ >+/** >+ * Command handler for cut line command (whole) >+ * >+ * @author David Green >+ */ >+public class CutLineHandler extends AbstractDeleteLineHandler { >+ public CutLineHandler() { >+ super(DeleteLineAction.WHOLE, true); >+ } >+} >Index: src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/CutLineToBeginningHandler.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/CutLineToBeginningHandler.java >diff -N src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/CutLineToBeginningHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/CutLineToBeginningHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,25 @@ >+/******************************************************************************* >+ * Copyright (c) 2007, 2010 David Green and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * David Green - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.wikitext.tasks.ui.commands; >+ >+import org.eclipse.ui.texteditor.DeleteLineAction; >+ >+/** >+ * Command handler for cut line command (to beginning) >+ * >+ * @author David Green >+ */ >+public class CutLineToBeginningHandler extends AbstractDeleteLineHandler { >+ public CutLineToBeginningHandler() { >+ super(DeleteLineAction.TO_BEGINNING, true); >+ } >+} >Index: src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/CutLineToEndHandler.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/CutLineToEndHandler.java >diff -N src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/CutLineToEndHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/CutLineToEndHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,25 @@ >+/******************************************************************************* >+ * Copyright (c) 2007, 2010 David Green and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * David Green - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.wikitext.tasks.ui.commands; >+ >+import org.eclipse.ui.texteditor.DeleteLineAction; >+ >+/** >+ * Command handler for cut line command (to end) >+ * >+ * @author David Green >+ */ >+public class CutLineToEndHandler extends AbstractDeleteLineHandler { >+ public CutLineToEndHandler() { >+ super(DeleteLineAction.TO_END, true); >+ } >+} >Index: src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/DeleteLineHandler.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/DeleteLineHandler.java >diff -N src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/DeleteLineHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/DeleteLineHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,25 @@ >+/******************************************************************************* >+ * Copyright (c) 2007, 2010 David Green and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * David Green - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.wikitext.tasks.ui.commands; >+ >+import org.eclipse.ui.texteditor.DeleteLineAction; >+ >+/** >+ * Command handler for delete line command (whole) >+ * >+ * @author David Green >+ */ >+public class DeleteLineHandler extends AbstractDeleteLineHandler { >+ public DeleteLineHandler() { >+ super(DeleteLineAction.WHOLE, false); >+ } >+} >Index: src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/DeleteLineToBeginningHandler.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/DeleteLineToBeginningHandler.java >diff -N src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/DeleteLineToBeginningHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/DeleteLineToBeginningHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,25 @@ >+/******************************************************************************* >+ * Copyright (c) 2007, 2010 David Green and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * David Green - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.wikitext.tasks.ui.commands; >+ >+import org.eclipse.ui.texteditor.DeleteLineAction; >+ >+/** >+ * Command handler for delete line command (to beginning) >+ * >+ * @author David Green >+ */ >+public class DeleteLineToBeginningHandler extends AbstractDeleteLineHandler { >+ public DeleteLineToBeginningHandler() { >+ super(DeleteLineAction.TO_BEGINNING, false); >+ } >+} >Index: src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/DeleteLineToEndHandler.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/DeleteLineToEndHandler.java >diff -N src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/DeleteLineToEndHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/wikitext/tasks/ui/commands/DeleteLineToEndHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,25 @@ >+/******************************************************************************* >+ * Copyright (c) 2007, 2010 David Green and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * David Green - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.wikitext.tasks.ui.commands; >+ >+import org.eclipse.ui.texteditor.DeleteLineAction; >+ >+/** >+ * Command handler for delete line command (to end) >+ * >+ * @author David Green >+ */ >+public class DeleteLineToEndHandler extends AbstractDeleteLineHandler { >+ public DeleteLineToEndHandler() { >+ super(DeleteLineAction.TO_END, false); >+ } >+} >#P org.eclipse.mylyn.wikitext.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.wikitext.ui/plugin.xml,v >retrieving revision 1.23 >diff -u -r1.23 plugin.xml >--- plugin.xml 8 Jun 2010 23:06:01 -0000 1.23 >+++ plugin.xml 22 Sep 2010 21:20:58 -0000 >@@ -228,7 +228,7 @@ > style="push" > tooltip="%command.tooltip.3"> > <visibleWhen> >- `<with variable="activeContexts"> >+ <with variable="activeContexts"> > <iterate operator="or"> > <equals > value="org.eclipse.mylyn.internal.wikitext.ui.editor.basicMarkupSourceContext"/>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 321701
:
177626
|
177980
|
177981
| 179419 |
179420
|
181533
|
181534