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 106047 Details for
Bug 199288
Expressions view should support paste
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Suggested patch
paste-watch-patch.txt (text/plain), 10.73 KB, created by
Mike Morearty
on 2008-06-27 17:22:16 EDT
(
hide
)
Description:
Suggested patch
Filename:
MIME Type:
Creator:
Mike Morearty
Created:
2008-06-27 17:22:16 EDT
Size:
10.73 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.debug.ui >Index: ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java,v >retrieving revision 1.45 >diff -u -r1.45 ExpressionView.java >--- ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java 14 Nov 2007 19:23:01 -0000 1.45 >+++ ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java 27 Jun 2008 21:15:19 -0000 >@@ -11,9 +11,14 @@ > *******************************************************************************/ > package org.eclipse.debug.internal.ui.views.expression; > >- >+import org.eclipse.core.runtime.IAdaptable; > import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.IExpressionManager; >+import org.eclipse.debug.core.ILaunch; >+import org.eclipse.debug.core.model.IDebugElement; >+import org.eclipse.debug.core.model.IWatchExpression; > import org.eclipse.debug.internal.ui.IDebugHelpContextIds; >+import org.eclipse.debug.internal.ui.actions.expressions.PasteWatchExpressionsAction; > import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants; > import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer; > import org.eclipse.debug.internal.ui.views.variables.AvailableLogicalStructuresAction; >@@ -21,6 +26,7 @@ > import org.eclipse.debug.internal.ui.views.variables.VariablesView; > import org.eclipse.debug.internal.ui.views.variables.VariablesViewMessages; > import org.eclipse.debug.internal.ui.views.variables.details.AvailableDetailPanesAction; >+import org.eclipse.debug.ui.DebugUITools; > import org.eclipse.debug.ui.IDebugUIConstants; > import org.eclipse.jface.action.IAction; > import org.eclipse.jface.action.IMenuManager; >@@ -29,11 +35,16 @@ > import org.eclipse.jface.util.LocalSelectionTransfer; > import org.eclipse.jface.viewers.ISelection; > import org.eclipse.swt.SWT; >+import org.eclipse.swt.dnd.Clipboard; > import org.eclipse.swt.dnd.DND; > import org.eclipse.swt.dnd.TextTransfer; > import org.eclipse.swt.dnd.Transfer; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.ui.ISharedImages; > import org.eclipse.ui.IWorkbenchActionConstants; >- >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds; >+ > /** > * Displays expressions and their values with a detail > * pane. >@@ -127,5 +138,98 @@ > viewer.addDragSupport(DND.DROP_MOVE, new Transfer[] {LocalSelectionTransfer.getTransfer()}, new SelectionDragAdapter(viewer)); > viewer.addDropSupport(DND.DROP_MOVE|DND.DROP_COPY, new Transfer[] {LocalSelectionTransfer.getTransfer(), TextTransfer.getInstance()}, new ExpressionDropAdapter(viewer)); > } >- >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#createActions() >+ */ >+ protected void createActions() { >+ super.createActions(); >+ >+ PasteWatchExpressionsAction paste = new PasteWatchExpressionsAction(this); >+ configure(paste, IWorkbenchActionDefinitionIds.PASTE, >+ PASTE_ACTION, ISharedImages.IMG_TOOL_PASTE); >+ } >+ >+ /** >+ * Configures the action to override the global action, and registers the >+ * action with this view. >+ * >+ * @param action >+ * action >+ * @param defId >+ * action definition id >+ * @param globalId >+ * global action id >+ * @param imgId >+ * image identifier >+ */ >+ private void configure(IAction action, String defId, String globalId, >+ String imgId) { >+ setAction(defId, action); >+ action.setActionDefinitionId(defId); >+ getViewSite().getActionBars().setGlobalActionHandler(globalId, action); >+ action.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages() >+ .getImageDescriptor(imgId)); >+ } >+ >+ /** >+ * Returns whether the given selection can be pasted into the expressions >+ * view. >+ * >+ * @param selection >+ * the selection to paste >+ * @return whether the given selection can be pasted into the given target >+ */ >+ public boolean canPaste() { >+ String clipboardText = getClipboardText(); >+ if (clipboardText != null && clipboardText.length() > 0) { >+ return true; >+ } >+ return false; >+ } >+ >+ /** >+ * Pastes the selection into the given target >+ * >+ * @param selection >+ * breakpoints >+ * @return whether successful >+ */ >+ public boolean performPaste() { >+ String clipboardText = getClipboardText(); >+ if (clipboardText != null && clipboardText.length() > 0) { >+ IExpressionManager expressionManager = DebugPlugin.getDefault() >+ .getExpressionManager(); >+ IWatchExpression watchExpression = expressionManager >+ .newWatchExpression(clipboardText); >+ expressionManager.addExpression(watchExpression); >+ watchExpression.setExpressionContext(getContext()); >+ return true; >+ } >+ return false; >+ } >+ >+ // TODO: duplicate code from WatchExpressionAction >+ protected IDebugElement getContext() { >+ IAdaptable object = DebugUITools.getDebugContext(); >+ IDebugElement context = null; >+ if (object instanceof IDebugElement) { >+ context = (IDebugElement) object; >+ } else if (object instanceof ILaunch) { >+ context = ((ILaunch) object).getDebugTarget(); >+ } >+ return context; >+ } >+ >+ protected String getClipboardText() { >+ Clipboard clipboard = new Clipboard(Display.getDefault()); >+ try { >+ TextTransfer textTransfer = TextTransfer.getInstance(); >+ return (String) clipboard.getContents(textTransfer); >+ } finally { >+ clipboard.dispose(); >+ } >+ } > } >Index: ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties,v >retrieving revision 1.133 >diff -u -r1.133 ActionMessages.properties >--- ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties 17 Apr 2008 16:21:11 -0000 1.133 >+++ ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties 27 Jun 2008 21:15:19 -0000 >@@ -182,6 +182,7 @@ > ConfigureColumnsAction_0=Select &Columns... > ConfigureColumnsAction_1=Select the &columns to display: > ConfigureColumnsAction_2=Select Columns >+PasteWatchExpressionsAction_0=&Paste > ProfileLastAction_0=Profi&le Last Launched > ProfileLastAction_1=Profi&le > ProfileLastAction_2=Profile the selected resource or active editor >Index: ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java,v >retrieving revision 1.45 >diff -u -r1.45 ActionMessages.java >--- ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java 29 May 2008 15:31:08 -0000 1.45 >+++ ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java 27 Jun 2008 21:15:19 -0000 >@@ -76,6 +76,8 @@ > > public static String OpenLaunchDialogAction_1; > >+ public static String PasteWatchExpressionsAction_0; >+ > public static String ProfileLastAction_0; > > public static String ProfileLastAction_1; >Index: ui/org/eclipse/debug/ui/IDebugView.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugView.java,v >retrieving revision 1.16 >diff -u -r1.16 IDebugView.java >--- ui/org/eclipse/debug/ui/IDebugView.java 12 Jun 2006 20:43:33 -0000 1.16 >+++ ui/org/eclipse/debug/ui/IDebugView.java 27 Jun 2008 21:15:19 -0000 >@@ -49,7 +49,7 @@ > * Action id for a view's cut action. Any view > * with a cut action that should be invoked when > * CTRL+X is pressed should store their >- * copy action with this key. >+ * cut action with this key. > * > * @see #setAction(String, IAction) > */ >@@ -59,7 +59,7 @@ > * Action id for a view's double-click action. Any view > * with an action that should be invoked when > * the mouse is double-clicked should store their >- * action with this key. >+ * double-click action with this key. > * > * @see #setAction(String, IAction) > */ >@@ -69,7 +69,7 @@ > * Action id for a view's find action. Any view > * with a find action that should be invoked when > * CTRL+F is pressed should store their >- * copy action with this key. >+ * find action with this key. > * > * @see #setAction(String, IAction) > */ >@@ -79,7 +79,7 @@ > * Action id for a view's paste action. Any view > * with a paste action that should be invoked when > * CTRL+V is pressed should store their >- * copy action with this key. >+ * paste action with this key. > * > * @see #setAction(String, IAction) > */ >Index: ui/org/eclipse/debug/internal/ui/actions/expressions/PasteWatchExpressionsAction.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/actions/expressions/PasteWatchExpressionsAction.java >diff -N ui/org/eclipse/debug/internal/ui/actions/expressions/PasteWatchExpressionsAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/actions/expressions/PasteWatchExpressionsAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,47 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Adobe Systems, Inc. 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: >+ * Adobe Systems, Inc. - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.debug.internal.ui.actions.expressions; >+ >+import org.eclipse.debug.internal.ui.actions.ActionMessages; >+import org.eclipse.debug.internal.ui.views.expression.ExpressionView; >+import org.eclipse.ui.actions.SelectionListenerAction; >+ >+/** >+ * Paste a watch expression into the expressions view. >+ */ >+public class PasteWatchExpressionsAction extends SelectionListenerAction { >+ >+ private final ExpressionView fExpressionView; >+ >+ public PasteWatchExpressionsAction(ExpressionView expressionView) { >+ super(ActionMessages.PasteWatchExpressionsAction_0); >+ fExpressionView = expressionView; >+// setToolTipText(BreakpointGroupMessages.PasteWatchExpressionsAction_1); >+// PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.PASTE_WATCH_EXPRESSIONS_ACTION); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) >+ */ >+ public void run() { >+ if (fExpressionView.canPaste()) { >+ fExpressionView.performPaste(); >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.action.Action#isEnabled() >+ */ >+ public boolean isEnabled() { >+ return fExpressionView.canPaste(); >+ } >+ >+}
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
Flags:
curtis.windatt.public
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 199288
: 106047