diff options
Diffstat (limited to 'org.eclipse.ui.externaltools')
10 files changed, 500 insertions, 19 deletions
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java new file mode 100644 index 000000000..8c510ed7f --- /dev/null +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java @@ -0,0 +1,417 @@ +/******************************************************************************* + * Copyright (c) 2000, 2007 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 + * dakshinamurthy.karra@gmail.com - bug 165371 + *******************************************************************************/ +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.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.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> + * A generalized version of AntBuildTab which was removed after the work of bug 165371 + * @since 3.4 + */ +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); + + 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(IExternalToolConstants.ATTR_INCLUDE_REFERENCED_PROJECTS, 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(IExternalToolConstants.ATTR_BUILD_SCOPE, (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, IExternalToolConstants.ATTR_BUILD_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(IExternalToolConstants.ATTR_BUILD_SCOPE, scope); + if (fReferencedProjects.getSelection()) { + // default is true + configuration.setAttribute(IExternalToolConstants.ATTR_INCLUDE_REFERENCED_PROJECTS, (String)null); + } else { + configuration.setAttribute(IExternalToolConstants.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 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 + } +} diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java index 70d085db0..38f59a96c 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java @@ -5,9 +5,9 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * * Contributors: * IBM Corporation - initial API and implementation + * dakshinamurthy.karra@gmail.com - bug 165371 *******************************************************************************/ package org.eclipse.ui.externaltools.internal.launchConfigurations; @@ -316,7 +316,7 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { 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 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { } 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()); diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java index 42b71f23e..f18bb254c 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java @@ -1,11 +1,12 @@ /********************************************************************** - * Copyright (c) 2000, 2006 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2000, 2007 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 - Initial API and implementation + * dakshinamurthy.karra@gmail.com - bug 165371 **********************************************************************/ package org.eclipse.ui.externaltools.internal.launchConfigurations; @@ -37,6 +38,17 @@ public class ExternalToolsLaunchConfigurationMessages extends NLS { 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_; diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties index f73cc545c..7e432a97c 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2000, 2006 IBM Corporation and others. +# Copyright (c) 2000, 2007 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 @@ -7,6 +7,7 @@ # # Contributors: # IBM Corporation - initial API and implementation +# dakshinamurthy.karra@gmail.com - bug 165371 ############################################################################### ExternalToolsMainTab__Location___2=&Location: @@ -32,6 +33,16 @@ ExternalToolsMainTab_30=Please specify the location of the external tool you wou 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}. diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java index ae5e112b0..cbc763353 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2007 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 @@ -8,6 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Keith Seitz (keiths@redhat.com) - Bug 27243 (environment variables contribution) + * dakshinamurthy.karra@gmail.com - bug 165371 *******************************************************************************/ package org.eclipse.ui.externaltools.internal.launchConfigurations; @@ -172,7 +173,7 @@ public class ExternalToolsUtil { * @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; } diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java index d8fd19813..c45144dd2 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. + * Copyright (c) 2000, 2007 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * dakshinamurthy.karra@gmail.com - bug 165371 *******************************************************************************/ package org.eclipse.ui.externaltools.internal.model; @@ -51,6 +52,7 @@ public class ExternalToolsImages { 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$ } /** diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/IExternalToolConstants.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/IExternalToolConstants.java index 2f24e609d..31de4e336 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/IExternalToolConstants.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/IExternalToolConstants.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. + * Copyright (c) 2000, 2007 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * dakshinamurthy.karra@gmail.com - bug 165371 *******************************************************************************/ package org.eclipse.ui.externaltools.internal.model; @@ -93,7 +94,12 @@ public interface IExternalToolConstants { * 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 +164,8 @@ public interface IExternalToolConstants { * 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_BUILD_SCOPE"; //$NON-NLS-1$ - /** * String attribute containing an array of build kinds for which an * external tool builder should be run. @@ -210,4 +215,17 @@ public interface IExternalToolConstants { * @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 a launch configuration. + * <code>null</code> indicates the default workspace build. + */ + public static final String ATTR_BUILD_SCOPE = PLUGIN_ID + ".ATTR_LAUNCH_CONFIGURATION_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$ } diff --git a/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramLaunchDelegate.java b/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramLaunchDelegate.java index a7efdbcd4..bed630430 100644 --- a/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramLaunchDelegate.java +++ b/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramLaunchDelegate.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2007 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 @@ -8,6 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Keith Seitz (keiths@redhat.com) - environment variables contribution (Bug 27243) + * dakshinamurthy.karra@gmail.com - bug 165371 *******************************************************************************/ package org.eclipse.ui.externaltools.internal.program.launchConfigurations; @@ -16,6 +17,7 @@ import java.io.File; 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 +37,7 @@ import org.eclipse.osgi.util.NLS; 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 +168,11 @@ public class ProgramLaunchDelegate extends LaunchConfigurationDelegate { 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 +229,18 @@ public class ProgramLaunchDelegate extends LaunchConfigurationDelegate { 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); + } } diff --git a/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramTabGroup.java b/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramTabGroup.java index 73a0e1557..7da41166c 100644 --- a/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramTabGroup.java +++ b/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramTabGroup.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. + * Copyright (c) 2000, 2007 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * dakshinamurthy.karra@gmail.com - bug 165371 *******************************************************************************/ package org.eclipse.ui.externaltools.internal.program.launchConfigurations; @@ -16,6 +17,7 @@ import org.eclipse.debug.ui.EnvironmentTab; 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 +28,7 @@ public class ProgramTabGroup extends AbstractLaunchConfigurationTabGroup { ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] { new ProgramMainTab(), new RefreshTab(), + new ExternalToolsBuildTab(), new EnvironmentTab(), new CommonTab() }; diff --git a/org.eclipse.ui.externaltools/icons/full/obj16/build_tab.gif b/org.eclipse.ui.externaltools/icons/full/obj16/build_tab.gif Binary files differnew file mode 100644 index 000000000..4fcb208b4 --- /dev/null +++ b/org.eclipse.ui.externaltools/icons/full/obj16/build_tab.gif |