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 49870 Details for
Bug 89178
[launching] Open Properties dialog by clicking "Run As..." with Ctrl key
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
proposed fix
89178 (text/plain), 11.99 KB, created by
Michael Rennie
on 2006-09-11 15:35:56 EDT
(
hide
)
Description:
proposed fix
Filename:
MIME Type:
Creator:
Michael Rennie
Created:
2006-09-11 15:35:56 EDT
Size:
11.99 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.debug.ui >Index: ui/org/eclipse/debug/internal/ui/actions/LaunchShortcutAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchShortcutAction.java,v >retrieving revision 1.11 >diff -u -r1.11 LaunchShortcutAction.java >--- ui/org/eclipse/debug/internal/ui/actions/LaunchShortcutAction.java 8 May 2006 20:07:19 -0000 1.11 >+++ ui/org/eclipse/debug/internal/ui/actions/LaunchShortcutAction.java 11 Sep 2006 19:35:42 -0000 >@@ -17,11 +17,17 @@ > import org.eclipse.core.expressions.Expression; > import org.eclipse.core.expressions.IEvaluationContext; > import org.eclipse.core.runtime.CoreException; >+import org.eclipse.debug.core.ILaunchConfiguration; > import org.eclipse.debug.internal.ui.DebugUIPlugin; > import org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutExtension; >+import org.eclipse.debug.ui.DebugUITools; >+import org.eclipse.debug.ui.ILaunchShortcut; > import org.eclipse.jface.action.Action; > import org.eclipse.jface.viewers.ISelection; > import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.jface.viewers.StructuredSelection; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.widgets.Event; > import org.eclipse.ui.IEditorPart; > import org.eclipse.ui.IWorkbenchPage; > import org.eclipse.ui.IWorkbenchWindow; >@@ -44,8 +50,6 @@ > fShortcut = shortcut; > updateEnablement(); > } >- >- > > /** > * Runs with either the active editor or workbench selection. >@@ -72,6 +76,37 @@ > } > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.action.Action#runWithEvent(org.eclipse.swt.widgets.Event) >+ */ >+ public void runWithEvent(Event event) { >+ if ((event.stateMask & SWT.MOD1) > 0) { >+ IWorkbenchWindow wb = DebugUIPlugin.getActiveWorkbenchWindow(); >+ ILaunchConfiguration config = null; >+ if (wb != null) { >+ IWorkbenchPage page = wb.getActivePage(); >+ if (page != null) { >+ if (page.getActivePart() == page.getActiveEditor()) { >+ IEditorPart editor = page.getActiveEditor(); >+ if (editor != null) { >+ config = fShortcut.getAssociatedLaunchConfig(editor); >+ } >+ } else { >+ ISelection selection = page.getSelection(); >+ if (selection instanceof IStructuredSelection) { >+ config = fShortcut.getAssociatedLaunchConfig(selection); >+ } >+ } >+ } >+ } >+ IStructuredSelection selection = new StructuredSelection(config); >+ String id = DebugUITools.getLaunchGroup(config, fMode).getIdentifier(); >+ DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUIPlugin.getShell(), selection, id); >+ } else { >+ run(); >+ } >+ } >+ > /** > * Since these actions are re-created each time the run/debug as menu is > * filled, the enablement of this action is static. >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java,v >retrieving revision 1.30 >diff -u -r1.30 LaunchShortcutExtension.java >--- ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java 8 May 2006 20:07:19 -0000 1.30 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java 11 Sep 2006 19:35:42 -0000 >@@ -29,10 +29,12 @@ > import org.eclipse.core.expressions.IEvaluationContext; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.debug.core.ILaunchConfiguration; > import org.eclipse.debug.internal.ui.DebugUIPlugin; > import org.eclipse.debug.internal.ui.Pair; > import org.eclipse.debug.internal.ui.actions.LaunchShortcutAction; > import org.eclipse.debug.ui.ILaunchShortcut; >+import org.eclipse.debug.ui.ILaunchShortcut2; > import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.jface.viewers.ISelection; > import org.eclipse.jface.viewers.StructuredSelection; >@@ -45,11 +47,11 @@ > /** > * Proxy to a launch shortcut extension > */ >-public class LaunchShortcutExtension implements ILaunchShortcut, IPluginContribution { >+public class LaunchShortcutExtension implements ILaunchShortcut2, IPluginContribution { > > private ImageDescriptor fImageDescriptor = null; > private List fPerspectives = null; >- private ILaunchShortcut fDelegate = null; >+ private ILaunchShortcut2 fDelegate = null; > private Set fModes = null; > private IConfigurationElement fContextualLaunchConfigurationElement = null; > private Expression fContextualLaunchExpr = null; >@@ -342,7 +344,7 @@ > protected ILaunchShortcut getDelegate() { > if (fDelegate == null) { > try { >- fDelegate = (ILaunchShortcut)fConfig.createExecutableExtension("class"); //$NON-NLS-1$ >+ fDelegate = (ILaunchShortcut2)fConfig.createExecutableExtension("class"); //$NON-NLS-1$ > } catch (CoreException e) { > DebugUIPlugin.errorDialog(DebugUIPlugin.getShell(), LaunchConfigurationsMessages.LaunchShortcutExtension_Error_4, LaunchConfigurationsMessages.LaunchShortcutExtension_Unable_to_use_launch_shortcut_5, e.getStatus()); // > } >@@ -421,5 +423,31 @@ > public String getPluginId() { > return fConfig.getContributor().getName(); > } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.ui.ILaunchShortcut#getAssociatedLaunchConfig(org.eclipse.jface.viewers.ISelection, java.lang.String) >+ */ >+ public ILaunchConfiguration getAssociatedLaunchConfig(ISelection selection) { >+ if(fDelegate == null) { >+ getDelegate(); >+ } >+ if(fDelegate != null) { >+ return fDelegate.getAssociatedLaunchConfig(selection); >+ } >+ return null; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.ui.ILaunchShortcut#getAssociatedLaunchConfig(org.eclipse.ui.IEditorPart, java.lang.String) >+ */ >+ public ILaunchConfiguration getAssociatedLaunchConfig(IEditorPart editor) { >+ if(fDelegate == null) { >+ getDelegate(); >+ } >+ if(fDelegate != null) { >+ return fDelegate.getAssociatedLaunchConfig(editor); >+ } >+ return null; >+ } > } > >Index: ui/org/eclipse/debug/ui/ILaunchShortcut2.java >=================================================================== >RCS file: ui/org/eclipse/debug/ui/ILaunchShortcut2.java >diff -N ui/org/eclipse/debug/ui/ILaunchShortcut2.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/ui/ILaunchShortcut2.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,42 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 IBM Corporation 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: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.debug.ui; >+ >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.jface.viewers.ISelection; >+import org.eclipse.ui.IEditorPart; >+ >+/** >+ * Provides new capabilities to have access to the associated <code>ILaunchCongfiguration</code>. >+ * This interface is intended to be used in the event your launch shortcut will provide access to >+ * the <code>LaunchConfigurationsDialog</code> via the Ctrl+Click mechanism >+ * @since 3.3 >+ */ >+public interface ILaunchShortcut2 extends ILaunchShortcut { >+ >+ /** >+ * Locates and returns the associated <code>ILaunchConfiguration</code> for the specified >+ * <code>ISelection</code>. This method can return <code>null</code>. >+ * @param selection the selection to search for a config for >+ * @return the associated <code>ILaunchConfiguration</code> or <code>null</code> if none found >+ * @since 3.3 >+ */ >+ public ILaunchConfiguration getAssociatedLaunchConfig(ISelection selection); >+ >+ /** >+ * Locates and returns the associated <code>ILaunchConfiguration</code> for the specified >+ * <code>IEditorPart</code>. This method can return <code>null</code>. >+ * @param editor the editor to search for the associated config for >+ * @return the associated <code>IlaunchConfiguration</code> or <code>null</code> if none found. >+ * @since 3.3 >+ */ >+ public ILaunchConfiguration getAssociatedLaunchConfig(IEditorPart editor); >+} >#P org.eclipse.jdt.debug.ui >Index: ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaLaunchShortcut.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaLaunchShortcut.java,v >retrieving revision 1.1 >diff -u -r1.1 JavaLaunchShortcut.java >--- ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaLaunchShortcut.java 4 Nov 2005 20:53:57 -0000 1.1 >+++ ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaLaunchShortcut.java 11 Sep 2006 19:35:43 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005 IBM Corporation and others. >+ * Copyright (c) 2005, 2006 IBM Corporation 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 >@@ -22,7 +22,7 @@ > import org.eclipse.debug.core.ILaunchManager; > import org.eclipse.debug.ui.DebugUITools; > import org.eclipse.debug.ui.IDebugModelPresentation; >-import org.eclipse.debug.ui.ILaunchShortcut; >+import org.eclipse.debug.ui.ILaunchShortcut2; > import org.eclipse.jdt.core.IJavaElement; > import org.eclipse.jdt.core.IType; > import org.eclipse.jdt.core.JavaModelException; >@@ -48,7 +48,7 @@ > * > * @since 3.2 > */ >-public abstract class JavaLaunchShortcut implements ILaunchShortcut { >+public abstract class JavaLaunchShortcut implements ILaunchShortcut2 { > > /** > * @param search the java elements to search for a main type >@@ -118,6 +118,63 @@ > } > > /** >+ * Searches for the associated launch configuration for the specified items >+ * @param items the items to search against >+ * @param mode the mode to constrain to >+ * @return the associated launch configuraiton or null if none found >+ * @since 3.3 >+ */ >+ protected ILaunchConfiguration findConfiguration(Object[] items) { >+ try { >+ IType[] types = findTypes(items, PlatformUI.getWorkbench().getProgressService()); >+ IType type = null; >+ if (types.length == 0) { >+ return null; >+ } >+ else if (types.length > 1) { >+ try { >+ type = chooseType(types, getTypeSelectionTitle()); >+ } catch (JavaModelException e) { >+ reportErorr(e); >+ return null; >+ } >+ } >+ else { >+ type = types[0]; >+ } >+ if(type != null) { >+ return findLaunchConfiguration(type, getConfigurationType()); >+ } >+ } >+ catch(CoreException ce) {JDIDebugUIPlugin.log(ce);} >+ catch(InterruptedException ie) {JDIDebugUIPlugin.log(ie);} >+ return null; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.ui.ILaunchShortcut#getAssociatedLaunchConfig(org.eclipse.ui.IEditorPart, java.lang.String) >+ */ >+ public ILaunchConfiguration getAssociatedLaunchConfig(IEditorPart editor) { >+ IEditorInput input = editor.getEditorInput(); >+ IJavaElement je = (IJavaElement) input.getAdapter(IJavaElement.class); >+ if (je != null) { >+ return findConfiguration(new Object[] {je}); >+ } >+ return null; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.ui.ILaunchShortcut#getAssociatedLaunchConfig(org.eclipse.jface.viewers.ISelection, java.lang.String) >+ */ >+ public ILaunchConfiguration getAssociatedLaunchConfig(ISelection selection) { >+ if (selection instanceof IStructuredSelection) { >+ return findConfiguration(((IStructuredSelection)selection).toArray()); >+ } >+ return null; >+ } >+ >+ >+ /** > * Launches a configuration for the given type > */ > protected void launch(IType type, String mode) {
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 89178
:
49870
|
55079
|
55080