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 56426 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 for property page
74480LaunchConfigurationPropertyPage.txt (text/plain), 30.86 KB, created by
Curtis Windatt
on 2007-01-04 17:44:59 EST
(
hide
)
Description:
Patch for property page
Filename:
MIME Type:
Creator:
Curtis Windatt
Created:
2007-01-04 17:44:59 EST
Size:
30.86 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.debug.ui >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/properties/LaunchConfigurationsPropertiesMessages.properties >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/launchConfigurations/properties/LaunchConfigurationsPropertiesMessages.properties >diff -N ui/org/eclipse/debug/internal/ui/launchConfigurations/properties/LaunchConfigurationsPropertiesMessages.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/properties/LaunchConfigurationsPropertiesMessages.properties 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,13 @@ >+ExecutionPropertiesPage_0=&Select default launch configuration for {0}: >+ExecutionPropertiesPage_1=New launch configuration >+ExecutionPropertiesPage_2=New... >+ExecutionPropertiesPage_3=Duplicates the currently selected launch configuration >+ExecutionPropertiesPage_4=Duplicate... >+ExecutionPropertiesPage_5=Edit the currently selected launch configuration >+ExecutionPropertiesPage_6=Edit... >+ExecutionPropertiesPage_7=Delete selected launch configuration(s) >+ExecutionPropertiesPage_8=Delete... >+ExecutionPropertiesPage_11=Configuration must be located in project {0} >+ExecutionPropertiesPage_12=Selection Configuration Type >+ExecutionPropertiesPage_13=&Select the kind of configuration to create: >+ExecutionPropertiesPage_14=New Configuration >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,533 @@ >+/******************************************************************************* >+ * 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.Arrays; >+import java.util.Collections; >+import java.util.Comparator; >+import java.util.HashSet; >+import java.util.Iterator; >+import java.util.List; >+import java.util.Set; >+ >+import org.eclipse.core.resources.IResource; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IAdaptable; >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.core.ILaunchConfigurationType; >+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; >+import org.eclipse.debug.core.ILaunchManager; >+import org.eclipse.debug.internal.core.LaunchManager; >+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.IInternalDebugUIConstants; >+import org.eclipse.debug.internal.ui.SWTUtil; >+import org.eclipse.debug.ui.DebugUITools; >+import org.eclipse.debug.ui.IDebugUIConstants; >+import org.eclipse.debug.ui.ILaunchGroup; >+import org.eclipse.jface.action.Action; >+import org.eclipse.jface.action.IAction; >+import org.eclipse.jface.action.ToolBarManager; >+import org.eclipse.jface.viewers.ArrayContentProvider; >+import org.eclipse.jface.viewers.CheckStateChangedEvent; >+import org.eclipse.jface.viewers.CheckboxTableViewer; >+import org.eclipse.jface.viewers.DoubleClickEvent; >+import org.eclipse.jface.viewers.ICheckStateListener; >+import org.eclipse.jface.viewers.IDoubleClickListener; >+import org.eclipse.jface.viewers.ISelection; >+import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.jface.viewers.StructuredSelection; >+import org.eclipse.jface.window.Window; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.custom.ViewForm; >+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.swt.widgets.ToolBar; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.actions.SelectionProviderAction; >+import org.eclipse.ui.dialogs.ListDialog; >+import org.eclipse.ui.dialogs.PropertyPage; >+ >+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,IDoubleClickListener { >+ >+ private ViewForm fViewForm; >+ private CheckboxTableViewer fViewer; >+ >+ >+ /** >+ * List of configurations to be deleted >+ */ >+ private Set fDeletedConfigurations = new HashSet(); >+ >+ /** >+ * List of original default candidates for the resource >+ */ >+ private Set fOriginalCandidates; >+ >+ /* (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 topComposite = new Composite(parent, SWT.NONE); >+ topComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); >+ GridLayout layout = new GridLayout(); >+ layout.marginHeight = 0; >+ layout.marginWidth = 0; >+ topComposite.setLayout(layout); >+ >+ SWTUtil.createLabel(topComposite, MessageFormat.format(LaunchConfigurationsPropertiesMessages.ExecutionPropertiesPage_0, new String[]{getResource().getName()}), 2); >+ >+ fViewForm = new ViewForm(topComposite,SWT.BORDER | SWT.FLAT); >+ GridData formGridData = new GridData(GridData.FILL_BOTH); >+ fViewForm.setLayoutData(formGridData); >+ >+ fViewer = createViewer(fViewForm); >+ fViewForm.setContent(fViewer.getControl()); >+ >+ ToolBar toolBar = new ToolBar(fViewForm,SWT.FLAT); >+ toolBar.setBackground(parent.getBackground()); >+ ToolBarManager toolBarManager = new ToolBarManager(toolBar); >+ fViewForm.setTopLeft(toolBar); >+ createActions(toolBarManager); >+ >+ fViewer.setSelection(new StructuredSelection()); >+ applyDialogFont(topComposite); >+ return topComposite; >+ } >+ >+ /** >+ * Creates and returns the viewer that will display the possible default configurations. >+ * >+ * @param parent parent composite to create the viewer in >+ * @return viewer viewer that will display possible default configurations >+ */ >+ protected CheckboxTableViewer createViewer(Composite parent){ >+ CheckboxTableViewer viewer = CheckboxTableViewer.newCheckList(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); >+ viewer.setLabelProvider(new DefaultLabelProvider()); >+ viewer.setContentProvider(new ArrayContentProvider()); >+ viewer.setComparator(new LaunchConfigurationComparator()); >+ viewer.addCheckStateListener(this); >+ viewer.addDoubleClickListener(this); >+ // Only filter private configurations and external tools to avoid filtering a default >+ viewer.addFilter(new PrivateConfigurationFilter()); >+ viewer.addFilter(new CategoryFilter()); >+ Table builderTable= viewer.getTable(); >+ GridData tableGridData = new GridData(GridData.FILL_BOTH); >+ tableGridData.heightHint = 300; >+ builderTable.setLayoutData(tableGridData); >+ >+ IResource resource = getResource(); >+ fOriginalCandidates = getDefaultCandidates(resource); >+ viewer.setInput(fOriginalCandidates); >+ try { >+ ILaunchConfiguration configuration = DebugPlugin.getDefault().getLaunchManager().getDefaultConfiguration(resource); >+ if (configuration != null) { >+ Iterator iterator = fOriginalCandidates.iterator(); >+ while (iterator.hasNext()) { >+ ILaunchConfigurationWorkingCopy wc = (ILaunchConfigurationWorkingCopy) iterator.next(); >+ if (configuration.equals(wc.getOriginal())) { >+ viewer.setChecked(wc, true); >+ break; >+ } >+ } >+ } >+ } catch (CoreException e) { >+ setErrorMessage(e.getMessage()); >+ } >+ >+ return viewer; >+ } >+ >+ /** >+ * Creates the actions for the property page and adds them to the >+ * tool bar manager. Called by <code>createContents()</code>. >+ * >+ * @param tbm The tool bar manager for this property page >+ */ >+ protected void createActions(ToolBarManager tbm){ >+ IAction action = new Action(){ >+ public void run() { >+ handleNew(); >+ } >+ }; >+ action.setDisabledImageDescriptor(DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_NEW_CONFIG)); >+ action.setImageDescriptor(DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_NEW_CONFIG)); >+ action.setToolTipText(LaunchConfigurationsPropertiesMessages.ExecutionPropertiesPage_1); >+ action.setText(LaunchConfigurationsPropertiesMessages.ExecutionPropertiesPage_2); >+ tbm.add(action); >+ >+ action = new SelectionProviderAction(getViewer(),null){ >+ public void run() { >+ handleCopy(); >+ } >+ public void selectionChanged(IStructuredSelection selection) { >+ setEnabled(selection.size() == 1); >+ } >+ }; >+ action.setDisabledImageDescriptor(DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_DUPLICATE_CONFIG)); >+ action.setImageDescriptor(DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_DUPLICATE_CONFIG)); >+ action.setToolTipText(LaunchConfigurationsPropertiesMessages.ExecutionPropertiesPage_3); >+ action.setText(LaunchConfigurationsPropertiesMessages.ExecutionPropertiesPage_4); >+ tbm.add(action); >+ >+ action = new SelectionProviderAction(getViewer(),null){ >+ public void run() { >+ handleEdit(); >+ } >+ public void selectionChanged(IStructuredSelection selection) { >+ setEnabled(selection.size() == 1); >+ } >+ }; >+ // TODO: What icons to use >+ action.setDisabledImageDescriptor(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_MODIFICATION_WATCHPOINT_DISABLED)); >+ action.setImageDescriptor(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_MODIFICATION_WATCHPOINT)); >+ action.setToolTipText(LaunchConfigurationsPropertiesMessages.ExecutionPropertiesPage_5); >+ action.setText(LaunchConfigurationsPropertiesMessages.ExecutionPropertiesPage_6); >+ tbm.add(action); >+ >+ action = new SelectionProviderAction(getViewer(),null){ >+ public void run() { >+ handleDelete(); >+ } >+ public void selectionChanged(IStructuredSelection selection) { >+ setEnabled(selection.size() >= 1); >+ } >+ }; >+ action.setDisabledImageDescriptor(DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_DELETE_CONFIG)); >+ action.setImageDescriptor(DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_DELETE_CONFIG)); >+ action.setToolTipText(LaunchConfigurationsPropertiesMessages.ExecutionPropertiesPage_7); >+ action.setText(LaunchConfigurationsPropertiesMessages.ExecutionPropertiesPage_8); >+ tbm.add(action); >+ >+ tbm.update(true); >+ >+ } >+ >+ /** >+ * Returns the viewer displaying possible default configurations. >+ * >+ * @return viewer >+ */ >+ protected CheckboxTableViewer getViewer(){ >+ return fViewer; >+ } >+ >+ /** >+ * 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) { >+ if (event.getChecked()){ >+ ILaunchConfiguration configuration = (ILaunchConfiguration) event.getElement(); >+ changeCurrentDefault(configuration); >+ } >+ else{ >+ changeCurrentDefault(null); >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) >+ */ >+ public void doubleClick(DoubleClickEvent event) { >+ ISelection selection = event.getSelection(); >+ if (!selection.isEmpty() && selection instanceof IStructuredSelection){ >+ // Switch checked state, setting default to null if config is unchecked >+ ILaunchConfiguration configuration = (ILaunchConfiguration)((IStructuredSelection)selection).getFirstElement(); >+ changeCurrentDefault(fViewer.getChecked(configuration) ? null : configuration); >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.preference.PreferencePage#performOk() >+ */ >+ public boolean performOk() { >+ Object[] checked = fViewer.getCheckedElements(); >+ try { >+ ILaunchConfiguration def = null; >+ if (checked.length == 1) { >+ def = (ILaunchConfiguration) checked[0]; >+ def = ((ILaunchConfigurationWorkingCopy)def).doSave(); >+ } >+ DebugPlugin.getDefault().getLaunchManager().setDefaultConfiguration(getResource(), def); >+ } catch (CoreException e) { >+ setErrorMessage(e.getMessage()); >+ return false; >+ } >+ >+ Iterator deletedIter = fDeletedConfigurations.iterator(); >+ while (deletedIter.hasNext()) { >+ ILaunchConfigurationWorkingCopy currentConfig = (ILaunchConfigurationWorkingCopy) deletedIter.next(); >+ try{ >+ if (currentConfig.getOriginal() != null){ >+ currentConfig.getOriginal().delete(); >+ } >+ } catch (CoreException e) { >+ DebugPlugin.logMessage("Problem deleting configuration " + currentConfig.getName(), e); //$NON-NLS-1$ >+ } >+ } >+ >+ Iterator originalIter = fOriginalCandidates.iterator(); >+ while (originalIter.hasNext()) { >+ ILaunchConfigurationWorkingCopy currentConfig = (ILaunchConfigurationWorkingCopy) originalIter.next(); >+ if (currentConfig.isDirty()){ >+ try{ >+ currentConfig.doSave(); >+ } catch (CoreException e) { >+ DebugPlugin.logMessage("Problem saving changes to configuration " + currentConfig.getName(), e); //$NON-NLS-1$ >+ } >+ } >+ } >+ >+ return super.performOk(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.preference.PreferencePage#performDefaults() >+ */ >+ protected void performDefaults() { >+ fViewer.setAllChecked(false); >+ setErrorMessage(null); >+ setValid(true); >+ super.performDefaults(); >+ } >+ >+ /** >+ * Sets the default configuration for the working set. This setting is only applied >+ * when <code>performOK</code> is pressed. Pass <code>null</code> as an argument to >+ * clear the default. >+ * >+ * @param configuration configuration to use as default or <code>null</code> >+ */ >+ private void changeCurrentDefault(ILaunchConfiguration configuration){ >+ if (configuration != null){ >+ // only allow one check >+ fViewer.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(LaunchConfigurationsPropertiesMessages.ExecutionPropertiesPage_11, new String[]{getResource().getProject().getName()})); >+ setValid(false); >+ return; >+ } >+ } >+ } else { >+ fViewer.setCheckedElements(new Object[]{}); >+ } >+ setErrorMessage(null); >+ setValid(true); >+ } >+ >+ /** >+ * Returns a list of potential default configurations candidates for the given >+ * resource. The configurations are working copies. >+ * >+ * @param resource resource >+ * @return list of default candidates >+ */ >+ private Set getDefaultCandidates(IResource resource) { >+ IPath resourcePath = resource.getFullPath(); >+ ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); >+ Set set = new HashSet(); >+ try { >+ 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())) { >+ set.add(configuration.getWorkingCopy()); >+ break; >+ } >+ } >+ } else { >+ // 1. similar to launch dialog - if no resource mapping, display the config >+ // 2. only consider the default launch category (applications, *not* external tools) >+ if (configuration.getType().getCategory() == null) { >+ set.add(configuration.getWorkingCopy()); >+ } >+ } >+ } >+ } catch (CoreException e) { >+ set.clear(); >+ DebugUIPlugin.log(e); >+ } >+ return set; >+ } >+ >+ private Set getConfigurationNames(){ >+ Set names = new HashSet(); >+ Iterator iter = fOriginalCandidates.iterator(); >+ while (iter.hasNext()) { >+ ILaunchConfiguration currentConfiguration = (ILaunchConfiguration) iter.next(); >+ names.add(currentConfiguration.getName()); >+ } >+ return names; >+ } >+ >+ /** >+ * Returns selected configurations. >+ * >+ * @return selected configurations >+ */ >+ private ILaunchConfigurationWorkingCopy[] getSelectedConfigurations() { >+ Object[] array = ((IStructuredSelection)fViewer.getSelection()).toArray(); >+ ILaunchConfigurationWorkingCopy[] lcs = new ILaunchConfigurationWorkingCopy[array.length]; >+ System.arraycopy(array, 0, lcs, 0, array.length); >+ return lcs; >+ } >+ >+ /** >+ * Copy the selection >+ */ >+ private void handleCopy() { >+ ILaunchConfigurationWorkingCopy configuration = getSelectedConfigurations()[0]; >+ try { >+ ILaunchConfigurationWorkingCopy copy = configuration.copy( >+ ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).generateUniqueLaunchConfigurationNameFrom(configuration.getName(), getConfigurationNames())); >+ copy.setAttributes(configuration.getAttributes()); >+ fOriginalCandidates.add(copy); >+ fViewer.refresh(); >+ fViewer.setSelection(new StructuredSelection(copy)); >+ } catch (CoreException e) { >+ setErrorMessage(e.getMessage()); >+ } >+ } >+ >+ /** >+ * Delete the selection >+ */ >+ private void handleDelete() { >+ Table table = fViewer.getTable(); >+ int[] indices = table.getSelectionIndices(); >+ Arrays.sort(indices); >+ ILaunchConfiguration[] configurations = getSelectedConfigurations(); >+ for (int i = 0; i < configurations.length; i++) { >+ fDeletedConfigurations.add(configurations[i]); >+ fOriginalCandidates.remove(configurations[i]); >+ } >+ fViewer.refresh(); >+ if (indices[0] < table.getItemCount()) { >+ fViewer.setSelection(new StructuredSelection(table.getItem(indices[0]).getData())); >+ } else if (table.getItemCount() > 0) { >+ fViewer.setSelection(new StructuredSelection(table.getItem(table.getItemCount() - 1).getData())); >+ } >+ } >+ >+ /** >+ * Edit the selection >+ */ >+ private void handleEdit() { >+ edit(getSelectedConfigurations()[0]); >+ fViewer.refresh(); >+ } >+ >+ /** >+ * Edits the given configuration as a nested working copy. >+ * Returns the code from the dialog used to edit the configuration. >+ * >+ * @param configuration >+ * @return dialog return code - OK or CANCEL >+ */ >+ private int edit(ILaunchConfigurationWorkingCopy configuration) { >+ // TODO: This will result in an NPE in non-standard groups >+ ILaunchGroup group = DebugUITools.getLaunchGroup(configuration, ILaunchManager.RUN_MODE); >+ if (group == null) { >+ group = DebugUITools.getLaunchGroup(configuration, ILaunchManager.DEBUG_MODE); >+ } >+ return DebugUIPlugin.openLaunchConfigurationPropertiesDialog(getShell(), configuration, group.getIdentifier(), getConfigurationNames(), null); >+ } >+ >+ /** >+ * Create a new configuration >+ */ >+ private void handleNew() { >+ ILaunchConfigurationType[] types = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationTypes(); >+ List avail = new ArrayList(types.length); >+ for (int i = 0; i < types.length; i++) { >+ ILaunchConfigurationType type = types[i]; >+ if (type.getCategory() == null) { >+ // TODO: external tools? >+ avail.add(type); >+ } >+ } >+ Collections.sort(avail, new Comparator() { >+ public int compare(Object o1, Object o2) { >+ ILaunchConfigurationType t1 = (ILaunchConfigurationType) o1; >+ ILaunchConfigurationType t2 = (ILaunchConfigurationType) o2; >+ return t1.getName().compareTo(t2.getName()); >+ } >+ >+ }); >+ ListDialog dialog = new ListDialog(getShell()); >+ dialog.setTitle(LaunchConfigurationsPropertiesMessages.ExecutionPropertiesPage_12); >+ dialog.setContentProvider(new ArrayContentProvider()); >+ dialog.setLabelProvider(new DefaultLabelProvider()); >+ dialog.setAddCancelButton(true); >+ dialog.setMessage(LaunchConfigurationsPropertiesMessages.ExecutionPropertiesPage_13); >+ dialog.setInput(avail); >+ if (dialog.open() == Window.OK) { >+ Object[] result = dialog.getResult(); >+ if (result.length == 1) { >+ ILaunchConfigurationType type = (ILaunchConfigurationType) result[0]; >+ try { >+ ILaunchConfigurationWorkingCopy wc = type.newInstance(null, >+ ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()). >+ generateUniqueLaunchConfigurationNameFrom(LaunchConfigurationsPropertiesMessages.ExecutionPropertiesPage_14,getConfigurationNames())); >+ if (edit(wc) == Window.OK) { >+ fOriginalCandidates.add(wc); >+ fViewer.refresh(); >+ fViewer.setSelection(new StructuredSelection(wc)); >+ } >+ } catch (CoreException e) { >+ setErrorMessage(e.getMessage()); >+ } >+ } >+ } >+ } >+ >+} >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/properties/PrivateConfigurationFilter.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/launchConfigurations/properties/PrivateConfigurationFilter.java >diff -N ui/org/eclipse/debug/internal/ui/launchConfigurations/properties/PrivateConfigurationFilter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/properties/PrivateConfigurationFilter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,35 @@ >+/******************************************************************************* >+ * 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 org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.ui.DebugUITools; >+import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.jface.viewers.ViewerFilter; >+ >+/** >+ * Filters private configurations. >+ * >+ * @since 3.3 >+ */ >+public class PrivateConfigurationFilter extends ViewerFilter { >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) >+ */ >+ public boolean select(Viewer viewer, Object parentElement, Object element) { >+ if (element instanceof ILaunchConfiguration) { >+ return !DebugUITools.isPrivate((ILaunchConfiguration) element); >+ } >+ return true; >+ } >+ >+} >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/properties/CategoryFilter.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/launchConfigurations/properties/CategoryFilter.java >diff -N ui/org/eclipse/debug/internal/ui/launchConfigurations/properties/CategoryFilter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/properties/CategoryFilter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,39 @@ >+/******************************************************************************* >+ * 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 org.eclipse.core.runtime.CoreException; >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.jface.viewers.ViewerFilter; >+ >+/** >+ * Filters configurations in non-default launch categories. >+ * >+ * @since 3.3 >+ */ >+public class CategoryFilter extends ViewerFilter { >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) >+ */ >+ public boolean select(Viewer viewer, Object parentElement, Object element) { >+ if (element instanceof ILaunchConfiguration) { >+ try { >+ return ((ILaunchConfiguration)element).getType().getCategory() == null; >+ } catch (CoreException e) { >+ return false; >+ } >+ } >+ return true; >+ } >+ >+} >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/properties/LaunchConfigurationComparator.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/launchConfigurations/properties/LaunchConfigurationComparator.java >diff -N ui/org/eclipse/debug/internal/ui/launchConfigurations/properties/LaunchConfigurationComparator.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/properties/LaunchConfigurationComparator.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,78 @@ >+/******************************************************************************* >+ * 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.Collections; >+import java.util.Comparator; >+import java.util.HashMap; >+import java.util.Iterator; >+import java.util.List; >+import java.util.Map; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.core.ILaunchConfigurationType; >+import org.eclipse.ui.model.WorkbenchViewerComparator; >+ >+/** >+ * Groups configurations by type. >+ * >+ * @since 3.3 >+ */ >+public class LaunchConfigurationComparator extends WorkbenchViewerComparator { >+ >+ private static Map categories; >+ >+ public int category(Object element) { >+ Map map = getCategories(); >+ if (element instanceof ILaunchConfiguration) { >+ ILaunchConfiguration configuration = (ILaunchConfiguration) element; >+ try { >+ Integer i = (Integer) map.get(configuration.getType()); >+ if (i != null) { >+ return i.intValue(); >+ } >+ } catch (CoreException e) { >+ } >+ } >+ return map.size(); >+ } >+ >+ private Map getCategories() { >+ if (categories == null) { >+ categories = new HashMap(); >+ ILaunchConfigurationType[] lcts = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationTypes(); >+ List types = new ArrayList(lcts.length); >+ for (int i = 0; i < lcts.length; i++) { >+ types.add(lcts[i]); >+ } >+ Collections.sort(types, new Comparator() { >+ public int compare(Object o1, Object o2) { >+ ILaunchConfigurationType t1 = (ILaunchConfigurationType) o1; >+ ILaunchConfigurationType t2 = (ILaunchConfigurationType) o2; >+ return t1.getName().compareTo(t2.getName()); >+ } >+ >+ }); >+ Iterator iterator = types.iterator(); >+ int i = 0; >+ while (iterator.hasNext()) { >+ categories.put(iterator.next(), new Integer(i)); >+ i++; >+ } >+ } >+ return categories; >+ } >+ >+ >+} >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/properties/LaunchConfigurationsPropertiesMessages.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/launchConfigurations/properties/LaunchConfigurationsPropertiesMessages.java >diff -N ui/org/eclipse/debug/internal/ui/launchConfigurations/properties/LaunchConfigurationsPropertiesMessages.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/properties/LaunchConfigurationsPropertiesMessages.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,28 @@ >+package org.eclipse.debug.internal.ui.launchConfigurations.properties; >+ >+import org.eclipse.osgi.util.NLS; >+ >+public class LaunchConfigurationsPropertiesMessages extends NLS { >+ private static final String BUNDLE_NAME = "org.eclipse.debug.internal.ui.launchConfigurations.properties.LaunchConfigurationsPropertiesMessages"; //$NON-NLS-1$ >+ public static String ExecutionPropertiesPage_0; >+ public static String ExecutionPropertiesPage_1; >+ public static String ExecutionPropertiesPage_11; >+ public static String ExecutionPropertiesPage_12; >+ public static String ExecutionPropertiesPage_13; >+ public static String ExecutionPropertiesPage_14; >+ public static String ExecutionPropertiesPage_2; >+ public static String ExecutionPropertiesPage_3; >+ public static String ExecutionPropertiesPage_4; >+ public static String ExecutionPropertiesPage_5; >+ public static String ExecutionPropertiesPage_6; >+ public static String ExecutionPropertiesPage_7; >+ public static String ExecutionPropertiesPage_8; >+ static { >+ // initialize resource bundle >+ NLS.initializeMessages(BUNDLE_NAME, >+ LaunchConfigurationsPropertiesMessages.class); >+ } >+ >+ private LaunchConfigurationsPropertiesMessages() { >+ } >+}
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