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

(-)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
(-)core/org/eclipse/debug/internal/core/LaunchManager.java (-15 / +13 lines)
Lines 2454-2485 Link Here
2454
			}
2454
			}
2455
		}
2455
		}
2456
		
2456
		
2457
		// remove previous settings, if any
2457
		// get preference nodes
2458
		org.osgi.service.prefs.Preferences projectNode = getProjectNode(resource);
2458
		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);
2459
		org.osgi.service.prefs.Preferences instanceNode = getInstanceNode(resource);
2462
		instanceNode.remove(DEFAULT_CONFIGURATION);
2463
		flush(instanceNode);
2464
		
2465
		if (configuration != null) {
2460
		if (configuration != null) {
2466
			org.osgi.service.prefs.Preferences node = null;
2467
			String configurationValue = null;
2468
			if (configuration.isLocal()) {
2461
			if (configuration.isLocal()) {
2469
				// for local configurations, use workspace (instance) scope preferences
2462
				// for local configurations, use workspace (instance) scope preferences
2470
				node = instanceNode;
2471
				if (!configuration.isWorkingCopy()) {
2463
				if (!configuration.isWorkingCopy()) {
2472
					configurationValue = configuration.getMemento();
2464
					instanceNode.put(DEFAULT_CONFIGURATION, configuration.getMemento());
2465
					projectNode.remove(DEFAULT_CONFIGURATION);
2473
				}
2466
				}
2467
				
2474
			} else {
2468
			} else {
2475
				// for shared configurations, use project scope preferences
2469
				// for shared configurations, use project scope preferences
2476
				node = projectNode;
2470
				projectNode.put(DEFAULT_CONFIGURATION, configuration.getFile().getProjectRelativePath().toPortableString());
2477
				configurationValue = configuration.getFile().getProjectRelativePath().toPortableString();
2471
				instanceNode.remove(DEFAULT_CONFIGURATION);
2478
			}
2472
			}
2479
			node.put(DEFAULT_CONFIGURATION, configurationValue);
2480
			flush(node);
2481
		}
2473
		}
2482
		
2474
		else {
2475
			//remove nodes because the default has been un-set
2476
			projectNode.remove(DEFAULT_CONFIGURATION);
2477
			instanceNode.remove(DEFAULT_CONFIGURATION);
2478
		}
2479
		flush(projectNode);
2480
		flush(instanceNode);
2483
	}	
2481
	}	
2484
	
2482
	
2485
	/**
2483
	/**
(-)core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java (-52 / +31 lines)
Lines 87-98 Link Here
87
	private IContainer fContainer;
87
	private IContainer fContainer;
88
	
88
	
89
	/**
89
	/**
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 
90
	 * Constructs a working copy of the specified launch 
97
	 * configuration.
91
	 * configuration.
98
	 * 
92
	 * 
Lines 121-128 Link Here
121
		super(parent.getLocation());
115
		super(parent.getLocation());
122
		setName(parent.getName());
116
		setName(parent.getName());
123
		copyFrom(parent);
117
		copyFrom(parent);
124
		setOriginal((LaunchConfiguration) parent.getOriginal());
118
		setOriginal(parent);
125
		fParent = parent;
126
		fSuppressChange = false;
119
		fSuppressChange = false;
127
	}	
120
	}	
128
	
121
	
Lines 173-214 Link Here
173
	 * @see ILaunchConfigurationWorkingCopy#doSave()
166
	 * @see ILaunchConfigurationWorkingCopy#doSave()
174
	 */
167
	 */
175
	public synchronized ILaunchConfiguration doSave() throws CoreException {
168
	public synchronized ILaunchConfiguration doSave() throws CoreException {
176
		if (fParent == null) {
169
		if (getOriginal() instanceof ILaunchConfigurationWorkingCopy) {
177
			if (isDirty()) {
170
			// save to parent working copy
178
				boolean useRunnable= true;
171
			LaunchConfigurationWorkingCopy wc = (LaunchConfigurationWorkingCopy) getOriginal();
179
				if (isLocal()) {
172
			wc.setName(getName());
180
					if (isMoved()) {
173
			wc.copyFrom(this);
181
						// If this config was moved from a shared location, saving
174
			return wc;
182
						// it will delete the original from the workspace. Use runnable.
175
		}
183
						useRunnable= !isNew() && !getOriginal().isLocal();
176
		else {
184
					} else {
177
			boolean useRunnable= true;
185
						useRunnable= false;
178
			if (isLocal()) {
186
					}
179
				if (isMoved()) {
187
				}
180
					// If this config was moved from a shared location, saving
188
	
181
					// it will delete the original from the workspace. Use runnable.
189
				if (useRunnable) {
182
					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 {
183
				} else {
198
					//file is persisted in the metadata not the workspace
184
					useRunnable= false;
199
					doSave0();
200
				}
185
				}
201
	
202
				getLaunchManager().setMovedFromTo(null, null);
203
			}
186
			}
204
	
187
			if (useRunnable) {
205
			return new LaunchConfiguration(getLocation());
188
				IWorkspaceRunnable wr = new IWorkspaceRunnable() {
206
		} else {
189
					public void run(IProgressMonitor pm) throws CoreException {
207
			// save to parent working copy
190
						doSave0();
208
			fParent.setName(getName());
191
					}
209
			fParent.copyFrom(this);
192
				};
210
			return fParent;
193
				
194
				ResourcesPlugin.getWorkspace().run(wr, null, 0, null);
195
			} else {
196
				//file is persisted in the metadata not the workspace
197
				doSave0();
198
			}
199
			getLaunchManager().setMovedFromTo(null, null);
211
		}
200
		}
201
		return new LaunchConfiguration(getLocation());
212
	}
202
	}
213
203
214
	
204
	
Lines 670-680 Link Here
670
	 * @see org.eclipse.debug.internal.core.LaunchConfiguration#getWorkingCopy()
660
	 * @see org.eclipse.debug.internal.core.LaunchConfiguration#getWorkingCopy()
671
	 */
661
	 */
672
	public ILaunchConfigurationWorkingCopy getWorkingCopy() throws CoreException {
662
	public ILaunchConfigurationWorkingCopy getWorkingCopy() throws CoreException {
673
		if (fParent == null) {
663
		return getNestedWorkingCopy();
674
			return super.getWorkingCopy();
675
		} else {
676
			return getNestedWorkingCopy();
677
		}
678
	}
664
	}
679
665
680
	/* (non-Javadoc)
666
	/* (non-Javadoc)
Lines 683-694 Link Here
683
	public ILaunchConfigurationWorkingCopy getNestedWorkingCopy() throws CoreException {
669
	public ILaunchConfigurationWorkingCopy getNestedWorkingCopy() throws CoreException {
684
		return new LaunchConfigurationWorkingCopy(this);
670
		return new LaunchConfigurationWorkingCopy(this);
685
	}
671
	}
686
687
	/* (non-Javadoc)
688
	 * @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#getParent()
689
	 */
690
	public ILaunchConfigurationWorkingCopy getParent() {
691
		return fParent;
692
	}
693
}
672
}
694
673
(-)core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java (-14 lines)
Lines 277-294 Link Here
277
	 * </p>
277
	 * </p>
278
	 */
278
	 */
279
	public ILaunchConfigurationWorkingCopy getNestedWorkingCopy() throws CoreException;	
279
	public ILaunchConfigurationWorkingCopy getNestedWorkingCopy() throws CoreException;	
280
	
281
	/**
282
	 * 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.
284
	 * 
285
	 * @return parent or <code>null</code>
286
	 * <p>
287
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
288
	 * part of a work in progress. There is no guarantee that this API will
289
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
290
	 * without consulting with the Platform/Debug team.
291
	 * </p>
292
	 */
293
	public ILaunchConfigurationWorkingCopy getParent();
294
}
280
}
(-)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/LaunchablePropertyTester.java (-3 / +3 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 20-30 Link Here
20
 */
20
 */
21
public class LaunchablePropertyTester extends PropertyTester {
21
public class LaunchablePropertyTester extends PropertyTester {
22
22
23
	/* (non-Javadoc)
23
	/**
24
	 * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
24
	 * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
25
	 */
25
	 */
26
	public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
26
	public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
27
		if (property.equals("launchable")) { //$NON-NLS-1$
27
		if ("launchable".equals(property)) { //$NON-NLS-1$
28
			if (DebugUIPlugin.getDefault().getLaunchConfigurationManager().launchModeAvailable((String)expectedValue)) {
28
			if (DebugUIPlugin.getDefault().getLaunchConfigurationManager().launchModeAvailable((String)expectedValue)) {
29
				return Platform.getAdapterManager().hasAdapter(receiver, ILaunchable.class.getName());
29
				return Platform.getAdapterManager().hasAdapter(receiver, ILaunchable.class.getName());
30
			}
30
			}
(-)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 (-3 / +106 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.ContextualLaunchPreferencePage"
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.ContextLaunchingContributedAction"
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.contextlaunch" />
949
          	<test property="org.eclipse.debug.ui.launchable" value="debug"/>
950
          </and>
951
         </enablement>
952
       </objectContribution>
953
       <objectContribution
954
             id="org.eclipse.debug.ui.contextlaunch.profileas"
955
             objectClass="org.eclipse.core.runtime.IAdaptable">
956
          <action
957
                class="org.eclipse.debug.internal.ui.actions.ContextLaunchingContributedAction"
958
                enablesFor="1"
959
                icon="icons/full/etool16/profile_exc.gif"
960
                id="org.eclipse.debug.ui.contextlaunch.profileas"
961
                label="%ContextLaunchingProfileMenu.name"
962
                menubarPath="additions"
963
                tooltip="%ContextLaunchingProfileMenu.tooltip">
964
          </action>
965
          <enablement>
966
          <and>
967
          	<test property="org.eclipse.debug.ui.contextlaunch" />
968
          	<test property="org.eclipse.debug.ui.launchable" value="profile"/>
969
          </and>
970
         </enablement> 
971
       </objectContribution>
910
   <!-- console additions -->
972
   <!-- console additions -->
973
      <objectContribution
974
            id="org.eclipse.debug.ui.contextlaunch.runas"
975
            objectClass="org.eclipse.core.runtime.IAdaptable">
976
         <action
977
               class="org.eclipse.debug.internal.ui.actions.ContextLaunchingContributedAction"
978
               enablesFor="1"
979
               icon="icons/full/etool16/run_exc.gif"
980
               id="org.eclipse.debug.ui.contextlaunch.runas"
981
               label="%ContextLaunchingRunMenu.name"
982
               menubarPath="additions"
983
               tooltip="%ContextLaunchingRunMenu.tooltip">
984
         </action>
985
         <enablement>
986
          <and>
987
          	<test property="org.eclipse.debug.ui.contextlaunch" />
988
          	<test property="org.eclipse.debug.ui.launchable" value="run"/>
989
          </and>
990
         </enablement> 
991
      </objectContribution>
911
      <viewerContribution
992
      <viewerContribution
912
             targetID="org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu"
993
             targetID="org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu"
913
             id="org.eclipse.debug.ui.processConsoleContextMenu">
994
             id="org.eclipse.debug.ui.processConsoleContextMenu">
Lines 1394-1399 Link Here
1394
            </or>
1475
            </or>
1395
         </enabledWhen>
1476
         </enabledWhen>
1396
      </page>
1477
      </page>
1478
      <page
1479
            class="org.eclipse.debug.internal.ui.preferences.DefaultLaunchConfigurationsPropertiesPage"
1480
            id="org.eclipse.debug.ui.properties.defaultLaunchConfigurations"
1481
            name="%DefaultLaunchConfigurationsPropPage.name"
1482
            >
1483
         <enabledWhen>
1484
            <adapt
1485
                  type="org.eclipse.core.resources.IResource">
1486
            </adapt>
1487
         </enabledWhen>
1488
      </page>
1397
   </extension>
1489
   </extension>
1398
<!-- commands and their bindings
1490
<!-- commands and their bindings
1399
NOTE: 
1491
NOTE: 
Lines 2050-2055 Link Here
2050
            properties="getModelIdentifier,isTerminatedOrDisconnected"
2142
            properties="getModelIdentifier,isTerminatedOrDisconnected"
2051
            type="org.eclipse.core.runtime.IAdaptable">
2143
            type="org.eclipse.core.runtime.IAdaptable">
2052
      </propertyTester>
2144
      </propertyTester>
2145
      <propertyTester
2146
            class="org.eclipse.debug.internal.ui.preferences.ContextLaunchingPropertyTester"
2147
            id="org.eclipse.debug.ui.contextlaunching.IAdaptableTester"
2148
            namespace="org.eclipse.debug.ui"
2149
            properties="contextlaunch"
2150
            type="org.eclipse.core.runtime.IAdaptable">
2151
      </propertyTester>
2053
   </extension>
2152
   </extension>
2054
<!-- Context extensions -->
2153
<!-- Context extensions -->
2055
  <extension
2154
  <extension
Lines 2235-2240 Link Here
2235
             id="org.eclipse.debug.ui.launchDelegatesKeywords"
2334
             id="org.eclipse.debug.ui.launchDelegatesKeywords"
2236
             label="%preferenceKeywords.launchDelegates">
2335
             label="%preferenceKeywords.launchDelegates">
2237
       </keyword>
2336
       </keyword>
2337
       <keyword
2338
             id="org.eclipse.debug.ui.contextLaunching"
2339
             label="%preferenceKeywords.contextLaunching">
2340
       </keyword>
2238
    </extension>
2341
    </extension>
2239
    <extension
2342
    <extension
2240
          point="org.eclipse.ui.importWizards">
2343
          point="org.eclipse.ui.importWizards">
(-)plugin.properties (+15 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 329-334 Link Here
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
331
preferenceKeywords.launchDelegates=launch delegate duplicate run debug profile mode configuration launchers launcher modes
344
preferenceKeywords.launchDelegates=launch delegate duplicate run debug profile mode configuration launchers launcher modes
345
preferenceKeywords.contextLaunching=run debug profile launch contextual delegate configuration execute
346
332
347
333
exportBreakpoints.label=E&xport Breakpoints...
348
exportBreakpoints.label=E&xport Breakpoints...
334
importBreakpoints.label=I&mport Breakpoints...
349
importBreakpoints.label=I&mport 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/LaunchConfigurationTabGroupViewer.java (+10 lines)
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 632-637 Link Here
632
						boolean refreshtabs = !delegatesEqual(fWorkingCopy, configuration);
639
						boolean refreshtabs = !delegatesEqual(fWorkingCopy, configuration);
633
						fOriginal = configuration;
640
						fOriginal = configuration;
634
						fWorkingCopy = configuration.getWorkingCopy();
641
						fWorkingCopy = configuration.getWorkingCopy();
642
						if(fOriginal instanceof ILaunchConfigurationWorkingCopy) {
643
							fWorkingCopy.doSave();
644
						}
635
						displayInstanceTabs(refreshtabs);
645
						displayInstanceTabs(refreshtabs);
636
					} else if (fInput instanceof ILaunchConfigurationType) {
646
					} else if (fInput instanceof ILaunchConfigurationType) {
637
						fDescription = getDescription((ILaunchConfigurationType)fInput);
647
						fDescription = getDescription((ILaunchConfigurationType)fInput);
(-)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 && type.getCategory() == null && !types.contains(type)) {
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;
(-)ui/org/eclipse/debug/ui/actions/AbstractLaunchToolbarAction.java (-3 / +9 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.ContextLaunchAction;
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-62 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 ContextLaunchAction(getLaunchGroupIdentifier()), -1);
59
		addToMenu(menu, getOpenDialogAction(), -1);
61
		}
62
		else {
63
			addToMenu(menu, new LaunchShortcutsAction(getLaunchGroupIdentifier()), -1);
64
			addToMenu(menu, getOpenDialogAction(), -1);
65
		}
60
		addToMenu(menu, new OrganizeFavoritesAction(getLaunchGroupIdentifier()), -1);
66
		addToMenu(menu, new OrganizeFavoritesAction(getLaunchGroupIdentifier()), -1);
61
	}
67
	}
62
	
68
	
(-)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/DefaultLaunchConfigurationsPropertiesPage.java (+499 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.Arrays;
15
import java.util.Collections;
16
import java.util.Comparator;
17
import java.util.HashSet;
18
import java.util.Iterator;
19
import java.util.List;
20
import java.util.Set;
21
22
import org.eclipse.core.resources.IResource;
23
import org.eclipse.core.runtime.CoreException;
24
import org.eclipse.core.runtime.IAdaptable;
25
import org.eclipse.core.runtime.IPath;
26
import org.eclipse.debug.core.DebugPlugin;
27
import org.eclipse.debug.core.ILaunchConfiguration;
28
import org.eclipse.debug.core.ILaunchConfigurationType;
29
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
30
import org.eclipse.debug.core.ILaunchManager;
31
import org.eclipse.debug.internal.core.LaunchManager;
32
import org.eclipse.debug.internal.ui.DebugUIPlugin;
33
import org.eclipse.debug.internal.ui.DefaultLabelProvider;
34
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
35
import org.eclipse.debug.internal.ui.SWTUtil;
36
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationComparator;
37
import org.eclipse.debug.ui.DebugUITools;
38
import org.eclipse.debug.ui.ILaunchGroup;
39
import org.eclipse.jface.viewers.ArrayContentProvider;
40
import org.eclipse.jface.viewers.CheckStateChangedEvent;
41
import org.eclipse.jface.viewers.CheckboxTableViewer;
42
import org.eclipse.jface.viewers.ICheckStateListener;
43
import org.eclipse.jface.viewers.ISelectionChangedListener;
44
import org.eclipse.jface.viewers.IStructuredSelection;
45
import org.eclipse.jface.viewers.SelectionChangedEvent;
46
import org.eclipse.jface.viewers.StructuredSelection;
47
import org.eclipse.jface.viewers.Viewer;
48
import org.eclipse.jface.viewers.ViewerFilter;
49
import org.eclipse.jface.window.Window;
50
import org.eclipse.swt.SWT;
51
import org.eclipse.swt.events.SelectionEvent;
52
import org.eclipse.swt.events.SelectionListener;
53
import org.eclipse.swt.layout.GridData;
54
import org.eclipse.swt.layout.GridLayout;
55
import org.eclipse.swt.widgets.Button;
56
import org.eclipse.swt.widgets.Composite;
57
import org.eclipse.swt.widgets.Control;
58
import org.eclipse.swt.widgets.Table;
59
import org.eclipse.ui.PlatformUI;
60
import org.eclipse.ui.dialogs.ListDialog;
61
import org.eclipse.ui.dialogs.PropertyPage;
62
63
import com.ibm.icu.text.MessageFormat;
64
65
/**
66
 * Displays default launch configuration settings for a selected resource - associated launch configurations.
67
 * 
68
 * @see parent class {@link PropertyPage}
69
 * @see associated interface {@link ILaunchConfiguration}
70
 * @see utilized dialog {@link org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog}
71
 * @see page help context id {@link IDebugHelpContextIds#DEFAULT_LAUNCHCONFIGURATION_PROPERTY_PAGE}
72
 * 
73
 * @since 3.3
74
 */
75
public class DefaultLaunchConfigurationsPropertiesPage extends PropertyPage {
76
	
77
	/**
78
	 * Provides a viewer filter for the tree 
79
	 */
80
	class DefaultConfigFilter extends ViewerFilter {
81
82
		/* (non-Javadoc)
83
		 * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
84
		 */
85
		public boolean select(Viewer viewer, Object parentElement, Object element) {
86
			boolean select = true;
87
			if (element instanceof ILaunchConfiguration) {
88
				try {
89
					ILaunchConfiguration configuration = (ILaunchConfiguration) element;
90
					select &= configuration.getType().getCategory() == null;
91
					select &= !DebugUITools.isPrivate(configuration);
92
					if (!configuration.isLocal()) {
93
						select &= getResource().getProject().equals(configuration.getFile().getProject());
94
					}
95
				} 
96
				catch (CoreException e) {return false;}
97
			}
98
			return select;
99
		}
100
101
	}
102
	
103
	/**
104
	 * List of configurations to be deleted
105
	 */
106
	private Set fDeletedConfigurations = new HashSet();
107
	
108
	/**
109
	 * List of original default candidates for the resource
110
	 */
111
	private Set fOriginalCandidates;
112
	
113
	private Set fConfigurationTypeContext = null;
114
	
115
	//widgets
116
	private CheckboxTableViewer fViewer;
117
	private Button fNewButton = null;
118
	private Button fEditButton = null;
119
	private Button fDuplicateButton = null;
120
	private Button fDeleteButton = null;
121
122
	/* (non-Javadoc)
123
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
124
	 */
125
	protected Control createContents(Composite parent) {
126
		PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IDebugHelpContextIds.DEFAULT_LAUNCHCONFIGURATION_PROPERTY_PAGE);
127
		
128
		Composite topComposite = SWTUtil.createComposite(parent, 2, 1, GridData.FILL_BOTH);
129
		
130
		SWTUtil.createWrapLabel(topComposite, DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_0, 2, 300);
131
		SWTUtil.createVerticalSpacer(topComposite, 2);
132
		SWTUtil.createWrapLabel(topComposite, MessageFormat.format(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_1, new String[]{getResource().getName()}), 2, 300);
133
		
134
		fViewer = createViewer(topComposite);
135
		
136
		Composite buttonComp = SWTUtil.createComposite(topComposite, 1, 1, GridData.FILL_VERTICAL);
137
		GridLayout layout = (GridLayout) buttonComp.getLayout();
138
		layout.marginHeight = 0;
139
		fNewButton = SWTUtil.createPushButton(buttonComp, DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_2, null);
140
		fNewButton.setToolTipText(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_3);
141
		fNewButton.addSelectionListener(new SelectionListener() {
142
			public void widgetDefaultSelected(SelectionEvent e) {}
143
			public void widgetSelected(SelectionEvent e) {
144
				handleNew();
145
			}
146
		});
147
		
148
		fDuplicateButton = SWTUtil.createPushButton(buttonComp, DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_4, null);
149
		fDuplicateButton.setToolTipText(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_5);
150
		fDuplicateButton.setEnabled(false);
151
		fDuplicateButton.addSelectionListener(new SelectionListener() {
152
			public void widgetDefaultSelected(SelectionEvent e) {}
153
			public void widgetSelected(SelectionEvent e) {
154
				handleCopy();
155
			}
156
		});
157
		fEditButton = SWTUtil.createPushButton(buttonComp, DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_6, null);
158
		fEditButton.setToolTipText(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_7);
159
		fEditButton.setEnabled(false);
160
		fEditButton.addSelectionListener(new SelectionListener() {
161
			public void widgetDefaultSelected(SelectionEvent e) {}
162
			public void widgetSelected(SelectionEvent e) {
163
				handleEdit();
164
			}
165
		});
166
		fDeleteButton = SWTUtil.createPushButton(buttonComp, DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_8, null);
167
		fDeleteButton.setToolTipText(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_9);
168
		fDeleteButton.setEnabled(false);
169
		fDeleteButton.addSelectionListener(new SelectionListener() {
170
			public void widgetDefaultSelected(SelectionEvent e) {}
171
			public void widgetSelected(SelectionEvent e) {
172
				handleDelete();
173
			}
174
		});
175
		
176
		fViewer.setSelection(new StructuredSelection());
177
		applyDialogFont(topComposite);
178
		return topComposite;
179
	}
180
181
	/**
182
	 * Creates and returns the viewer that will display the possible default configurations.
183
	 * 
184
	 * @param parent parent composite to create the viewer in
185
	 * @return viewer viewer that will display possible default configurations
186
	 */
187
	protected CheckboxTableViewer createViewer(Composite parent){
188
		CheckboxTableViewer viewer = CheckboxTableViewer.newCheckList(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
189
		viewer.setLabelProvider(new DefaultLabelProvider());
190
		viewer.setContentProvider(new ArrayContentProvider());
191
		viewer.setComparator(new LaunchConfigurationComparator());
192
		viewer.addCheckStateListener(new ICheckStateListener() {
193
			public void checkStateChanged(CheckStateChangedEvent event) {
194
				if (event.getChecked()) {
195
					fViewer.setCheckedElements(new Object[] {event.getElement()});
196
				}
197
				else{
198
					fViewer.setCheckedElements(new Object[] {});
199
				}
200
			}
201
		});
202
		// Only filter private configurations and external tools to avoid filtering a default
203
		viewer.addFilter(new DefaultConfigFilter());
204
		Table builderTable = viewer.getTable();
205
		GridData tableGridData = new GridData(GridData.FILL_BOTH);
206
		tableGridData.heightHint = 300;
207
		builderTable.setLayoutData(tableGridData);
208
		
209
		IResource resource = getResource();
210
		fOriginalCandidates = getDefaultCandidates(resource);
211
		viewer.setInput(fOriginalCandidates);
212
		try {
213
			ILaunchConfiguration configuration = DebugPlugin.getDefault().getLaunchManager().getDefaultConfiguration(resource);
214
			if (configuration != null) {
215
				Iterator iterator = fOriginalCandidates.iterator();
216
				while (iterator.hasNext()) {
217
					ILaunchConfigurationWorkingCopy wc = (ILaunchConfigurationWorkingCopy) iterator.next();
218
					if (configuration.equals(wc.getOriginal())) {
219
						viewer.setChecked(wc, true);
220
						break;
221
					}
222
				}
223
			}
224
		} catch (CoreException e) {
225
			setErrorMessage(e.getMessage());
226
		}
227
		viewer.addSelectionChangedListener(new ISelectionChangedListener() {
228
			public void selectionChanged(SelectionChangedEvent event) {
229
				boolean empty = event.getSelection().isEmpty();
230
				fEditButton.setEnabled(!empty);
231
				fDuplicateButton.setEnabled(!empty);
232
				fDeleteButton.setEnabled(!empty);
233
			}
234
		});
235
		
236
		return viewer;
237
	}
238
239
	/**
240
	 * Returns the viewer displaying possible default configurations.
241
	 * 
242
	 * @return viewer
243
	 */
244
	protected CheckboxTableViewer getViewer(){
245
		return fViewer;
246
	}
247
		
248
	/**
249
	 * Returns the resource this property page is open on.
250
	 * 
251
	 * @return resource
252
	 */
253
	protected IResource getResource() {
254
		Object element = getElement();
255
		IResource resource = null;
256
		if (element instanceof IResource) {
257
			resource = (IResource) element;
258
		} else if (element instanceof IAdaptable) {
259
			resource = (IResource) ((IAdaptable)element).getAdapter(IResource.class);
260
		}
261
		return resource;
262
	}
263
264
	/* (non-Javadoc)
265
	 * @see org.eclipse.jface.preference.PreferencePage#performOk()
266
	 */
267
	public boolean performOk() {
268
		Object[] checked = fViewer.getCheckedElements();
269
		try {
270
			ILaunchConfiguration def = null;
271
			if (checked.length == 1) {
272
					def = (ILaunchConfiguration) checked[0];
273
					def = ((ILaunchConfigurationWorkingCopy)def).doSave();
274
			}
275
			DebugPlugin.getDefault().getLaunchManager().setDefaultConfiguration(getResource(), def);
276
		} catch (CoreException e) {
277
			setErrorMessage(e.getMessage());
278
			return false;
279
		}
280
	//delete 
281
		Iterator iter = fDeletedConfigurations.iterator();
282
		while (iter.hasNext()) {
283
			ILaunchConfigurationWorkingCopy currentConfig = (ILaunchConfigurationWorkingCopy) iter.next();
284
			try{			
285
				if (currentConfig.getOriginal() != null){
286
					currentConfig.getOriginal().delete();
287
				}
288
			} catch (CoreException e) {
289
				DebugPlugin.logMessage("Problem deleting configuration " + currentConfig.getName(), e); //$NON-NLS-1$
290
			}
291
		}
292
	//add
293
		iter = fOriginalCandidates.iterator();
294
		while (iter.hasNext()) {
295
			ILaunchConfigurationWorkingCopy currentConfig = (ILaunchConfigurationWorkingCopy) iter.next();
296
			if (currentConfig.isDirty()){
297
				try{
298
					currentConfig.doSave();
299
				} catch (CoreException e) {
300
					DebugPlugin.logMessage("Problem saving changes to configuration " + currentConfig.getName(), e); //$NON-NLS-1$
301
				}
302
			}
303
		}
304
		
305
		return super.performOk();
306
	}
307
308
	/* (non-Javadoc)
309
	 * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
310
	 */
311
	protected void performDefaults() {
312
		fViewer.setAllChecked(false);
313
		setErrorMessage(null);
314
		setValid(true);
315
		super.performDefaults();
316
	}
317
318
	/**
319
	 * Returns a list of potential default configurations candidates for the given
320
	 * resource. The configurations are working copies.
321
	 *  
322
	 * @param resource resource
323
	 * @return list of default candidates
324
	 */
325
	private Set getDefaultCandidates(IResource resource) {
326
		collectConfigurationTypeContext();
327
		IPath resourcePath = resource.getFullPath();
328
		ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
329
		Set set = new HashSet();
330
		try {
331
			ILaunchConfiguration[] configurations = manager.getLaunchConfigurations();
332
			ILaunchConfiguration configuration = null;
333
			IResource[] resources = null;
334
			for (int i = 0; i < configurations.length; i++) {
335
				configuration = configurations[i];
336
				resources = configuration.getMappedResources();
337
				if (resources != null) {
338
					for (int j = 0; j < resources.length; j++) {
339
						if (resource.equals(resources[j]) || resourcePath.isPrefixOf(resources[j].getFullPath())) {
340
							set.add(configuration.getWorkingCopy());
341
							break;
342
						}
343
					}
344
				} else {
345
					// 1. similar to launch dialog - if no resource mapping, display the config
346
					if (!"org.eclipse.ui.externaltools".equals(configuration.getType().getCategory())) { //$NON-NLS-1$
347
						set.add(configuration.getWorkingCopy());
348
						fConfigurationTypeContext.add(configuration.getType());
349
					}
350
				}
351
			}
352
		} catch (CoreException e) {
353
			set.clear();
354
			DebugUIPlugin.log(e);
355
		}
356
		return set;
357
	}
358
	
359
	/**
360
	 * Collects the default set of <code>ILaunchConfigurationType</code>s based on the mapping from launch shortcuts.
361
	 * We also must consider those types of launch configurations that do not support a resource mapping, as those types might
362
	 * apply but we can't be sure 
363
	 */
364
	private void collectConfigurationTypeContext() {
365
		if(fConfigurationTypeContext == null) {
366
			fConfigurationTypeContext = new HashSet();
367
			fConfigurationTypeContext.addAll(DebugUIPlugin.getDefault().getLaunchConfigurationManager().getApplicableConfigurationTypes(getResource()));
368
		}
369
	}
370
	
371
	/**
372
	 * Returns the names of the launch configurations passed in as original input to the tree viewer
373
	 * @return the names of the original launch configurations
374
	 */
375
	private Set getConfigurationNames() {
376
		Set names = new HashSet();
377
		Iterator iter = fOriginalCandidates.iterator();
378
		Object o = null;
379
		while (iter.hasNext()) {
380
			o = iter.next();
381
			if(o instanceof ILaunchConfiguration) {
382
				names.add(((ILaunchConfiguration)o).getName());
383
			}
384
		}
385
		return names;
386
	}
387
	
388
	/**
389
	 * Returns selected configurations.
390
	 * 
391
	 * @return selected configurations
392
	 */
393
	private ILaunchConfigurationWorkingCopy[] getSelectedConfigurations() {
394
		IStructuredSelection ss = (IStructuredSelection) fViewer.getSelection();
395
		return (ILaunchConfigurationWorkingCopy[]) ss.toList().toArray(new ILaunchConfigurationWorkingCopy[ss.size()]);
396
	}
397
398
	/**
399
	 * Copy the selection
400
	 */
401
	private void handleCopy() {
402
		ILaunchConfigurationWorkingCopy configuration = getSelectedConfigurations()[0];
403
		try {
404
			ILaunchConfigurationWorkingCopy copy = configuration.copy(
405
					((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).generateUniqueLaunchConfigurationNameFrom(configuration.getName(), getConfigurationNames()));
406
			copy.setAttributes(configuration.getAttributes());
407
			fOriginalCandidates.add(copy);
408
			fViewer.refresh();
409
			fViewer.setSelection(new StructuredSelection(copy));
410
		} catch (CoreException e) {
411
			setErrorMessage(e.getMessage());
412
		}
413
	}
414
415
	/**
416
	 * Delete the selection
417
	 */
418
	private void handleDelete() {
419
		Table table = fViewer.getTable();
420
		int[] indices = table.getSelectionIndices();
421
		Arrays.sort(indices);
422
		ILaunchConfiguration[] configurations = getSelectedConfigurations();
423
		for (int i = 0; i < configurations.length; i++) {
424
			fDeletedConfigurations.add(configurations[i]);
425
			fOriginalCandidates.remove(configurations[i]);
426
		}
427
		fViewer.refresh();
428
		if (indices[0] < table.getItemCount()) {
429
			fViewer.setSelection(new StructuredSelection(table.getItem(indices[0]).getData()));
430
		} else if (table.getItemCount() > 0) {
431
			fViewer.setSelection(new StructuredSelection(table.getItem(table.getItemCount() - 1).getData()));
432
		}
433
	}
434
435
	/**
436
	 * Edit the selection
437
	 */
438
	private void handleEdit() {
439
		edit(getSelectedConfigurations()[0]);
440
		fViewer.refresh();
441
	}
442
443
	/**
444
	 * Edits the given configuration as a nested working copy.
445
	 * Returns the code from the dialog used to edit the configuration.
446
	 * 
447
	 * @param configuration
448
	 * @return dialog return code - OK or CANCEL
449
	 */
450
	private int edit(ILaunchConfigurationWorkingCopy configuration) {
451
		// TODO: This will result in an NPE in non-standard groups
452
		ILaunchGroup group = DebugUITools.getLaunchGroup(configuration, ILaunchManager.RUN_MODE);
453
		if (group == null) {
454
			group = DebugUITools.getLaunchGroup(configuration, ILaunchManager.DEBUG_MODE);
455
		}
456
		return DebugUIPlugin.openLaunchConfigurationPropertiesDialog(getShell(), configuration, group.getIdentifier(), getConfigurationNames(), null);
457
	}
458
459
	/**
460
	 * Create a new configuration
461
	 */
462
	private void handleNew() {
463
		List avail = new ArrayList(fConfigurationTypeContext);
464
		Collections.sort(avail, new Comparator() {
465
				public int compare(Object o1, Object o2) {
466
					ILaunchConfigurationType t1 = (ILaunchConfigurationType) o1;
467
					ILaunchConfigurationType t2 = (ILaunchConfigurationType) o2;
468
					return t1.getName().compareTo(t2.getName());
469
				}
470
			
471
			});
472
		ListDialog dialog = new ListDialog(getShell());
473
		dialog.setTitle(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_11);
474
		dialog.setContentProvider(new ArrayContentProvider());
475
		dialog.setLabelProvider(new DefaultLabelProvider());
476
		dialog.setAddCancelButton(true);
477
		dialog.setMessage(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_12);
478
		dialog.setInput(avail);
479
		if (dialog.open() == Window.OK) {
480
			Object[] result = dialog.getResult();
481
			if (result.length == 1) {
482
				ILaunchConfigurationType type = (ILaunchConfigurationType) result[0];
483
				try {
484
					ILaunchConfigurationWorkingCopy wc = type.newInstance(null, 
485
							((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).
486
							generateUniqueLaunchConfigurationNameFrom("New_configuration", getConfigurationNames())); //$NON-NLS-1$
487
					if (edit(wc) == Window.OK) {
488
						fOriginalCandidates.add(wc);
489
						fViewer.refresh();
490
						fViewer.setSelection(new StructuredSelection(wc));
491
					}
492
				} catch (CoreException e) {
493
					setErrorMessage(e.getMessage());
494
				}
495
			}
496
		}
497
	}
498
	
499
}
(-)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/preferences/ContextualLaunchPreferencePage.java (+113 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 ContextualLaunchPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
36
	
37
	/**
38
	 * a list of the field editors
39
	 * @since 3.2
40
	 */
41
	private List fFieldEditors;
42
	
43
	/**
44
	 * The default constructor
45
	 */
46
	public ContextualLaunchPreferencePage() {
47
		super();
48
		setPreferenceStore(DebugUIPlugin.getDefault().getPreferenceStore());
49
	}
50
	
51
	/**
52
	 * @see org.eclipse.jface.preference.PreferencePage#createControl(org.eclipse.swt.widgets.Composite)
53
	 */
54
	public void createControl(Composite parent) {
55
		super.createControl(parent);
56
		PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDebugHelpContextIds.CONTEXTUAL_LAUNCHING_PREFERENCE_PAGE);
57
	}
58
	
59
	/**
60
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
61
	 */
62
	protected Control createContents(Composite parent) {
63
		fFieldEditors = new ArrayList();
64
		Composite comp = SWTUtil.createComposite(parent, 1, 1, GridData.FILL_BOTH);
65
		
66
		SWTUtil.createWrapLabel(comp, DebugPreferencesMessages.ContextualLaunchPreferencePage_0, 1, 300);
67
		SWTUtil.createVerticalSpacer(comp, 2);
68
		//use contextual launch
69
		FieldEditor edit = new BooleanFieldEditor(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH, DebugPreferencesMessages.ContextualLaunchPreferencePage_1, comp);	
70
		fFieldEditors.add(edit);
71
			
72
		//init the field editors
73
		initFieldEditors();
74
		return comp;
75
	}
76
	
77
	/**
78
	 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
79
	 */
80
	public void init(IWorkbench workbench) {}
81
	
82
	/**
83
	 * Initializes the field editors to their values
84
	 * @since 3.2
85
	 */
86
	private void initFieldEditors() {
87
		FieldEditor editor;
88
		for(int i = 0; i < fFieldEditors.size(); i++) {
89
			editor = (FieldEditor)fFieldEditors.get(i);
90
			editor.setPreferenceStore(getPreferenceStore());
91
			editor.load();
92
		}
93
	}
94
	
95
	/**
96
	 * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
97
	 */
98
	protected void performDefaults() {
99
		for(int i = 0; i < fFieldEditors.size(); i++) {
100
			((FieldEditor)fFieldEditors.get(i)).loadDefault();
101
		}
102
	}
103
	
104
	/**
105
	 * @see org.eclipse.jface.preference.PreferencePage#performOk()
106
	 */
107
	public boolean performOk() {
108
		for(int i = 0; i < fFieldEditors.size(); i++) {
109
			((FieldEditor)fFieldEditors.get(i)).store();
110
		}
111
		return super.performOk();
112
	}
113
}
(-)ui/org/eclipse/debug/internal/ui/actions/ContextLaunchingContributedAction.java (+56 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.jface.action.IAction;
14
import org.eclipse.jface.viewers.ISelection;
15
import org.eclipse.swt.widgets.Event;
16
import org.eclipse.ui.IActionDelegate2;
17
18
/**
19
 * A stub action
20
 * 
21
 * @since 3.3
22
 * EXPERIMENTAL
23
 */
24
public class ContextLaunchingContributedAction implements IActionDelegate2 {
25
26
	/**
27
	 * Constructor
28
	 */
29
	public ContextLaunchingContributedAction() {}
30
31
	/**
32
	 * @see org.eclipse.ui.IActionDelegate2#dispose()
33
	 */
34
	public void dispose() {}
35
36
	/**
37
	 * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
38
	 */
39
	public void init(IAction action) {}
40
41
	/**
42
	 * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event)
43
	 */
44
	public void runWithEvent(IAction action, Event event) {}
45
46
	/**
47
	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
48
	 */
49
	public void run(IAction action) {}
50
51
	/**
52
	 * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
53
	 */
54
	public void selectionChanged(IAction action, ISelection selection) {}
55
56
}
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/ContextLaunchAction.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 ContextLaunchAction extends Action implements IWorkbenchWindowActionDelegate {
27
28
	private String fId = null;
29
	
30
	/**
31
	 * Constructor
32
	 * @param id
33
	 */
34
	public ContextLaunchAction(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/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
 */

Return to bug 74480