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 8542 Details for
Bug 54117
Contextual Launch should use XML Expression Language
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]
Replaces previous patch for jdt.debug.ui
org.eclipse.jdt.debug.ui.xml.patch (text/plain), 20.45 KB, created by
Chris Tilt
on 2004-03-12 16:34:20 EST
(
hide
)
Description:
Replaces previous patch for jdt.debug.ui
Filename:
MIME Type:
Creator:
Chris Tilt
Created:
2004-03-12 16:34:20 EST
Size:
20.45 KB
patch
obsolete
>Index: .project >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.debug.ui/.project,v >retrieving revision 1.14 >diff -u -r1.14 .project >--- .project 26 Feb 2004 16:39:44 -0000 1.14 >+++ .project 12 Mar 2004 21:28:25 -0000 >@@ -3,23 +3,15 @@ > <name>org.eclipse.jdt.debug.ui</name> > <comment></comment> > <projects> >- <project>org.eclipse.compare</project> >- <project>org.eclipse.core.resources</project> >- <project>org.eclipse.core.runtime.compatibility</project> >+ <project>EBay</project> >+ <project>org.eclipse.core.expressions</project> > <project>org.eclipse.core.variables</project> > <project>org.eclipse.debug.core</project> > <project>org.eclipse.debug.ui</project> >- <project>org.eclipse.jdt.core</project> > <project>org.eclipse.jdt.debug</project> > <project>org.eclipse.jdt.launching</project> >- <project>org.eclipse.jdt.ui</project> > <project>org.eclipse.jface.text</project> > <project>org.eclipse.search</project> >- <project>org.eclipse.ui</project> >- <project>org.eclipse.ui.editors</project> >- <project>org.eclipse.ui.ide</project> >- <project>org.eclipse.ui.views</project> >- <project>org.eclipse.ui.workbench.texteditor</project> > </projects> > <buildSpec> > <buildCommand> >Index: plugin.xml >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.debug.ui/plugin.xml,v >retrieving revision 1.266 >diff -u -r1.266 plugin.xml >--- plugin.xml 11 Mar 2004 23:16:56 -0000 1.266 >+++ plugin.xml 12 Mar 2004 21:28:33 -0000 >@@ -22,6 +22,7 @@ > <import plugin="org.eclipse.ui"/> > <import plugin="org.eclipse.core.resources"/> > <import plugin="org.eclipse.core.variables"/> >+ <import plugin="org.eclipse.core.expressions"/> > <import plugin="org.eclipse.jdt.core"/> > <import plugin="org.eclipse.search"/> > <import plugin="org.eclipse.debug.core"/> >@@ -38,6 +39,15 @@ > <extension-point id="vmInstallTypePage" name="%vmInstallTypePage" schema="schema/vmInstallTypePage.exsd"/> > > <!-- Extensions --> >+ <extension point="org.eclipse.core.expressions.propertyTesters"> >+ <propertyTester >+ namespace="org.eclipse.jdt.debug.ui" >+ properties="hasMainType, isApplet" >+ type="org.eclipse.core.resources.IResource" >+ class="org.eclipse.jdt.internal.debug.ui.launcher.ResourceExtender" >+ id="org.eclipse.jdt.debug.IResourceExtender"> >+ </propertyTester> >+ </extension> > <extension > point="org.eclipse.debug.core.watchExpressionDelegates"> > <watchExpressionDelegate >@@ -1904,19 +1914,28 @@ > icon="icons/full/ctool16/java_app.gif" > helpContextId="org.eclipse.jdt.debug.ui.shortcut_local_java_application" > modes="run, debug" >- nameFilter="*.java" >- 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="ContextualLaunchActionFilter" >- value="supportsContextualLaunch"/> >+ <contextualLaunch> >+ <enablement> >+ <with variable="selection"> >+ <count value="1"/> >+ <iterate> >+ <or> >+ <test property="org.eclipse.debug.ui.matchesPattern" value="*.java"/> >+ <test property="org.eclipse.debug.ui.matchesPattern" value="*.class"/> >+ </or> >+ <test property="org.eclipse.jdt.debug.ui.hasMainType"/> >+ </iterate> >+ </with> >+ </enablement> >+ <contextLabel >+ mode="run" >+ label="%ContextualRunJavaApplication.label"/> >+ <contextLabel >+ mode="debug" >+ label="%ContextualDebugJavaApplication.label"/> >+ </contextualLaunch> > <perspective > id="org.eclipse.jdt.ui.JavaPerspective"> > </perspective> >@@ -1935,19 +1954,28 @@ > icon="icons/full/ctool16/java_applet.gif" > helpContextId="org.eclipse.jdt.debug.ui.shortcut_java_applet" > modes="run, debug" >- nameFilter="*.java" >- 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="ContextualLaunchActionFilter" >- value="supportsContextualLaunch"/> >- <contextLabel >- mode="run" >- label="%ContextualRunJavaApplet.label"/> >- <contextLabel >- mode="debug" >- label="%ContextualDebugJavaApplet.label"/> >+ <contextualLaunch> >+ <enablement> >+ <with variable="selection"> >+ <count value="1"/> >+ <iterate> >+ <or> >+ <test property="org.eclipse.debug.ui.matchesPattern" value="*.java"/> >+ <test property="org.eclipse.debug.ui.matchesPattern" value="*.class"/> >+ </or> >+ <test property="org.eclipse.jdt.debug.ui.isApplet"/> >+ </iterate> >+ </with> >+ </enablement> >+ <contextLabel >+ mode="run" >+ label="%ContextualRunJavaApplet.label"/> >+ <contextLabel >+ mode="debug" >+ label="%ContextualDebugJavaApplet.label"/> >+ </contextualLaunch> > <perspective > id="org.eclipse.jdt.ui.JavaPerspective"> > </perspective> >Index: .externalToolBuilders/Build Snippet Support JAR.launch >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.debug.ui/.externalToolBuilders/Build Snippet Support JAR.launch,v >retrieving revision 1.7 >diff -u -r1.7 Build Snippet Support JAR.launch >--- .externalToolBuilders/Build Snippet Support JAR.launch 26 Feb 2004 16:39:44 -0000 1.7 >+++ .externalToolBuilders/Build Snippet Support JAR.launch 12 Mar 2004 21:28:34 -0000 >@@ -1,9 +1,12 @@ > <?xml version="1.0" encoding="UTF-8"?> > <launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType"> >+<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> >+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/> > <stringAttribute key="org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE" value="${working_set:<?xml version="1.0" encoding="UTF-8"?> <launchConfigurationWorkingSet factoryID="org.eclipse.ui.internal.WorkingSetFactory" name="workingSet" editPageId="org.eclipse.ui.resourceWorkingSetPage"> <item factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/org.eclipse.jdt.debug.ui/Snippet Support" type="2"/> <item factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/org.eclipse.jdt.debug.ui/scripts/buildExtraJAR.xml" type="1"/> </launchConfigurationWorkingSet> }"/> > <stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/> > <stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${working_set:<?xml version="1.0" encoding="UTF-8"?> <launchConfigurationWorkingSet factoryID="org.eclipse.ui.internal.WorkingSetFactory" name="workingSet"> <item factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/org.eclipse.jdt.debug.ui" type="4"/> </launchConfigurationWorkingSet> }"/> > <stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/org.eclipse.jdt.debug.ui/scripts/buildExtraJAR.xml}"/> > <booleanAttribute key="org.eclipse.debug.ui.ATTR_RUN_IN_BACKGROUND" value="false"/> >+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> > <stringAttribute key="org.eclipse.debug.ui.target_run_perspective" value="perspective_none"/> > </launchConfiguration> >Index: ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaAppletLaunchShortcut.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaAppletLaunchShortcut.java,v >retrieving revision 1.12 >diff -u -r1.12 JavaAppletLaunchShortcut.java >--- ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaAppletLaunchShortcut.java 8 Feb 2004 21:50:42 -0000 1.12 >+++ ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaAppletLaunchShortcut.java 12 Mar 2004 21:28:44 -0000 >@@ -13,13 +13,9 @@ > 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; >@@ -27,15 +23,12 @@ > 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; >-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; >@@ -51,7 +44,7 @@ > import org.eclipse.ui.dialogs.ElementListSelectionDialog; > import org.eclipse.ui.editors.text.WorkspaceOperationRunner; > >-public class JavaAppletLaunchShortcut implements ILaunchShortcut, ILaunchFilter { >+public class JavaAppletLaunchShortcut implements ILaunchShortcut { > > private static final String EMPTY_STRING = ""; //$NON-NLS-1$ > >@@ -268,46 +261,5 @@ > } > return (IStructuredSelection)selection; > } >- /* (non-Javadoc) >- * @see org.eclipse.ui.IActionFilter#testAttribute(java.lang.Object, java.lang.String, java.lang.String) >- */ >- 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$ >- return nameMatches(target, value); >- } >- 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); >- } >- /** >- * 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); >- if (result.size() > 0) { >- return true; >- } >- } catch (JavaModelException e) { >- return false; >- } >- } >- return false; >- } >+ > } >Index: ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaApplicationLaunchShortcut.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaApplicationLaunchShortcut.java,v >retrieving revision 1.13 >diff -u -r1.13 JavaApplicationLaunchShortcut.java >--- ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaApplicationLaunchShortcut.java 24 Feb 2004 19:04:31 -0000 1.13 >+++ ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaApplicationLaunchShortcut.java 12 Mar 2004 21:28:44 -0000 >@@ -16,7 +16,6 @@ > import java.util.Collections; > import java.util.List; > >-import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IAdaptable; > import org.eclipse.debug.core.DebugPlugin; >@@ -26,21 +25,13 @@ > 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; > 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.core.search.IJavaSearchScope; > import org.eclipse.jdt.core.search.SearchEngine; > 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.jdt.ui.IJavaElementSearchConstants; > import org.eclipse.jface.dialogs.ErrorDialog; >@@ -58,7 +49,7 @@ > /** > * Performs single click launching for local Java applications. > */ >-public class JavaApplicationLaunchShortcut implements ILaunchShortcut, ILaunchFilter { >+public class JavaApplicationLaunchShortcut implements ILaunchShortcut { > > /** > * @param search the java elements to search for a main type >@@ -296,61 +287,4 @@ > } > } > >- /* (non-Javadoc) >- * @see org.eclipse.ui.IActionFilter#testAttribute(java.lang.Object, java.lang.String, java.lang.String) >- */ >- 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$ >- return nameMatches(target, value); >- } >- 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); >- } >- >- /** >- * 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())); >- 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/ResourceExtender.java >=================================================================== >RCS file: ui/org/eclipse/jdt/internal/debug/ui/launcher/ResourceExtender.java >diff -N ui/org/eclipse/jdt/internal/debug/ui/launcher/ResourceExtender.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/jdt/internal/debug/ui/launcher/ResourceExtender.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,104 @@ >+/******************************************************************************* >+ * Copyright (c) 2004 International Business Machines Corp. and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Common Public License v0.5 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/cpl-v05.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.jdt.internal.debug.ui.launcher; >+ >+import java.util.HashSet; >+import java.util.Set; >+ >+import org.eclipse.core.expressions.PropertyTester; >+import org.eclipse.core.resources.IResource; >+import org.eclipse.core.runtime.NullProgressMonitor; >+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.internal.corext.Assert; >+import org.eclipse.jdt.internal.corext.util.JavaModelUtil; >+ >+/** >+ * ResourceExtender provides propertyTester(s) for IResource types >+ * for use in XML Expression Language syntax. >+ */ >+public class ResourceExtender extends PropertyTester { >+ >+ private static final String PROPERTY_IS_APPLET= "isApplet"; //$NON-NLS-1$ >+ private static final String PROPERTY_HAS_MAIN_TYPE= "hasMainType"; //$NON-NLS-1$ >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jdt.internal.corext.refactoring.participants.properties.IPropertyEvaluator#test(java.lang.Object, java.lang.String, java.lang.String) >+ */ >+ public boolean test(Object receiver, String method, Object[] args, Object expectedValue) { >+ IResource resource= (IResource)receiver; >+ if (PROPERTY_IS_APPLET.equals(method)) { //$NON-NLS-1$ >+ return isApplet(resource); >+ } else if (PROPERTY_HAS_MAIN_TYPE.equals(method)) { >+ return hasMain(resource); >+ } >+ Assert.isTrue(false); >+ return false; >+ } >+ >+ /** >+ * 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); >+ if (result.size() > 0) { >+ return true; >+ } >+ } catch (JavaModelException e) { >+ return false; >+ } >+ } >+ return false; >+ } >+ >+ /** >+ * 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())); >+ 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; >+ } >+}
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 54117
:
8516
|
8540
| 8542