Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 54442 Details for
Bug 74480
[launching] Simplify the launch experience for less technical users of Eclipse
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch
def-launch.patch (text/plain), 19.02 KB, created by
Darin Wright
on 2006-11-23 18:08:06 EST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Darin Wright
Created:
2006-11-23 18:08:06 EST
Size:
19.02 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.debug.core >Index: core/org/eclipse/debug/internal/core/LaunchManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java,v >retrieving revision 1.175 >diff -u -r1.175 LaunchManager.java >--- core/org/eclipse/debug/internal/core/LaunchManager.java 14 Nov 2006 20:07:24 -0000 1.175 >+++ core/org/eclipse/debug/internal/core/LaunchManager.java 23 Nov 2006 22:54:20 -0000 >@@ -57,6 +57,7 @@ > import org.eclipse.core.resources.IResourceDeltaVisitor; > import org.eclipse.core.resources.IResourceProxy; > import org.eclipse.core.resources.IResourceProxyVisitor; >+import org.eclipse.core.resources.ProjectScope; > import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IConfigurationElement; >@@ -65,11 +66,13 @@ > import org.eclipse.core.runtime.ISafeRunnable; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.ListenerList; >+import org.eclipse.core.runtime.Path; > import org.eclipse.core.runtime.Platform; > import org.eclipse.core.runtime.PlatformObject; > import org.eclipse.core.runtime.Preferences; > import org.eclipse.core.runtime.SafeRunner; > import org.eclipse.core.runtime.Status; >+import org.eclipse.core.runtime.preferences.InstanceScope; > import org.eclipse.core.variables.VariablesPlugin; > import org.eclipse.debug.core.DebugException; > import org.eclipse.debug.core.DebugPlugin; >@@ -77,6 +80,7 @@ > import org.eclipse.debug.core.ILaunchConfiguration; > import org.eclipse.debug.core.ILaunchConfigurationListener; > import org.eclipse.debug.core.ILaunchConfigurationType; >+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; > import org.eclipse.debug.core.ILaunchDelegate; > import org.eclipse.debug.core.ILaunchListener; > import org.eclipse.debug.core.ILaunchManager; >@@ -94,6 +98,7 @@ > import org.eclipse.debug.internal.core.sourcelookup.SourceContainerType; > import org.eclipse.debug.internal.core.sourcelookup.SourcePathComputer; > import org.eclipse.osgi.service.environment.Constants; >+import org.osgi.service.prefs.BackingStoreException; > import org.w3c.dom.Document; > import org.w3c.dom.Element; > import org.w3c.dom.Node; >@@ -116,6 +121,10 @@ > > > /** >+ * >+ */ >+ private static final String DEFAULT_CONFIGURATION = "defaultConfiguration"; >+ /** > * Constants for xml node names > * > * @since 3.3 >@@ -2312,5 +2321,101 @@ > } > } > return title; >- } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.ILaunchManager#getDefaultConfiguration(org.eclipse.core.resources.IResource) >+ */ >+ public ILaunchConfiguration getDefaultConfiguration(IResource resource) throws CoreException { >+ IProject project = resource.getProject(); >+ if (project != null) { >+ org.osgi.service.prefs.Preferences projectNode = getProjectNode(resource); >+ String configValue = projectNode.get(DEFAULT_CONFIGURATION, null); >+ if (configValue != null) { >+ // shared config >+ IFile file = project.getFile(Path.fromPortableString(configValue)); >+ return getLaunchConfiguration(file); >+ } else { >+ org.osgi.service.prefs.Preferences instanceNode = getInstanceNode(resource); >+ configValue = instanceNode.get(DEFAULT_CONFIGURATION, null); >+ if (configValue != null) { >+ // local config >+ return getLaunchConfiguration(configValue); >+ } >+ } >+ } >+ return null; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.ILaunchManager#setDefaultConfiguration(org.eclipse.core.resources.IResource, org.eclipse.debug.core.ILaunchConfiguration) >+ */ >+ public void setDefaultConfiguration(IResource resource, ILaunchConfiguration configuration) throws CoreException { >+ IProject project = resource.getProject(); >+ if (project == null) { >+ throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), >+ DebugPlugin.INTERNAL_ERROR, "Illegal argument: can only set default launch configuration on and within projects.", null)); >+ } >+ if (configuration != null && !configuration.isLocal()) { >+ if (!configuration.getFile().getProject().equals(project)) { >+ throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), >+ DebugPlugin.INTERNAL_ERROR, "A shared launch configuration must be shared in same project that it is a default configuration for.", null)); >+ } >+ } >+ >+ // remove previous settings, if any >+ org.osgi.service.prefs.Preferences projectNode = getProjectNode(resource); >+ projectNode.remove(DEFAULT_CONFIGURATION); >+ flush(projectNode); >+ org.osgi.service.prefs.Preferences instanceNode = getInstanceNode(resource); >+ instanceNode.remove(DEFAULT_CONFIGURATION); >+ flush(instanceNode); >+ >+ if (configuration != null) { >+ org.osgi.service.prefs.Preferences node = null; >+ String configurationValue = null; >+ if (configuration.isLocal()) { >+ // for local configurations, use workspace (instance) scope preferences >+ node = instanceNode; >+ if (configuration.isWorkingCopy()) { >+ configurationValue = ((ILaunchConfigurationWorkingCopy)configuration).getOriginal().getMemento(); >+ } else { >+ configurationValue = configuration.getMemento(); >+ } >+ } else { >+ // for shared configurations, use project scope preferences >+ node = projectNode; >+ configurationValue = configuration.getFile().getProjectRelativePath().toPortableString(); >+ } >+ node.put(DEFAULT_CONFIGURATION, configurationValue); >+ flush(node); >+ } >+ >+ } >+ >+ private void flush(org.osgi.service.prefs.Preferences node) { >+ try { >+ node.flush(); >+ } catch (BackingStoreException e) { >+ // TODO Auto-generated catch block >+ e.printStackTrace(); >+ } >+ } >+ >+ private org.osgi.service.prefs.Preferences getProjectNode(IResource resource) { >+ org.osgi.service.prefs.Preferences node = Platform.getPreferencesService().getRootNode(); >+ ProjectScope scope = new ProjectScope(resource.getProject()); >+ node = scope.getNode(DebugPlugin.getUniqueIdentifier()); >+ IProject project = resource.getProject(); >+ if (!resource.equals(project)) { >+ node = node.node(resource.getProjectRelativePath().toString()); >+ } >+ return node; >+ } >+ >+ private org.osgi.service.prefs.Preferences getInstanceNode(IResource resource) { >+ org.osgi.service.prefs.Preferences node = Platform.getPreferencesService().getRootNode(); >+ node = node.node(InstanceScope.SCOPE).node(DebugPlugin.getUniqueIdentifier()); >+ return node.node(resource.getFullPath().makeRelative().toString()); >+ } > } >Index: core/org/eclipse/debug/core/ILaunchManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java,v >retrieving revision 1.62 >diff -u -r1.62 ILaunchManager.java >--- core/org/eclipse/debug/core/ILaunchManager.java 19 Oct 2006 21:37:53 -0000 1.62 >+++ core/org/eclipse/debug/core/ILaunchManager.java 23 Nov 2006 22:54:20 -0000 >@@ -14,6 +14,7 @@ > import java.util.Map; > > import org.eclipse.core.resources.IFile; >+import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.debug.core.model.IDebugTarget; > import org.eclipse.debug.core.model.IPersistableSourceLocator; >@@ -459,6 +460,42 @@ > */ > public void removeLaunchListener(ILaunchListener listener); > >+ /** >+ * Sets the given launch configuration as the default configuration for the specified >+ * resource. There is only one default configuration per resource and this replaces >+ * any previously existing launch configuration for the resource, if any. Specifying >+ * a configuration of <code>null</code> clears the default configuration for the >+ * given resource. >+ * >+ * @param resource resource >+ * @param configuration launch configuration or <code>null</code> >+ * @exception CoreException if unable to set as default >+ * @since 3.3 >+ * <p> >+ * <strong>EXPERIMENTAL</strong>. This method has been added as >+ * part of a work in progress. There is no guarantee that this API will >+ * remain unchanged during the 3.3 release cycle. Please do not use this API >+ * without consulting with the Platform/Debug team. >+ * </p> >+ */ >+ public void setDefaultConfiguration(IResource resource, ILaunchConfiguration configuration) throws CoreException; >+ >+ /** >+ * Returns the default launch configuration for the specified resource, or <code>null</code> >+ * if none. >+ * >+ * @param configuration launch configuration >+ * @return launch configuration or <code>null</code> >+ * @exception CoreException if an error occurs retrieving the configuration >+ * @since 3.3 >+ * <p> >+ * <strong>EXPERIMENTAL</strong>. This method has been added as >+ * part of a work in progress. There is no guarantee that this API will >+ * remain unchanged during the 3.3 release cycle. Please do not use this API >+ * without consulting with the Platform/Debug team. >+ * </p> >+ */ >+ public ILaunchConfiguration getDefaultConfiguration(IResource resource) throws CoreException; > } > > >#P org.eclipse.debug.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/plugin.xml,v >retrieving revision 1.381 >diff -u -r1.381 plugin.xml >--- plugin.xml 17 Nov 2006 21:21:20 -0000 1.381 >+++ plugin.xml 23 Nov 2006 22:54:23 -0000 >@@ -1452,6 +1452,13 @@ > </or> > </enabledWhen> > </page> >+ <page >+ adaptable="true" >+ class="org.eclipse.debug.internal.ui.launchConfigurations.properties.ExecutionPropertiesPage" >+ id="org.eclipse.debug.ui.properties.execution" >+ name="Execution" >+ objectClass="org.eclipse.core.resources.IResource"> >+ </page> > </extension> > <!-- commands and their bindings > NOTE: >Index: ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java,v >retrieving revision 1.59 >diff -u -r1.59 IDebugHelpContextIds.java >--- ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java 26 Oct 2006 20:12:40 -0000 1.59 >+++ ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java 23 Nov 2006 22:54:23 -0000 >@@ -105,6 +105,7 @@ > // Property pages > public static final String PROCESS_PROPERTY_PAGE = PREFIX + "process_property_page_context"; //$NON-NLS-1$ > public static final String PROCESS_PAGE_RUN_AT = PREFIX + "process_page_run_at_time_widget"; //$NON-NLS-1$ >+ public static final String EXECUTION_PROPERTY_PAGE = PREFIX + "execution_property_page"; //$NON-NLS-1$ > > // Launch configuration dialog pages > public static final String LAUNCH_CONFIGURATION_DIALOG_COMMON_TAB = PREFIX + "launch_configuration_dialog_common_tab"; //$NON-NLS-1$ >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/properties/ExecutionPropertiesPage.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/launchConfigurations/properties/ExecutionPropertiesPage.java >diff -N ui/org/eclipse/debug/internal/ui/launchConfigurations/properties/ExecutionPropertiesPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/properties/ExecutionPropertiesPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,209 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.debug.internal.ui.launchConfigurations.properties; >+ >+import java.util.ArrayList; >+import java.util.List; >+ >+import org.eclipse.core.resources.IResource; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IAdaptable; >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.core.ILaunchManager; >+import org.eclipse.debug.internal.ui.DebugUIPlugin; >+import org.eclipse.debug.internal.ui.DefaultLabelProvider; >+import org.eclipse.debug.internal.ui.IDebugHelpContextIds; >+import org.eclipse.debug.internal.ui.SWTUtil; >+import org.eclipse.jface.viewers.CheckStateChangedEvent; >+import org.eclipse.jface.viewers.CheckboxTableViewer; >+import org.eclipse.jface.viewers.ICheckStateListener; >+import org.eclipse.jface.viewers.IStructuredContentProvider; >+import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Table; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.dialogs.PropertyPage; >+import org.eclipse.ui.model.WorkbenchViewerComparator; >+ >+import com.ibm.icu.text.MessageFormat; >+ >+/** >+ * Displays execution settings for a resource - associated launch configurations. >+ * >+ * @since 3.3 >+ */ >+public class ExecutionPropertiesPage extends PropertyPage implements ICheckStateListener { >+ >+ private CheckboxTableViewer viewer; >+ >+ class ContentProvider implements IStructuredContentProvider { >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) >+ */ >+ public Object[] getElements(Object inputElement) { >+ IResource resource = (IResource)inputElement; >+ IPath resourcePath = resource.getFullPath(); >+ ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); >+ try { >+ List list = new ArrayList(); >+ ILaunchConfiguration[] configurations = manager.getLaunchConfigurations(); >+ for (int i = 0; i < configurations.length; i++) { >+ ILaunchConfiguration configuration = configurations[i]; >+ IResource[] resources = configuration.getMappedResources(); >+ if (resources != null) { >+ for (int j = 0; j < resources.length; j++) { >+ IResource mappedResource = resources[j]; >+ if (resource.equals(mappedResource) || >+ resourcePath.isPrefixOf(mappedResource.getFullPath())) { >+ list.add(configuration); >+ break; >+ } >+ } >+ } >+ } >+ return list.toArray(); >+ } catch (CoreException e) { >+ DebugUIPlugin.log(e); >+ } >+ return new Object[0]; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.IContentProvider#dispose() >+ */ >+ public void dispose() { >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) >+ */ >+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >+ } >+ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) >+ */ >+ protected Control createContents(Composite parent) { >+ // TODO: add help to documentation >+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IDebugHelpContextIds.EXECUTION_PROPERTY_PAGE); >+ >+ Composite composite = new Composite(parent, SWT.NONE); >+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >+ GridLayout layout = new GridLayout(); >+ layout.marginHeight = 0; >+ layout.marginWidth = 0; >+ layout.numColumns = 2; >+ composite.setLayout(layout); >+ >+ SWTUtil.createLabel(composite, MessageFormat.format("Select default launch &configuration for {0}:", new String[]{getResource().getName()}), 2); >+ >+ viewer= CheckboxTableViewer.newCheckList(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER); >+ viewer.setLabelProvider(new DefaultLabelProvider()); >+ viewer.setContentProvider(new ContentProvider()); >+ viewer.setComparator(new WorkbenchViewerComparator()); >+ viewer.addCheckStateListener(this); >+ //TODO: launch config filters? >+ Table builderTable= viewer.getTable(); >+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL); >+ gridData.heightHint = 300; >+ builderTable.setLayoutData(gridData); >+ >+ IResource resource = getResource(); >+ viewer.setInput(resource); >+ try { >+ ILaunchConfiguration configuration = DebugPlugin.getDefault().getLaunchManager().getDefaultConfiguration(resource); >+ if (configuration != null) { >+ viewer.setChecked(configuration, true); >+ } >+ } catch (CoreException e) { >+ setErrorMessage(e.getMessage()); >+ } >+ >+ applyDialogFont(composite); >+ return composite; >+ } >+ >+ /** >+ * Returns the resource this property page is open on. >+ * >+ * @return resource >+ */ >+ protected IResource getResource() { >+ Object element = getElement(); >+ IResource resource = null; >+ if (element instanceof IResource) { >+ resource = (IResource) element; >+ } else if (element instanceof IAdaptable) { >+ resource = (IResource) ((IAdaptable)element).getAdapter(IResource.class); >+ } >+ return resource; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.ICheckStateListener#checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent) >+ */ >+ public void checkStateChanged(CheckStateChangedEvent event) { >+ ILaunchConfiguration configuration = (ILaunchConfiguration) event.getElement(); >+ // only allow one check >+ viewer.setCheckedElements(new Object[]{configuration}); >+ // validate >+ if (!configuration.isLocal()) { >+ if (!getResource().getProject().equals(configuration.getFile().getProject())) { >+ // a config must be stored in the same project that it is a default config for >+ setErrorMessage(MessageFormat.format("Configuration must be located in project {0}", new String[]{getResource().getProject().getName()})); >+ setValid(false); >+ return; >+ } >+ } >+ setErrorMessage(null); >+ setValid(true); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.preference.PreferencePage#performOk() >+ */ >+ public boolean performOk() { >+ Object[] checked = viewer.getCheckedElements(); >+ try { >+ ILaunchConfiguration def = null; >+ if (checked.length == 1) { >+ def = (ILaunchConfiguration) checked[0]; >+ } >+ DebugPlugin.getDefault().getLaunchManager().setDefaultConfiguration(getResource(), def); >+ } catch (CoreException e) { >+ setErrorMessage(e.getMessage()); >+ return false; >+ } >+ return super.performOk(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.preference.PreferencePage#performDefaults() >+ */ >+ protected void performDefaults() { >+ viewer.setAllChecked(false); >+ setErrorMessage(null); >+ setValid(true); >+ super.performDefaults(); >+ } >+ >+ >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 74480
:
53335
|
54442
|
54503
|
55420
|
56341
|
56426
|
56666
|
56675
|
56736
|
56804
|
56849
|
56854
|
57047
|
57181
|
57350
|
58480
|
58788
|
58895