Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 54117 | Differences between
and this patch

Collapse All | Expand All

(-)plugin.xml (-22 / +47 lines)
Lines 1904-1922 Link Here
1904
            icon="icons/full/ctool16/java_app.gif"
1904
            icon="icons/full/ctool16/java_app.gif"
1905
            helpContextId="org.eclipse.jdt.debug.ui.shortcut_local_java_application"
1905
            helpContextId="org.eclipse.jdt.debug.ui.shortcut_local_java_application"
1906
            modes="run, debug"
1906
            modes="run, debug"
1907
            nameFilter="*.java"
1908
            filterClass="org.eclipse.jdt.internal.debug.ui.launcher.JavaApplicationLaunchShortcut"
1909
            class="org.eclipse.jdt.internal.debug.ui.launcher.JavaApplicationLaunchShortcut"
1907
            class="org.eclipse.jdt.internal.debug.ui.launcher.JavaApplicationLaunchShortcut"
1910
            id="org.eclipse.jdt.debug.ui.localJavaShortcut">
1908
            id="org.eclipse.jdt.debug.ui.localJavaShortcut">
1911
         <contextLabel
1909
         <!-- Contextual Launch work in progress -c.tilt -->
1912
         	mode="run"
1910
         <contextualLaunch>
1913
         	label="%ContextualRunJavaApplication.label"/>
1911
           <enablement>
1914
  		 <contextLabel
1912
             <with variable="selection">
1915
  		 	mode="debug"
1913
               <count value="1"/>
1916
  		 	label="%ContextualDebugJavaApplication.label"/>
1914
               <iterate>
1917
         <filter
1915
                 <or>
1918
         	name="ContextualLaunchActionFilter"
1916
                   <test property="org.eclipse.debug.ui.matchesPattern" value="*.java"/>
1919
         	value="supportsContextualLaunch"/>
1917
                   <test property="org.eclipse.debug.ui.matchesPattern" value="*.class"/>
1918
                 </or>
1919
                 <!-- waiting for fixes from HEAD
1920
                 <test property="org.eclipse.jdt.ui.hasMainType"/>
1921
                 -->
1922
               </iterate>
1923
             </with>
1924
           </enablement>
1925
           <contextLabel
1926
         	  mode="run"
1927
         	  label="%ContextualRunJavaApplication.label"/>
1928
  		   <contextLabel
1929
  		 	  mode="debug"
1930
  		 	  label="%ContextualDebugJavaApplication.label"/>
1931
  		 </contextualLaunch>
1932
  		 <!-- End Contextual Launch work in progress -->
1920
         <perspective
1933
         <perspective
1921
               id="org.eclipse.jdt.ui.JavaPerspective">
1934
               id="org.eclipse.jdt.ui.JavaPerspective">
1922
         </perspective>
1935
         </perspective>
Lines 1935-1953 Link Here
1935
            icon="icons/full/ctool16/java_applet.gif"
1948
            icon="icons/full/ctool16/java_applet.gif"
1936
            helpContextId="org.eclipse.jdt.debug.ui.shortcut_java_applet"
1949
            helpContextId="org.eclipse.jdt.debug.ui.shortcut_java_applet"
1937
            modes="run, debug"
1950
            modes="run, debug"
1938
            nameFilter="*.java"
1939
            filterClass="org.eclipse.jdt.internal.debug.ui.launcher.JavaAppletLaunchShortcut"
1940
            class="org.eclipse.jdt.internal.debug.ui.launcher.JavaAppletLaunchShortcut"
1951
            class="org.eclipse.jdt.internal.debug.ui.launcher.JavaAppletLaunchShortcut"
1941
            id="org.eclipse.jdt.debug.ui.javaAppletShortcut">
1952
            id="org.eclipse.jdt.debug.ui.javaAppletShortcut">
1942
         <filter
1953
         <contextualLaunch>
1943
         	name="ContextualLaunchActionFilter"
1954
           <enablement>
1944
         	value="supportsContextualLaunch"/>
1955
             <with variable="selection">
1945
         <contextLabel
1956
               <count value="1"/>
1946
         	mode="run"
1957
               <iterate>
1947
         	label="%ContextualRunJavaApplet.label"/>
1958
                 <or>
1948
  		 <contextLabel
1959
                   <test property="org.eclipse.debug.ui.matchesPattern" value="*.java"/>
1949
  		 	mode="debug"
1960
                   <test property="org.eclipse.debug.ui.matchesPattern" value="*.class"/>
1950
  		 	label="%ContextualDebugJavaApplet.label"/>
1961
                 </or>
1962
                 <!-- waiting for fixes from HEAD
1963
                 <test property="org.eclipse.jdt.isApplet"/>
1964
                 -->
1965
               </iterate>
1966
             </with>
1967
           </enablement>
1968
           <contextLabel
1969
         	  mode="run"
1970
         	  label="%ContextualRunJavaApplet.label"/>
1971
  		   <contextLabel
1972
  		 	  mode="debug"
1973
  		 	  label="%ContextualDebugJavaApplet.label"/>
1974
  		 </contextualLaunch>
1975
 end work in progress -->
1951
         <perspective
1976
         <perspective
1952
               id="org.eclipse.jdt.ui.JavaPerspective">
1977
               id="org.eclipse.jdt.ui.JavaPerspective">
1953
         </perspective>
1978
         </perspective>
(-)ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaAppletLaunchShortcut.java (-24 / +3 lines)
Lines 14-19 Link Here
14
import java.util.ArrayList;
14
import java.util.ArrayList;
15
import java.util.Collections;
15
import java.util.Collections;
16
import java.util.HashSet;
16
import java.util.HashSet;
17
import java.util.Iterator;
17
import java.util.List;
18
import java.util.List;
18
import java.util.Set;
19
import java.util.Set;
19
20
Lines 51-57 Link Here
51
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
52
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
52
import org.eclipse.ui.editors.text.WorkspaceOperationRunner;
53
import org.eclipse.ui.editors.text.WorkspaceOperationRunner;
53
54
54
public class JavaAppletLaunchShortcut implements ILaunchShortcut, ILaunchFilter {
55
public class JavaAppletLaunchShortcut implements ILaunchShortcut {
55
56
56
	private static final String EMPTY_STRING = ""; //$NON-NLS-1$
57
	private static final String EMPTY_STRING = ""; //$NON-NLS-1$
57
58
Lines 268-296 Link Here
268
		}
269
		}
269
		return (IStructuredSelection)selection;
270
		return (IStructuredSelection)selection;
270
	}
271
	}
271
	/* (non-Javadoc)
272
272
	 * @see org.eclipse.ui.IActionFilter#testAttribute(java.lang.Object, java.lang.String, java.lang.String)
273
	 */
274
	public boolean testAttribute(IResource target, String name, String value) {
275
		if ("ContextualLaunchActionFilter".equals(name)) { //$NON-NLS-1$
276
			return isApplet(target);
277
		} else if ("NameMatches".equals(name)) { //$NON-NLS-1$
278
			return nameMatches(target, value);
279
		}
280
		return false;
281
	}
282
	/**
283
	 * Test if the name of the target resource matches a pattern.
284
	 * 
285
	 * @param target selected resource from workspace
286
	 * @param value regular expression pattern to test
287
	 * @return true if the pattern matches the resource name, false otherwise
288
	 */
289
	private boolean nameMatches(IResource resource, String pattern) {
290
		String filename = resource.getName();
291
		StringMatcher sm = new StringMatcher(pattern, true, false);
292
		return sm.match(filename);
293
	}
294
	/**
273
	/**
295
	 * Check if the specified resource is an Applet.
274
	 * Check if the specified resource is an Applet.
296
	 * @return <code>true</code> if the target resource is an Applet,
275
	 * @return <code>true</code> if the target resource is an Applet,
(-)ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaApplicationLaunchShortcut.java (-26 / +1 lines)
Lines 58-64 Link Here
58
/**
58
/**
59
 * Performs single click launching for local Java applications.
59
 * Performs single click launching for local Java applications.
60
 */
60
 */
61
public class JavaApplicationLaunchShortcut implements ILaunchShortcut, ILaunchFilter {
61
public class JavaApplicationLaunchShortcut implements ILaunchShortcut {
62
	
62
	
63
	/**
63
	/**
64
	 * @param search the java elements to search for a main type
64
	 * @param search the java elements to search for a main type
Lines 294-324 Link Here
294
		} else {
294
		} else {
295
			MessageDialog.openError(getShell(), LauncherMessages.getString("JavaApplicationAction.Launch_failed_7"), LauncherMessages.getString("JavaApplicationLaunchShortcut.The_selection_does_not_contain_a_main_type._2")); //$NON-NLS-1$ //$NON-NLS-2$
295
			MessageDialog.openError(getShell(), LauncherMessages.getString("JavaApplicationAction.Launch_failed_7"), LauncherMessages.getString("JavaApplicationLaunchShortcut.The_selection_does_not_contain_a_main_type._2")); //$NON-NLS-1$ //$NON-NLS-2$
296
		}
296
		}
297
	}
298
299
	/* (non-Javadoc)
300
	 * @see org.eclipse.ui.IActionFilter#testAttribute(java.lang.Object, java.lang.String, java.lang.String)
301
	 */
302
	public boolean testAttribute(IResource target, String name, String value) {
303
		if ("ContextualLaunchActionFilter".equals(name)) { //$NON-NLS-1$
304
			return hasMain(target);
305
		} else if ("NameMatches".equals(name)) { //$NON-NLS-1$
306
			return nameMatches(target, value);
307
		}
308
		return false;
309
	}
310
	
311
	/**
312
	 * Test if the name of the target resource matches a pattern.
313
	 * 
314
	 * @param target selected resource from workspace
315
	 * @param value regular expression pattern to test
316
	 * @return true if the pattern matches the resource name, false otherwise
317
	 */
318
	private boolean nameMatches(IResource target, String regexp) {
319
		String filename = target.getName();
320
		StringMatcher sm = new StringMatcher(regexp, true, false);
321
		return sm.match(filename);
322
	}
297
	}
323
	
298
	
324
	/**
299
	/**

Return to bug 54117