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 7724 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 final release.
org.eclipse.jdt.debug.ui.contextuallaunch.patch (text/plain), 7.00 KB, created by
Chris Tilt
on 2004-02-07 19:04:12 EST
(
hide
)
Description:
Part two of final release.
Filename:
MIME Type:
Creator:
Chris Tilt
Created:
2004-02-07 19:04:12 EST
Size:
7.00 KB
patch
obsolete
>Index: ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaAppletLaunchShortcut.java >=================================================================== >retrieving revision 1.11 >diff -u -r1.11 JavaAppletLaunchShortcut.java >--- ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaAppletLaunchShortcut.java 29 Jan 2004 17:56:04 -0000 1.11 >+++ ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaAppletLaunchShortcut.java 7 Feb 2004 23:44:56 -0000 >@@ -27,6 +27,7 @@ > import org.eclipse.debug.core.ILaunchManager; > import org.eclipse.debug.ui.DebugUITools; > import org.eclipse.debug.ui.IDebugModelPresentation; >+import org.eclipse.debug.ui.ILaunchFilter; > import org.eclipse.debug.ui.ILaunchShortcut; > import org.eclipse.jdt.core.IJavaElement; > import org.eclipse.jdt.core.IType; >@@ -43,7 +44,6 @@ > 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; >@@ -51,7 +51,7 @@ > import org.eclipse.ui.dialogs.ElementListSelectionDialog; > import org.eclipse.ui.editors.text.WorkspaceOperationRunner; > >-public class JavaAppletLaunchShortcut implements ILaunchShortcut, IActionFilter { >+public class JavaAppletLaunchShortcut implements ILaunchShortcut, ILaunchFilter { > > private static final String EMPTY_STRING = ""; //$NON-NLS-1$ > >@@ -271,7 +271,7 @@ > /* (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) { >+ public boolean testAttribute(IResource target, String name, String value) { > if ("ContextualLaunchActionFilter".equals(name)) { //$NON-NLS-1$ > return isApplet(target); > } else if ("NameMatches".equals(name)) { //$NON-NLS-1$ >@@ -279,23 +279,25 @@ > } > return false; > } >- >- 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; >- } >+ /** >+ * Test if the name of the target resource matches a pattern. >+ * >+ * @param target selected resource from workspace >+ * @param value regular expression pattern to test >+ * @return true if the pattern matches the resource name, false otherwise >+ */ >+ private boolean nameMatches(IResource resource, String pattern) { >+ String filename = resource.getName(); >+ StringMatcher sm = new StringMatcher(pattern, true, false); >+ return sm.match(filename); > } >- >- private boolean isApplet(Object target) { >- if (target != null && target instanceof IStructuredSelection) { >- Object[] selections = ((IStructuredSelection )target).toArray(); >- IResource resource = (IResource)selections[0]; >+ /** >+ * Check if the specified resource is an Applet. >+ * @return <code>true</code> if the target resource is an Applet, >+ * <code>false</code> otherwise. >+ */ >+ private boolean isApplet(IResource resource) { >+ if (resource != null) { > try { > Set result= new HashSet(); > AppletLaunchConfigurationUtils.collectTypes(resource, new NullProgressMonitor(), result); >Index: ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaApplicationLaunchShortcut.java >=================================================================== >retrieving revision 1.11 >diff -u -r1.11 JavaApplicationLaunchShortcut.java >--- ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaApplicationLaunchShortcut.java 31 Jan 2004 01:02:02 -0000 1.11 >+++ ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaApplicationLaunchShortcut.java 7 Feb 2004 23:44:56 -0000 >@@ -25,6 +25,7 @@ > import org.eclipse.debug.core.ILaunchManager; > import org.eclipse.debug.ui.DebugUITools; > import org.eclipse.debug.ui.IDebugModelPresentation; >+import org.eclipse.debug.ui.ILaunchFilter; > import org.eclipse.debug.ui.ILaunchShortcut; > import org.eclipse.jdt.core.IClassFile; > import org.eclipse.jdt.core.ICompilationUnit; >@@ -46,7 +47,6 @@ > 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; >@@ -54,7 +54,7 @@ > /** > * Performs single click launching for local Java applications. > */ >-public class JavaApplicationLaunchShortcut implements ILaunchShortcut, IActionFilter { >+public class JavaApplicationLaunchShortcut implements ILaunchShortcut, ILaunchFilter { > > /** > * @param search the java elements to search for a main type >@@ -270,7 +270,7 @@ > /* (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) { >+ public boolean testAttribute(IResource target, String name, String value) { > if ("ContextualLaunchActionFilter".equals(name)) { //$NON-NLS-1$ > return hasMain(target); > } else if ("NameMatches".equals(name)) { //$NON-NLS-1$ >@@ -279,23 +279,27 @@ > return false; > } > >- 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; >- } >+ /** >+ * Test if the name of the target resource matches a pattern. >+ * >+ * @param target selected resource from workspace >+ * @param value regular expression pattern to test >+ * @return true if the pattern matches the resource name, false otherwise >+ */ >+ private boolean nameMatches(IResource target, String regexp) { >+ String filename = target.getName(); >+ StringMatcher sm = new StringMatcher(regexp, true, false); >+ return sm.match(filename); > } > >- private boolean hasMain(Object target) { >- if (target != null && target instanceof IStructuredSelection) { >- Object[] selections = ((IStructuredSelection )target).toArray(); >- IResource resource = (IResource)selections[0]; >- IJavaElement element = JavaCore.create(resource); >+ /** >+ * Look for a Java main() method in the specified resource. >+ * @return true if the target resource has a <code>main</code> method, >+ * <code>false</code> otherwise. >+ */ >+ private boolean hasMain(IResource target) { >+ if (target != null) { >+ IJavaElement element = JavaCore.create(target); > if (element instanceof ICompilationUnit) { > ICompilationUnit cu = (ICompilationUnit) element; > IType mainType= cu.getType(Signature.getQualifier(cu.getElementName()));
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