Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Swanson2005-02-07 23:27:34 +0000
committerDarin Swanson2005-02-07 23:27:34 +0000
commitb072e960ec2d916c44c6df368d0c9ef1e01c3867 (patch)
treefe98694c4971be8ebceaf7513f7dc9935a738831 /org.eclipse.ui.externaltools
parent0e2eb83d55526d6cf5c958e7b2b9eb6475e4eff1 (diff)
downloadeclipse.platform.debug-b072e960ec2d916c44c6df368d0c9ef1e01c3867.tar.gz
eclipse.platform.debug-b072e960ec2d916c44c6df368d0c9ef1e01c3867.tar.xz
eclipse.platform.debug-b072e960ec2d916c44c6df368d0c9ef1e01c3867.zip
Bug 82405 - Adjust to new ICommand API
Diffstat (limited to 'org.eclipse.ui.externaltools')
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java1
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java35
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolBuilder.java4
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/IExternalToolConstants.java9
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java27
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/EditCommandDialog.java79
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.properties8
-rw-r--r--org.eclipse.ui.externaltools/plugin.xml3
8 files changed, 158 insertions, 8 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
index 4ad34f979..aaa1ec9cc 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
@@ -143,6 +143,7 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab {
buffer.append(',');
configuration.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, buffer.toString());
configuration.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, false);
+ configuration.setAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, true);
}
/* (non-Javadoc)
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java
index e253213e0..4419e0c11 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java
@@ -18,6 +18,7 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -125,6 +126,7 @@ public class BuilderUtils {
try {
newCommand = project.getDescription().newCommand();
newCommand = toBuildCommand(project, config, newCommand);
+ configureTriggers(config, newCommand);
} catch (CoreException exception) {
Shell shell= ExternalToolsPlugin.getActiveWorkbenchShell();
if (shell != null) {
@@ -134,6 +136,36 @@ public class BuilderUtils {
}
return newCommand;
}
+
+ private static void configureTriggers(ILaunchConfiguration config, ICommand newCommand) throws CoreException {
+ newCommand.setBuilding(IncrementalProjectBuilder.FULL_BUILD, false);
+ newCommand.setBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD, false);
+ newCommand.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, false);
+ newCommand.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, false);
+ String buildKinds= config.getAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, (String)null);
+ int[] triggers= ExternalToolBuilder.buildTypesToArray(buildKinds);
+ for (int i = 0; i < triggers.length; i++) {
+ switch (triggers[i]) {
+ case IncrementalProjectBuilder.FULL_BUILD:
+ newCommand.setBuilding(IncrementalProjectBuilder.FULL_BUILD, true);
+ break;
+ case IncrementalProjectBuilder.INCREMENTAL_BUILD:
+ newCommand.setBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD, true);
+ break;
+ case IncrementalProjectBuilder.AUTO_BUILD:
+ newCommand.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, true);
+ break;
+ case IncrementalProjectBuilder.CLEAN_BUILD:
+ newCommand.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, true);
+ break;
+ }
+ }
+ if (!config.getAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false)) {
+ ILaunchConfigurationWorkingCopy copy= config.getWorkingCopy();
+ copy.setAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, true);
+ copy.doSave();
+ }
+ }
/**
* Returns whether the given configuration is an "unmigrated" builder.
@@ -238,8 +270,7 @@ public class BuilderUtils {
* IExternalToolConstants.EXTENSION_POINT_CONFIGURATION_DUPLICATION_MAPS.
*/
public static ILaunchConfiguration duplicateConfiguration(IProject project, ILaunchConfiguration config) throws CoreException {
- Map attributes= null;
- attributes= config.getAttributes();
+ Map attributes= config.getAttributes();
String newName= new StringBuffer(config.getName()).append(ExternalToolsModelMessages.getString("BuilderUtils.7")).toString(); //$NON-NLS-1$
newName= DebugPlugin.getDefault().getLaunchManager().generateUniqueLaunchConfigurationNameFrom(newName);
ILaunchConfigurationType newType= getConfigurationDuplicationType(config);
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolBuilder.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolBuilder.java
index d3a003ba4..8c7a05750 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolBuilder.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolBuilder.java
@@ -66,6 +66,10 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder {
private List projectsWithinScope;
private boolean buildKindCompatible(int kind, ILaunchConfiguration config) throws CoreException {
+ if (config.getAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false)) {
+ //triggers have been set on the ICommand associated with this builder..therefore build kind must be compatible
+ return true;
+ }
int[] buildKinds = buildTypesToArray(config.getAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, "")); //$NON-NLS-1$
for (int j = 0; j < buildKinds.length; j++) {
if (kind == buildKinds[j]) {
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 a0cd1ecb6..e99c3178a 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
@@ -76,7 +76,7 @@ public interface IExternalToolConstants {
public static final String BUILD_TYPE_AUTO = "auto"; //$NON-NLS-1$
/**
- * Build type indicating an no project build request for
+ * Build type indicating no project build request for
* the external tool running as a builder (value <code>none</code>).
*/
public static final String BUILD_TYPE_NONE = "none"; //$NON-NLS-1$
@@ -197,4 +197,11 @@ public interface IExternalToolConstants {
* The value is the name of the disabled builder.
*/
public static final String ATTR_DISABLED_BUILDER = PLUGIN_ID + ".ATTR_DISABLED_BUILDER"; //$NON-NLS-1$
+
+ /**
+ * boolean attribute identifying that an external tool builder has been configured for triggering
+ * using the <code>ICommand.setBuilding(int)</code> mechanism
+ * @since 3.1
+ */
+ public static final String ATTR_TRIGGERS_CONFIGURED = PLUGIN_ID + ".ATTR_TRIGGERS_CONFIGURED"; //$NON-NLS-1$
} \ No newline at end of file
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java
index ab08d3e6f..d04e429e8 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java
@@ -25,6 +25,7 @@ import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceDescription;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
@@ -668,10 +669,22 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
handleException(e);
}
}
+ } else if (data instanceof ICommand) {
+ ICommand command= (ICommand) data;
+ if (command.isConfigurable()) {
+ if (editCommand(command)) {
+ userHasMadeChanges= true;
+ }
+ }
}
}
}
+ private boolean editCommand(ICommand data) {
+ EditCommandDialog dialog= new EditCommandDialog(getShell(), data);
+ return Window.OK == dialog.open();
+ }
+
/**
* Prompts the user to proceed with the migration of a project builder from
* the old format to the new, launch configuration-based, format and returns
@@ -748,12 +761,13 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
enableRemove= ext == null;
}
} else {
- enableEdit= false;
-
if (data instanceof ErrorConfig) {
+ enableEdit= false;
continue;
}
- IExtension ext= Platform.getExtensionRegistry().getExtension(ResourcesPlugin.PI_RESOURCES, ResourcesPlugin.PT_BUILDERS, ((ICommand)data).getBuilderName());
+ ICommand command= (ICommand) data;
+ enableEdit= command.isConfigurable();
+ IExtension ext= Platform.getExtensionRegistry().getExtension(ResourcesPlugin.PI_RESOURCES, ResourcesPlugin.PT_BUILDERS, command.getBuilderName());
enableRemove= ext == null;
break;
}
@@ -1103,6 +1117,13 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
return true;
}
}
+
+ if (oldCommand.isBuilding(IncrementalProjectBuilder.AUTO_BUILD) != newCommand.isBuilding(IncrementalProjectBuilder.AUTO_BUILD)
+ || oldCommand.isBuilding(IncrementalProjectBuilder.CLEAN_BUILD) != newCommand.isBuilding(IncrementalProjectBuilder.CLEAN_BUILD)
+ || oldCommand.isBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD) != newCommand.isBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD)
+ || oldCommand.isBuilding(IncrementalProjectBuilder.FULL_BUILD) != newCommand.isBuilding(IncrementalProjectBuilder.FULL_BUILD)) {
+ return true;
+ }
}
} catch (CoreException ce) {
return true;
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/EditCommandDialog.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/EditCommandDialog.java
new file mode 100644
index 000000000..837799ffd
--- /dev/null
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/EditCommandDialog.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2005 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.ui;
+
+import org.eclipse.core.resources.ICommand;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Dialog to alter the triggers of an ICommand that represents a builder.
+ */
+public class EditCommandDialog extends Dialog {
+
+ private Button fFullButton;
+ private Button fIncrementalButton;
+ private Button fAutoButton;
+ private Button fCleanButton;
+
+ private ICommand fCommand;
+
+ public EditCommandDialog(Shell parentShell, ICommand command) {
+ super(parentShell);
+ fCommand= command;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createDialogArea(Composite parent) {
+
+ getShell().setText(ExternalToolsUIMessages.getString("EditCommandDialog.0")); //$NON-NLS-1$
+ Composite composite = (Composite)super.createDialogArea(parent);
+
+ Label label= new Label(composite, SWT.NONE);
+ label.setText(ExternalToolsUIMessages.getString("EditCommandDialog.1")); //$NON-NLS-1$
+
+ fFullButton = new Button(composite, SWT.CHECK);
+ fFullButton.setText(ExternalToolsUIMessages.getString("EditCommandDialog.2")); //$NON-NLS-1$
+ fFullButton.setSelection(fCommand.isBuilding(IncrementalProjectBuilder.FULL_BUILD));
+ fIncrementalButton = new Button(composite, SWT.CHECK);
+ fIncrementalButton.setText(ExternalToolsUIMessages.getString("EditCommandDialog.3")); //$NON-NLS-1$
+ fIncrementalButton.setSelection(fCommand.isBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD));
+ fAutoButton = new Button(composite, SWT.CHECK);
+ fAutoButton.setText(ExternalToolsUIMessages.getString("EditCommandDialog.4")); //$NON-NLS-1$
+ fAutoButton.setSelection(fCommand.isBuilding(IncrementalProjectBuilder.AUTO_BUILD));
+
+ fCleanButton = new Button(composite, SWT.CHECK);
+ fCleanButton.setText(ExternalToolsUIMessages.getString("EditCommandDialog.5")); //$NON-NLS-1$
+ fCleanButton.setSelection(fCommand.isBuilding(IncrementalProjectBuilder.CLEAN_BUILD));
+ applyDialogFont(composite);
+ return composite;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+ */
+ protected void okPressed() {
+ fCommand.setBuilding(IncrementalProjectBuilder.FULL_BUILD, fFullButton.getSelection());
+ fCommand.setBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD, fIncrementalButton.getSelection());
+ fCommand.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, fAutoButton.getSelection());
+ fCommand.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, fCleanButton.getSelection());
+
+ super.okPressed();
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.properties b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.properties
index 4827229f0..cc72d6600 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.properties
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2004 IBM Corporation and others.
+# Copyright (c) 2000, 2005 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Common Public License v1.0
# which accompanies this distribution, and is available at
@@ -52,3 +52,9 @@ ExternalToolsPreferencePage.1=C&onfirm before migrating projects to the new form
ExternalToolMigration.37=An exception occurred accessing external tool\'s \"run in background\" attribute
ExternalToolMigration.38=An exception occurred attempting to migrate external tool\'s \"run in background\" attribute
+EditCommandDialog.0=Configure Builder
+EditCommandDialog.1=Run this builder:
+EditCommandDialog.2=After a "&Clean"
+EditCommandDialog.3=During &manual builds
+EditCommandDialog.4=During &auto builds
+EditCommandDialog.5=&During a "Clean"
diff --git a/org.eclipse.ui.externaltools/plugin.xml b/org.eclipse.ui.externaltools/plugin.xml
index 1b0846cd1..1b7314ff8 100644
--- a/org.eclipse.ui.externaltools/plugin.xml
+++ b/org.eclipse.ui.externaltools/plugin.xml
@@ -122,7 +122,8 @@
id="ExternalToolBuilder"
name="%Builder.externalTools"
point="org.eclipse.core.resources.builders">
- <builder>
+ <builder
+ isConfigurable= "true">
<run
class="org.eclipse.ui.externaltools.internal.model.ExternalToolBuilder">
</run>

Back to the top