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 74480 | Differences between
and this patch

Collapse All | Expand All

(-)plugin.xml (-1 / +7 lines)
Lines 459-464 Link Here
459
         	  mode="debug"
459
         	  mode="debug"
460
         	  label="%AntLaunchShortcut.label"/>
460
         	  label="%AntLaunchShortcut.label"/>
461
  		 </contextualLaunch>
461
  		 </contextualLaunch>
462
        <configurationType
463
              id="org.eclipse.ant.AntLaunchConfigurationType">
464
        </configurationType>
462
      </shortcut>
465
      </shortcut>
463
      <shortcut
466
      <shortcut
464
            label="%AntLaunchShortcutWithDialog.label"
467
            label="%AntLaunchShortcutWithDialog.label"
Lines 487-492 Link Here
487
         	  mode="debug"
490
         	  mode="debug"
488
         	  label="%AntLaunchShortcutWithDialog.label"/>
491
         	  label="%AntLaunchShortcutWithDialog.label"/>
489
  		 </contextualLaunch>
492
  		 </contextualLaunch>
493
        <configurationType
494
              id="org.eclipse.ant.AntBuilderLaunchConfigurationType">
495
        </configurationType>
490
      </shortcut>
496
      </shortcut>
491
   </extension>
497
   </extension>
492
<!-- Console Extensions -->
498
<!-- Console Extensions -->
Lines 805-808 Link Here
805
      </renameParticipant>
811
      </renameParticipant>
806
   </extension>
812
   </extension>
807
813
808
</plugin>
814
</plugin>
(-)contexts_Debugger.xml (-4 / +12 lines)
Lines 5-11 Link Here
5
	Copyright (c) IBM Corporation and others 2000, 2006. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page.
5
	Copyright (c) IBM Corporation and others 2000, 2006. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page.
6
	
6
	
7
	All Platform Debug contexts, those for org.eclipse.debug.ui, are located in this file
7
	All Platform Debug contexts, those for org.eclipse.debug.ui, are located in this file
8
	All contexts are gouped by their relation, with all relations grouped alphabetically.
8
	All contexts are grouped by their relation, with all relations grouped alphabetically.
9
-->
9
-->
10
<!--
10
<!--
11
	Breakpoints View
11
	Breakpoints View
Lines 558-564 Link Here
558
   		<topic label="Working Sets..." href="reference/views/breakpoints/ref-workingsets_viewaction.htm"/>
558
   		<topic label="Working Sets..." href="reference/views/breakpoints/ref-workingsets_viewaction.htm"/>
559
   	</context>
559
   	</context>
560
   	<context id="delete_associated_launch_configs_dialog">
560
   	<context id="delete_associated_launch_configs_dialog">
561
   		<description>This dialog prompts users to clean up launch configuraitons that are associated with, or used to launch code from, the project that is being deleted </description>
561
   		<description>This dialog prompts users to clean up launch configurations that are associated with, or used to launch code from, the project that is being deleted </description>
562
   		<topic label="Running and Debugging" href="tasks/task-running_and_debugging.htm"/>
562
   		<topic label="Running and Debugging" href="tasks/task-running_and_debugging.htm"/>
563
		<topic label="Creating a Java application launch configuration" href="tasks/tasks-java-local-configuration.htm"/>
563
		<topic label="Creating a Java application launch configuration" href="tasks/tasks-java-local-configuration.htm"/>
564
   	</context>
564
   	</context>
Lines 677-683 Link Here
677
		<topic label="Source Attachments" href="reference/ref-124.htm"/>
677
		<topic label="Source Attachments" href="reference/ref-124.htm"/>
678
	</context>
678
	</context>
679
	<context  id="launch_configuration_dialog_launchers_tab" >
679
	<context  id="launch_configuration_dialog_launchers_tab" >
680
		<description>This tab allows you to a specific launchers to use with the selected launch configuration in the event ther is more than one available.</description>
680
		<description>This tab allows you to a specific launchers to use with the selected launch configuration in the event there is more than one available.</description>
681
		<topic label="Java application launch configuration" href=" tasks\tasks-java-local-configuration.htm"/>
681
		<topic label="Java application launch configuration" href=" tasks\tasks-java-local-configuration.htm"/>
682
	</context>
682
	</context>
683
683
Lines 794-800 Link Here
794
	</context> 
794
	</context> 
795
795
796
<!--
796
<!--
797
	Multiview Action conetxts
797
	Multiview Action contexts
798
-->
798
-->
799
	<context id="find_element_context">
799
	<context id="find_element_context">
800
		<description>This command finds an element by name.</description>
800
		<description>This command finds an element by name.</description>
Lines 867-872 Link Here
867
		<topic label="Debug Preferences" href="reference/preferences/ref-debug.htm"/>
867
		<topic label="Debug Preferences" href="reference/preferences/ref-debug.htm"/>
868
		<topic label="Debugger Concepts" href="concepts/cdebugger.htm"/>
868
		<topic label="Debugger Concepts" href="concepts/cdebugger.htm"/>
869
	</context>
869
	</context>
870
	<context id="contextual_launch_preference_page">
871
		<description>This page allows you to change settings that apply to contextual launching</description>
872
		<topic label="Debug Preferences" href="reference/preferences/ref-debug.htm"/>
873
		<topic label="Debugger Concepts" href="concepts/cdebugger.htm"/>
874
	</context>
870
	
875
	
871
<!-- 
876
<!-- 
872
	Property Pages 
877
	Property Pages 
Lines 880-885 Link Here
880
	<context id="TableRenderingPropertiesPage_context" >
885
	<context id="TableRenderingPropertiesPage_context" >
881
		<description>This page displays properties from the selected memory.</description>
886
		<description>This page displays properties from the selected memory.</description>
882
	</context>
887
	</context>
888
	<context id="default_launchconfiguration_property_page">
889
		<description>This page displays the properties for default launch configurations for the selected resource</description>
890
	</context>
883
891
884
<!--
892
<!--
885
	Run Menu
893
	Run Menu
(-)ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.java (-5 / +5 lines)
Lines 32-39 Link Here
32
 * This class is an abstract implementation of common features for a debug <code>IViewActionDelegate</code>
32
 * This class is an abstract implementation of common features for a debug <code>IViewActionDelegate</code>
33
 *
33
 *
34
 * This class is intended to be extended by clients
34
 * This class is intended to be extended by clients
35
 * @see {@link IViewActionDelegate}
35
 * @see implemented interface {@link IViewActionDelegate}
36
 * @see {@link IActionDelegate2}
36
 * @see implemented interface {@link IActionDelegate2}
37
 */
37
 */
38
public abstract class AbstractDebugActionDelegate implements IViewActionDelegate, IActionDelegate2 {
38
public abstract class AbstractDebugActionDelegate implements IViewActionDelegate, IActionDelegate2 {
39
	
39
	
Lines 48-54 Link Here
48
	private IViewPart fViewPart;
48
	private IViewPart fViewPart;
49
	
49
	
50
	/**
50
	/**
51
	 * Cache of the most recent seletion
51
	 * Cache of the most recent selection
52
	 */
52
	 */
53
	private IStructuredSelection fSelection = StructuredSelection.EMPTY;
53
	private IStructuredSelection fSelection = StructuredSelection.EMPTY;
54
	
54
	
Lines 58-64 Link Here
58
	private boolean fInitialized = false;
58
	private boolean fInitialized = false;
59
	
59
	
60
	/**
60
	/**
61
	 * It's crucial that delegate actions have a zero-arg constructor so that
61
	 * It's crucial that delegate actions have a zero-argument constructor so that
62
	 * they can be reflected into existence when referenced in an action set
62
	 * they can be reflected into existence when referenced in an action set
63
	 * in the plugin's plugin.xml file.
63
	 * in the plugin's plugin.xml file.
64
	 */
64
	 */
Lines 257-263 Link Here
257
	}
257
	}
258
258
259
	/**
259
	/**
260
	 * Sets the initialized state of this aciton to the specified boolean value
260
	 * Sets the initialized state of this action to the specified boolean value
261
	 * @param initialized the value to set the initialized state to
261
	 * @param initialized the value to set the initialized state to
262
	 */
262
	 */
263
	protected void setInitialized(boolean initialized) {
263
	protected void setInitialized(boolean initialized) {
(-)ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties (+1 lines)
Lines 165-167 Link Here
165
ConfigureColumnsAction_0=Select &Columns...
165
ConfigureColumnsAction_0=Select &Columns...
166
ConfigureColumnsAction_1=Select the &columns to display:
166
ConfigureColumnsAction_1=Select the &columns to display:
167
ConfigureColumnsAction_2=Select Columns
167
ConfigureColumnsAction_2=Select Columns
168
OpenLaunchDialogAction_0=&Open Launch Dialog
(-)ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java (+2 lines)
Lines 61-66 Link Here
61
    public static String OpenBreakpointMarkerAction_Go_to_Breakpoint_1;
61
    public static String OpenBreakpointMarkerAction_Go_to_Breakpoint_1;
62
    public static String OpenBreakpointMarkerAction_Go_to_File_for_Breakpoint_2;
62
    public static String OpenBreakpointMarkerAction_Go_to_File_for_Breakpoint_2;
63
63
64
	public static String OpenLaunchDialogAction_0;
65
64
    public static String RelaunchActionDelegate_An_exception_occurred_while_launching_2;
66
    public static String RelaunchActionDelegate_An_exception_occurred_while_launching_2;
65
    public static String RelaunchActionDelegate_Launch_Failed_1;
67
    public static String RelaunchActionDelegate_Launch_Failed_1;
66
    public static String RelaunchLastAction_Cannot_relaunch_1;
68
    public static String RelaunchLastAction_Cannot_relaunch_1;
(-)ui/org/eclipse/debug/internal/ui/actions/LaunchablePropertyTester.java (-6 / +25 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 11-16 Link Here
11
package org.eclipse.debug.internal.ui.actions;
11
package org.eclipse.debug.internal.ui.actions;
12
12
13
import org.eclipse.core.expressions.PropertyTester;
13
import org.eclipse.core.expressions.PropertyTester;
14
import org.eclipse.core.resources.IResource;
15
import org.eclipse.core.runtime.IAdaptable;
14
import org.eclipse.core.runtime.Platform;
16
import org.eclipse.core.runtime.Platform;
15
import org.eclipse.debug.internal.ui.DebugUIPlugin;
17
import org.eclipse.debug.internal.ui.DebugUIPlugin;
16
import org.eclipse.debug.ui.actions.ILaunchable;
18
import org.eclipse.debug.ui.actions.ILaunchable;
Lines 20-35 Link Here
20
 */
22
 */
21
public class LaunchablePropertyTester extends PropertyTester {
23
public class LaunchablePropertyTester extends PropertyTester {
22
24
23
	/* (non-Javadoc)
25
	/**
24
	 * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
26
	 * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
25
	 */
27
	 */
26
	public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
28
	public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
27
		if (property.equals("launchable")) { //$NON-NLS-1$
29
		if ("launchable".equals(property)) { //$NON-NLS-1$
28
			if (DebugUIPlugin.getDefault().getLaunchConfigurationManager().launchModeAvailable((String)expectedValue)) {
30
				if (DebugUIPlugin.getDefault().getLaunchConfigurationManager().launchModeAvailable((String)expectedValue)) {
29
				return Platform.getAdapterManager().hasAdapter(receiver, ILaunchable.class.getName());
31
					return Platform.getAdapterManager().hasAdapter(receiver, ILaunchable.class.getName());
30
			}
32
				}
33
		}
34
		else if("resource".equals(property)) { //$NON-NLS-1$
35
			return getResource(receiver) != null;
31
		}
36
		}
32
		return false;
37
		return false;
33
	}
38
	}
34
39
40
	/**
41
	 * Returns the resource this property page is open on.
42
	 * 
43
	 * @return resource
44
	 */
45
	protected IResource getResource(Object element) {
46
		IResource resource = null;
47
		if (element instanceof IResource) {
48
			resource = (IResource) element;
49
		} else if (element instanceof IAdaptable) {
50
			resource = (IResource) ((IAdaptable)element).getAdapter(IResource.class);
51
		}
52
		return resource;
53
	}
35
}
54
}
(-)ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java (-5 / +8 lines)
Lines 26-34 Link Here
26
		super();
26
		super();
27
	}
27
	}
28
28
29
	/*
29
	/**
30
	 * (non-Javadoc)
31
	 * 
32
	 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
30
	 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
33
	 */
31
	 */
34
	public void initializeDefaultPreferences() {
32
	public void initializeDefaultPreferences() {
Lines 51-56 Link Here
51
		prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_ALL_BREAKPOINTS, true);
49
		prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_ALL_BREAKPOINTS, true);
52
		prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_BREAKPOINTS_FROM_CONTAINER, true);
50
		prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_BREAKPOINTS_FROM_CONTAINER, true);
53
		
51
		
52
	//contextual launching preference page
53
		prefs.setDefault(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH, false);
54
		
54
		//View Management preference page
55
		//View Management preference page
55
		prefs.setDefault(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES, IDebugUIConstants.ID_DEBUG_PERSPECTIVE);
56
		prefs.setDefault(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES, IDebugUIConstants.ID_DEBUG_PERSPECTIVE);
56
		prefs.setDefault(IInternalDebugUIConstants.PREF_TRACK_VIEWS, true);
57
		prefs.setDefault(IInternalDebugUIConstants.PREF_TRACK_VIEWS, true);
Lines 111-120 Link Here
111
		prefs.setDefault(IDebugUIConstants.PREF_DEFAULT_EBCDIC_CODE_PAGE, 
112
		prefs.setDefault(IDebugUIConstants.PREF_DEFAULT_EBCDIC_CODE_PAGE, 
112
				IDebugPreferenceConstants.DEFAULT_EBCDIC_CP);
113
				IDebugPreferenceConstants.DEFAULT_EBCDIC_CP);
113
		
114
		
114
		if (MemoryViewUtil.isLinuxGTK())
115
		if (MemoryViewUtil.isLinuxGTK()) {
115
			prefs.setDefault(IDebugPreferenceConstants.PREF_DYNAMIC_LOAD_MEM, false);
116
			prefs.setDefault(IDebugPreferenceConstants.PREF_DYNAMIC_LOAD_MEM, false);
116
		else
117
		}
118
		else {
117
			prefs.setDefault(IDebugPreferenceConstants.PREF_DYNAMIC_LOAD_MEM, true);
119
			prefs.setDefault(IDebugPreferenceConstants.PREF_DYNAMIC_LOAD_MEM, true);
120
		}
118
		
121
		
119
		prefs.setDefault(IDebugPreferenceConstants.PREF_TABLE_RENDERING_PAGE_SIZE, IDebugPreferenceConstants.DEFAULT_PAGE_SIZE);
122
		prefs.setDefault(IDebugPreferenceConstants.PREF_TABLE_RENDERING_PAGE_SIZE, IDebugPreferenceConstants.DEFAULT_PAGE_SIZE);
120
		prefs.setDefault(IDebugPreferenceConstants.PREF_RESET_MEMORY_BLOCK, IDebugPreferenceConstants.RESET_VISIBLE);
123
		prefs.setDefault(IDebugPreferenceConstants.PREF_RESET_MEMORY_BLOCK, IDebugPreferenceConstants.RESET_VISIBLE);
(-)ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java (+2 lines)
Lines 86-91 Link Here
86
	public static final String LAUNCH_CONFIGURATION_PREFERENCE_PAGE = PREFIX + "launch_configuration_preference_page_context"; //$NON-NLS-1$
86
	public static final String LAUNCH_CONFIGURATION_PREFERENCE_PAGE = PREFIX + "launch_configuration_preference_page_context"; //$NON-NLS-1$
87
	public static final String VIEW_MANAGEMENT_PREFERENCE_PAGE = PREFIX + "view_management_preference_page_context"; //$NON-NLS-1$
87
	public static final String VIEW_MANAGEMENT_PREFERENCE_PAGE = PREFIX + "view_management_preference_page_context"; //$NON-NLS-1$
88
	public static final String LAUNCH_DELEGATES_PREFERENCE_PAGE = PREFIX + "launch_delegate_preference_page_context"; //$NON-NLS-1$
88
	public static final String LAUNCH_DELEGATES_PREFERENCE_PAGE = PREFIX + "launch_delegate_preference_page_context"; //$NON-NLS-1$
89
	public static final String CONTEXTUAL_LAUNCHING_PREFERENCE_PAGE = PREFIX + "contextual_launch_preference_page"; //$NON-NLS-1$
89
	
90
	
90
	// Dialogs
91
	// Dialogs
91
	public static final String LAUNCH_CONFIGURATION_DIALOG = PREFIX + "launch_configuration_dialog"; //$NON-NLS-1$
92
	public static final String LAUNCH_CONFIGURATION_DIALOG = PREFIX + "launch_configuration_dialog"; //$NON-NLS-1$
Lines 115-120 Link Here
115
	// Property pages
116
	// Property pages
116
	public static final String PROCESS_PROPERTY_PAGE = PREFIX + "process_property_page_context"; //$NON-NLS-1$
117
	public static final String PROCESS_PROPERTY_PAGE = PREFIX + "process_property_page_context"; //$NON-NLS-1$
117
	public static final String PROCESS_PAGE_RUN_AT = PREFIX + "process_page_run_at_time_widget"; //$NON-NLS-1$
118
	public static final String PROCESS_PAGE_RUN_AT = PREFIX + "process_page_run_at_time_widget"; //$NON-NLS-1$
119
	public static final String DEFAULT_LAUNCHCONFIGURATION_PROPERTY_PAGE = PREFIX + "default_launchconfiguration_property_page"; //$NON-NLS-1$
118
	
120
	
119
	// Launch configuration dialog pages
121
	// Launch configuration dialog pages
120
	public static final String LAUNCH_CONFIGURATION_DIALOG_COMMON_TAB = PREFIX + "launch_configuration_dialog_common_tab"; //$NON-NLS-1$
122
	public static final String LAUNCH_CONFIGURATION_DIALOG_COMMON_TAB = PREFIX + "launch_configuration_dialog_common_tab"; //$NON-NLS-1$
(-)ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java (+8 lines)
Lines 202-207 Link Here
202
    public static final String DETAIL_PANE_FONT= "org.eclipse.debug.ui.DetailPaneFont"; //$NON-NLS-1$   
202
    public static final String DETAIL_PANE_FONT= "org.eclipse.debug.ui.DetailPaneFont"; //$NON-NLS-1$   
203
203
204
    /**
204
    /**
205
     * Boolean preference indicating if contextual launch options should be visible
206
     * to the user rather than the "run as" menu.
207
     * 
208
     * @since 3.3
209
     */ 
210
    public static final String PREF_USE_CONTEXTUAL_LAUNCH= IDebugUIConstants.PLUGIN_ID + ".UseContextualLaunch"; //$NON-NLS-1$
211
    
212
    /**
205
     * String preference controlling whether editors are saved before launching.
213
     * String preference controlling whether editors are saved before launching.
206
     * Valid values are either "always", "never", or "prompt".
214
     * Valid values are either "always", "never", or "prompt".
207
     * If "always" or "never", launching will save editors (or not) automatically.
215
     * If "always" or "never", launching will save editors (or not) automatically.
(-)plugin.xml (-4 / +116 lines)
Lines 155-160 Link Here
155
               id="org.eclipse.debug.ui.launchDelegatesKeywords">
155
               id="org.eclipse.debug.ui.launchDelegatesKeywords">
156
         </keywordReference>
156
         </keywordReference>
157
      </page>
157
      </page>
158
      <page
159
            category="org.eclipse.debug.ui.DebugPreferencePage"
160
            class="org.eclipse.debug.internal.ui.preferences.ContextLaunchingPreferencePage"
161
            id="org.eclipse.debug.ui.contextualLaunchingPage"
162
            name="%ContextualLaunchingPrefPage.name">
163
         <keywordReference
164
               id="org.eclipse.debug.ui.contextLaunching">
165
         </keywordReference>
166
      </page>
158
   </extension>
167
   </extension>
159
   <extension point="org.eclipse.ui.actionSets">
168
   <extension point="org.eclipse.ui.actionSets">
160
   		<actionSet
169
   		<actionSet
Lines 874-880 Link Here
874
               id="org.eclipse.debug.ui.contextualLaunch.profile.submenu">
883
               id="org.eclipse.debug.ui.contextualLaunch.profile.submenu">
875
        </action>    
884
        </action>    
876
        <enablement>
885
        <enablement>
877
         	<test property="org.eclipse.debug.ui.launchable" value="profile"/>
886
          <and>
887
          	<test property="org.eclipse.debug.ui.launchable" value="profile"/>
888
          	<not>
889
          		<test property="org.eclipse.debug.ui.contextlaunch" />
890
          	</not>
891
          </and>
878
        </enablement>        
892
        </enablement>        
879
      </objectContribution>
893
      </objectContribution>
880
      <objectContribution
894
      <objectContribution
Lines 889-895 Link Here
889
               id="org.eclipse.debug.ui.contextualLaunch.debug.submenu">
903
               id="org.eclipse.debug.ui.contextualLaunch.debug.submenu">
890
         </action>
904
         </action>
891
         <enablement>
905
         <enablement>
892
         	<test property="org.eclipse.debug.ui.launchable" value="debug"/>
906
          <and>
907
          	<test property="org.eclipse.debug.ui.launchable" value="debug"/>
908
          	<not>
909
          		<test property="org.eclipse.debug.ui.contextlaunch" />
910
          	</not>
911
          </and>
893
         </enablement>     
912
         </enablement>     
894
       </objectContribution>    
913
       </objectContribution>    
895
       <objectContribution
914
       <objectContribution
Lines 904-913 Link Here
904
               id="org.eclipse.debug.ui.contextualLaunch.run.submenu">
923
               id="org.eclipse.debug.ui.contextualLaunch.run.submenu">
905
         </action>                  
924
         </action>                  
906
         <enablement>
925
         <enablement>
907
         	<test property="org.eclipse.debug.ui.launchable" value="run"/>
926
          <and>
927
          	<test property="org.eclipse.debug.ui.launchable" value="run"/>
928
          	<not>
929
          		<test property="org.eclipse.debug.ui.contextlaunch" />
930
          	</not>
931
          </and>
908
         </enablement>
932
         </enablement>
909
      </objectContribution>
933
      </objectContribution>
934
       <objectContribution
935
             id="org.eclipse.debug.ui.contextlaunch.debugas"
936
             objectClass="org.eclipse.core.runtime.IAdaptable">
937
          <action
938
                class="org.eclipse.debug.internal.ui.actions.DebugContextLaunchingAction"
939
                enablesFor="1"
940
                icon="icons/full/etool16/debug_exc.gif"
941
                id="org.eclipse.debug.ui.contextlaunch.debugas"
942
                label="%ContextLaunchingDebugMenu.name"
943
                menubarPath="additions"
944
                tooltip="%ContextLaunchingDebugMenu.tooltip">
945
          </action>
946
          <enablement>
947
          <and>
948
            <test property="org.eclipse.debug.ui.resource" />
949
          	<test property="org.eclipse.debug.ui.contextlaunch" />
950
          	<test property="org.eclipse.debug.ui.launchable" value="debug"/>
951
          </and>
952
         </enablement>
953
       </objectContribution>
954
       <objectContribution
955
             id="org.eclipse.debug.ui.contextlaunch.profileas"
956
             objectClass="org.eclipse.core.runtime.IAdaptable">
957
          <action
958
                class="org.eclipse.debug.internal.ui.actions.ProfileContextLaunchingAction"
959
                enablesFor="1"
960
                icon="icons/full/etool16/profile_exc.gif"
961
                id="org.eclipse.debug.ui.contextlaunch.profileas"
962
                label="%ContextLaunchingProfileMenu.name"
963
                menubarPath="additions"
964
                tooltip="%ContextLaunchingProfileMenu.tooltip">
965
          </action>
966
          <enablement>
967
          <and>
968
            <test property="org.eclipse.debug.ui.resource" />
969
          	<test property="org.eclipse.debug.ui.contextlaunch" />
970
          	<test property="org.eclipse.debug.ui.launchable" value="profile"/>
971
          </and>
972
         </enablement> 
973
       </objectContribution>
910
   <!-- console additions -->
974
   <!-- console additions -->
975
      <objectContribution
976
            id="org.eclipse.debug.ui.contextlaunch.runas"
977
            objectClass="org.eclipse.core.runtime.IAdaptable">
978
         <action
979
               class="org.eclipse.debug.internal.ui.actions.RunContextLaunchingAction"
980
               enablesFor="1"
981
               icon="icons/full/etool16/run_exc.gif"
982
               id="org.eclipse.debug.ui.contextlaunch.runas"
983
               label="%ContextLaunchingRunMenu.name"
984
               menubarPath="additions"
985
               tooltip="%ContextLaunchingRunMenu.tooltip">
986
         </action>
987
         <enablement>
988
          <and>
989
          	<test property="org.eclipse.debug.ui.contextlaunch" />
990
          	<test property="org.eclipse.debug.ui.resource" />
991
          	<test property="org.eclipse.debug.ui.launchable" value="run"/>
992
          </and>
993
         </enablement> 
994
      </objectContribution>
911
      <viewerContribution
995
      <viewerContribution
912
             targetID="org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu"
996
             targetID="org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu"
913
             id="org.eclipse.debug.ui.processConsoleContextMenu">
997
             id="org.eclipse.debug.ui.processConsoleContextMenu">
Lines 1394-1399 Link Here
1394
            </or>
1478
            </or>
1395
         </enabledWhen>
1479
         </enabledWhen>
1396
      </page>
1480
      </page>
1481
      <page
1482
            class="org.eclipse.debug.internal.ui.preferences.DefaultLaunchConfigurationsPropertiesPage"
1483
            id="org.eclipse.debug.ui.properties.defaultLaunchConfigurations"
1484
            name="%DefaultLaunchConfigurationsPropPage.name"
1485
            >
1486
         <enabledWhen>
1487
            <and>
1488
               <adapt
1489
                     type="org.eclipse.core.resources.IResource">
1490
               </adapt>
1491
               <test property="org.eclipse.debug.ui.contextlaunch" />
1492
               <test
1493
                     property="org.eclipse.debug.ui.resource">
1494
               </test>
1495
            </and>
1496
         </enabledWhen>
1497
      </page>
1397
   </extension>
1498
   </extension>
1398
<!-- commands and their bindings
1499
<!-- commands and their bindings
1399
NOTE: 
1500
NOTE: 
Lines 2032-2038 Link Here
2032
      </propertyTester>
2133
      </propertyTester>
2033
	  <propertyTester
2134
	  <propertyTester
2034
			namespace="org.eclipse.debug.ui"
2135
			namespace="org.eclipse.debug.ui"
2035
			properties="launchable"
2136
			properties="launchable, resource"
2036
			type="java.lang.Object"
2137
			type="java.lang.Object"
2037
			class="org.eclipse.debug.internal.ui.actions.LaunchablePropertyTester"
2138
			class="org.eclipse.debug.internal.ui.actions.LaunchablePropertyTester"
2038
			id="org.eclipse.debug.ui.propertyTesters.launchable">		
2139
			id="org.eclipse.debug.ui.propertyTesters.launchable">		
Lines 2050-2055 Link Here
2050
            properties="getModelIdentifier,isTerminatedOrDisconnected"
2151
            properties="getModelIdentifier,isTerminatedOrDisconnected"
2051
            type="org.eclipse.core.runtime.IAdaptable">
2152
            type="org.eclipse.core.runtime.IAdaptable">
2052
      </propertyTester>
2153
      </propertyTester>
2154
      <propertyTester
2155
            class="org.eclipse.debug.internal.ui.preferences.ContextLaunchingPropertyTester"
2156
            id="org.eclipse.debug.ui.contextlaunching.IAdaptableTester"
2157
            namespace="org.eclipse.debug.ui"
2158
            properties="contextlaunch"
2159
            type="org.eclipse.core.runtime.IAdaptable">
2160
      </propertyTester>
2053
   </extension>
2161
   </extension>
2054
<!-- Context extensions -->
2162
<!-- Context extensions -->
2055
  <extension
2163
  <extension
Lines 2235-2240 Link Here
2235
             id="org.eclipse.debug.ui.launchDelegatesKeywords"
2343
             id="org.eclipse.debug.ui.launchDelegatesKeywords"
2236
             label="%preferenceKeywords.launchDelegates">
2344
             label="%preferenceKeywords.launchDelegates">
2237
       </keyword>
2345
       </keyword>
2346
       <keyword
2347
             id="org.eclipse.debug.ui.contextLaunching"
2348
             label="%preferenceKeywords.contextLaunching">
2349
       </keyword>
2238
    </extension>
2350
    </extension>
2239
    <extension
2351
    <extension
2240
          point="org.eclipse.ui.importWizards">
2352
          point="org.eclipse.ui.importWizards">
(-)plugin.properties (+14 lines)
Lines 27-32 Link Here
27
BreakpointOrganizersName=Breakpoint Organizers
27
BreakpointOrganizersName=Breakpoint Organizers
28
VariableValueEditorsName=Variable Value Editors
28
VariableValueEditorsName=Variable Value Editors
29
29
30
ContextLaunchingRunMenu.name=&Run
31
ContextLaunchingRunMenu.tooltip=Run the selected item
32
33
ContextLaunchingDebugMenu.name=&Debug
34
ContextLaunchingDebugMenu.tooltip=Debug the selected item
35
36
ContextLaunchingProfileMenu.name=&Profile
37
ContextLaunchingProfileMenu.tooltip=Profile the selected item
38
39
ContextualLaunchingPrefPage.name=Contextual Launching
40
41
DefaultLaunchConfigurationsPropPage.name=Default Launch Configurations
42
30
BreakpointActionSet.label=Breakpoints
43
BreakpointActionSet.label=Breakpoints
31
CollapseAll.label=Collapse All
44
CollapseAll.label=Collapse All
32
CollapseAll.tooltip= Collapse All
45
CollapseAll.tooltip= Collapse All
Lines 328-333 Link Here
328
preferenceKeywords.viewManagement=views
341
preferenceKeywords.viewManagement=views
329
preferenceKeywords.perspective=perspectives switching assign automatic run debug
342
preferenceKeywords.perspective=perspectives switching assign automatic run debug
330
preferenceKeywords.launchConfigurations=filters launch migration configurations run debug
343
preferenceKeywords.launchConfigurations=filters launch migration configurations run debug
344
preferenceKeywords.contextLaunching=run debug profile launch contextual delegate configuration execute
331
preferenceKeywords.launchDelegates=launch delegate duplicate run debug profile mode configuration launchers launcher modes
345
preferenceKeywords.launchDelegates=launch delegate duplicate run debug profile mode configuration launchers launcher modes
332
346
333
exportBreakpoints.label=E&xport Breakpoints...
347
exportBreakpoints.label=E&xport Breakpoints...
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupExtension.java (-1 / +1 lines)
Lines 57-63 Link Here
57
	 * on the given configuration element
57
	 * on the given configuration element
58
	 * 
58
	 * 
59
	 * @param element the configuration element defining the
59
	 * @param element the configuration element defining the
60
	 *  attribtues of this launch configuration tab extension
60
	 *  attributes of this launch configuration tab extension
61
	 * @return a new launch configuration tab extension
61
	 * @return a new launch configuration tab extension
62
	 */
62
	 */
63
	public LaunchConfigurationTabGroupExtension(IConfigurationElement element) {
63
	public LaunchConfigurationTabGroupExtension(IConfigurationElement element) {
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchersDialog.java (-2 / +2 lines)
Lines 41-48 Link Here
41
import org.eclipse.swt.widgets.Text;
41
import org.eclipse.swt.widgets.Text;
42
42
43
/**
43
/**
44
 * Thsi dialog is used to select a preferred launcher, and alos provides access to the 
44
 * This dialog is used to select a preferred launcher, and alos provides access to the 
45
 * worspace defaults for preferred launchers
45
 * workspace defaults for preferred launchers
46
 * 
46
 * 
47
 *  @since 3.3
47
 *  @since 3.3
48
 *  EXPERIMENTAL
48
 *  EXPERIMENTAL
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java (-2 / +12 lines)
Lines 360-366 Link Here
360
	
360
	
361
	/**
361
	/**
362
	 * Creates some help text for the tab group launch types
362
	 * Creates some help text for the tab group launch types
363
	 * @param parent thep arent composite
363
	 * @param parent the parent composite
364
	 * @since 3.2
364
	 * @since 3.2
365
	 */
365
	 */
366
	private void createGettingStarted(Composite parent) {
366
	private void createGettingStarted(Composite parent) {
Lines 492-498 Link Here
492
		ILaunchConfigurationTab[] tabs = getTabs();
492
		ILaunchConfigurationTab[] tabs = getTabs();
493
		if (tabs != null) {
493
		if (tabs != null) {
494
			// update the working copy from the active tab
494
			// update the working copy from the active tab
495
			boolean newwc = !getWorkingCopy().isDirty();
495
			getActiveTab().performApply(getWorkingCopy());
496
			getActiveTab().performApply(getWorkingCopy());
497
			if(getOriginal() instanceof ILaunchConfigurationWorkingCopy && newwc) {
498
				try {
499
					getWorkingCopy().doSave();
500
				} 
501
				catch (CoreException e) {DebugUIPlugin.log(e);}
502
			}
496
			updateButtons();
503
			updateButtons();
497
			// update error ticks
504
			// update error ticks
498
			CTabItem item = null;
505
			CTabItem item = null;
Lines 948-953 Link Here
948
		if (workingCopy == null) {
955
		if (workingCopy == null) {
949
			return false;
956
			return false;
950
		}
957
		}
958
		if(workingCopy.getParent() != null) {
959
			return !workingCopy.getParent().contentsEqual(workingCopy);
960
		}
951
		// Working copy hasn't been saved
961
		// Working copy hasn't been saved
952
		if (workingCopy.getOriginal() == null) {
962
		if (workingCopy.getOriginal() == null) {
953
			return true;
963
			return true;
Lines 1354-1361 Link Here
1354
		try {
1364
		try {
1355
			if(fTabGroup != null) {
1365
			if(fTabGroup != null) {
1356
				fTabGroup.initializeFrom(fOriginal);
1366
				fTabGroup.initializeFrom(fOriginal);
1357
				fWorkingCopy = fOriginal.getWorkingCopy();
1358
				fNameWidget.setText(fOriginal.getName());
1367
				fNameWidget.setText(fOriginal.getName());
1368
				fWorkingCopy = fOriginal.getWorkingCopy();
1359
				refreshStatus();
1369
				refreshStatus();
1360
			}
1370
			}
1361
		} 
1371
		} 
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java (-1 / +4 lines)
Lines 851-857 Link Here
851
	 * @return the shell title
851
	 * @return the shell title
852
	 */
852
	 */
853
	protected String getShellTitle() {
853
	protected String getShellTitle() {
854
		String title = DebugUIPlugin.removeAccelerators(getLaunchGroup().getLabel());
854
		String title = null;
855
		if(getLaunchGroup() != null) {
856
			 title = DebugUIPlugin.removeAccelerators(getLaunchGroup().getLabel());
857
		}
855
		if (title == null) {
858
		if (title == null) {
856
			title = LaunchConfigurationsMessages.LaunchConfigurationDialog_Launch_Configurations_18; 
859
			title = LaunchConfigurationsMessages.LaunchConfigurationDialog_Launch_Configurations_18; 
857
		}
860
		}
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java (-2 / +2 lines)
Lines 257-263 Link Here
257
	 *  expression tree is malformed.
257
	 *  expression tree is malformed.
258
	 */
258
	 */
259
	public Expression getContextualLaunchEnablementExpression() throws CoreException {
259
	public Expression getContextualLaunchEnablementExpression() throws CoreException {
260
		// all of this stuff is optional, so...tedius testing is required
260
		// all of this stuff is optional, so...tedious testing is required
261
		if (fContextualLaunchExpr == null) {
261
		if (fContextualLaunchExpr == null) {
262
			IConfigurationElement contextualLaunchElement = getContextualLaunchConfigurationElement();
262
			IConfigurationElement contextualLaunchElement = getContextualLaunchConfigurationElement();
263
			if (contextualLaunchElement == null) {
263
			if (contextualLaunchElement == null) {
Lines 284-290 Link Here
284
	 *  expression tree is malformed.
284
	 *  expression tree is malformed.
285
	 */
285
	 */
286
	public Expression getShortcutEnablementExpression() throws CoreException {
286
	public Expression getShortcutEnablementExpression() throws CoreException {
287
		// all of this stuff is optional, so...tedius testing is required
287
		// all of this stuff is optional, so...tedious testing is required
288
		if (fStandardLaunchExpr == null) {
288
		if (fStandardLaunchExpr == null) {
289
			IConfigurationElement[] elements = getConfigurationElement().getChildren(ExpressionTagNames.ENABLEMENT);
289
			IConfigurationElement[] elements = getConfigurationElement().getChildren(ExpressionTagNames.ENABLEMENT);
290
			IConfigurationElement enablement = elements.length > 0 ? elements[0] : null; 
290
			IConfigurationElement enablement = elements.length > 0 ? elements[0] : null; 
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java (-1 / +41 lines)
Lines 32-37 Link Here
32
import javax.xml.parsers.ParserConfigurationException;
32
import javax.xml.parsers.ParserConfigurationException;
33
import javax.xml.transform.TransformerException;
33
import javax.xml.transform.TransformerException;
34
34
35
import org.eclipse.core.expressions.EvaluationContext;
36
import org.eclipse.core.expressions.IEvaluationContext;
35
import org.eclipse.core.resources.IProject;
37
import org.eclipse.core.resources.IProject;
36
import org.eclipse.core.resources.IResource;
38
import org.eclipse.core.resources.IResource;
37
import org.eclipse.core.resources.ISaveContext;
39
import org.eclipse.core.resources.ISaveContext;
Lines 56-61 Link Here
56
import org.eclipse.debug.core.ILaunchManager;
58
import org.eclipse.debug.core.ILaunchManager;
57
import org.eclipse.debug.core.ILaunchMode;
59
import org.eclipse.debug.core.ILaunchMode;
58
import org.eclipse.debug.internal.core.IConfigurationElementConstants;
60
import org.eclipse.debug.internal.core.IConfigurationElementConstants;
61
import org.eclipse.debug.internal.core.LaunchManager;
59
import org.eclipse.debug.internal.ui.DebugPluginImages;
62
import org.eclipse.debug.internal.ui.DebugPluginImages;
60
import org.eclipse.debug.internal.ui.DebugUIPlugin;
63
import org.eclipse.debug.internal.ui.DebugUIPlugin;
61
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
64
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
Lines 594-604 Link Here
594
		}
597
		}
595
		return fLaunchShortcuts;
598
		return fLaunchShortcuts;
596
	}
599
	}
600
601
	/**
602
	 * Returns a listing of all of the <code>ILaunchConfigurationType</code>s that apply to the currently
603
	 * specified <code>IResource</code>.
604
	 * 
605
	 * @param resource the resource context
606
	 * @return a listing of applicable <code>ILaunchConfigurationType</code>s, or an empty list, never <code>null</code>
607
	 * @since 3.3
608
	 */
609
	public List getApplicableConfigurationTypes(IResource resource) {
610
		List types = new ArrayList();
611
		try {
612
			List exts = getLaunchShortcuts();
613
			LaunchShortcutExtension ext = null;
614
			List list = new ArrayList();
615
			list.add(resource);
616
			IEvaluationContext context = new EvaluationContext(null, list);
617
			context.addVariable("selection", list); //$NON-NLS-1$
618
			HashSet set = new HashSet();
619
			for(Iterator iter = exts.iterator(); iter.hasNext();) {
620
				ext = (LaunchShortcutExtension) iter.next();
621
				if(ext.evalEnablementExpression(context, ext.getContextualLaunchEnablementExpression())) {
622
					set.addAll(ext.getAssociatedConfigurationTypes());
623
				}
624
			}
625
			LaunchManager lm = (LaunchManager) DebugPlugin.getDefault().getLaunchManager();
626
			ILaunchConfigurationType type = null;
627
			for(Iterator iter = set.iterator(); iter.hasNext();) {
628
				type = lm.getLaunchConfigurationType((String)iter.next());
629
				if(type != null && !"org.eclipse.ui.externaltools".equals(type.getCategory()) && !types.contains(type)) { //$NON-NLS-1$
630
					types.add(type);
631
				}
632
			}
633
		}
634
		catch(CoreException ce) {DebugUIPlugin.log(ce);}
635
		return types;
636
	}
597
	
637
	
598
	/**
638
	/**
599
	 * Returns a listing of all applicable <code>LaunchShortcutExtension</code>s for the given
639
	 * Returns a listing of all applicable <code>LaunchShortcutExtension</code>s for the given
600
	 * launch configuration type id.
640
	 * launch configuration type id.
601
	 * @param typeid the id of the launch configuraiton
641
	 * @param typeid the id of the launch configuration
602
	 * @return a listing of <code>LaunchShortcutExtension</code>s that are associated with the specified launch configuration
642
	 * @return a listing of <code>LaunchShortcutExtension</code>s that are associated with the specified launch configuration
603
	 * type id or an empty list, never <code>null</code>
643
	 * type id or an empty list, never <code>null</code>
604
	 * 
644
	 * 
(-)ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties (+15 lines)
Lines 16-21 Link Here
16
ConsolePreferencePage_Standard_In__4=Standard &In text color:
16
ConsolePreferencePage_Standard_In__4=Standard &In text color:
17
ConsolePreferencePage_Standard_Out__2=Standard &Out text color:
17
ConsolePreferencePage_Standard_Out__2=Standard &Out text color:
18
ConsolePreferencePage_Wrap_text_1=Fixed &width console
18
ConsolePreferencePage_Wrap_text_1=Fixed &width console
19
ContextualLaunchPreferencePage_0=This page is used to edit contextual launching options (EXPERIMENTAL).
20
ContextualLaunchPreferencePage_1=&Enable contextual launching.
19
ConsolePreferencePage_Console_width=&Maximum character width:
21
ConsolePreferencePage_Console_width=&Maximum character width:
20
ConsolePreferencePage_Limit_console_output_1=&Limit console output
22
ConsolePreferencePage_Limit_console_output_1=&Limit console output
21
ConsolePreferencePage_Console_buffer_size__characters___2=Console &buffer size (characters):
23
ConsolePreferencePage_Console_buffer_size__characters___2=Console &buffer size (characters):
Lines 127-129 Link Here
127
LaunchDelegatesPreferencePage_4=Launcher Description
129
LaunchDelegatesPreferencePage_4=Launcher Description
128
LaunchPerspectivePreferencePage_0=There is no perspective information available to change.
130
LaunchPerspectivePreferencePage_0=There is no perspective information available to change.
129
LaunchPerspectivePreferencePage_1=The selected types/launchers do not have any common mode sets.
131
LaunchPerspectivePreferencePage_1=The selected types/launchers do not have any common mode sets.
132
DefaultLaunchConfigurationsPropertiesPage_0=This page allows you to select a default way to launch the currently selected resource.
133
DefaultLaunchConfigurationsPropertiesPage_1=&Select default configuration for {0}:
134
DefaultLaunchConfigurationsPropertiesPage_2=&New...
135
DefaultLaunchConfigurationsPropertiesPage_3=Create new launch configuration
136
DefaultLaunchConfigurationsPropertiesPage_4=Du&plicate
137
DefaultLaunchConfigurationsPropertiesPage_5=Duplicate selected launch configuration
138
DefaultLaunchConfigurationsPropertiesPage_6=&Edit...
139
DefaultLaunchConfigurationsPropertiesPage_7=Edit selected launch configuration
140
DefaultLaunchConfigurationsPropertiesPage_8=De&lete
141
DefaultLaunchConfigurationsPropertiesPage_9=Delete selected launch configuration
142
DefaultLaunchConfigurationsPropertiesPage_10=Configuration must be located in project {0}
143
DefaultLaunchConfigurationsPropertiesPage_11=Select Configuration Type
144
DefaultLaunchConfigurationsPropertiesPage_12=&Select the configuration type to create:
(-)ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java (+30 lines)
Lines 32-37 Link Here
32
	public static String ConsolePreferencePage_12;
32
	public static String ConsolePreferencePage_12;
33
	public static String ConsolePreferencePage_13;
33
	public static String ConsolePreferencePage_13;
34
34
35
	public static String ContextualLaunchPreferencePage_0;
36
37
	public static String ContextualLaunchPreferencePage_1;
38
35
	public static String DebugPreferencePage_1;
39
	public static String DebugPreferencePage_1;
36
	public static String DebugPreferencePage_2;
40
	public static String DebugPreferencePage_2;
37
41
Lines 51-56 Link Here
51
	public static String DebugPreferencePage_26;
55
	public static String DebugPreferencePage_26;
52
	public static String DebugPreferencePage_27;
56
	public static String DebugPreferencePage_27;
53
57
58
	public static String DefaultLaunchConfigurationsPropertiesPage_0;
59
60
	public static String DefaultLaunchConfigurationsPropertiesPage_1;
61
62
	public static String DefaultLaunchConfigurationsPropertiesPage_10;
63
64
	public static String DefaultLaunchConfigurationsPropertiesPage_11;
65
66
	public static String DefaultLaunchConfigurationsPropertiesPage_12;
67
68
	public static String DefaultLaunchConfigurationsPropertiesPage_2;
69
70
	public static String DefaultLaunchConfigurationsPropertiesPage_3;
71
72
	public static String DefaultLaunchConfigurationsPropertiesPage_4;
73
74
	public static String DefaultLaunchConfigurationsPropertiesPage_5;
75
76
	public static String DefaultLaunchConfigurationsPropertiesPage_6;
77
78
	public static String DefaultLaunchConfigurationsPropertiesPage_7;
79
80
	public static String DefaultLaunchConfigurationsPropertiesPage_8;
81
82
	public static String DefaultLaunchConfigurationsPropertiesPage_9;
83
54
	public static String LaunchDelegatesPreferencePage_0;
84
	public static String LaunchDelegatesPreferencePage_0;
55
85
56
	public static String LaunchDelegatesPreferencePage_1;
86
	public static String LaunchDelegatesPreferencePage_1;
(-)schema/launchShortcuts.exsd (-1 / +1 lines)
Lines 246-252 Link Here
246
    id=&quot;org.eclipse.jdt.launching.localJavaApplication&quot;&gt;
246
    id=&quot;org.eclipse.jdt.launching.localJavaApplication&quot;&gt;
247
  &lt;/configurationType&gt;
247
  &lt;/configurationType&gt;
248
  &lt;/shortcut&gt;
248
  &lt;/shortcut&gt;
249
&lt;extension&gt;
249
&lt;/extension&gt;
250
&lt;/pre&gt;
250
&lt;/pre&gt;
251
&lt;/p&gt;
251
&lt;/p&gt;
252
&lt;p&gt;
252
&lt;p&gt;
(-)ui/org/eclipse/debug/ui/actions/AbstractLaunchToolbarAction.java (-2 / +8 lines)
Lines 13-18 Link Here
13
13
14
import org.eclipse.debug.core.ILaunchConfiguration;
14
import org.eclipse.debug.core.ILaunchConfiguration;
15
import org.eclipse.debug.internal.ui.DebugUIPlugin;
15
import org.eclipse.debug.internal.ui.DebugUIPlugin;
16
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
17
import org.eclipse.debug.internal.ui.launchConfigurations.ContextLaunchingAction;
16
import org.eclipse.debug.internal.ui.launchConfigurations.OrganizeFavoritesAction;
18
import org.eclipse.debug.internal.ui.launchConfigurations.OrganizeFavoritesAction;
17
import org.eclipse.debug.ui.DebugUITools;
19
import org.eclipse.debug.ui.DebugUITools;
18
import org.eclipse.jface.action.IAction;
20
import org.eclipse.jface.action.IAction;
Lines 54-61 Link Here
54
		if (menu.getItemCount() > 0) {
56
		if (menu.getItemCount() > 0) {
55
			addSeparator(menu);
57
			addSeparator(menu);
56
		}
58
		}
57
59
		if(DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH)) {
58
		addToMenu(menu, new LaunchShortcutsAction(getLaunchGroupIdentifier()), -1);
60
			addToMenu(menu, new ContextLaunchingAction(getLaunchGroupIdentifier()), -1);
61
		}
62
		else {
63
			addToMenu(menu, new LaunchShortcutsAction(getLaunchGroupIdentifier()), -1);
64
		}
59
		addToMenu(menu, getOpenDialogAction(), -1);
65
		addToMenu(menu, getOpenDialogAction(), -1);
60
		addToMenu(menu, new OrganizeFavoritesAction(getLaunchGroupIdentifier()), -1);
66
		addToMenu(menu, new OrganizeFavoritesAction(getLaunchGroupIdentifier()), -1);
61
	}
67
	}
(-)ui/org/eclipse/debug/ui/actions/ContextualLaunchAction.java (-2 / +2 lines)
Lines 53-59 Link Here
53
 * An action delegate that builds a context menu with applicable launch shortcuts
53
 * An action delegate that builds a context menu with applicable launch shortcuts
54
 * for a specific launch mode.
54
 * for a specific launch mode.
55
 * <p>
55
 * <p>
56
 * This class can be subclassed and contributed as an object contribution pop-up
56
 * This class can be sub-classed and contributed as an object contribution pop-up
57
 * menu extension action. When invoked, it becomes a sub-menu that dynamically
57
 * menu extension action. When invoked, it becomes a sub-menu that dynamically
58
 * builds a list of applicable launch shortcuts for the current selection.
58
 * builds a list of applicable launch shortcuts for the current selection.
59
 * Each launch shortcut may have optional information to support a context menu action.
59
 * Each launch shortcut may have optional information to support a context menu action.
Lines 171-177 Link Here
171
	/**
171
	/**
172
	 * This method is used to determine if the selected object is in fact a shared launch
172
	 * This method is used to determine if the selected object is in fact a shared launch
173
	 * configuration that can be launched
173
	 * configuration that can be launched
174
	 * @return true if the item is a shared ocnfig , false otherwise
174
	 * @return true if the item is a shared config , false otherwise
175
	 * @since 3.3
175
	 * @since 3.3
176
	 */
176
	 */
177
	private boolean isSharedConfig(Object receiver) {
177
	private boolean isSharedConfig(Object receiver) {
(-)ui/org/eclipse/debug/ui/actions/OpenLaunchDialogAction.java (-2 / +9 lines)
Lines 16-21 Link Here
16
import org.eclipse.debug.core.ILaunchConfigurationType;
16
import org.eclipse.debug.core.ILaunchConfigurationType;
17
import org.eclipse.debug.internal.ui.DebugUIPlugin;
17
import org.eclipse.debug.internal.ui.DebugUIPlugin;
18
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
18
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
19
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
20
import org.eclipse.debug.internal.ui.actions.ActionMessages;
19
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchGroupExtension;
21
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchGroupExtension;
20
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchHistory;
22
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchHistory;
21
import org.eclipse.debug.ui.DebugUITools;
23
import org.eclipse.debug.ui.DebugUITools;
Lines 59-66 Link Here
59
		fIdentifier = identifier;
61
		fIdentifier = identifier;
60
		LaunchGroupExtension extension = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(identifier);
62
		LaunchGroupExtension extension = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(identifier);
61
		if (extension != null) {
63
		if (extension != null) {
62
			setText(extension.getLabel() + "..."); //$NON-NLS-1$
64
			if(DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH)) {
63
			setImageDescriptor(extension.getImageDescriptor());
65
				setText(ActionMessages.OpenLaunchDialogAction_0);
66
			}
67
			else {
68
				setText(extension.getLabel() + "..."); //$NON-NLS-1$
69
				setImageDescriptor(extension.getImageDescriptor());
70
			}
64
		}
71
		}
65
		PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.OPEN_LAUNCH_CONFIGURATION_ACTION);
72
		PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.OPEN_LAUNCH_CONFIGURATION_ACTION);
66
	}
73
	}
(-)ui/org/eclipse/debug/internal/ui/preferences/ContextLaunchingPropertyTester.java (+34 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.debug.internal.ui.preferences;
12
13
import org.eclipse.core.expressions.PropertyTester;
14
import org.eclipse.debug.internal.ui.DebugUIPlugin;
15
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
16
17
/**
18
 * Tests properties for enabling/disabling popup menu object contributions
19
 * @since 3.3
20
 * 
21
 * EXPERIMENTAL
22
 */
23
public class ContextLaunchingPropertyTester extends PropertyTester {
24
25
	/**
26
	 * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
27
	 */
28
	public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
29
		if("contextlaunch".equals(property)) { //$NON-NLS-1$
30
			return DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH);
31
		}
32
		return false;
33
	}
34
}
(-)ui/org/eclipse/debug/internal/ui/preferences/ContextLaunchingPreferencePage.java (+104 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.debug.internal.ui.preferences;
12
13
import java.util.ArrayList;
14
import java.util.List;
15
16
import org.eclipse.debug.internal.ui.DebugUIPlugin;
17
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
18
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
19
import org.eclipse.debug.internal.ui.SWTUtil;
20
import org.eclipse.jface.preference.BooleanFieldEditor;
21
import org.eclipse.jface.preference.FieldEditor;
22
import org.eclipse.jface.preference.PreferencePage;
23
import org.eclipse.swt.layout.GridData;
24
import org.eclipse.swt.widgets.Composite;
25
import org.eclipse.swt.widgets.Control;
26
import org.eclipse.ui.IWorkbench;
27
import org.eclipse.ui.IWorkbenchPreferencePage;
28
import org.eclipse.ui.PlatformUI;
29
30
/**
31
 * A preference page for configuring launching preferences.
32
 * 
33
 * @since 3.3
34
 */
35
public class ContextLaunchingPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
36
	
37
	/**
38
	 * a list of the field editors
39
	 */
40
	private List fFieldEditors;
41
	
42
	/**
43
	 * The default constructor
44
	 */
45
	public ContextLaunchingPreferencePage() {
46
		super();
47
		setPreferenceStore(DebugUIPlugin.getDefault().getPreferenceStore());
48
	}
49
	
50
	/**
51
	 * @see org.eclipse.jface.preference.PreferencePage#createControl(org.eclipse.swt.widgets.Composite)
52
	 */
53
	public void createControl(Composite parent) {
54
		super.createControl(parent);
55
		PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDebugHelpContextIds.CONTEXTUAL_LAUNCHING_PREFERENCE_PAGE);
56
	}
57
	
58
	/**
59
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
60
	 */
61
	protected Control createContents(Composite parent) {
62
		fFieldEditors = new ArrayList();
63
		Composite comp = SWTUtil.createComposite(parent, 1, 1, GridData.FILL_BOTH);
64
		
65
		SWTUtil.createWrapLabel(comp, DebugPreferencesMessages.ContextualLaunchPreferencePage_0, 1, 300);
66
		SWTUtil.createVerticalSpacer(comp, 2);
67
		//use contextual launch
68
		FieldEditor edit = new BooleanFieldEditor(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH, DebugPreferencesMessages.ContextualLaunchPreferencePage_1, comp);	
69
		fFieldEditors.add(edit);
70
			
71
		//init the field editors
72
		FieldEditor editor;
73
		for(int i = 0; i < fFieldEditors.size(); i++) {
74
			editor = (FieldEditor)fFieldEditors.get(i);
75
			editor.setPreferenceStore(getPreferenceStore());
76
			editor.load();
77
		}
78
		return comp;
79
	}
80
	
81
	/**
82
	 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
83
	 */
84
	public void init(IWorkbench workbench) {}
85
	
86
	/**
87
	 * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
88
	 */
89
	protected void performDefaults() {
90
		for(int i = 0; i < fFieldEditors.size(); i++) {
91
			((FieldEditor)fFieldEditors.get(i)).loadDefault();
92
		}
93
	}
94
	
95
	/**
96
	 * @see org.eclipse.jface.preference.PreferencePage#performOk()
97
	 */
98
	public boolean performOk() {
99
		for(int i = 0; i < fFieldEditors.size(); i++) {
100
			((FieldEditor)fFieldEditors.get(i)).store();
101
		}
102
		return super.performOk();
103
	}
104
}
(-)ui/org/eclipse/debug/internal/ui/actions/ContextLaunchingAction.java (+142 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.debug.internal.ui.actions;
12
13
import org.eclipse.core.resources.IResource;
14
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.IAdaptable;
16
import org.eclipse.core.runtime.IStatus;
17
import org.eclipse.core.runtime.Status;
18
import org.eclipse.debug.core.DebugPlugin;
19
import org.eclipse.debug.core.ILaunchConfiguration;
20
import org.eclipse.debug.internal.core.LaunchManager;
21
import org.eclipse.debug.internal.ui.DebugUIPlugin;
22
import org.eclipse.debug.ui.DebugUITools;
23
import org.eclipse.jface.action.IAction;
24
import org.eclipse.jface.viewers.ISelection;
25
import org.eclipse.jface.viewers.IStructuredSelection;
26
import org.eclipse.swt.widgets.Event;
27
import org.eclipse.ui.IActionDelegate2;
28
29
/**
30
 * A universal context launching action for popup menus. 
31
 * This action gets its immediate context from what was right-clicked
32
 * on to present the action.
33
 * 
34
 * @see {@link IActionDelegate2}
35
 * @see {@link org.eclipse.debug.core.ILaunchManager}
36
 * 
37
 * @since 3.3
38
 * EXPERIMENTAL
39
 */
40
public class ContextLaunchingAction implements IActionDelegate2 {
41
42
	/**
43
	 * The currently selected context that was right clicked on
44
	 */
45
	private IStructuredSelection fCurrentSelection = null;
46
	/**
47
	 * the mode the action is created on
48
	 */
49
	private String fMode = null;
50
	
51
	/**
52
	 * Constructor
53
	 * @param mode
54
	 */
55
	public ContextLaunchingAction(String mode) {
56
		fMode = mode;
57
	}
58
59
	/**
60
	 * @see org.eclipse.ui.IActionDelegate2#dispose()
61
	 */
62
	public void dispose() {
63
		fCurrentSelection = null;
64
	}
65
66
	/**
67
	 * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
68
	 */
69
	public void init(IAction action) {}
70
71
	/**
72
	 * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event)
73
	 */
74
	public void runWithEvent(IAction action, Event event) {
75
		if(fCurrentSelection != null && !fCurrentSelection.isEmpty()) {
76
			try {
77
				Object o = fCurrentSelection.getFirstElement();
78
				if(o instanceof IAdaptable) {
79
					IAdaptable adapt = (IAdaptable) o;
80
					IResource resource = (IResource) adapt.getAdapter(IResource.class);
81
					if(resource != null) {
82
						ILaunchConfiguration config = getLaunchManager().getDefaultConfiguration(resource);
83
						if(config != null) {
84
							if(config.exists()) {
85
								DebugUITools.launch(config, fMode);
86
							}
87
							else {
88
								//might have been moved or shared since last invocation
89
							}
90
						}
91
						else {
92
							DebugUITools.openLaunchConfigurationDialog(DebugUIPlugin.getShell(), null, fMode);
93
						}
94
					}
95
					else {
96
						report("The selected context is not launchable");
97
					}
98
				}
99
				else {
100
					report("The selected context is not launchable");
101
				}
102
			}
103
			catch (CoreException ce) {DebugUIPlugin.log(ce);}
104
		}
105
		else {
106
			report("There is no selected context to launch with");
107
		}
108
	}
109
110
	/**
111
	 * Reports an error status to the log with the specified message
112
	 * @param message the message to put in the error status
113
	 */
114
	protected void report(String message) {
115
		DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), message));
116
	}
117
	
118
	/**
119
	 * Returns the launch manager
120
	 * @return the launch manager
121
	 */
122
	protected LaunchManager getLaunchManager() {
123
		return (LaunchManager) DebugPlugin.getDefault().getLaunchManager();
124
	}
125
	
126
	/**
127
	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
128
	 */
129
	public void run(IAction action) {
130
		//not called
131
	}
132
133
	/**
134
	 * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
135
	 */
136
	public void selectionChanged(IAction action, ISelection selection) {
137
		if(!selection.isEmpty()) {
138
			fCurrentSelection = (IStructuredSelection) selection;
139
		}
140
	}
141
142
}
(-)ui/org/eclipse/debug/internal/ui/actions/ProfileContextLaunchingAction.java (+33 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.debug.internal.ui.actions;
12
13
import org.eclipse.debug.core.ILaunchManager;
14
15
/**
16
 * Specialization of <code>ContextLaunchingAction</code> for profile mode
17
 * 
18
 * @see {@link ContextLaunchingAction}
19
 * @see {@link ILaunchManager}
20
 * 
21
 * @since 3.3
22
 * EXPERIMENTAL
23
 */
24
public class ProfileContextLaunchingAction extends ContextLaunchingAction {
25
26
	/**
27
	 * Constructor
28
	 */
29
	public ProfileContextLaunchingAction() {
30
		super(ILaunchManager.PROFILE_MODE);
31
	}
32
33
}
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/ContextLaunchingAction.java (+64 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.debug.internal.ui.launchConfigurations;
12
13
import org.eclipse.debug.internal.ui.DebugUIPlugin;
14
import org.eclipse.jface.action.Action;
15
import org.eclipse.jface.action.IAction;
16
import org.eclipse.jface.viewers.ISelection;
17
import org.eclipse.ui.IWorkbenchWindow;
18
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
19
20
/**
21
 * A wrapper class for a context launching toolbar action
22
 * 
23
 *  @since 3.3
24
 *  EXPERIMENTAL
25
 */
26
public class ContextLaunchingAction extends Action implements IWorkbenchWindowActionDelegate {
27
28
	private String fId = null;
29
	
30
	/**
31
	 * Constructor
32
	 * @param id
33
	 */
34
	public ContextLaunchingAction(String id) {
35
		fId = id;
36
		LaunchGroupExtension extension = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(id);
37
		if (extension != null) {
38
			setText(extension.getLabel());
39
			setImageDescriptor(extension.getImageDescriptor());
40
		}
41
	}
42
43
	/**
44
	 * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
45
	 */
46
	public void dispose() {
47
		fId = null;
48
	}
49
50
	/**
51
	 * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
52
	 */
53
	public void init(IWorkbenchWindow window) {}
54
55
	/**
56
	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
57
	 */
58
	public void run(IAction action) {}
59
60
	/**
61
	 * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
62
	 */
63
	public void selectionChanged(IAction action, ISelection selection) {}
64
}
(-)ui/org/eclipse/debug/internal/ui/preferences/DefaultLaunchConfigurationsPropertiesPage.java (+443 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.debug.internal.ui.preferences;
12
13
import java.util.Arrays;
14
import java.util.Collections;
15
import java.util.Comparator;
16
import java.util.HashSet;
17
import java.util.Iterator;
18
import java.util.List;
19
import java.util.Set;
20
21
import org.eclipse.core.resources.IResource;
22
import org.eclipse.core.runtime.CoreException;
23
import org.eclipse.core.runtime.IAdaptable;
24
import org.eclipse.debug.core.DebugPlugin;
25
import org.eclipse.debug.core.ILaunchConfiguration;
26
import org.eclipse.debug.core.ILaunchConfigurationType;
27
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
28
import org.eclipse.debug.internal.core.LaunchManager;
29
import org.eclipse.debug.internal.ui.DebugUIPlugin;
30
import org.eclipse.debug.internal.ui.DefaultLabelProvider;
31
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
32
import org.eclipse.debug.internal.ui.SWTUtil;
33
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationComparator;
34
import org.eclipse.debug.ui.DebugUITools;
35
import org.eclipse.debug.ui.IDebugUIConstants;
36
import org.eclipse.jface.viewers.ArrayContentProvider;
37
import org.eclipse.jface.viewers.CheckStateChangedEvent;
38
import org.eclipse.jface.viewers.CheckboxTableViewer;
39
import org.eclipse.jface.viewers.ICheckStateListener;
40
import org.eclipse.jface.viewers.ISelectionChangedListener;
41
import org.eclipse.jface.viewers.IStructuredSelection;
42
import org.eclipse.jface.viewers.SelectionChangedEvent;
43
import org.eclipse.jface.viewers.StructuredSelection;
44
import org.eclipse.jface.viewers.Viewer;
45
import org.eclipse.jface.viewers.ViewerFilter;
46
import org.eclipse.jface.window.Window;
47
import org.eclipse.swt.SWT;
48
import org.eclipse.swt.events.SelectionEvent;
49
import org.eclipse.swt.events.SelectionListener;
50
import org.eclipse.swt.layout.GridData;
51
import org.eclipse.swt.layout.GridLayout;
52
import org.eclipse.swt.widgets.Button;
53
import org.eclipse.swt.widgets.Composite;
54
import org.eclipse.swt.widgets.Control;
55
import org.eclipse.swt.widgets.Table;
56
import org.eclipse.ui.PlatformUI;
57
import org.eclipse.ui.dialogs.ListDialog;
58
import org.eclipse.ui.dialogs.PropertyPage;
59
60
import com.ibm.icu.text.MessageFormat;
61
62
/**
63
 * Displays default launch configuration settings for a selected resource - associated launch configurations.
64
 * 
65
 * @see {@link PropertyPage}
66
 * @see {@link ILaunchConfiguration}
67
 * @see {@link org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog}
68
 * @see {@link IDebugHelpContextIds#DEFAULT_LAUNCHCONFIGURATION_PROPERTY_PAGE}
69
 * 
70
 * @since 3.3
71
 */
72
public class DefaultLaunchConfigurationsPropertiesPage extends PropertyPage {
73
	
74
	/**
75
	 * Provides a viewer filter for the tree 
76
	 */
77
	class DefaultConfigFilter extends ViewerFilter {
78
79
		/* (non-Javadoc)
80
		 * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
81
		 */
82
		public boolean select(Viewer viewer, Object parentElement, Object element) {
83
			boolean select = true;
84
			if (element instanceof ILaunchConfiguration) {
85
				try {
86
					ILaunchConfiguration configuration = (ILaunchConfiguration) element;
87
					select &= configuration.getType().getCategory() == null;
88
					select &= !DebugUITools.isPrivate(configuration);
89
					if (!configuration.isLocal()) {
90
						select &= getResource().getProject().equals(configuration.getFile().getProject());
91
					}
92
				} 
93
				catch (CoreException e) {return false;}
94
			}
95
			return select;
96
		}
97
98
	}
99
	
100
	/**
101
	 * Set of configurations to be deleted
102
	 */
103
	private Set fDeletedConfigurations = new HashSet();
104
	
105
	/**
106
	 * Set of original default candidates for the resource
107
	 */
108
	private Set fOriginalCandidates;
109
	
110
	//widgets
111
	private CheckboxTableViewer fViewer;
112
	private Button fNewButton = null;
113
	private Button fEditButton = null;
114
	private Button fDuplicateButton = null;
115
	private Button fDeleteButton = null;
116
117
	/* (non-Javadoc)
118
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
119
	 */
120
	protected Control createContents(Composite parent) {
121
		PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IDebugHelpContextIds.DEFAULT_LAUNCHCONFIGURATION_PROPERTY_PAGE);
122
		
123
		Composite topComposite = SWTUtil.createComposite(parent, 2, 1, GridData.FILL_BOTH);
124
		
125
		SWTUtil.createWrapLabel(topComposite, DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_0, 2, 300);
126
		SWTUtil.createVerticalSpacer(topComposite, 2);
127
		SWTUtil.createWrapLabel(topComposite, MessageFormat.format(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_1, new String[]{getResource().getName()}), 2, 300);
128
		
129
		fViewer = createViewer(topComposite);
130
		
131
		Composite buttonComp = SWTUtil.createComposite(topComposite, 1, 1, GridData.FILL_VERTICAL);
132
		GridLayout layout = (GridLayout) buttonComp.getLayout();
133
		layout.marginHeight = 0;
134
		fNewButton = SWTUtil.createPushButton(buttonComp, DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_2, null);
135
		fNewButton.setToolTipText(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_3);
136
		fNewButton.addSelectionListener(new SelectionListener() {
137
			public void widgetDefaultSelected(SelectionEvent e) {}
138
			public void widgetSelected(SelectionEvent e) {
139
				handleNew();
140
			}
141
		});
142
		
143
		fDuplicateButton = SWTUtil.createPushButton(buttonComp, DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_4, null);
144
		fDuplicateButton.setToolTipText(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_5);
145
		fDuplicateButton.setEnabled(false);
146
		fDuplicateButton.addSelectionListener(new SelectionListener() {
147
			public void widgetDefaultSelected(SelectionEvent e) {}
148
			public void widgetSelected(SelectionEvent e) {
149
				handleCopy();
150
			}
151
		});
152
		fEditButton = SWTUtil.createPushButton(buttonComp, DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_6, null);
153
		fEditButton.setToolTipText(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_7);
154
		fEditButton.setEnabled(false);
155
		fEditButton.addSelectionListener(new SelectionListener() {
156
			public void widgetDefaultSelected(SelectionEvent e) {}
157
			public void widgetSelected(SelectionEvent e) {
158
				handleEdit();
159
			}
160
		});
161
		fDeleteButton = SWTUtil.createPushButton(buttonComp, DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_8, null);
162
		fDeleteButton.setToolTipText(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_9);
163
		fDeleteButton.setEnabled(false);
164
		fDeleteButton.addSelectionListener(new SelectionListener() {
165
			public void widgetDefaultSelected(SelectionEvent e) {}
166
			public void widgetSelected(SelectionEvent e) {
167
				handleDelete();
168
			}
169
		});
170
		
171
		fViewer.setSelection(new StructuredSelection());
172
		applyDialogFont(topComposite);
173
		return topComposite;
174
	}
175
176
	/**
177
	 * Creates and returns the viewer that will display the possible default configurations.
178
	 * 
179
	 * @param parent parent composite to create the viewer in
180
	 * @return viewer viewer that will display possible default configurations
181
	 */
182
	protected CheckboxTableViewer createViewer(Composite parent){
183
		CheckboxTableViewer viewer = CheckboxTableViewer.newCheckList(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
184
		viewer.setLabelProvider(new DefaultLabelProvider());
185
		viewer.setContentProvider(new ArrayContentProvider());
186
		viewer.setComparator(new LaunchConfigurationComparator());
187
		viewer.addCheckStateListener(new ICheckStateListener() {
188
			public void checkStateChanged(CheckStateChangedEvent event) {
189
				if (event.getChecked()) {
190
					fViewer.setCheckedElements(new Object[] {event.getElement()});
191
				}
192
				else{
193
					fViewer.setCheckedElements(new Object[] {});
194
				}
195
			}
196
		});
197
		// Only filter private configurations and external tools to avoid filtering a default
198
		viewer.addFilter(new DefaultConfigFilter());
199
		Table builderTable = viewer.getTable();
200
		GridData tableGridData = new GridData(GridData.FILL_BOTH);
201
		tableGridData.heightHint = 300;
202
		builderTable.setLayoutData(tableGridData);
203
		
204
		IResource resource = getResource();
205
		fOriginalCandidates = getLaunchManager().getDefaultCandidates(resource);
206
		viewer.setInput(fOriginalCandidates);
207
		try {
208
			ILaunchConfiguration configuration = getLaunchManager().getDefaultConfiguration(resource);
209
			if (configuration != null) {
210
				Iterator iterator = fOriginalCandidates.iterator();
211
				while (iterator.hasNext()) {
212
					ILaunchConfigurationWorkingCopy wc = (ILaunchConfigurationWorkingCopy) iterator.next();
213
					if (configuration.equals(wc.getOriginal())) {
214
						viewer.setChecked(wc, true);
215
						break;
216
					}
217
				}
218
			}
219
		} catch (CoreException e) {
220
			setErrorMessage(e.getMessage());
221
		}
222
		viewer.addSelectionChangedListener(new ISelectionChangedListener() {
223
			public void selectionChanged(SelectionChangedEvent event) {
224
				boolean empty = event.getSelection().isEmpty();
225
				fEditButton.setEnabled(!empty);
226
				fDuplicateButton.setEnabled(!empty);
227
				fDeleteButton.setEnabled(!empty);
228
			}
229
		});
230
		
231
		return viewer;
232
	}
233
234
	/**
235
	 * Returns the viewer displaying possible default configurations.
236
	 * 
237
	 * @return viewer
238
	 */
239
	protected CheckboxTableViewer getViewer(){
240
		return fViewer;
241
	}
242
		
243
	/**
244
	 * Returns the launch manager
245
	 * @return the launch manager
246
	 */
247
	protected LaunchManager getLaunchManager() {
248
		return (LaunchManager) DebugPlugin.getDefault().getLaunchManager();
249
	}
250
	
251
	/**
252
	 * Returns the resource this property page is open on.
253
	 * 
254
	 * @return resource
255
	 */
256
	protected IResource getResource() {
257
		Object element = getElement();
258
		IResource resource = null;
259
		if (element instanceof IResource) {
260
			resource = (IResource) element;
261
		} else if (element instanceof IAdaptable) {
262
			resource = (IResource) ((IAdaptable)element).getAdapter(IResource.class);
263
		}
264
		return resource;
265
	}
266
267
	/* (non-Javadoc)
268
	 * @see org.eclipse.jface.preference.PreferencePage#performOk()
269
	 */
270
	public boolean performOk() {
271
		Object[] checked = fViewer.getCheckedElements();
272
		try {
273
			ILaunchConfiguration def = null;
274
			if (checked.length == 1) {
275
					def = (ILaunchConfiguration) checked[0];
276
					def = ((ILaunchConfigurationWorkingCopy)def).doSave();
277
			}
278
			DebugPlugin.getDefault().getLaunchManager().setDefaultConfiguration(getResource(), def);
279
		} catch (CoreException e) {
280
			setErrorMessage(e.getMessage());
281
			return false;
282
		}
283
	//delete 
284
		Iterator iter = fDeletedConfigurations.iterator();
285
		while (iter.hasNext()) {
286
			ILaunchConfigurationWorkingCopy currentConfig = (ILaunchConfigurationWorkingCopy) iter.next();
287
			try{			
288
				if (currentConfig.getOriginal() != null){
289
					currentConfig.getOriginal().delete();
290
				}
291
			} catch (CoreException e) {
292
				DebugPlugin.logMessage("Problem deleting configuration " + currentConfig.getName(), e); //$NON-NLS-1$
293
			}
294
		}
295
	//add
296
		iter = fOriginalCandidates.iterator();
297
		while (iter.hasNext()) {
298
			ILaunchConfigurationWorkingCopy currentConfig = (ILaunchConfigurationWorkingCopy) iter.next();
299
			if (currentConfig.isDirty()){
300
				try{
301
					currentConfig.doSave();
302
				} catch (CoreException e) {
303
					DebugPlugin.logMessage("Problem saving changes to configuration " + currentConfig.getName(), e); //$NON-NLS-1$
304
				}
305
			}
306
		}
307
		
308
		return super.performOk();
309
	}
310
311
	/* (non-Javadoc)
312
	 * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
313
	 */
314
	protected void performDefaults() {
315
		fViewer.setAllChecked(false);
316
		setErrorMessage(null);
317
		setValid(true);
318
		super.performDefaults();
319
	}
320
	
321
	/**
322
	 * Returns the names of the launch configurations passed in as original input to the tree viewer
323
	 * @return the names of the original launch configurations
324
	 */
325
	private Set getConfigurationNames() {
326
		Set names = new HashSet();
327
		Iterator iter = fOriginalCandidates.iterator();
328
		Object o = null;
329
		while (iter.hasNext()) {
330
			o = iter.next();
331
			if(o instanceof ILaunchConfiguration) {
332
				names.add(((ILaunchConfiguration)o).getName());
333
			}
334
		}
335
		return names;
336
	}
337
	
338
	/**
339
	 * Returns selected configurations.
340
	 * 
341
	 * @return selected configurations
342
	 */
343
	private ILaunchConfigurationWorkingCopy[] getSelectedConfigurations() {
344
		IStructuredSelection ss = (IStructuredSelection) fViewer.getSelection();
345
		return (ILaunchConfigurationWorkingCopy[]) ss.toList().toArray(new ILaunchConfigurationWorkingCopy[ss.size()]);
346
	}
347
348
	/**
349
	 * Copy the selection
350
	 */
351
	private void handleCopy() {
352
		ILaunchConfigurationWorkingCopy configuration = getSelectedConfigurations()[0];
353
		try {
354
			ILaunchConfigurationWorkingCopy copy = configuration.copy(
355
					((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).generateUniqueLaunchConfigurationNameFrom(configuration.getName(), getConfigurationNames()));
356
			copy.setAttributes(configuration.getAttributes());
357
			fOriginalCandidates.add(copy);
358
			fViewer.refresh();
359
			fViewer.setSelection(new StructuredSelection(copy));
360
		} catch (CoreException e) {
361
			setErrorMessage(e.getMessage());
362
		}
363
	}
364
365
	/**
366
	 * Delete the selection
367
	 */
368
	private void handleDelete() {
369
		Table table = fViewer.getTable();
370
		int[] indices = table.getSelectionIndices();
371
		Arrays.sort(indices);
372
		ILaunchConfiguration[] configurations = getSelectedConfigurations();
373
		for (int i = 0; i < configurations.length; i++) {
374
			fDeletedConfigurations.add(configurations[i]);
375
			fOriginalCandidates.remove(configurations[i]);
376
		}
377
		fViewer.refresh();
378
		if (indices[0] < table.getItemCount()) {
379
			fViewer.setSelection(new StructuredSelection(table.getItem(indices[0]).getData()));
380
		} else if (table.getItemCount() > 0) {
381
			fViewer.setSelection(new StructuredSelection(table.getItem(table.getItemCount() - 1).getData()));
382
		}
383
	}
384
385
	/**
386
	 * Edit the selection
387
	 */
388
	private void handleEdit() {
389
		edit(getSelectedConfigurations()[0]);
390
		fViewer.refresh();
391
	}
392
393
	/**
394
	 * Edits the given configuration as a nested working copy.
395
	 * Returns the code from the dialog used to edit the configuration.
396
	 * 
397
	 * @param configuration
398
	 * @return dialog return code - OK or CANCEL
399
	 */
400
	private int edit(ILaunchConfigurationWorkingCopy configuration) {
401
		return DebugUIPlugin.openLaunchConfigurationPropertiesDialog(getShell(), configuration, IDebugUIConstants.ID_RUN_LAUNCH_GROUP, getConfigurationNames(), null);
402
	}
403
404
	/**
405
	 * Create a new configuration
406
	 */
407
	private void handleNew() {
408
		List avail = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getApplicableConfigurationTypes(getResource());
409
		Collections.sort(avail, new Comparator() {
410
				public int compare(Object o1, Object o2) {
411
					ILaunchConfigurationType t1 = (ILaunchConfigurationType) o1;
412
					ILaunchConfigurationType t2 = (ILaunchConfigurationType) o2;
413
					return t1.getName().compareTo(t2.getName());
414
				}
415
			
416
			});
417
		ListDialog dialog = new ListDialog(getShell());
418
		dialog.setTitle(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_11);
419
		dialog.setContentProvider(new ArrayContentProvider());
420
		dialog.setLabelProvider(new DefaultLabelProvider());
421
		dialog.setAddCancelButton(true);
422
		dialog.setMessage(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_12);
423
		dialog.setInput(avail);
424
		if (dialog.open() == Window.OK) {
425
			Object[] result = dialog.getResult();
426
			if (result.length == 1) {
427
				ILaunchConfigurationType type = (ILaunchConfigurationType) result[0];
428
				try {
429
					ILaunchConfigurationWorkingCopy wc = type.newInstance(null, 
430
							((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).
431
							generateUniqueLaunchConfigurationNameFrom("New_configuration", getConfigurationNames())); //$NON-NLS-1$
432
					if (edit(wc) == Window.OK) {
433
						fOriginalCandidates.add(wc);
434
						fViewer.refresh();
435
						fViewer.setSelection(new StructuredSelection(wc));
436
					}
437
				} catch (CoreException e) {
438
					setErrorMessage(e.getMessage());
439
				}
440
			}
441
		}
442
	}	
443
}
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationComparator.java (+82 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.debug.internal.ui.launchConfigurations;
12
13
import java.util.Arrays;
14
import java.util.Collections;
15
import java.util.Comparator;
16
import java.util.HashMap;
17
import java.util.Iterator;
18
import java.util.List;
19
import java.util.Map;
20
21
import org.eclipse.core.runtime.CoreException;
22
import org.eclipse.debug.core.DebugPlugin;
23
import org.eclipse.debug.core.ILaunchConfiguration;
24
import org.eclipse.debug.core.ILaunchConfigurationType;
25
import org.eclipse.ui.model.WorkbenchViewerComparator;
26
27
/**
28
 * Groups configurations by type.
29
 * 
30
 * @since 3.3
31
 */
32
public class LaunchConfigurationComparator extends WorkbenchViewerComparator {
33
34
	/**
35
	 * the map of categories of <code>ILaunchConfigurationType</code>s to <code>Integer</code>s entries
36
	 */
37
	private static Map fgCategories;
38
	
39
	/**
40
	 * @see org.eclipse.jface.viewers.ViewerComparator#category(java.lang.Object)
41
	 */
42
	public int category(Object element) {
43
		Map map = getCategories();
44
		if (element instanceof ILaunchConfiguration) {
45
			ILaunchConfiguration configuration = (ILaunchConfiguration) element;
46
			try {
47
				Integer i = (Integer) map.get(configuration.getType());
48
				if (i != null) {
49
					return i.intValue();
50
				}
51
			} catch (CoreException e) {
52
			}
53
		}
54
		return map.size();
55
	}
56
	
57
	/**
58
	 * Returns the map of categories
59
	 * @return the map of categories
60
	 */
61
	private Map getCategories() {
62
		if (fgCategories == null) {
63
			fgCategories = new HashMap();
64
			List types = Arrays.asList(DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationTypes());
65
			Collections.sort(types, new Comparator() {
66
				public int compare(Object o1, Object o2) {
67
					ILaunchConfigurationType t1 = (ILaunchConfigurationType) o1;
68
					ILaunchConfigurationType t2 = (ILaunchConfigurationType) o2;
69
					return t1.getName().compareTo(t2.getName());
70
				}
71
			
72
			});
73
			Iterator iterator = types.iterator();
74
			int i = 0;
75
			while (iterator.hasNext()) {
76
				fgCategories.put(iterator.next(), new Integer(i));
77
				i++;
78
			}
79
		}
80
		return fgCategories;
81
	}
82
}
(-)ui/org/eclipse/debug/internal/ui/actions/RunContextLaunchingAction.java (+33 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.debug.internal.ui.actions;
12
13
import org.eclipse.debug.core.ILaunchManager;
14
15
/**
16
 * Specialization of <code>ContextLaunchingAction</code> for run mode
17
 * 
18
 * @see {@link ContextLaunchingAction}
19
 * @see {@link ILaunchManager}
20
 * 
21
 * @since 3.3
22
 * EXPERIMENTAL
23
 */
24
public class RunContextLaunchingAction extends ContextLaunchingAction {
25
26
	/**
27
	 * Constructor
28
	 */
29
	public RunContextLaunchingAction() {
30
		super(ILaunchManager.RUN_MODE);
31
	}
32
33
}
(-)ui/org/eclipse/debug/internal/ui/actions/DebugContextLaunchingAction.java (+32 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.debug.internal.ui.actions;
12
13
import org.eclipse.debug.core.ILaunchManager;
14
15
/**
16
 * Specialization of <code>ContextLaunchingAction</code> for debug mode
17
 * 
18
 * @see {@link ContextLaunchingAction}
19
 * @see {@link ILaunchManager}
20
 * 
21
 * @since 3.3
22
 * EXPERIMENTAL
23
 */
24
public class DebugContextLaunchingAction extends ContextLaunchingAction {
25
	
26
	/**
27
	 * Constructor
28
	 */
29
	public DebugContextLaunchingAction() {
30
		super(ILaunchManager.DEBUG_MODE);
31
	}
32
}
(-)ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaMainTab.java (-1 / +1 lines)
Lines 53-59 Link Here
53
 * A launch configuration tab that displays and edits project and
53
 * A launch configuration tab that displays and edits project and
54
 * main type name launch configuration attributes.
54
 * main type name launch configuration attributes.
55
 * <p>
55
 * <p>
56
 * This class may be instantiated. This class is not intended to be subclassed.
56
 * This class may be instantiated. This class is not intended to be sub-classed.
57
 * </p>
57
 * </p>
58
 * @since 3.2
58
 * @since 3.2
59
 */
59
 */
(-)plugin.xml (+3 lines)
Lines 266-271 Link Here
266
         <perspective
266
         <perspective
267
               id="org.eclipse.debug.ui.DebugPerspective">
267
               id="org.eclipse.debug.ui.DebugPerspective">
268
         </perspective>
268
         </perspective>
269
         <configurationType
270
               id="org.eclipse.jdt.junit.launchconfig">
271
         </configurationType>
269
      </shortcut>
272
      </shortcut>
270
   </extension>
273
   </extension>
271
   <extension
274
   <extension
(-)plugin.xml (+9 lines)
Lines 1090-1095 Link Here
1090
         <perspective
1090
         <perspective
1091
               id="org.eclipse.pde.PDEPerspective">
1091
               id="org.eclipse.pde.PDEPerspective">
1092
         </perspective>
1092
         </perspective>
1093
         <configurationType
1094
               id="org.eclipse.pde.ui.JunitLaunchConfig">
1095
         </configurationType>
1093
      </shortcut>
1096
      </shortcut>
1094
      <shortcut
1097
      <shortcut
1095
            label="%launcher.shortcut.label"
1098
            label="%launcher.shortcut.label"
Lines 1133-1138 Link Here
1133
         <perspective
1136
         <perspective
1134
               id="org.eclipse.pde.PDEPerspective">
1137
               id="org.eclipse.pde.PDEPerspective">
1135
         </perspective>
1138
         </perspective>
1139
         <configurationType
1140
               id="org.eclipse.pde.ui.RuntimeWorkbench">
1141
         </configurationType>
1136
      </shortcut>
1142
      </shortcut>
1137
      <shortcut
1143
      <shortcut
1138
            label="%Equinox.shortcut.label"
1144
            label="%Equinox.shortcut.label"
Lines 1176-1181 Link Here
1176
         <perspective
1182
         <perspective
1177
               id="org.eclipse.pde.PDEPerspective">
1183
               id="org.eclipse.pde.PDEPerspective">
1178
         </perspective>
1184
         </perspective>
1185
         <configurationType
1186
               id="org.eclipse.pde.ui.EquinoxLauncher">
1187
         </configurationType>
1179
      </shortcut>
1188
      </shortcut>
1180
      <!-- <shortcut
1189
      <!-- <shortcut
1181
            label="%launcher.swt.name"
1190
            label="%launcher.swt.name"
(-)tests/org/eclipse/jdt/debug/tests/launching/LaunchConfigurationTests.java (-1 / +1 lines)
Lines 738-744 Link Here
738
		 
738
		 
739
		 // get a working copy
739
		 // get a working copy
740
		 wc = handle.getWorkingCopy();
740
		 wc = handle.getWorkingCopy();
741
		 ILaunchConfigurationWorkingCopy nested = wc.getNestedWorkingCopy();
741
		 ILaunchConfigurationWorkingCopy nested = wc.getWorkingCopy();
742
		 
742
		 
743
		 // verify nested is same as original
743
		 // verify nested is same as original
744
		 assertEquals("String1 should be String1", nested.getAttribute("String1", "Missing"), "String1");
744
		 assertEquals("String1 should be String1", nested.getAttribute("String1", "Missing"), "String1");
(-)core/org/eclipse/debug/core/ILaunchConfiguration.java (-6 / +11 lines)
Lines 374-390 Link Here
374
	
374
	
375
	/**
375
	/**
376
	 * Returns a working copy of this launch configuration.
376
	 * Returns a working copy of this launch configuration.
377
	 * If the this method is called on a working copy, a nested working 
378
	 * copy is created (a working copy of a working copy).
377
	 * Changes to the working copy will be applied to this
379
	 * Changes to the working copy will be applied to this
378
	 * launch configuration when saved. The working copy will
380
	 * launch configuration when saved, or to the parent working copy. 
379
	 * refer to this launch configuration as its original
381
	 * The working copy will refer to this launch configuration as its original
380
	 * launch configuration.
382
	 * launch configuration, or the working copy it was created from.
381
	 * <p>
383
	 * <p>
382
	 * When a working copy (B) is created from a working copy (A), the newly
384
	 * When a working copy (B) is created from a working copy (A), the newly
383
	 * created working copy (B) is initialized with the attributes from
385
	 * created working copy (B) is initialized with the attributes from
384
	 * the first working copy (A). Whenever a working copy is saved, it is written
386
	 * the first working copy (A). Whenever a working copy is saved, it is written
385
	 * back to the original non-working copy configuration.
387
	 * back to the working copy from which it was created: in this example working 
388
	 * copy B will write back to working copy A, and A will write back to the 
389
	 * original launch configuration.
386
	 * </p>
390
	 * </p>
387
	 * @return a working copy of this launch configuration
391
	 * @return a working copy of this launch configuration, or a nested working copy if called
392
	 * on an instance of <code>ILaunchConfigurationWorkingCopy</code>
388
	 * @exception CoreException if this method fails. Reasons include:
393
	 * @exception CoreException if this method fails. Reasons include:
389
	 * <ul>
394
	 * <ul>
390
	 * <li>An exception occurs while initializing the contents of the
395
	 * <li>An exception occurs while initializing the contents of the
Lines 396-402 Link Here
396
	
401
	
397
	/**
402
	/**
398
	 * Returns whether this launch configuration is stored
403
	 * Returns whether this launch configuration is stored
399
	 * locally with the workspace. This is a handle-only method.
404
	 * locally within the workspace. This is a handle-only method.
400
	 * 
405
	 * 
401
	 * @return whether this launch configuration is stored
406
	 * @return whether this launch configuration is stored
402
	 *  locally with the workspace
407
	 *  locally with the workspace
(-)core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java (-27 / +2 lines)
Lines 111-120 Link Here
111
	
111
	
112
	/**
112
	/**
113
	 * Returns the original launch configuration this working copy
113
	 * Returns the original launch configuration this working copy
114
	 * was created from, or <code>null</code> if this is a new
114
	 * was created from or <code>null</code> if this is a new
115
	 * working copy created from a launch configuration type.
115
	 * working copy created from a launch configuration type.
116
	 * 
116
	 * 
117
	 * @return the original launch configuration, or <code>null</code>
117
	 * @return the original launch configuration, working copy, or <code>null</code>
118
	 */
118
	 */
119
	public ILaunchConfiguration getOriginal();
119
	public ILaunchConfiguration getOriginal();
120
	
120
	
Lines 254-284 Link Here
254
	public void removeModes(Set modes);
254
	public void removeModes(Set modes);
255
	
255
	
256
	/**
256
	/**
257
	 * Returns a working copy of this working copy. Changes to the working copy will
258
	 * be applied to this working copy when saved. The working copy will
259
	 * refer to this launch configuration as its parent. Changes are only
260
	 * saved to the underlying original configuration when the root working
261
	 * copy is saved.
262
	 * 
263
	 * @return a working copy of this working copy
264
	 * @exception CoreException if this method fails. Reasons include:
265
	 * <ul>
266
	 * <li>An exception occurs while initializing the contents of the
267
	 * working copy from this configuration's underlying storage.</li>
268
	 * </ul>
269
	 * @see ILaunchConfigurationWorkingCopy#getOriginal()
270
	 * @see ILaunchConfigurationWorkingCopy#getParent()
271
	 * @since 3.3
272
	 * <p>
273
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
274
	 * part of a work in progress. There is no guarantee that this API will
275
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
276
	 * without consulting with the Platform/Debug team.
277
	 * </p>
278
	 */
279
	public ILaunchConfigurationWorkingCopy getNestedWorkingCopy() throws CoreException;	
280
	
281
	/**
282
	 * Returns the parent of this working copy or <code>null</code> if this working
257
	 * Returns the parent of this working copy or <code>null</code> if this working
283
	 * copy is not a nested copy of another working copy.
258
	 * copy is not a nested copy of another working copy.
284
	 * 
259
	 * 
(-)core/org/eclipse/debug/internal/core/LaunchManager.java (-15 / +53 lines)
Lines 2438-2443 Link Here
2438
		return null;
2438
		return null;
2439
	}
2439
	}
2440
2440
2441
	/**
2442
	 * Returns a list of potential default configurations candidates for the given
2443
	 * resource. The configurations are working copies.
2444
	 *  
2445
	 * @param resource resource
2446
	 * @return list of default candidates
2447
	 */
2448
	public Set getDefaultCandidates(IResource resource) {
2449
		IPath resourcePath = resource.getFullPath();
2450
		ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
2451
		Set set = new HashSet();
2452
		try {
2453
			ILaunchConfiguration[] configurations = manager.getLaunchConfigurations();
2454
			ILaunchConfiguration configuration = null;
2455
			IResource[] resources = null;
2456
			for (int i = 0; i < configurations.length; i++) {
2457
				configuration = configurations[i];
2458
				resources = configuration.getMappedResources();
2459
				if (resources != null) {
2460
					for (int j = 0; j < resources.length; j++) {
2461
						if (resource.equals(resources[j]) || resourcePath.isPrefixOf(resources[j].getFullPath()) ||
2462
								resources[j].getFullPath().isPrefixOf(resourcePath)) {
2463
							set.add(configuration.getWorkingCopy());
2464
							break;
2465
						}
2466
					}
2467
				} else {
2468
					// 1. similar to launch dialog - if no resource mapping, display the config
2469
					if (!"org.eclipse.ui.externaltools".equals(configuration.getType().getCategory())) { //$NON-NLS-1$
2470
						set.add(configuration.getWorkingCopy());
2471
					}
2472
				}
2473
			}
2474
		} catch (CoreException e) {
2475
			set.clear();
2476
			DebugPlugin.log(e);
2477
		}
2478
		return set;
2479
	}
2480
	
2441
	/* (non-Javadoc)
2481
	/* (non-Javadoc)
2442
	 * @see org.eclipse.debug.core.ILaunchManager#setDefaultConfiguration(org.eclipse.core.resources.IResource, org.eclipse.debug.core.ILaunchConfiguration)
2482
	 * @see org.eclipse.debug.core.ILaunchManager#setDefaultConfiguration(org.eclipse.core.resources.IResource, org.eclipse.debug.core.ILaunchConfiguration)
2443
	 */
2483
	 */
Lines 2454-2485 Link Here
2454
			}
2494
			}
2455
		}
2495
		}
2456
		
2496
		
2457
		// remove previous settings, if any
2497
		// get preference nodes
2458
		org.osgi.service.prefs.Preferences projectNode = getProjectNode(resource);
2498
		org.osgi.service.prefs.Preferences projectNode = getProjectNode(resource);
2459
		projectNode.remove(DEFAULT_CONFIGURATION);
2460
		flush(projectNode);
2461
		org.osgi.service.prefs.Preferences instanceNode = getInstanceNode(resource);
2499
		org.osgi.service.prefs.Preferences instanceNode = getInstanceNode(resource);
2462
		instanceNode.remove(DEFAULT_CONFIGURATION);
2463
		flush(instanceNode);
2464
		
2465
		if (configuration != null) {
2500
		if (configuration != null) {
2466
			org.osgi.service.prefs.Preferences node = null;
2467
			String configurationValue = null;
2468
			if (configuration.isLocal()) {
2501
			if (configuration.isLocal()) {
2469
				// for local configurations, use workspace (instance) scope preferences
2502
				// for local configurations, use workspace (instance) scope preferences
2470
				node = instanceNode;
2471
				if (!configuration.isWorkingCopy()) {
2503
				if (!configuration.isWorkingCopy()) {
2472
					configurationValue = configuration.getMemento();
2504
					instanceNode.put(DEFAULT_CONFIGURATION, configuration.getMemento());
2505
					projectNode.remove(DEFAULT_CONFIGURATION);
2473
				}
2506
				}
2507
				
2474
			} else {
2508
			} else {
2475
				// for shared configurations, use project scope preferences
2509
				// for shared configurations, use project scope preferences
2476
				node = projectNode;
2510
				projectNode.put(DEFAULT_CONFIGURATION, configuration.getFile().getProjectRelativePath().toPortableString());
2477
				configurationValue = configuration.getFile().getProjectRelativePath().toPortableString();
2511
				instanceNode.remove(DEFAULT_CONFIGURATION);
2478
			}
2512
			}
2479
			node.put(DEFAULT_CONFIGURATION, configurationValue);
2480
			flush(node);
2481
		}
2513
		}
2482
		
2514
		else {
2515
			//remove nodes because the default has been un-set
2516
			projectNode.remove(DEFAULT_CONFIGURATION);
2517
			instanceNode.remove(DEFAULT_CONFIGURATION);
2518
		}
2519
		flush(projectNode);
2520
		flush(instanceNode);
2483
	}	
2521
	}	
2484
	
2522
	
2485
	/**
2523
	/**
(-)core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java (-57 / +49 lines)
Lines 55-60 Link Here
55
	private LaunchConfiguration fOriginal;
55
	private LaunchConfiguration fOriginal;
56
	
56
	
57
	/**
57
	/**
58
	 * Handle to a parent working copy
59
	 * @since 3.3
60
	 */
61
	private LaunchConfigurationWorkingCopy fParent =  null;
62
	
63
	/**
58
	 * Working copy of attributes.
64
	 * Working copy of attributes.
59
	 */
65
	 */
60
	private LaunchConfigurationInfo fInfo;
66
	private LaunchConfigurationInfo fInfo;
Lines 87-98 Link Here
87
	private IContainer fContainer;
93
	private IContainer fContainer;
88
	
94
	
89
	/**
95
	/**
90
	 * Parent working copy.
91
	 * @since 3.3
92
	 */
93
	private LaunchConfigurationWorkingCopy fParent = null;
94
	
95
	/**
96
	 * Constructs a working copy of the specified launch 
96
	 * Constructs a working copy of the specified launch 
97
	 * configuration.
97
	 * configuration.
98
	 * 
98
	 * 
Lines 173-214 Link Here
173
	 * @see ILaunchConfigurationWorkingCopy#doSave()
173
	 * @see ILaunchConfigurationWorkingCopy#doSave()
174
	 */
174
	 */
175
	public synchronized ILaunchConfiguration doSave() throws CoreException {
175
	public synchronized ILaunchConfiguration doSave() throws CoreException {
176
		if (fParent == null) {
176
		if (getParent() != null) {
177
			if (isDirty()) {
177
			// save to parent working copy
178
				boolean useRunnable= true;
178
			LaunchConfigurationWorkingCopy wc = (LaunchConfigurationWorkingCopy) getParent();
179
				if (isLocal()) {
179
			wc.setName(getName());
180
					if (isMoved()) {
180
			wc.copyFrom(this);
181
						// If this config was moved from a shared location, saving
181
			return wc;
182
						// it will delete the original from the workspace. Use runnable.
182
		}
183
						useRunnable= !isNew() && !getOriginal().isLocal();
183
		else {
184
					} else {
184
			boolean useRunnable= true;
185
						useRunnable= false;
185
			if (isLocal()) {
186
					}
186
				if (isMoved()) {
187
				}
187
					// If this config was moved from a shared location, saving
188
	
188
					// it will delete the original from the workspace. Use runnable.
189
				if (useRunnable) {
189
					useRunnable= !isNew() && !getOriginal().isLocal();
190
					IWorkspaceRunnable wr = new IWorkspaceRunnable() {
191
						public void run(IProgressMonitor pm) throws CoreException {
192
							doSave0();
193
						}
194
					};
195
					
196
					ResourcesPlugin.getWorkspace().run(wr, null, 0, null);
197
				} else {
190
				} else {
198
					//file is persisted in the metadata not the workspace
191
					useRunnable= false;
199
					doSave0();
200
				}
192
				}
201
	
202
				getLaunchManager().setMovedFromTo(null, null);
203
			}
193
			}
204
	
194
			if (useRunnable) {
205
			return new LaunchConfiguration(getLocation());
195
				IWorkspaceRunnable wr = new IWorkspaceRunnable() {
206
		} else {
196
					public void run(IProgressMonitor pm) throws CoreException {
207
			// save to parent working copy
197
						doSave0();
208
			fParent.setName(getName());
198
					}
209
			fParent.copyFrom(this);
199
				};
210
			return fParent;
200
				
201
				ResourcesPlugin.getWorkspace().run(wr, null, 0, null);
202
			} else {
203
				//file is persisted in the metadata not the workspace
204
				doSave0();
205
			}
206
			getLaunchManager().setMovedFromTo(null, null);
211
		}
207
		}
208
		return new LaunchConfiguration(getLocation());
212
	}
209
	}
213
210
214
	
211
	
Lines 364-370 Link Here
364
	 * @see ILaunchConfigurationWorkingCopy#getOriginal()
361
	 * @see ILaunchConfigurationWorkingCopy#getOriginal()
365
	 */
362
	 */
366
	public ILaunchConfiguration getOriginal() {
363
	public ILaunchConfiguration getOriginal() {
367
		return fOriginal;
364
		ILaunchConfiguration config = fOriginal;
365
		ILaunchConfigurationWorkingCopy parent = fParent;
366
		while(parent != null) {
367
			config = parent.getOriginal();
368
			parent = parent.getParent();
369
		}
370
		return config;
371
	}
372
	
373
	/**
374
	 * @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#getParent()
375
	 */
376
	public ILaunchConfigurationWorkingCopy getParent() {
377
		return fParent;
368
	}
378
	}
369
	
379
	
370
	/**
380
	/**
Lines 670-694 Link Here
670
	 * @see org.eclipse.debug.internal.core.LaunchConfiguration#getWorkingCopy()
680
	 * @see org.eclipse.debug.internal.core.LaunchConfiguration#getWorkingCopy()
671
	 */
681
	 */
672
	public ILaunchConfigurationWorkingCopy getWorkingCopy() throws CoreException {
682
	public ILaunchConfigurationWorkingCopy getWorkingCopy() throws CoreException {
673
		if (fParent == null) {
674
			return super.getWorkingCopy();
675
		} else {
676
			return getNestedWorkingCopy();
677
		}
678
	}
679
680
	/* (non-Javadoc)
681
	 * @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#getNestedWorkingCopy()
682
	 */
683
	public ILaunchConfigurationWorkingCopy getNestedWorkingCopy() throws CoreException {
684
		return new LaunchConfigurationWorkingCopy(this);
683
		return new LaunchConfigurationWorkingCopy(this);
685
	}
684
	}
686
687
	/* (non-Javadoc)
688
	 * @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#getParent()
689
	 */
690
	public ILaunchConfigurationWorkingCopy getParent() {
691
		return fParent;
692
	}
693
}
685
}
694
686

Return to bug 74480