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 7622 Details for
Bug 18338
Run/Debug in the context menu
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]
Part two of (semi-final) release
org.eclipse.jdt.debug.ui.patch (text/plain), 13.94 KB, created by
Chris Tilt
on 2004-01-28 19:55:01 EST
(
hide
)
Description:
Part two of (semi-final) release
Filename:
MIME Type:
Creator:
Chris Tilt
Created:
2004-01-28 19:55:01 EST
Size:
13.94 KB
patch
obsolete
>Index: plugin.properties >=================================================================== >retrieving revision 1.121 >diff -u -r1.121 plugin.properties >--- plugin.properties 20 Jan 2004 02:28:51 -0000 1.121 >+++ plugin.properties 29 Jan 2004 00:38:21 -0000 >@@ -168,6 +168,8 @@ > vmPageName=Runtime JRE > > JavaApplicationShortcut.label=Java Application >+ContextualRunJavaApplication.label=Run Java Application >+ContextualDebugJavaApplication.label=Debug Java Application > > jreSystemLibrary.name=JRE System Library > >@@ -194,6 +196,8 @@ > ThreadView.tooltip=Switch to Thread View > > AppletShortcut.label=Java Applet >+ContextualRunJavaApplet.label=Run Java Applet >+ContextualDebugJavaApplet.label=Debug Java Applet > > ActionDefinition.localJavaShortcut.name=Run as Java Application > ActionDefinition.localJavaShortcut.description=Attempts to run the currently selected element as a Java application >Index: plugin.xml >=================================================================== >retrieving revision 1.248 >diff -u -r1.248 plugin.xml >--- plugin.xml 27 Jan 2004 23:30:55 -0000 1.248 >+++ plugin.xml 29 Jan 2004 00:38:28 -0000 >@@ -1973,8 +1973,21 @@ > icon="icons/full/ctool16/java_app.gif" > helpContextId="org.eclipse.jdt.debug.ui.shortcut_local_java_application" > modes="run, debug" >+ filterClass="org.eclipse.jdt.internal.debug.ui.launcher.JavaApplicationLaunchShortcut" > class="org.eclipse.jdt.internal.debug.ui.launcher.JavaApplicationLaunchShortcut" > id="org.eclipse.jdt.debug.ui.localJavaShortcut"> >+ <contextLabel >+ mode="run" >+ label="%ContextualRunJavaApplication.label"/> >+ <contextLabel >+ mode="debug" >+ label="%ContextualDebugJavaApplication.label"/> >+ <filter >+ name="NameMatches" >+ value="*.java"/> >+ <filter >+ name="ContextualLaunchActionFilter" >+ value="supportsContextualLaunch"/> > <perspective > id="org.eclipse.jdt.ui.JavaPerspective"> > </perspective> >@@ -1993,8 +2006,21 @@ > icon="icons/full/ctool16/java_applet.gif" > helpContextId="org.eclipse.jdt.debug.ui.shortcut_java_applet" > modes="run, debug" >+ filterClass="org.eclipse.jdt.internal.debug.ui.launcher.JavaAppletLaunchShortcut" > class="org.eclipse.jdt.internal.debug.ui.launcher.JavaAppletLaunchShortcut" > id="org.eclipse.jdt.debug.ui.javaAppletShortcut"> >+ <filter >+ name="NameMatches" >+ value="*.java"/> >+ <filter >+ name="ContextualLaunchActionFilter" >+ value="supportsContextualLaunch"/> >+ <contextLabel >+ mode="run" >+ label="%ContextualRunJavaApplet.label"/> >+ <contextLabel >+ mode="debug" >+ label="%ContextualDebugJavaApplet.label"/> > <perspective > id="org.eclipse.jdt.ui.JavaPerspective"> > </perspective> >Index: ui/org/eclipse/jdt/internal/debug/ui/launcher/AppletLaunchConfigurationUtils.java >=================================================================== >retrieving revision 1.5 >diff -u -r1.5 AppletLaunchConfigurationUtils.java >--- ui/org/eclipse/jdt/internal/debug/ui/launcher/AppletLaunchConfigurationUtils.java 20 Oct 2003 21:51:35 -0000 1.5 >+++ ui/org/eclipse/jdt/internal/debug/ui/launcher/AppletLaunchConfigurationUtils.java 29 Jan 2004 00:38:35 -0000 >@@ -129,7 +129,7 @@ > return result; > } > >- private static void collectTypes(Object element, IProgressMonitor monitor, Set result) throws JavaModelException/*, InvocationTargetException*/ { >+ public static void collectTypes(Object element, IProgressMonitor monitor, Set result) throws JavaModelException/*, InvocationTargetException*/ { > element= computeScope(element); > while((element instanceof IJavaElement) && !(element instanceof ICompilationUnit) && (element instanceof ISourceReference)) { > if(element instanceof IType) { >Index: ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaAppletLaunchShortcut.java >=================================================================== >retrieving revision 1.8 >diff -u -r1.8 JavaAppletLaunchShortcut.java >--- ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaAppletLaunchShortcut.java 25 Aug 2003 17:47:16 -0000 1.8 >+++ ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaAppletLaunchShortcut.java 29 Jan 2004 00:38:36 -0000 >@@ -13,9 +13,13 @@ > import java.lang.reflect.InvocationTargetException; > import java.util.ArrayList; > import java.util.Collections; >+import java.util.HashSet; > import java.util.List; >+import java.util.Set; > >+import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.NullProgressMonitor; > import org.eclipse.debug.core.DebugPlugin; > import org.eclipse.debug.core.ILaunchConfiguration; > import org.eclipse.debug.core.ILaunchConfigurationType; >@@ -26,25 +30,28 @@ > import org.eclipse.debug.ui.ILaunchShortcut; > import org.eclipse.jdt.core.IJavaElement; > import org.eclipse.jdt.core.IType; >+import org.eclipse.jdt.core.JavaModelException; > import org.eclipse.jdt.debug.ui.JavaUISourceLocator; > import org.eclipse.jdt.debug.ui.launchConfigurations.AppletParametersTab; > import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin; >+import org.eclipse.jdt.internal.debug.ui.console.StringMatcher; > import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; > import org.eclipse.jdt.ui.JavaElementLabelProvider; > import org.eclipse.jface.dialogs.MessageDialog; >-import org.eclipse.jface.dialogs.ProgressMonitorDialog; > import org.eclipse.jface.viewers.ISelection; > import org.eclipse.jface.viewers.IStructuredSelection; > import org.eclipse.jface.viewers.StructuredSelection; > import org.eclipse.jface.window.Window; > import org.eclipse.swt.widgets.Shell; >+import org.eclipse.ui.IActionFilter; > import org.eclipse.ui.IEditorInput; > import org.eclipse.ui.IEditorPart; > import org.eclipse.ui.IWorkbenchPage; > import org.eclipse.ui.IWorkbenchWindow; > import org.eclipse.ui.dialogs.ElementListSelectionDialog; >+import org.eclipse.ui.editors.text.WorkspaceOperationRunner; > >-public class JavaAppletLaunchShortcut implements ILaunchShortcut { >+public class JavaAppletLaunchShortcut implements ILaunchShortcut, IActionFilter { > > private static final String EMPTY_STRING = ""; //$NON-NLS-1$ > >@@ -53,7 +60,7 @@ > > if (search != null) { > try { >- types = AppletLaunchConfigurationUtils.findApplets(new ProgressMonitorDialog(getShell()), search); >+ types = AppletLaunchConfigurationUtils.findApplets(new WorkspaceOperationRunner(), search); > } catch (InterruptedException e) { > JDIDebugUIPlugin.log(e); > return; >@@ -261,4 +268,51 @@ > } > return (IStructuredSelection)selection; > } >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IActionFilter#testAttribute(java.lang.Object, java.lang.String, java.lang.String) >+ */ >+ public boolean testAttribute(Object target, String name, String value) { >+ if ("ContextualLaunchActionFilter".equals(name)) { >+ return isApplet(target); >+ // return false; >+ } else if ("NameMatches".equals(name)) { >+ return nameMatches(target, value); >+ } >+ return false; >+ } >+ >+ /** >+ * @param target >+ * @param value >+ * @return >+ */ >+ private boolean nameMatches(Object target, String value) { >+ try { >+ Object[] selections = ((IStructuredSelection) target).toArray(); >+ IResource resource = (IResource) selections[0]; >+ String filename = resource.getName(); >+ StringMatcher sm = new StringMatcher(value, true, false); >+ return sm.match(filename); >+ } catch (ClassCastException e) { >+ return false; >+ } >+ } >+ >+ private boolean isApplet(Object target) { >+ if (target != null && target instanceof IStructuredSelection) { >+ Object[] selections = ((IStructuredSelection )target).toArray(); >+ IResource resource = (IResource)selections[0]; >+ IType[] types= null; >+ try { >+ final Set result= new HashSet(); >+ AppletLaunchConfigurationUtils.collectTypes(resource, new NullProgressMonitor(), result); >+ if (result.size() > 0) { >+ return true; >+ } >+ } catch (JavaModelException e) { >+ return false; >+ } >+ } >+ return false; >+ } > } >Index: ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaApplicationLaunchShortcut.java >=================================================================== >retrieving revision 1.8 >diff -u -r1.8 JavaApplicationLaunchShortcut.java >--- ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaApplicationLaunchShortcut.java 15 Jul 2003 17:36:37 -0000 1.8 >+++ ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaApplicationLaunchShortcut.java 29 Jan 2004 00:38:37 -0000 >@@ -14,9 +14,13 @@ > import java.lang.reflect.InvocationTargetException; > import java.util.ArrayList; > import java.util.Collections; >+import java.util.HashSet; > import java.util.List; >+import java.util.Set; > >+import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.NullProgressMonitor; > import org.eclipse.debug.core.DebugPlugin; > import org.eclipse.debug.core.ILaunchConfiguration; > import org.eclipse.debug.core.ILaunchConfigurationType; >@@ -25,10 +29,17 @@ > import org.eclipse.debug.ui.DebugUITools; > import org.eclipse.debug.ui.IDebugModelPresentation; > import org.eclipse.debug.ui.ILaunchShortcut; >+import org.eclipse.jdt.core.IClassFile; >+import org.eclipse.jdt.core.ICompilationUnit; > import org.eclipse.jdt.core.IJavaElement; > import org.eclipse.jdt.core.IType; >+import org.eclipse.jdt.core.JavaCore; >+import org.eclipse.jdt.core.JavaModelException; >+import org.eclipse.jdt.core.Signature; > import org.eclipse.jdt.debug.ui.JavaUISourceLocator; >+import org.eclipse.jdt.internal.corext.util.JavaModelUtil; > import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin; >+import org.eclipse.jdt.internal.debug.ui.console.StringMatcher; > import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; > import org.eclipse.jface.dialogs.ErrorDialog; > import org.eclipse.jface.dialogs.MessageDialog; >@@ -38,6 +49,7 @@ > import org.eclipse.jface.window.Window; > import org.eclipse.swt.widgets.Display; > import org.eclipse.swt.widgets.Shell; >+import org.eclipse.ui.IActionFilter; > import org.eclipse.ui.IEditorInput; > import org.eclipse.ui.IEditorPart; > import org.eclipse.ui.dialogs.ElementListSelectionDialog; >@@ -45,7 +57,7 @@ > /** > * Performs single click launching for local Java applications. > */ >-public class JavaApplicationLaunchShortcut implements ILaunchShortcut { >+public class JavaApplicationLaunchShortcut implements ILaunchShortcut, IActionFilter { > > /** > * @param search the java elements to search for a main type >@@ -258,4 +270,80 @@ > } > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IActionFilter#testAttribute(java.lang.Object, java.lang.String, java.lang.String) >+ */ >+ public boolean testAttribute(Object target, String name, String value) { >+ if ("ContextualLaunchActionFilter".equals(name)) { >+ return hasMain2(target); >+ } else if ("NameMatches".equals(name)) { >+ return nameMatches(target, value); >+ } >+ return false; >+ } >+ >+ /** >+ * @param target >+ * @param value >+ * @return >+ */ >+ private boolean nameMatches(Object target, String value) { >+ try { >+ Object[] selections = ((IStructuredSelection) target).toArray(); >+ IResource resource = (IResource) selections[0]; >+ String filename = resource.getName(); >+ StringMatcher sm = new StringMatcher(value, true, false); >+ return sm.match(filename); >+ } catch (ClassCastException e) { >+ return false; >+ } >+ } >+ >+ private boolean hasMain(Object target) { >+ if (target != null && target instanceof IStructuredSelection) { >+ Object[] selections = ((IStructuredSelection )target).toArray(); >+ IResource resource = (IResource)selections[0]; >+ IType[] types= null; >+ try { >+ final Set result= new HashSet(); >+ MainMethodFinder.collectTypes(resource, new NullProgressMonitor(), result); >+ if (result.size() > 0) { >+ return true; >+ } >+ } catch (JavaModelException e) { >+ return false; >+ } >+ } >+ return false; >+ } >+ >+ private boolean hasMain2(Object target) { >+ if (target != null && target instanceof IStructuredSelection) { >+ Object[] selections = ((IStructuredSelection )target).toArray(); >+ IResource resource = (IResource)selections[0]; >+ IJavaElement element = JavaCore.create(resource); >+ if (element instanceof ICompilationUnit) { >+ ICompilationUnit cu = (ICompilationUnit) element; >+ IType mainType= cu.getType(Signature.getQualifier(cu.getElementName())); >+ try { >+ if (mainType.exists() && JavaModelUtil.hasMainMethod(mainType)) { >+ return true; >+ } >+ } catch (JavaModelException e) { >+ return false; >+ } >+ } else if (element instanceof IClassFile) { >+ IType mainType; >+ try { >+ mainType = ((IClassFile)element).getType(); >+ if (JavaModelUtil.hasMainMethod(mainType)) { >+ return true; >+ } >+ } catch (JavaModelException e) { >+ return false; >+ } >+ } >+ } >+ return false; >+ } > } >Index: ui/org/eclipse/jdt/internal/debug/ui/launcher/MainMethodFinder.java >=================================================================== >retrieving revision 1.9 >diff -u -r1.9 MainMethodFinder.java >--- ui/org/eclipse/jdt/internal/debug/ui/launcher/MainMethodFinder.java 17 Jul 2003 19:41:13 -0000 1.9 >+++ ui/org/eclipse/jdt/internal/debug/ui/launcher/MainMethodFinder.java 29 Jan 2004 00:38:38 -0000 >@@ -69,7 +69,7 @@ > return (IType[]) result.toArray(new IType[result.size()]) ; > } > >- private static void collectTypes(Object element, IProgressMonitor monitor, Set result) throws JavaModelException { >+ public static void collectTypes(Object element, IProgressMonitor monitor, Set result) throws JavaModelException { > if (element instanceof IProcess) { > element= ((IProcess)element).getLaunch(); > } else if (element instanceof IDebugTarget) {
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 18338
:
7595
|
7596
|
7597
|
7621
|
7622
|
7723
|
7724