Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations')
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java310
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java34
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties53
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java645
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java202
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/IgnoreWhiteSpaceComparator.java47
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/WorkingSetComparator.java52
7 files changed, 0 insertions, 1343 deletions
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
deleted file mode 100644
index 6f6a13792..000000000
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java
+++ /dev/null
@@ -1,310 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.externaltools.internal.launchConfigurations;
-
-
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.debug.ui.RefreshTab;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-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.Label;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetManager;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.IWorkingSetEditWizard;
-import org.eclipse.ui.externaltools.internal.model.ExternalToolBuilder;
-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.help.WorkbenchHelp;
-import org.eclipse.ui.ide.IDE;
-
-public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab {
-
- private Button afterClean;
- private Button autoBuildButton;
- private Button manualBuild;
- private Button workingSetButton;
- private Button specifyResources;
- protected Button fLaunchInBackgroundButton;
- private IWorkingSet workingSet;
-
- private SelectionListener selectionListener= new SelectionAdapter() {
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- public void widgetSelected(SelectionEvent e) {
- boolean enabled= autoBuildButton.getSelection() || manualBuild.getSelection();
- workingSetButton.setEnabled(enabled);
- specifyResources.setEnabled(enabled && workingSetButton.getSelection());
- updateLaunchConfigurationDialog();
- }
- };
-
- public void createControl(Composite parent) {
- Composite mainComposite = new Composite(parent, SWT.NONE);
- setControl(mainComposite);
- WorkbenchHelp.setHelp(getControl(), IExternalToolsHelpContextIds.EXTERNAL_TOOLS_LAUNCH_CONFIGURATION_DIALOG_BUILDER_TAB);
-
- GridLayout layout = new GridLayout();
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.horizontalSpan = 2;
- layout.numColumns = 2;
- layout.makeColumnsEqualWidth = false;
- mainComposite.setLayout(layout);
- mainComposite.setLayoutData(gridData);
- mainComposite.setFont(parent.getFont());
- createLaunchInBackgroundComposite(mainComposite);
- createBuildScheduleComponent(mainComposite);
-
- }
-
- /**
- * Creates the controls needed to edit the launch in background
- * attribute of an external tool
- *
- * @param parent the composite to create the controls in
- */
- protected void createLaunchInBackgroundComposite(Composite parent) {
- fLaunchInBackgroundButton = createCheckButton(parent, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsBuilderTab.14")); //$NON-NLS-1$
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = 2;
- fLaunchInBackgroundButton.setLayoutData(data);
- fLaunchInBackgroundButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateLaunchConfigurationDialog();
- }
- });
- }
-
- private void createBuildScheduleComponent(Composite parent) {
- Label label= new Label(parent, SWT.NONE);
- label.setText(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsBuilderTab.Run_this_builder_for__1")); //$NON-NLS-1$
- label.setFont(parent.getFont());
- afterClean= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsBuilderTab.&Full_builds_2"), ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsBuilderTab.Full"), 2); //$NON-NLS-1$ //$NON-NLS-2$
- manualBuild= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsBuilderTab.&Incremental_builds_4"), ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsBuilderTab.Inc"), 2); //$NON-NLS-1$ //$NON-NLS-2$
- autoBuildButton= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsBuilderTab.&Auto_builds_(Not_recommended)_6"), ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsBuilderTab.Auto"), 2); //$NON-NLS-1$ //$NON-NLS-2$
-
- createVerticalSpacer(parent, 2);
-
- workingSetButton= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsBuilderTab.workingSet_label"), ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsBuilderTab.workingSet_tooltip"), 1); //$NON-NLS-1$ //$NON-NLS-2$
- specifyResources= createPushButton(parent, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsBuilderTab.13"), null); //$NON-NLS-1$
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
- specifyResources.setLayoutData(gd);
- specifyResources.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- selectResources();
- }
- });
- }
-
- /*
- * Creates a check button in the given composite with the given text
- */
- private Button createButton(Composite parent, SelectionListener listener, String text, String tooltipText, int columns) {
- Button button= createCheckButton(parent, text);
- button.setToolTipText(tooltipText);
- button.addSelectionListener(listener);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = columns;
- button.setLayoutData(gd);
- return button;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
- */
- public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
- StringBuffer buffer= new StringBuffer(IExternalToolConstants.BUILD_TYPE_FULL);
- buffer.append(',');
- buffer.append(IExternalToolConstants.BUILD_TYPE_INCREMENTAL);
- buffer.append(',');
- configuration.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, buffer.toString());
- configuration.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, false);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
- */
- public void initializeFrom(ILaunchConfiguration configuration) {
-
- afterClean.setSelection(false);
- manualBuild.setSelection(false);
- autoBuildButton.setSelection(false);
-
- String buildKindString= null;
- String buildScope= null;
- try {
- buildKindString= configuration.getAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, ""); //$NON-NLS-1$
- buildScope= configuration.getAttribute(IExternalToolConstants.ATTR_BUILD_SCOPE, (String)null);
- } catch (CoreException e) {
- }
-
- workingSetButton.setSelection(buildScope != null);
- workingSetButton.setEnabled(buildScope != null);
-
- if (buildScope != null) {
- workingSet = RefreshTab.getWorkingSet(buildScope);
- }
-
- int buildTypes[]= ExternalToolBuilder.buildTypesToArray(buildKindString);
- for (int i = 0; i < buildTypes.length; i++) {
- switch (buildTypes[i]) {
- case IncrementalProjectBuilder.FULL_BUILD:
- afterClean.setSelection(true);
- break;
- case IncrementalProjectBuilder.INCREMENTAL_BUILD:
- manualBuild.setSelection(true);
- break;
- case IncrementalProjectBuilder.AUTO_BUILD:
- autoBuildButton.setSelection(true);
- break;
- }
- }
- boolean enabled= autoBuildButton.getSelection() || manualBuild.getSelection();
- workingSetButton.setEnabled(enabled);
- specifyResources.setEnabled(enabled && workingSetButton.getSelection());
- updateRunInBackground(configuration);
- }
-
- protected void updateRunInBackground(ILaunchConfiguration configuration) {
- fLaunchInBackgroundButton.setSelection(isLaunchInBackground(configuration));
- }
-
- /**
- * Returns whether the given configuration should be run in the background.
- *
- * @param configuration the configuration
- * @return whether the configuration is configured to run in the background
- */
- public static boolean isLaunchInBackground(ILaunchConfiguration configuration) {
- boolean launchInBackground= false;
- try {
- launchInBackground= configuration.getAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, false);
- } catch (CoreException ce) {
- ExternalToolsPlugin.getDefault().log(ce);
- }
- return launchInBackground;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
- */
- public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- StringBuffer buffer= new StringBuffer();
- if (afterClean.getSelection()) {
- buffer.append(IExternalToolConstants.BUILD_TYPE_FULL).append(',');
- }
- if (manualBuild.getSelection()){
- buffer.append(IExternalToolConstants.BUILD_TYPE_INCREMENTAL).append(',');
- }
- if (autoBuildButton.getSelection()) {
- buffer.append(IExternalToolConstants.BUILD_TYPE_AUTO).append(',');
- }
- configuration.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, buffer.toString());
-
- if (workingSetButton.getSelection()) {
- String scope = RefreshTab.getRefreshAttribute(workingSet);
- configuration.setAttribute(IExternalToolConstants.ATTR_BUILD_SCOPE, scope);
- } else {
- configuration.setAttribute(IExternalToolConstants.ATTR_BUILD_SCOPE, (String)null);
- }
- configuration.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, fLaunchInBackgroundButton.getSelection());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
- */
- public String getName() {
- return ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsBuilderTab.Build_Options_9"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage()
- */
- public Image getImage() {
- return PlatformUI.getWorkbench().getSharedImages().getImage(IDE.SharedImages.IMG_OBJ_PROJECT);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration)
- */
- public boolean isValid(ILaunchConfiguration launchConfig) {
- setErrorMessage(null);
- setMessage(null);
-
- boolean buildKindSelected= afterClean.getSelection() || manualBuild.getSelection() || autoBuildButton.getSelection();
- if (!buildKindSelected) {
- setErrorMessage(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsBuilderTab.buildKindError")); //$NON-NLS-1$
- return false;
- }
- if (workingSetButton.getSelection() && (workingSet == null || workingSet.getElements().length == 0)) {
- setErrorMessage(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsBuilderTab.16")); //$NON-NLS-1$
- }
-
- return true;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#canSave()
- */
- public boolean canSave() {
- return isValid(null);
- }
-
- /**
- * Prompts the user to select the working set that triggers the build.
- */
- private void selectResources() {
- IWorkingSetManager workingSetManager= PlatformUI.getWorkbench().getWorkingSetManager();
-
- if (workingSet == null){
- workingSet = workingSetManager.createWorkingSet(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsBuilderTab.15"), new IAdaptable[0]); //$NON-NLS-1$
- }
- IWorkingSetEditWizard wizard= workingSetManager.createWorkingSetEditWizard(workingSet);
- WizardDialog dialog = new WizardDialog(ExternalToolsPlugin.getStandardDisplay().getActiveShell(), wizard);
- dialog.create();
-
- if (dialog.open() == Window.CANCEL) {
- return;
- }
- workingSet = wizard.getSelection();
- updateLaunchConfigurationDialog();
- }
- /* (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/ExternalToolsLaunchConfigurationMessages.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java
deleted file mode 100644
index e1e1695db..000000000
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.externaltools.internal.launchConfigurations;
-
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class ExternalToolsLaunchConfigurationMessages {
-
- private static final String BUNDLE_NAME = "org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsLaunchConfigurationMessages"; //$NON-NLS-1$
-
- private static final ResourceBundle RESOURCE_BUNDLE =
- ResourceBundle.getBundle(BUNDLE_NAME);
-
- private ExternalToolsLaunchConfigurationMessages() {
- }
-
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-}
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
deleted file mode 100644
index cca674c06..000000000
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties
+++ /dev/null
@@ -1,53 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-ExternalToolsMainTab.&Location___2=&Location:
-ExternalToolsMainTab.&Browse_Workspace..._3=Browse Works&pace...
-ExternalToolsMainTab.Brows&e_File_System..._4=Brows&e File System...
-ExternalToolsMainTab.Working_&Directory__5=Working &Directory:
-ExternalToolsMainTab.Browse_Wor&kspace..._6=Browse Wor&kspace...
-ExternalToolsMainTab.Browse_F&ile_System..._7=Br&owse File System...
-ExternalToolsMainTab.Error_reading_configuration_10=Error reading configuration
-ExternalToolsMainTab.&Main_17=Main
-ExternalToolsMainTab.External_tool_location_cannot_be_empty_18=External tool location cannot be empty
-ExternalToolsMainTab.External_tool_location_does_not_exist_19=External tool location does not exist
-ExternalToolsMainTab.External_tool_location_specified_is_not_a_file_20=External tool location specified is not a file
-ExternalToolsMainTab.External_tool_working_directory_does_not_exist_or_is_invalid_21=External tool working directory does not exist or is invalid
-ExternalToolsMainTab.Select_a_resource_22=Select a resource:
-ExternalToolsMainTab.23=Select a working directory:
-ExternalToolsMainTab.&Arguments___1=&Arguments:
-ExternalToolsMainTab.Varia&bles..._2=Variable&s...
-ExternalToolsMainTab.3=Note: Enclose an argument containing spaces using double-quotes (\").
-ExternalToolsMainTab.Error_reading_configuration_7=Error reading configuration
-ExternalToolsMainTab.Not_a_directory=The specified location is not a directory
-ExternalToolsMainTab.30=Please specify the location of the external tool you would like to configure.
-ExternalToolsMainTab.31=Var&iables...
-ExternalToolsMainTab.32=Varia&bles...
-
-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}.
-
-ExternalToolsBuilderTab.Run_this_builder_for__1=Run the builder:
-ExternalToolsBuilderTab.&Full_builds_2=&After a \"Clean\"
-ExternalToolsBuilderTab.Full=Runs on the first build that occurs after a clean.
-ExternalToolsBuilderTab.&Incremental_builds_4=&During Manual Builds
-ExternalToolsBuilderTab.Inc=Runs whenever the user invokes a build (but not for auto-build).
-ExternalToolsBuilderTab.&Auto_builds_(Not_recommended)_6=During A&uto Builds
-ExternalToolsBuilderTab.Auto=Runs whenever a resource in the workspace is modified if autobuilding is enabled. Enabling this option should be paired with a specifying a resource working set.
-ExternalToolsBuilderTab.Build_Options_9=&Build Options
-ExternalToolsBuilderTab.workingSet_label=Specify working set of &relevant resources (not applied for the build after a clean)
-ExternalToolsBuilderTab.workingSet_tooltip=The working set of resources that if changed from a manual or auto build will trigger the external tool builder
-ExternalToolsBuilderTab.buildKindError=At least one type of build kind must be selected
-ExternalToolsBuilderTab.14=Launch in bac&kground
-ExternalToolsBuilderTab.13=&Specify Resources...
-ExternalToolsBuilderTab.16=Must select resources in working set.
-ExternalToolsBuilderTab.15=workingSet \ No newline at end of file
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java
deleted file mode 100644
index d6829796a..000000000
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java
+++ /dev/null
@@ -1,645 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.externaltools.internal.launchConfigurations;
-
-
-import java.io.File;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.variables.IStringVariableManager;
-import org.eclipse.core.variables.VariablesPlugin;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.internal.ui.stringsubstitution.StringVariableSelectionDialog;
-import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleAdapter;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-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.Control;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.dialogs.ContainerSelectionDialog;
-import org.eclipse.ui.dialogs.ResourceSelectionDialog;
-import org.eclipse.ui.externaltools.internal.model.ExternalToolsImages;
-import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin;
-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants;
-
-/**
- * The external tools main tab allows the user to configure primary attributes
- * of external tool launch configurations such as the location, working directory,
- * and arguments.
- */
-public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTab {
- public final static String FIRST_EDIT = "editedByExternalToolsMainTab"; //$NON-NLS-1$
-
- protected Text locationField;
- protected Text workDirectoryField;
- protected Button fileLocationButton;
- protected Button workspaceLocationButton;
- protected Button variablesLocationButton;
- protected Button fileWorkingDirectoryButton;
- protected Button workspaceWorkingDirectoryButton;
- protected Button variablesWorkingDirectoryButton;
-
- protected Text argumentField;
- protected Button argumentVariablesButton;
-
- protected SelectionAdapter selectionAdapter;
-
- protected boolean fInitializing= false;
- private boolean userEdited= false;
-
- protected WidgetListener fListener= new WidgetListener();
-
- /**
- * A listener to update for text modification and widget selection.
- */
- protected class WidgetListener extends SelectionAdapter implements ModifyListener {
- public void modifyText(ModifyEvent e) {
- if (!fInitializing) {
- setDirty(true);
- userEdited= true;
- updateLaunchConfigurationDialog();
- }
- }
- public void widgetSelected(SelectionEvent e) {
- setDirty(true);
- Object source= e.getSource();
- if (source == workspaceLocationButton) {
- handleWorkspaceLocationButtonSelected();
- } else if (source == fileLocationButton) {
- handleFileLocationButtonSelected();
- } else if (source == workspaceWorkingDirectoryButton) {
- handleWorkspaceWorkingDirectoryButtonSelected();
- } else if (source == fileWorkingDirectoryButton) {
- handleFileWorkingDirectoryButtonSelected();
- } else if (source == argumentVariablesButton) {
- handleVariablesButtonSelected(argumentField);
- } else if (source == variablesLocationButton) {
- handleVariablesButtonSelected(locationField);
- } else if (source == variablesWorkingDirectoryButton) {
- handleVariablesButtonSelected(workDirectoryField);
- }
- }
-
- }
-
- /* (non-Javadoc)
- * @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);
- mainComposite.setFont(parent.getFont());
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- mainComposite.setLayout(layout);
- mainComposite.setLayoutData(gridData);
-
- createLocationComponent(mainComposite);
- createWorkDirectoryComponent(mainComposite);
- createArgumentComponent(mainComposite);
- createVerticalSpacer(mainComposite, 1);
-
- Dialog.applyDialogFont(parent);
- }
-
- /**
- * Creates the controls needed to edit the location
- * attribute of an external tool
- *
- * @param group the composite to create the controls in
- */
- protected void createLocationComponent(Composite parent) {
- Group group = new Group(parent, SWT.NONE);
- String locationLabel = getLocationLabel();
- group.setText(locationLabel);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- group.setLayout(layout);
- group.setLayoutData(gridData);
-
- locationField = new Text(group, SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- locationField.setLayoutData(gridData);
- locationField.addModifyListener(fListener);
- addControlAccessibleListener(locationField, group.getText());
-
- Composite buttonComposite = new Composite(group, SWT.NONE);
- layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.numColumns = 3;
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
- buttonComposite.setLayout(layout);
- buttonComposite.setLayoutData(gridData);
- buttonComposite.setFont(parent.getFont());
-
- workspaceLocationButton= createPushButton(buttonComposite, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.&Browse_Workspace..._3"), null); //$NON-NLS-1$
- workspaceLocationButton.addSelectionListener(fListener);
- addControlAccessibleListener(workspaceLocationButton, group.getText() + " " + workspaceLocationButton.getText()); //$NON-NLS-1$
-
- fileLocationButton= createPushButton(buttonComposite, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Brows&e_File_System..._4"), null); //$NON-NLS-1$
- fileLocationButton.addSelectionListener(fListener);
- addControlAccessibleListener(fileLocationButton, group.getText() + " " + fileLocationButton.getText()); //$NON-NLS-1$
-
- variablesLocationButton = createPushButton(buttonComposite, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.31"), null); //$NON-NLS-1$
- variablesLocationButton.addSelectionListener(fListener);
- addControlAccessibleListener(variablesLocationButton, group.getText() + " " + variablesLocationButton.getText()); //$NON-NLS-1$
- }
-
- /**
- * Returns the label used for the location widgets. Subclasses may wish to override.
- */
- protected String getLocationLabel() {
- return ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.&Location___2"); //$NON-NLS-1$
- }
-
- /**
- * Creates the controls needed to edit the working directory
- * attribute of an external tool
- *
- * @param parent the composite to create the controls in
- */
- protected void createWorkDirectoryComponent(Composite parent) {
- Group group = new Group(parent, SWT.NONE);
- String groupName = getWorkingDirectoryLabel();
- group.setText(groupName);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- group.setLayout(layout);
- group.setLayoutData(gridData);
-
- workDirectoryField = new Text(group, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- workDirectoryField.setLayoutData(data);
- workDirectoryField.addModifyListener(fListener);
- addControlAccessibleListener(workDirectoryField,group.getText());
-
- Composite buttonComposite = new Composite(group, SWT.NONE);
- layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 3;
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
- buttonComposite.setLayout(layout);
- buttonComposite.setLayoutData(gridData);
- buttonComposite.setFont(parent.getFont());
-
- workspaceWorkingDirectoryButton= createPushButton(buttonComposite, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Browse_Wor&kspace..._6"), null); //$NON-NLS-1$
- workspaceWorkingDirectoryButton.addSelectionListener(fListener);
- addControlAccessibleListener(workspaceWorkingDirectoryButton, group.getText() + " " + workspaceWorkingDirectoryButton.getText()); //$NON-NLS-1$
-
- fileWorkingDirectoryButton= createPushButton(buttonComposite, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Browse_F&ile_System..._7"), null); //$NON-NLS-1$
- fileWorkingDirectoryButton.addSelectionListener(fListener);
- addControlAccessibleListener(fileWorkingDirectoryButton, group.getText() + " " + fileLocationButton.getText()); //$NON-NLS-1$
-
- variablesWorkingDirectoryButton = createPushButton(buttonComposite, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.32"), null); //$NON-NLS-1$
- variablesWorkingDirectoryButton.addSelectionListener(fListener);
- addControlAccessibleListener(variablesWorkingDirectoryButton, group.getText() + " " + variablesWorkingDirectoryButton.getText()); //$NON-NLS-1$
- }
-
- /**
- * Return the String to use as the label for the working directory field.
- * Subclasses may wish to override.
- */
- protected String getWorkingDirectoryLabel() {
- return ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Working_&Directory__5"); //$NON-NLS-1$
- }
-
- /**
- * Creates the controls needed to edit the argument and
- * prompt for argument attributes of an external tool
- *
- * @param parent the composite to create the controls in
- */
- protected void createArgumentComponent(Composite parent) {
- Group group = new Group(parent, SWT.NONE);
- String groupName = ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.&Arguments___1"); //$NON-NLS-1$
- group.setText(groupName);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- GridData gridData = new GridData(GridData.FILL_BOTH);
- group.setLayout(layout);
- group.setLayoutData(gridData);
- group.setFont(parent.getFont());
-
- argumentField = new Text(group, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
- gridData = new GridData(GridData.FILL_BOTH);
- gridData.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- gridData.heightHint = 30;
- argumentField.setLayoutData(gridData);
- argumentField.addModifyListener(fListener);
- addControlAccessibleListener(argumentField, group.getText());
-
- Composite composite = new Composite(group, SWT.NONE);
- layout = new GridLayout();
- layout.numColumns= 1;
- layout.marginHeight= 0;
- layout.marginWidth= 0;
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
- composite.setLayout(layout);
- composite.setLayoutData(gridData);
- composite.setFont(parent.getFont());
-
- argumentVariablesButton= createPushButton(composite, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Varia&bles..._2"), null); //$NON-NLS-1$
- argumentVariablesButton.addSelectionListener(fListener);
- addControlAccessibleListener(argumentVariablesButton, argumentVariablesButton.getText()); // need to strip the mnemonic from buttons
-
- Label instruction = new Label(group, SWT.NONE);
- instruction.setText(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.3")); //$NON-NLS-1$
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gridData.horizontalSpan = 2;
- instruction.setLayoutData(gridData);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
- */
- public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
- configuration.setAttribute(FIRST_EDIT, true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
- */
- public void initializeFrom(ILaunchConfiguration configuration) {
- fInitializing= true;
- updateLocation(configuration);
- updateWorkingDirectory(configuration);
- updateArgument(configuration);
- fInitializing= false;
- setDirty(false);
- }
-
- /**
- * Updates the working directory widgets to match the state of the given launch
- * configuration.
- */
- protected void updateWorkingDirectory(ILaunchConfiguration configuration) {
- String workingDir= ""; //$NON-NLS-1$
- try {
- workingDir= configuration.getAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, ""); //$NON-NLS-1$
- } catch (CoreException ce) {
- ExternalToolsPlugin.getDefault().log(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Error_reading_configuration_10"), ce); //$NON-NLS-1$
- }
- workDirectoryField.setText(workingDir);
- }
-
- /**
- * Updates the location widgets to match the state of the given launch
- * configuration.
- */
- protected void updateLocation(ILaunchConfiguration configuration) {
- String location= ""; //$NON-NLS-1$
- try {
- location= configuration.getAttribute(IExternalToolConstants.ATTR_LOCATION, ""); //$NON-NLS-1$
- } catch (CoreException ce) {
- ExternalToolsPlugin.getDefault().log(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Error_reading_configuration_10"), ce); //$NON-NLS-1$
- }
- locationField.setText(location);
- }
-
- /**
- * Updates the argument widgets to match the state of the given launch
- * configuration.
- */
- protected void updateArgument(ILaunchConfiguration configuration) {
- String arguments= ""; //$NON-NLS-1$
- try {
- arguments= configuration.getAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, ""); //$NON-NLS-1$
- } catch (CoreException ce) {
- ExternalToolsPlugin.getDefault().log(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Error_reading_configuration_7"), ce); //$NON-NLS-1$
- }
- argumentField.setText(arguments);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
- */
- public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- String location= locationField.getText().trim();
- if (location.length() == 0) {
- configuration.setAttribute(IExternalToolConstants.ATTR_LOCATION, (String)null);
- } else {
- configuration.setAttribute(IExternalToolConstants.ATTR_LOCATION, location);
- }
-
- String workingDirectory= workDirectoryField.getText().trim();
- if (workingDirectory.length() == 0) {
- configuration.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, (String)null);
- } else {
- configuration.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, workingDirectory);
- }
-
- String arguments= argumentField.getText().trim();
- if (arguments.length() == 0) {
- configuration.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, (String)null);
- } else {
- configuration.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, arguments);
- }
-
- if(userEdited) {
- configuration.setAttribute(FIRST_EDIT, (String)null);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
- */
- public String getName() {
- return ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.&Main_17"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration)
- */
- public boolean isValid(ILaunchConfiguration launchConfig) {
- setErrorMessage(null);
- setMessage(null);
- boolean newConfig = false;
- try {
- newConfig = launchConfig.getAttribute(FIRST_EDIT, false);
- } catch (CoreException e) {
- //assume false is correct
- }
- return validateLocation(newConfig) && validateWorkDirectory();
- }
-
- /**
- * Validates the content of the location field.
- */
- protected boolean validateLocation(boolean newConfig) {
- String location = locationField.getText().trim();
- if (location.length() < 1) {
- if (newConfig) {
- setErrorMessage(null);
- setMessage(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.30")); //$NON-NLS-1$
- } else {
- setErrorMessage(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.External_tool_location_cannot_be_empty_18")); //$NON-NLS-1$
- setMessage(null);
- }
- return false;
- }
-
- String expandedLocation= null;
- try {
- expandedLocation= resolveValue(location);
- if (expandedLocation == null) { //a variable that needs to be resolved at runtime
- return true;
- }
- } catch (CoreException e) {
- setErrorMessage(e.getStatus().getMessage());
- return false;
- }
-
- File file = new File(expandedLocation);
- if (!file.exists()) { // The file does not exist.
- if (!newConfig) {
- setErrorMessage(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.External_tool_location_does_not_exist_19")); //$NON-NLS-1$
- }
- return false;
- }
- if (!file.isFile()) {
- if (!newConfig) {
- setErrorMessage(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.External_tool_location_specified_is_not_a_file_20")); //$NON-NLS-1$
- }
- return false;
- }
- return true;
- }
-
- /**
- * Validates the variables of the given string to determine if all variables are valid
- *
- * @param expression expression with variables
- * @exception CoreException if a variable is specified that does not exist
- */
- private void validateVaribles(String expression) throws CoreException {
- IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
- manager.validateStringVariables(expression);
- }
-
- private String resolveValue(String expression) throws CoreException {
- String expanded= null;
- try {
- expanded= getValue(expression);
- } catch (CoreException e) { //possibly just a variable that needs to be resolved at runtime
- validateVaribles(expression);
- return null;
- }
- return expanded;
- }
-
- /**
- * Validates the value of the given string to determine if any/all variables are valid
- *
- * @param expression expression with variables
- * @return whether the expression contained any variable values
- * @exception CoreException if variable resolution fails
- */
- private String getValue(String expression) throws CoreException {
- IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
- return manager.performStringSubstitution(expression);
- }
-
- /**
- * Validates the content of the working directory field.
- */
- protected boolean validateWorkDirectory() {
- String dir = workDirectoryField.getText().trim();
- if (dir.length() <= 0) {
- return true;
- }
-
- String expandedDir= null;
- try {
- expandedDir= resolveValue(dir);
- if (expandedDir == null) { //a variable that needs to be resolved at runtime
- return true;
- }
- } catch (CoreException e) {
- setErrorMessage(e.getStatus().getMessage());
- return false;
- }
-
- File file = new File(expandedDir);
- if (!file.exists()) { // The directory does not exist.
- setErrorMessage(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.External_tool_working_directory_does_not_exist_or_is_invalid_21")); //$NON-NLS-1$
- return false;
- }
- if (!file.isDirectory()) {
- setErrorMessage(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Not_a_directory")); //$NON-NLS-1$
- return false;
- }
- return true;
- }
-
- /**
- * Prompts the user to choose a location from the filesystem and
- * sets the location as the full path of the selected file.
- */
- protected void handleFileLocationButtonSelected() {
- FileDialog fileDialog = new FileDialog(getShell(), SWT.NONE);
- fileDialog.setFileName(locationField.getText());
- String text= fileDialog.open();
- if (text != null) {
- locationField.setText(text);
- }
- }
-
- /**
- * Prompts the user for a workspace location within the workspace and sets
- * the location as a String containing the workspace_loc variable or
- * <code>null</code> if no location was obtained from the user.
- */
- protected void handleWorkspaceLocationButtonSelected() {
- ResourceSelectionDialog dialog;
- dialog = new ResourceSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Select_a_resource_22")); //$NON-NLS-1$
- dialog.open();
- Object[] results = dialog.getResult();
- if (results == null || results.length < 1) {
- return;
- }
- IResource resource = (IResource)results[0];
- locationField.setText(newVariableExpression("workspace_loc", resource.getFullPath().toString())); //$NON-NLS-1$
- }
-
- /**
- * Prompts the user for a working directory location within the workspace
- * and sets the working directory as a String containing the workspace_loc
- * variable or <code>null</code> if no location was obtained from the user.
- */
- protected void handleWorkspaceWorkingDirectoryButtonSelected() {
- ContainerSelectionDialog containerDialog;
- containerDialog = new ContainerSelectionDialog(
- getShell(),
- ResourcesPlugin.getWorkspace().getRoot(),
- false,
- ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.23")); //$NON-NLS-1$
- containerDialog.open();
- Object[] resource = containerDialog.getResult();
- String text= null;
- if (resource != null && resource.length > 0) {
- text= newVariableExpression("workspace_loc", ((IPath)resource[0]).toString()); //$NON-NLS-1$
- }
- if (text != null) {
- workDirectoryField.setText(text);
- }
- }
-
- /**
- * Returns a new variable expression with the given variable and the given argument.
- * @see IStringVariableManager#generateVariableExpression(String, String)
- */
- protected String newVariableExpression(String varName, String arg) {
- return VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression(varName, arg);
- }
-
- /**
- * Prompts the user to choose a working directory from the filesystem.
- */
- protected void handleFileWorkingDirectoryButtonSelected() {
- DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.SAVE);
- dialog.setMessage(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.23")); //$NON-NLS-1$
- dialog.setFilterPath(workDirectoryField.getText());
- String text= dialog.open();
- if (text != null) {
- workDirectoryField.setText(text);
- }
- }
-
- /**
- * A variable entry button has been pressed for the given text
- * field. Prompt the user for a variable and enter the result
- * in the given field.
- */
- private void handleVariablesButtonSelected(Text textField) {
- String variable = getVariable();
- if (variable != null) {
- textField.append(variable);
- }
- }
-
- /**
- * Prompts the user to choose and configure a variable and returns
- * the resulting string, suitable to be used as an attribute.
- */
- private String getVariable() {
- StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
- dialog.open();
- return dialog.getVariableExpression();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage()
- */
- public Image getImage() {
- return ExternalToolsImages.getImage(IExternalToolConstants.IMG_TAB_MAIN);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
- */
- public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
- */
- public void activated(ILaunchConfigurationWorkingCopy workingCopy) {
- }
-
- /*
- * Fix for Bug 60163 Accessibility: New Builder Dialog missing object info for textInput controls
- */
- public void addControlAccessibleListener(Control control, String controlName) {
- //strip mnemonic (&)
- String[] strs = controlName.split("&"); //$NON-NLS-1$
- StringBuffer stripped = new StringBuffer();
- for (int i = 0; i < strs.length; i++) {
- stripped.append(strs[i]);
- }
- control.getAccessible().addAccessibleListener(new ControlAccessibleListener(stripped.toString()));
- }
-
- private class ControlAccessibleListener extends AccessibleAdapter {
- private String controlName;
- ControlAccessibleListener(String name) {
- controlName = name;
- }
- public void getName(AccessibleEvent e) {
- e.result = controlName;
- }
-
- }
-} \ No newline at end of file
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
deleted file mode 100644
index 2050d0bc3..000000000
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Keith Seitz (keiths@redhat.com) - Bug 27243 (environment variables contribution)
- *******************************************************************************/
-package org.eclipse.ui.externaltools.internal.launchConfigurations;
-
-
-import java.io.File;
-import java.text.MessageFormat;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.variables.IStringVariableManager;
-import org.eclipse.core.variables.VariablesPlugin;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.ui.RefreshTab;
-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants;
-
-/**
- * Utilities for external tool launch configurations.
- * <p>
- * This class it not intended to be instantiated.
- * </p>
- */
-public class ExternalToolsUtil {
-
- /**
- * Throws a core exception with an error status object built from
- * the given message, lower level exception, and error code.
- *
- * @param message the status message
- * @param exception lower level exception associated with the
- * error, or <code>null</code> if none
- * @param code error code
- */
- protected static void abort(String message, Throwable exception, int code) throws CoreException {
- throw new CoreException(new Status(IStatus.ERROR, IExternalToolConstants.PLUGIN_ID, code, message, exception));
- }
-
- /**
- * Expands and returns the location attribute of the given launch
- * configuration. The location is
- * verified to point to an existing file, in the local file system.
- *
- * @param configuration launch configuration
- * @return an absolute path to a file in the local file system
- * @throws CoreException if unable to retrieve the associated launch
- * configuration attribute, if unable to resolve any variables, or if the
- * resolved location does not point to an existing file in the local file
- * system
- */
- public static IPath getLocation(ILaunchConfiguration configuration) throws CoreException {
- String location = configuration.getAttribute(IExternalToolConstants.ATTR_LOCATION, (String) null);
- if (location == null) {
- abort(MessageFormat.format(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsUtil.Location_not_specified_by_{0}_1"), new String[] { configuration.getName()}), null, 0); //$NON-NLS-1$
- } else {
- String expandedLocation = getStringVariableManager().performStringSubstitution(location);
- if (expandedLocation == null || expandedLocation.length() == 0) {
- String msg = MessageFormat.format(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsUtil.invalidLocation_{0}"), new Object[] { configuration.getName()}); //$NON-NLS-1$
- abort(msg, null, 0);
- } else {
- File file = new File(expandedLocation);
- if (file.isFile()) {
- return new Path(expandedLocation);
- }
-
- String msg = MessageFormat.format(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsUtil.invalidLocation_{0}"), new Object[] { configuration.getName()}); //$NON-NLS-1$
- abort(msg, null, 0);
- }
- }
- // execution will not reach here
- return null;
- }
-
- /**
- * Returns a boolean specifying whether or not output should be captured for
- * the given configuration
- *
- * @param configuration the configuration from which the value will be
- * extracted
- * @return boolean specifying whether or not output should be captured
- * @throws CoreException if unable to access the associated attribute
- */
- public static boolean getCaptureOutput(ILaunchConfiguration configuration) throws CoreException {
- return configuration.getAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, true);
- }
-
- /**
- * Expands and returns the working directory attribute of the given launch
- * configuration. Returns <code>null</code> if a working directory is not
- * specified. If specified, the working is verified to point to an existing
- * directory in the local file system.
- *
- * @param configuration launch configuration
- * @return an absolute path to a directory in the local file system, or
- * <code>null</code> if unspecified
- * @throws CoreException if unable to retrieve the associated launch
- * configuration attribute, if unable to resolve any variables, or if the
- * resolved location does not point to an existing directory in the local
- * file system
- */
- public static IPath getWorkingDirectory(ILaunchConfiguration configuration) throws CoreException {
- String location = configuration.getAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, (String) null);
- if (location != null) {
- String expandedLocation = getStringVariableManager().performStringSubstitution(location);
- if (expandedLocation.length() > 0) {
- File path = new File(expandedLocation);
- if (path.isDirectory()) {
- return new Path(expandedLocation);
- }
- String msg = MessageFormat.format(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsUtil.invalidDirectory_{0}"), new Object[] { expandedLocation, configuration.getName()}); //$NON-NLS-1$
- abort(msg, null, 0);
- }
- }
- return null;
- }
-
- /**
- * Expands and returns the arguments attribute of the given launch
- * configuration. Returns <code>null</code> if arguments are not specified.
- *
- * @param configuration launch configuration
- * @return an array of resolved arguments, or <code>null</code> if
- * unspecified
- * @throws CoreException if unable to retrieve the associated launch
- * configuration attribute, or if unable to resolve any variables
- */
- public static String[] getArguments(ILaunchConfiguration configuration) throws CoreException {
- String args = configuration.getAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, (String) null);
- if (args != null) {
- String expanded = getStringVariableManager().performStringSubstitution(args);
- return parseStringIntoList(expanded);
- }
- return null;
- }
-
- private static IStringVariableManager getStringVariableManager() {
- return VariablesPlugin.getDefault().getStringVariableManager();
- }
-
- /**
- * Returns whether the given launch configuration is enabled. This property
- * is intended only to apply to external tool builder configurations and
- * determines whether the project builder will launch the configuration
- * when it builds.
- *
- * @param configuration the configuration for which the enabled state should
- * be determined.
- * @return whether the given configuration is enabled to be run when a build occurs.
- * @throws CoreException if unable to access the associated attribute
- */
- public static boolean isBuilderEnabled(ILaunchConfiguration configuration) throws CoreException {
- return configuration.getAttribute(IExternalToolConstants.ATTR_BUILDER_ENABLED, true);
- }
-
- /**
- * Returns the collection of resources for the build scope as specified by the given launch configuration.
- *
- * @param configuration launch configuration
- * @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);
- if (scope == null) {
- return null;
- }
-
- return RefreshTab.getRefreshResources(scope);
- }
-
- /**
- * Parses the argument text into an array of individual
- * strings using the space character as the delimiter.
- * An individual argument containing spaces must have a
- * double quote (") at the start and end. Two double
- * quotes together is taken to mean an embedded double
- * quote in the argument text.
- *
- * @param arguments the arguments as one string
- * @return the array of arguments
- */
- public static String[] parseStringIntoList(String arguments) {
- if (arguments == null || arguments.length() == 0) {
- return new String[0];
- }
- String[] res= DebugPlugin.parseArguments(arguments);
- return res;
- }
-
-}
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/IgnoreWhiteSpaceComparator.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/IgnoreWhiteSpaceComparator.java
deleted file mode 100644
index f2f93146d..000000000
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/IgnoreWhiteSpaceComparator.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.externaltools.internal.launchConfigurations;
-
-import java.util.Comparator;
-
-public class IgnoreWhiteSpaceComparator implements Comparator {
-
- /* (non-Javadoc)
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- */
- public int compare(Object o1, Object o2) {
- String one= (String)o1;
- String two= (String)o2;
- int i1 = 0;
- int i2 = 0;
- int l1 = one.length();
- int l2 = two.length();
- char ch1 = ' ';
- char ch2 = ' ';
- while (i1 < l1 && i2 < l2) {
- while (i1 < l1 && Character.isWhitespace(ch1 = one.charAt(i1))) {
- i1++;
- }
- while (i2 < l2 && Character.isWhitespace(ch2 = two.charAt(i2))) {
- i2++;
- }
- if (i1 == l1 && i2 == l2) {
- return 0;
- }
- if (ch1 != ch2) {
- return -1;
- }
- i1++;
- i2++;
- }
- return 0;
- }
-}
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/WorkingSetComparator.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/WorkingSetComparator.java
deleted file mode 100644
index cd8fea5d2..000000000
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/WorkingSetComparator.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.externaltools.internal.launchConfigurations;
-
-import java.util.Comparator;
-
-import org.eclipse.debug.ui.RefreshTab;
-import org.eclipse.ui.IWorkingSet;
-
-/**
- * Comparator for refresh scope launch configuration attribute
- * <code>ATTR_REFRESH_SCOPE</code>.
- */
-public class WorkingSetComparator implements Comparator {
-
- /* (non-Javadoc)
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- */
- public int compare(Object o1, Object o2) {
- String one= (String)o1;
- String two= (String)o2;
- if (one == null || two == null) {
- if (one == two) {
- return 0;
- }
- return -1;
- }
- if (one.startsWith("${working_set:") && two.startsWith("${working_set:")) { //$NON-NLS-1$//$NON-NLS-2$
- IWorkingSet workingSet1 = RefreshTab.getWorkingSet(one);
- IWorkingSet workingSet2 = RefreshTab.getWorkingSet(two);
- if (workingSet1 == null || workingSet2 == null) {
- if (workingSet1 == workingSet2) {
- return 0;
- }
- return -1;
- }
- if (workingSet1.equals(workingSet2)) {
- return 0;
- }
- return -1;
- }
- return one.compareTo(two);
- }
-}

Back to the top