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 74694 Details for
Bug 165371
Add 'Build' tab and functionality to program external tools
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch against org.eclipse.ant.ui and org.eclipse.ui.externaltools
programlaunch.patch (text/plain), 51.95 KB, created by
dakshinamurthy.karra
on 2007-07-26 10:43:57 EDT
(
hide
)
Description:
Patch against org.eclipse.ant.ui and org.eclipse.ui.externaltools
Filename:
MIME Type:
Creator:
dakshinamurthy.karra
Created:
2007-07-26 10:43:57 EDT
Size:
51.95 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ant.ui >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntTabGroup.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntTabGroup.java,v >retrieving revision 1.14 >diff -u -r1.14 AntTabGroup.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntTabGroup.java 23 Feb 2005 17:20:11 -0000 1.14 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntTabGroup.java 26 Jul 2007 14:38:12 -0000 >@@ -25,6 +25,7 @@ > import org.eclipse.debug.ui.ILaunchConfigurationTab; > import org.eclipse.debug.ui.RefreshTab; > import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; >+import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuildTab; > import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; > > public class AntTabGroup extends AbstractLaunchConfigurationTabGroup { >@@ -53,7 +54,7 @@ > ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] { > new AntMainTab(), > new RefreshTab(), >- new AntBuildTab(), >+ new ExternalToolsBuildTab(), > new AntTargetsTab(), > new AntClasspathTab(), > new AntPropertiesTab(), >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchConfigurationMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchConfigurationMessages.java,v >retrieving revision 1.6 >diff -u -r1.6 AntLaunchConfigurationMessages.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchConfigurationMessages.java 25 May 2005 20:20:29 -0000 1.6 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchConfigurationMessages.java 26 Jul 2007 14:38:08 -0000 >@@ -19,16 +19,6 @@ > public static String AddVariableStringAction_3; > public static String AddVariableStringAction_4; > >- public static String AntBuildTab_1; >- public static String AntBuildTab_2; >- public static String AntBuildTab_3; >- public static String AntBuildTab_4; >- public static String AntBuildTab_5; >- public static String AntBuildTab_6; >- public static String AntBuildTab_7; >- public static String AntBuildTab_8; >- public static String AntBuildTab_9; >- > public static String AntLaunchDelegate_Launching__0__1; > public static String AntLaunchDelegate_Running__0__2; > public static String AntLaunchDelegate_Build_In_Progress; >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchConfigurationMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchConfigurationMessages.properties,v >retrieving revision 1.42 >diff -u -r1.42 AntLaunchConfigurationMessages.properties >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchConfigurationMessages.properties 23 Mar 2006 19:11:48 -0000 1.42 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchConfigurationMessages.properties 26 Jul 2007 14:38:08 -0000 >@@ -14,16 +14,6 @@ > AddVariableStringAction_3=&Variables... > AddVariableStringAction_4=Add Variable Classpath Entry > >-AntBuildTab_1=&Build before launch >-AntBuildTab_2=The &entire workspace >-AntBuildTab_3=The &project containing the selected resource >-AntBuildTab_4=&Specific projects >-AntBuildTab_5=P&rojects... >-AntBuildTab_6=Include referenced pro&jects >-AntBuildTab_7=Select &Projects: >-AntBuildTab_8=Build >-AntBuildTab_9=No projects specified >- > AntLaunchDelegate_Launching__0__1=Launching {0} > AntLaunchDelegate_Running__0__2=Running {0} > AntLaunchDelegate_Build_In_Progress=Ant build {0} already in progress. Concurrent Ant builds are possible if you specify to build in a separate JRE. >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntBuildTab.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntBuildTab.java,v >retrieving revision 1.11 >diff -u -r1.11 AntBuildTab.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntBuildTab.java 11 Aug 2005 16:30:00 -0000 1.11 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntBuildTab.java 26 Jul 2007 14:38:08 -0000 >@@ -11,38 +11,8 @@ > package org.eclipse.ant.internal.ui.launchConfigurations; > > >-import java.util.ArrayList; >-import java.util.Iterator; >-import java.util.List; >-import org.eclipse.ant.internal.ui.AntUIImages; > import org.eclipse.ant.internal.ui.AntUIPlugin; >-import org.eclipse.ant.internal.ui.IAntUIConstants; >-import org.eclipse.ant.internal.ui.IAntUIHelpContextIds; >-import org.eclipse.core.resources.IProject; >-import org.eclipse.core.resources.IResource; >-import org.eclipse.core.resources.IWorkspace; >-import org.eclipse.core.resources.IWorkspaceRoot; >-import org.eclipse.core.resources.ResourcesPlugin; >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.debug.core.ILaunchConfiguration; >-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; >-import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; >-import org.eclipse.debug.ui.DebugUITools; >-import org.eclipse.jface.viewers.IStructuredContentProvider; >-import org.eclipse.jface.viewers.Viewer; >-import org.eclipse.jface.window.Window; >-import org.eclipse.swt.SWT; >-import org.eclipse.swt.events.SelectionAdapter; >-import org.eclipse.swt.events.SelectionEvent; >-import org.eclipse.swt.graphics.Image; >-import org.eclipse.swt.layout.GridData; >-import org.eclipse.swt.layout.GridLayout; >-import org.eclipse.swt.widgets.Button; >-import org.eclipse.swt.widgets.Composite; >-import org.eclipse.swt.widgets.Group; >-import org.eclipse.ui.PlatformUI; >-import org.eclipse.ui.dialogs.ListSelectionDialog; >-import org.eclipse.ui.model.WorkbenchLabelProvider; >+import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuildTab; > > /** > * A launch configuration tab which allows the user to specify >@@ -53,7 +23,7 @@ > * </p> > * @since 3.0 > */ >-public class AntBuildTab extends AbstractLaunchConfigurationTab { >+public class AntBuildTab extends ExternalToolsBuildTab { > > /** > * String attribute identifying the build scope for this launch configuration. >@@ -68,360 +38,17 @@ > */ > public static final String ATTR_INCLUDE_REFERENCED_PROJECTS = AntUIPlugin.getUniqueIdentifier() + ".ATTR_INCLUDE_REFERENCED_PROJECTS"; //$NON-NLS-1$ > >- // Check Buttons >- private Button fBuildButton; >- >- // Group box >- private Group fGroup; >- >- // Radio Buttons >- private Button fProjectButton; >- private Button fSpecificProjectsButton; >- private Button fWorkspaceButton; >- >- // Push Button >- private Button fSelectButton; >- >- // whether to include referenced projects >- private Button fReferencedProjects; >- >- // projects to build (empty if none) >- private List fProjects = new ArrayList(); >- >- class ProjectsContentProvider implements IStructuredContentProvider { >- >- /* (non-Javadoc) >- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) >- */ >- public Object[] getElements(Object inputElement) { >- return ((IWorkspace)inputElement).getRoot().getProjects(); >- } >- >- /* (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) { >- } >- >- } >- /** >- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite) >- */ >- public void createControl(Composite parent) { >- Composite mainComposite = new Composite(parent, SWT.NONE); >- setControl(mainComposite); >- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IAntUIHelpContextIds.ANT_BUILD_TAB); >- >- GridLayout layout = new GridLayout(); >- GridData gd = new GridData(GridData.FILL_HORIZONTAL); >- mainComposite.setLayout(layout); >- mainComposite.setLayoutData(gd); >- mainComposite.setFont(parent.getFont()); >- >- fBuildButton = createCheckButton(mainComposite, AntLaunchConfigurationMessages.AntBuildTab_1); >- fBuildButton.addSelectionListener(new SelectionAdapter() { >- public void widgetSelected(SelectionEvent e) { >- updateEnabledState(); >- updateLaunchConfigurationDialog(); >- } >- }); >- >- fGroup = new Group(mainComposite, SWT.NONE); >- fGroup.setFont(mainComposite.getFont()); >- layout = new GridLayout(); >- layout.numColumns = 2; >- layout.makeColumnsEqualWidth = false; >- fGroup.setLayout(layout); >- gd = new GridData(GridData.FILL_HORIZONTAL); >- gd.horizontalSpan = 2; >- fGroup.setLayoutData(gd); >- >- SelectionAdapter adapter = new SelectionAdapter() { >- public void widgetSelected(SelectionEvent e) { >- if (((Button)e.getSource()).getSelection()) { >- updateEnabledState(); >- updateLaunchConfigurationDialog(); >- } >- } >- }; >- >- fWorkspaceButton = createRadioButton(fGroup, AntLaunchConfigurationMessages.AntBuildTab_2); >- gd = new GridData(GridData.FILL_HORIZONTAL); >- gd.horizontalSpan = 2; >- fWorkspaceButton.setLayoutData(gd); >- fWorkspaceButton.addSelectionListener(adapter); >- >- fProjectButton = createRadioButton(fGroup, AntLaunchConfigurationMessages.AntBuildTab_3); >- gd = new GridData(GridData.FILL_HORIZONTAL); >- gd.horizontalSpan = 2; >- fProjectButton.setLayoutData(gd); >- fProjectButton.addSelectionListener(adapter); >- >- fSpecificProjectsButton = createRadioButton(fGroup, AntLaunchConfigurationMessages.AntBuildTab_4); >- gd = new GridData(GridData.FILL_HORIZONTAL); >- gd.horizontalSpan = 1; >- fSpecificProjectsButton.setLayoutData(gd); >- fSpecificProjectsButton.addSelectionListener(adapter); >- >- fSelectButton = createPushButton(fGroup, AntLaunchConfigurationMessages.AntBuildTab_5, null); >- gd = (GridData)fSelectButton.getLayoutData(); >- gd.horizontalAlignment = GridData.HORIZONTAL_ALIGN_END; >- fSelectButton.addSelectionListener(new SelectionAdapter() { >- public void widgetSelected(SelectionEvent e) { >- selectResources(); >- } >- }); >- >- createVerticalSpacer(mainComposite, 1); >- fReferencedProjects = createCheckButton(mainComposite, AntLaunchConfigurationMessages.AntBuildTab_6); >- } >- >- /** >- * Prompts the user to select the projects to build. >- */ >- private void selectResources() { >- ListSelectionDialog dialog = new ListSelectionDialog(getShell(), ResourcesPlugin.getWorkspace(), new ProjectsContentProvider(), new WorkbenchLabelProvider(), AntLaunchConfigurationMessages.AntBuildTab_7); >- dialog.setInitialElementSelections(fProjects); >- if (dialog.open() == Window.CANCEL) { >- return; >- } >- Object[] res = dialog.getResult(); >- fProjects = new ArrayList(res.length); >- for (int i = 0; i < res.length; i++) { >- fProjects.add(res[i]); >- } >- updateLaunchConfigurationDialog(); >- } >- >- /** >- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) >- */ >- public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { >- } >- >- /** >- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration) >- */ >- public void initializeFrom(ILaunchConfiguration configuration) { >- updateScope(configuration); >- updateReferencedProjects(configuration); >- updateEnabledState(); >- } >- >- private void updateReferencedProjects(ILaunchConfiguration configuration) { >- boolean ref = false; >- try { >- ref = configuration.getAttribute(ATTR_INCLUDE_REFERENCED_PROJECTS, true); >- } catch (CoreException e) { >- AntUIPlugin.log(AntUIPlugin.newErrorStatus("Exception reading launch configuration", e)); //$NON-NLS-1$ >- } >- fReferencedProjects.setSelection(ref); >- } >- >- /** >- * Updates the tab to display the build scope specified by the launch config >- */ >- private void updateScope(ILaunchConfiguration configuration) { >- String scope = null; >- try { >- scope= configuration.getAttribute(ATTR_BUILD_SCOPE, (String)null); >- } catch (CoreException ce) { >- AntUIPlugin.log(AntUIPlugin.newErrorStatus("Exception reading launch configuration", ce)); //$NON-NLS-1$ >- } >- fBuildButton.setSelection(scope != null); >- fWorkspaceButton.setSelection(false); >- fProjectButton.setSelection(false); >- fSpecificProjectsButton.setSelection(false); >- fProjects.clear(); >- if (scope == null) { >- // select the workspace by default >- fBuildButton.setSelection(true); >- fWorkspaceButton.setSelection(true); >- } else { >- if (scope.equals("${none}")) { //$NON-NLS-1$ >- fBuildButton.setSelection(false); >- } else if (scope.equals("${project}")) { //$NON-NLS-1$ >- fProjectButton.setSelection(true); >- } else if (scope.startsWith("${projects:")) { //$NON-NLS-1$ >- fSpecificProjectsButton.setSelection(true); >- IProject[] projects = getBuildProjects(scope); >- fProjects = new ArrayList(projects.length); >- for (int i = 0; i < projects.length; i++) { >- fProjects.add(projects[i]); >- } >- } >- } >- } >- /** >- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) >- */ >- public void performApply(ILaunchConfigurationWorkingCopy configuration) { >- String scope = generateScopeMemento(); >- configuration.setAttribute(ATTR_BUILD_SCOPE, scope); >- if (fReferencedProjects.getSelection()) { >- // default is true >- configuration.setAttribute(ATTR_INCLUDE_REFERENCED_PROJECTS, (String)null); >- } else { >- configuration.setAttribute(ATTR_INCLUDE_REFERENCED_PROJECTS, false); >- } >- } >- >- /** >- * Generates a memento for the build scope. >- */ >- private String generateScopeMemento() { >- if (fBuildButton.getSelection()) { >- if (fWorkspaceButton.getSelection()) { >- return null; >- } >- if (fProjectButton.getSelection()) { >- return "${project}"; //$NON-NLS-1$ >- } >- if (fSpecificProjectsButton.getSelection()) { >- return getBuildScopeAttribute(fProjects); >- } >- return null; >- >- } >- return "${none}"; //$NON-NLS-1$ >- } >- >- /** >- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName() >- */ >- public String getName() { >- return AntLaunchConfigurationMessages.AntBuildTab_8; >- } >- >- /** >- * Updates the enablement state of the fields. >- */ >- private void updateEnabledState() { >- boolean enabled= fBuildButton.getSelection(); >- fGroup.setEnabled(enabled); >- fWorkspaceButton.setEnabled(enabled); >- fProjectButton.setEnabled(enabled); >- fSpecificProjectsButton.setEnabled(enabled); >- fSelectButton.setEnabled(enabled && fSpecificProjectsButton.getSelection()); >- if (!enabled) { >- super.setErrorMessage(null); >- } >- if (enabled) { >- if (!fWorkspaceButton.getSelection() && !fProjectButton.getSelection() && >- !fSpecificProjectsButton.getSelection()) { >- fWorkspaceButton.setSelection(true); >- } >- } >- fReferencedProjects.setEnabled(fBuildButton.getSelection() && (fProjectButton.getSelection() || fSpecificProjectsButton.getSelection())); >- } >- >- /** >- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage() >- */ >- public Image getImage() { >- return AntUIImages.getImage(IAntUIConstants.IMG_ANT_BUILD_TAB); >- } >- >- public boolean isValid(ILaunchConfiguration launchConfig) { >- setErrorMessage(null); >- setMessage(null); >- if (fBuildButton.getSelection() && fSpecificProjectsButton.getSelection() && fProjects.isEmpty()) { >- setErrorMessage(AntLaunchConfigurationMessages.AntBuildTab_9); >- return false; >- } >- return true; >- } >- >- /** >- * Returns a collection of projects referenced by a build scope attribute. >- * >- * @param scope build scope attribute (<code>ATTR_BUILD_SCOPE</code>) >- * @return collection of porjects referred to by the scope attribute >- */ >- public static IProject[] getBuildProjects(String scope) { >- if (scope.startsWith("${projects:")) { //$NON-NLS-1$ >- String pathString = scope.substring(11, scope.length() - 1); >- if (pathString.length() > 1) { >- String[] names = pathString.split(","); //$NON-NLS-1$ >- IProject[] projects = new IProject[names.length]; >- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); >- for (int i = 0; i < names.length; i++) { >- projects[i] = root.getProject(names[i]); >- } >- return projects; >- } >- } else if (scope.equals("${project}")) { //$NON-NLS-1$ >- IResource resource = DebugUITools.getSelectedResource(); >- if (resource != null) { >- return new IProject[]{resource.getProject()}; >- } >- } >- return new IProject[0]; >- } >- >- /** >- * Returns the build scope attribute specified by the given launch configuration >- * or <code>null</code> if none. >- * >- * @param configuration launch configuration >- * @return build scope attribute (<code>ATTR_BUILD_SCOPE</code>) >- * @throws CoreException if unable to access the associated attribute >- */ >- public static String getBuildScope(ILaunchConfiguration configuration) throws CoreException { >- return configuration.getAttribute(ATTR_BUILD_SCOPE, (String) null); >- } >- >- /** >- * Whether referenced projects should be considered when building. Only valid >- * when a set of projects is to be built. >- * >- * @param configuration >- * @return whether referenced projects should be considerd when building >- * @throws CoreException if unable to access the associated attribute >- */ >- public static boolean isIncludeReferencedProjects(ILaunchConfiguration configuration) throws CoreException { >- return configuration.getAttribute(ATTR_INCLUDE_REFERENCED_PROJECTS, true); >- } >- >- /** >- * Creates and returns a memento for the given project set, to be used as a >- * build scope attribute. >- * >- * @param projects list of projects >- * @return an equivalent refresh attribute >- */ >- public static String getBuildScopeAttribute(List projects) { >- StringBuffer buf = new StringBuffer(); >- buf.append("${projects:"); //$NON-NLS-1$ >- Iterator iterator = projects.iterator(); >- while (iterator.hasNext()) { >- IProject project = (IProject) iterator.next(); >- buf.append(project.getName()); >- if (iterator.hasNext()) { >- buf.append(","); //$NON-NLS-1$ >- } >- } >- buf.append("}"); //$NON-NLS-1$ >- return buf.toString(); >- } >- > /* (non-Javadoc) >- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) >+ * @see org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuildTab#getAttrIncludeReferencedProjectsId() > */ >- public void activated(ILaunchConfigurationWorkingCopy workingCopy) { >- // do nothing on activation >+ protected String getAttrIncludeReferencedProjectsId() { >+ return ATTR_INCLUDE_REFERENCED_PROJECTS ; > } >- >+ > /* (non-Javadoc) >- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) >+ * @see org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuildTab#getAttrBuildScopeId() > */ >- public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) { >- // do nothing on deactivation >+ protected String getAttrBuildScopeId() { >+ return ATTR_BUILD_SCOPE ; > } > } >Index: Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchDelegate.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchDelegate.java,v >retrieving revision 1.79 >diff -u -r1.79 AntLaunchDelegate.java >--- Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchDelegate.java 4 May 2007 12:28:55 -0000 1.79 >+++ Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchDelegate.java 26 Jul 2007 14:38:11 -0000 >@@ -66,6 +66,7 @@ > import org.eclipse.jface.dialogs.MessageDialogWithToggle; > import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.osgi.service.resolver.BundleDescription; >+import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuildTab; > import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsUtil; > import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; > import org.eclipse.ui.externaltools.internal.program.launchConfigurations.BackgroundResourceRefresher; >@@ -668,17 +669,10 @@ > * @see org.eclipse.debug.core.model.LaunchConfigurationDelegate#getBuildOrder(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String) > */ > protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException { >- String scope = null; >- try { >- scope = configuration.getAttribute(AntBuildTab.ATTR_BUILD_SCOPE, (String)null); >- } catch (CoreException e) { >- return null; >- } >- if (scope == null) { >- return null; >- } >- IProject[] projects = AntBuildTab.getBuildProjects(scope); >- boolean isRef = AntBuildTab.isIncludeReferencedProjects(configuration); >+ IProject[] projects = ExternalToolsBuildTab.getBuildProjects(configuration, AntBuildTab.ATTR_BUILD_SCOPE); >+ if (projects == null) >+ return null ; >+ boolean isRef = ExternalToolsBuildTab.isIncludeReferencedProjects(configuration, AntBuildTab.ATTR_INCLUDE_REFERENCED_PROJECTS); > if (isRef) { > return computeReferencedBuildOrder(projects); > } >#P org.eclipse.ui.externaltools >Index: External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java,v >retrieving revision 1.46 >diff -u -r1.46 ExternalToolsUtil.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java 18 Apr 2006 16:04:56 -0000 1.46 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java 26 Jul 2007 14:38:19 -0000 >@@ -172,7 +172,7 @@ > * @throws CoreException if an exception occurs while retrieving the resources > */ > public static IResource[] getResourcesForBuildScope(ILaunchConfiguration configuration) throws CoreException { >- String scope = configuration.getAttribute(IExternalToolConstants.ATTR_BUILD_SCOPE, (String) null); >+ String scope = configuration.getAttribute(IExternalToolConstants.ATTR_BUILDER_SCOPE, (String) null); > if (scope == null) { > return null; > } >Index: External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java,v >retrieving revision 1.46 >diff -u -r1.46 ExternalToolsBuilderTab.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java 16 Apr 2007 23:42:11 -0000 1.46 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java 26 Jul 2007 14:38:16 -0000 >@@ -316,7 +316,7 @@ > String buildScope= null; > try { > buildKindString= configuration.getAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, ""); //$NON-NLS-1$ >- buildScope= configuration.getAttribute(IExternalToolConstants.ATTR_BUILD_SCOPE, (String)null); >+ buildScope= configuration.getAttribute(IExternalToolConstants.ATTR_BUILDER_SCOPE, (String)null); > } catch (CoreException e) { > } > >@@ -426,9 +426,9 @@ > } > if (workingSetButton.getSelection()) { > String scope = RefreshTab.getRefreshAttribute(workingSet); >- configuration.setAttribute(IExternalToolConstants.ATTR_BUILD_SCOPE, scope); >+ configuration.setAttribute(IExternalToolConstants.ATTR_BUILDER_SCOPE, scope); > } else { >- configuration.setAttribute(IExternalToolConstants.ATTR_BUILD_SCOPE, (String)null); >+ configuration.setAttribute(IExternalToolConstants.ATTR_BUILDER_SCOPE, (String)null); > } > configuration.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, fLaunchInBackgroundButton.getSelection()); > >Index: External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java,v >retrieving revision 1.7 >diff -u -r1.7 ExternalToolsLaunchConfigurationMessages.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java 18 Jan 2006 22:04:04 -0000 1.7 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java 26 Jul 2007 14:38:16 -0000 >@@ -37,6 +37,17 @@ > public static String ExternalToolsMainTab_31; > public static String ExternalToolsMainTab_32; > >+ public static String ExternalToolsBuildTab_1; >+ public static String ExternalToolsBuildTab_2; >+ public static String ExternalToolsBuildTab_3; >+ public static String ExternalToolsBuildTab_4; >+ public static String ExternalToolsBuildTab_5; >+ public static String ExternalToolsBuildTab_6; >+ public static String ExternalToolsBuildTab_7; >+ public static String ExternalToolsBuildTab_8; >+ public static String ExternalToolsBuildTab_9; >+ >+ > public static String ExternalToolsUtil_Location_not_specified_by__0__1; > public static String ExternalToolsUtil_invalidLocation__0_; > public static String ExternalToolsUtil_invalidDirectory__0_; >Index: External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties,v >retrieving revision 1.36 >diff -u -r1.36 ExternalToolsLaunchConfigurationMessages.properties >--- External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties 18 Jan 2006 22:04:04 -0000 1.36 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties 26 Jul 2007 14:38:16 -0000 >@@ -32,6 +32,16 @@ > ExternalToolsMainTab_31=Var&iables... > ExternalToolsMainTab_32=Varia&bles... > >+ExternalToolsBuildTab_1=&Build before launch >+ExternalToolsBuildTab_2=The &entire workspace >+ExternalToolsBuildTab_3=The &project containing the selected resource >+ExternalToolsBuildTab_4=&Specific projects >+ExternalToolsBuildTab_5=P&rojects... >+ExternalToolsBuildTab_6=Include referenced pro&jects >+ExternalToolsBuildTab_7=Select &Projects: >+ExternalToolsBuildTab_8=Build >+ExternalToolsBuildTab_9=No projects specified >+ > ExternalToolsUtil_Location_not_specified_by__0__1=Location not specified by {0} > ExternalToolsUtil_invalidLocation__0_ = The file does not exist for the external tool named {0}. > ExternalToolsUtil_invalidDirectory__0_ = The working directory {0} does not exist for the external tool named {1}. >Index: Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramTabGroup.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramTabGroup.java,v >retrieving revision 1.14 >diff -u -r1.14 ProgramTabGroup.java >--- Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramTabGroup.java 23 Feb 2005 16:02:16 -0000 1.14 >+++ Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramTabGroup.java 26 Jul 2007 14:38:22 -0000 >@@ -16,6 +16,7 @@ > import org.eclipse.debug.ui.ILaunchConfigurationDialog; > import org.eclipse.debug.ui.ILaunchConfigurationTab; > import org.eclipse.debug.ui.RefreshTab; >+import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuildTab; > > public class ProgramTabGroup extends AbstractLaunchConfigurationTabGroup { > >@@ -26,6 +27,7 @@ > ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] { > new ProgramMainTab(), > new RefreshTab(), >+ new ExternalToolsBuildTab(), > new EnvironmentTab(), > new CommonTab() > }; >Index: Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramLaunchDelegate.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramLaunchDelegate.java,v >retrieving revision 1.37 >diff -u -r1.37 ProgramLaunchDelegate.java >--- Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramLaunchDelegate.java 21 Jul 2006 22:28:42 -0000 1.37 >+++ Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramLaunchDelegate.java 26 Jul 2007 14:38:20 -0000 >@@ -16,6 +16,7 @@ > import java.util.HashMap; > import java.util.Map; > >+import org.eclipse.core.resources.IProject; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.IProgressMonitor; >@@ -35,6 +36,7 @@ > import org.eclipse.ui.IWindowListener; > import org.eclipse.ui.IWorkbenchWindow; > import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuildTab; > import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsUtil; > import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; > >@@ -165,11 +167,11 @@ > if (p != null) { > monitor.beginTask(NLS.bind(ExternalToolsProgramMessages.ProgramLaunchDelegate_3, new String[] {configuration.getName()}), IProgressMonitor.UNKNOWN); > process = DebugPlugin.newProcess(launch, p, location.toOSString(), processAttributes); >- if (process == null) { >+ } >+ if (p == null || process == null) { >+ if (p != null) > p.destroy(); >- throw new CoreException(new Status(IStatus.ERROR, IExternalToolConstants.PLUGIN_ID, IExternalToolConstants.ERR_INTERNAL_ERROR, ExternalToolsProgramMessages.ProgramLaunchDelegate_4, null)); >- } >- >+ throw new CoreException(new Status(IStatus.ERROR, IExternalToolConstants.PLUGIN_ID, IExternalToolConstants.ERR_INTERNAL_ERROR, ExternalToolsProgramMessages.ProgramLaunchDelegate_4, null)); > } > process.setAttribute(IProcess.ATTR_CMDLINE, generateCommandLine(cmdLine)); > >@@ -226,4 +228,17 @@ > return buf.toString(); > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.LaunchConfigurationDelegate#getBuildOrder(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String) >+ */ >+ protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException { >+ IProject[] projects = ExternalToolsBuildTab.getBuildProjects(configuration, null); >+ if (projects == null) >+ return null ; >+ boolean isRef = ExternalToolsBuildTab.isIncludeReferencedProjects(configuration, null); >+ if (isRef) { >+ return computeReferencedBuildOrder(projects); >+ } >+ return computeBuildOrder(projects); >+ } > } >Index: External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java,v >retrieving revision 1.35 >diff -u -r1.35 ExternalToolsImages.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java 12 Apr 2005 16:37:23 -0000 1.35 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java 26 Jul 2007 14:38:20 -0000 >@@ -51,6 +51,7 @@ > private static void declareImages() { > // Objects > declareRegistryImage(IExternalToolConstants.IMG_TAB_MAIN, OBJECT + "main_tab.gif"); //$NON-NLS-1$ >+ declareRegistryImage(IExternalToolConstants.IMG_TAB_BUILD, OBJECT + "build_tab.gif"); //$NON-NLS-1$ > } > > /** >Index: External Tools Base/org/eclipse/ui/externaltools/internal/model/IExternalToolsHelpContextIds.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/IExternalToolsHelpContextIds.java,v >retrieving revision 1.19 >diff -u -r1.19 IExternalToolsHelpContextIds.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/model/IExternalToolsHelpContextIds.java 23 Feb 2005 16:02:16 -0000 1.19 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/model/IExternalToolsHelpContextIds.java 26 Jul 2007 14:38:20 -0000 >@@ -34,4 +34,5 @@ > //Launch configuration dialog tabs > public static final String EXTERNAL_TOOLS_LAUNCH_CONFIGURATION_DIALOG_BUILDER_TAB = PREFIX + "builders_tab_context"; //$NON-NLS-1$ > public static final String EXTERNAL_TOOLS_LAUNCH_CONFIGURATION_DIALOG_PROGRAM_MAIN_TAB = PREFIX + "program_main_tab_context"; //$NON-NLS-1$ >+ public static final String EXTERNAL_TOOLS_LAUNCH_CONFIGURATION_DIALOG_BUILD_TAB = PREFIX + "build_tab_context"; //$NON-NLS-1$ > } >Index: External Tools Base/org/eclipse/ui/externaltools/internal/model/IExternalToolConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/IExternalToolConstants.java,v >retrieving revision 1.23 >diff -u -r1.23 IExternalToolConstants.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/model/IExternalToolConstants.java 23 Feb 2005 16:00:19 -0000 1.23 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/model/IExternalToolConstants.java 26 Jul 2007 14:38:20 -0000 >@@ -93,7 +93,12 @@ > * Main tab image. > */ > public static final String IMG_TAB_MAIN = PLUGIN_ID + ".IMG_TAB_MAIN"; //$NON-NLS-1$ >- >+ >+ /** >+ * Build tab image >+ */ >+ public static final String IMG_TAB_BUILD = PLUGIN_ID + ".IMG_TAB_BUILD"; //$NON-NLS-1$ >+ > // ------- Launch configuration types -------- > /** > * Program launch configuration type identifier. >@@ -158,9 +163,8 @@ > * external tool to run. Default value is <code>null</code> > * indicating that the builder will be triggered for all changes. > */ >- public static final String ATTR_BUILD_SCOPE = PLUGIN_ID + ".ATTR_BUILD_SCOPE"; //$NON-NLS-1$ >+ public static final String ATTR_BUILDER_SCOPE = PLUGIN_ID + ".ATTR_BUILDER_SCOPE"; //$NON-NLS-1$ > >- > /** > * String attribute containing an array of build kinds for which an > * external tool builder should be run. >@@ -210,4 +214,17 @@ > * @since 3.1 > */ > public static final String ATTR_TRIGGERS_CONFIGURED = PLUGIN_ID + ".ATTR_TRIGGERS_CONFIGURED"; //$NON-NLS-1$ >+ >+ /** >+ * String attribute identifying the build scope for this launch configuration. >+ * <code>null</code> indicates the default workspace build. >+ */ >+ public static final String ATTR_BUILD_SCOPE = PLUGIN_ID + ".ATTR_BUILD_SCOPE"; //$NON-NLS-1$ >+ >+ /** >+ * Attribute identifier specifying whether referenced projects should be >+ * considered when computing the projects to build. Default value is >+ * <code>true</code>. >+ */ >+ public static final String ATTR_INCLUDE_REFERENCED_PROJECTS = PLUGIN_ID + ".ATTR_INCLUDE_REFERENCED_PROJECTS"; //$NON-NLS-1$ > } >Index: icons/full/obj16/build_tab.gif >=================================================================== >RCS file: icons/full/obj16/build_tab.gif >diff -N icons/full/obj16/build_tab.gif >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ icons/full/obj16/build_tab.gif 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,5 @@ >+GIF89aæôöüøùüÈÎÝõ÷üôöû¯·Ég}©j« ®®òõûöøüùúüøùûmt³s²z·»»Â ¯ ®®µïóú2]À¢Ä¥Ç¬²½ÏÞèøóöû©Þè÷åíùêðù÷ùüöøûàêøìòúô÷û§âì÷çïøøúü£¡¤¦¨«ª°µ°±¼µ¹³¿¶¼´º²àÈÔ²hÔ²iÚ½|Õ²iÿÿÿ!ù@,@ 8@8=88& >+ >+.&>?9';><67!*±*±:4 >+ >+45ÈÉÊ32)ÏÐÑ21%%ÖØ0-Ü-Üâæ/$ã$æìé+,ã,ïõò@"(Û(ïú}äaÁA| ,\¨p!A; >Index: External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java >=================================================================== >RCS file: External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java >diff -N External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,433 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2005 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.ui.externaltools.internal.launchConfigurations; >+ >+ >+import java.util.ArrayList; >+import java.util.Iterator; >+import java.util.List; >+ >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.IResource; >+import org.eclipse.core.resources.IWorkspace; >+import org.eclipse.core.resources.IWorkspaceRoot; >+import org.eclipse.core.resources.ResourcesPlugin; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; >+import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; >+import org.eclipse.debug.ui.DebugUITools; >+import org.eclipse.jface.viewers.IStructuredContentProvider; >+import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.jface.window.Window; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.SelectionAdapter; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.graphics.Image; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Group; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.dialogs.ListSelectionDialog; >+import org.eclipse.ui.externaltools.internal.model.ExternalToolsImages; >+import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin; >+import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; >+import org.eclipse.ui.externaltools.internal.model.IExternalToolsHelpContextIds; >+import org.eclipse.ui.model.WorkbenchLabelProvider; >+ >+/** >+ * A launch configuration tab which allows the user to specify >+ * which resources should be built before a build (a build scope) >+ * <p> >+ * This class may be instantiated; this class is not intended >+ * to be subclassed. >+ * </p> >+ * @since 3.0 >+ */ >+public class ExternalToolsBuildTab extends AbstractLaunchConfigurationTab { >+ // Check Buttons >+ private Button fBuildButton; >+ >+ // Group box >+ private Group fGroup; >+ >+ // Radio Buttons >+ private Button fProjectButton; >+ private Button fSpecificProjectsButton; >+ private Button fWorkspaceButton; >+ >+ // Push Button >+ private Button fSelectButton; >+ >+ // whether to include referenced projects >+ private Button fReferencedProjects; >+ >+ // projects to build (empty if none) >+ private List fProjects = new ArrayList(); >+ >+ class ProjectsContentProvider implements IStructuredContentProvider { >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) >+ */ >+ public Object[] getElements(Object inputElement) { >+ return ((IWorkspace)inputElement).getRoot().getProjects(); >+ } >+ >+ /* (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) { >+ } >+ >+ } >+ /** >+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite) >+ */ >+ public void createControl(Composite parent) { >+ Composite mainComposite = new Composite(parent, SWT.NONE); >+ setControl(mainComposite); >+ PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IExternalToolsHelpContextIds.EXTERNAL_TOOLS_LAUNCH_CONFIGURATION_DIALOG_BUILD_TAB); >+ >+ GridLayout layout = new GridLayout(); >+ GridData gd = new GridData(GridData.FILL_HORIZONTAL); >+ mainComposite.setLayout(layout); >+ mainComposite.setLayoutData(gd); >+ mainComposite.setFont(parent.getFont()); >+ >+ fBuildButton = createCheckButton(mainComposite, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_1); >+ fBuildButton.addSelectionListener(new SelectionAdapter() { >+ public void widgetSelected(SelectionEvent e) { >+ updateEnabledState(); >+ updateLaunchConfigurationDialog(); >+ } >+ }); >+ >+ fGroup = new Group(mainComposite, SWT.NONE); >+ fGroup.setFont(mainComposite.getFont()); >+ layout = new GridLayout(); >+ layout.numColumns = 2; >+ layout.makeColumnsEqualWidth = false; >+ fGroup.setLayout(layout); >+ gd = new GridData(GridData.FILL_HORIZONTAL); >+ gd.horizontalSpan = 2; >+ fGroup.setLayoutData(gd); >+ >+ SelectionAdapter adapter = new SelectionAdapter() { >+ public void widgetSelected(SelectionEvent e) { >+ if (((Button)e.getSource()).getSelection()) { >+ updateEnabledState(); >+ updateLaunchConfigurationDialog(); >+ } >+ } >+ }; >+ >+ fWorkspaceButton = createRadioButton(fGroup, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_2); >+ gd = new GridData(GridData.FILL_HORIZONTAL); >+ gd.horizontalSpan = 2; >+ fWorkspaceButton.setLayoutData(gd); >+ fWorkspaceButton.addSelectionListener(adapter); >+ >+ fProjectButton = createRadioButton(fGroup, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_3); >+ gd = new GridData(GridData.FILL_HORIZONTAL); >+ gd.horizontalSpan = 2; >+ fProjectButton.setLayoutData(gd); >+ fProjectButton.addSelectionListener(adapter); >+ >+ fSpecificProjectsButton = createRadioButton(fGroup, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_4); >+ gd = new GridData(GridData.FILL_HORIZONTAL); >+ gd.horizontalSpan = 1; >+ fSpecificProjectsButton.setLayoutData(gd); >+ fSpecificProjectsButton.addSelectionListener(adapter); >+ >+ fSelectButton = createPushButton(fGroup, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_5, null); >+ gd = (GridData)fSelectButton.getLayoutData(); >+ gd.horizontalAlignment = GridData.HORIZONTAL_ALIGN_END; >+ fSelectButton.addSelectionListener(new SelectionAdapter() { >+ public void widgetSelected(SelectionEvent e) { >+ selectResources(); >+ } >+ }); >+ >+ createVerticalSpacer(mainComposite, 1); >+ fReferencedProjects = createCheckButton(mainComposite, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_6); >+ } >+ >+ /** >+ * Prompts the user to select the projects to build. >+ */ >+ private void selectResources() { >+ ListSelectionDialog dialog = new ListSelectionDialog(getShell(), ResourcesPlugin.getWorkspace(), new ProjectsContentProvider(), new WorkbenchLabelProvider(), ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_7); >+ dialog.setInitialElementSelections(fProjects); >+ if (dialog.open() == Window.CANCEL) { >+ return; >+ } >+ Object[] res = dialog.getResult(); >+ fProjects = new ArrayList(res.length); >+ for (int i = 0; i < res.length; i++) { >+ fProjects.add(res[i]); >+ } >+ updateLaunchConfigurationDialog(); >+ } >+ >+ /** >+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) >+ */ >+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { >+ } >+ >+ /** >+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration) >+ */ >+ public void initializeFrom(ILaunchConfiguration configuration) { >+ updateScope(configuration); >+ updateReferencedProjects(configuration); >+ updateEnabledState(); >+ } >+ >+ private void updateReferencedProjects(ILaunchConfiguration configuration) { >+ boolean ref = false; >+ try { >+ ref = configuration.getAttribute(getAttrIncludeReferencedProjectsId(), true); >+ } catch (CoreException e) { >+ ExternalToolsPlugin.getDefault().log("Exception reading launch configuration", e); //$NON-NLS-1$ >+ } >+ fReferencedProjects.setSelection(ref); >+ } >+ >+ /** >+ * Updates the tab to display the build scope specified by the launch config >+ */ >+ private void updateScope(ILaunchConfiguration configuration) { >+ String scope = null; >+ try { >+ scope= configuration.getAttribute(getAttrBuildScopeId(), (String)null); >+ } catch (CoreException ce) { >+ ExternalToolsPlugin.getDefault().log("Exception reading launch configuration", ce); //$NON-NLS-1$ >+ } >+ fBuildButton.setSelection(scope != null); >+ fWorkspaceButton.setSelection(false); >+ fProjectButton.setSelection(false); >+ fSpecificProjectsButton.setSelection(false); >+ fProjects.clear(); >+ if (scope == null) { >+ // select the workspace by default >+ fBuildButton.setSelection(true); >+ fWorkspaceButton.setSelection(true); >+ } else { >+ if (scope.equals("${none}")) { //$NON-NLS-1$ >+ fBuildButton.setSelection(false); >+ } else if (scope.equals("${project}")) { //$NON-NLS-1$ >+ fProjectButton.setSelection(true); >+ } else if (scope.startsWith("${projects:")) { //$NON-NLS-1$ >+ fSpecificProjectsButton.setSelection(true); >+ IProject[] projects = getBuildProjects(configuration, getAttrBuildScopeId()); >+ fProjects = new ArrayList(projects.length); >+ for (int i = 0; i < projects.length; i++) { >+ fProjects.add(projects[i]); >+ } >+ } >+ } >+ } >+ /** >+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) >+ */ >+ public void performApply(ILaunchConfigurationWorkingCopy configuration) { >+ String scope = generateScopeMemento(); >+ configuration.setAttribute(getAttrBuildScopeId(), scope); >+ if (fReferencedProjects.getSelection()) { >+ // default is true >+ configuration.setAttribute(getAttrIncludeReferencedProjectsId(), (String)null); >+ } else { >+ configuration.setAttribute(getAttrIncludeReferencedProjectsId(), false); >+ } >+ } >+ >+ /** >+ * Generates a memento for the build scope. >+ */ >+ private String generateScopeMemento() { >+ if (fBuildButton.getSelection()) { >+ if (fWorkspaceButton.getSelection()) { >+ return null; >+ } >+ if (fProjectButton.getSelection()) { >+ return "${project}"; //$NON-NLS-1$ >+ } >+ if (fSpecificProjectsButton.getSelection()) { >+ return getBuildScopeAttribute(fProjects); >+ } >+ return null; >+ >+ } >+ return "${none}"; //$NON-NLS-1$ >+ } >+ >+ /** >+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName() >+ */ >+ public String getName() { >+ return ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_8; >+ } >+ >+ /** >+ * Updates the enablement state of the fields. >+ */ >+ private void updateEnabledState() { >+ boolean enabled= fBuildButton.getSelection(); >+ fGroup.setEnabled(enabled); >+ fWorkspaceButton.setEnabled(enabled); >+ fProjectButton.setEnabled(enabled); >+ fSpecificProjectsButton.setEnabled(enabled); >+ fSelectButton.setEnabled(enabled && fSpecificProjectsButton.getSelection()); >+ if (!enabled) { >+ super.setErrorMessage(null); >+ } >+ if (enabled) { >+ if (!fWorkspaceButton.getSelection() && !fProjectButton.getSelection() && >+ !fSpecificProjectsButton.getSelection()) { >+ fWorkspaceButton.setSelection(true); >+ } >+ } >+ fReferencedProjects.setEnabled(fBuildButton.getSelection() && (fProjectButton.getSelection() || fSpecificProjectsButton.getSelection())); >+ } >+ >+ /** >+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage() >+ */ >+ public Image getImage() { >+ return ExternalToolsImages.getImage(IExternalToolConstants.IMG_TAB_BUILD); >+ } >+ >+ public boolean isValid(ILaunchConfiguration launchConfig) { >+ setErrorMessage(null); >+ setMessage(null); >+ if (fBuildButton.getSelection() && fSpecificProjectsButton.getSelection() && fProjects.isEmpty()) { >+ setErrorMessage(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_9); >+ return false; >+ } >+ return true; >+ } >+ >+ /** >+ * Returns a collection of projects referenced by a build scope attribute. >+ * >+ * @return collection of projects referred to by configuration >+ */ >+ public static IProject[] getBuildProjects(ILaunchConfiguration configuration, String buildScopeId) { >+ String scope = null; >+ String id = buildScopeId ; >+ if (id == null) >+ id = IExternalToolConstants.ATTR_BUILD_SCOPE ; >+ try { >+ scope = configuration.getAttribute(id, (String)null); >+ } catch (CoreException e) { >+ return null; >+ } >+ if (scope == null) { >+ return null; >+ } >+ if (scope.startsWith("${projects:")) { //$NON-NLS-1$ >+ String pathString = scope.substring(11, scope.length() - 1); >+ if (pathString.length() > 1) { >+ String[] names = pathString.split(","); //$NON-NLS-1$ >+ IProject[] projects = new IProject[names.length]; >+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); >+ for (int i = 0; i < names.length; i++) { >+ projects[i] = root.getProject(names[i]); >+ } >+ return projects; >+ } >+ } else if (scope.equals("${project}")) { //$NON-NLS-1$ >+ IResource resource = DebugUITools.getSelectedResource(); >+ if (resource != null) { >+ return new IProject[]{resource.getProject()}; >+ } >+ } >+ return new IProject[0]; >+ } >+ >+ /** >+ * Whether referenced projects should be considered when building. Only valid >+ * when a set of projects is to be built. >+ * >+ * @param configuration >+ * @return whether referenced projects should be considerd when building >+ * @throws CoreException if unable to access the associated attribute >+ */ >+ public static boolean isIncludeReferencedProjects(ILaunchConfiguration configuration, String includeReferencedProjectsId) throws CoreException { >+ String id = includeReferencedProjectsId; >+ if (id == null) >+ id = IExternalToolConstants.ATTR_INCLUDE_REFERENCED_PROJECTS ; >+ return configuration.getAttribute(id, true); >+ } >+ >+ /** >+ * Creates and returns a memento for the given project set, to be used as a >+ * build scope attribute. >+ * >+ * @param projects list of projects >+ * @return an equivalent refresh attribute >+ */ >+ public static String getBuildScopeAttribute(List projects) { >+ StringBuffer buf = new StringBuffer(); >+ buf.append("${projects:"); //$NON-NLS-1$ >+ Iterator iterator = projects.iterator(); >+ while (iterator.hasNext()) { >+ IProject project = (IProject) iterator.next(); >+ buf.append(project.getName()); >+ if (iterator.hasNext()) { >+ buf.append(","); //$NON-NLS-1$ >+ } >+ } >+ buf.append("}"); //$NON-NLS-1$ >+ return buf.toString(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) >+ */ >+ public void activated(ILaunchConfigurationWorkingCopy workingCopy) { >+ // do nothing on activation >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) >+ */ >+ public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) { >+ // do nothing on deactivation >+ } >+ >+ /** >+ * For backward compatibility - overridden in AntBuildTab >+ * @return id for referenced projects >+ */ >+ protected String getAttrIncludeReferencedProjectsId() { >+ return IExternalToolConstants.ATTR_INCLUDE_REFERENCED_PROJECTS; >+ } >+ >+ /** >+ * For backward compatibility - overridden in AntBuildTab >+ * @return id for build scope >+ */ >+ protected String getAttrBuildScopeId() { >+ return IExternalToolConstants.ATTR_BUILD_SCOPE; >+ } >+ >+}
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 165371
: 74694 |
74697