diff --git a/build/org.eclipse.cdt.make.ui/plugin.properties b/build/org.eclipse.cdt.make.ui/plugin.properties
index 3eea17795ca..50331a4ce30 100644
--- a/build/org.eclipse.cdt.make.ui/plugin.properties
+++ b/build/org.eclipse.cdt.make.ui/plugin.properties
@@ -22,8 +22,11 @@ CommandTargetCreate.name=Create Make Target
CommandTargetCreate.description=Create a new make build target for the selected container.
PreferenceMakeProject.name=New Make Projects
+PreferenceMakeTargets.name=Make Targets
+PreferenceScannerConfig.name=Scanner Configuration Discovery
PropertyMakeProject.name= C/C++ Make Project
+PropertyScannerConfig.name=Scanner Configuration Discovery
ViewCatagoryMake.name=Make
ViewMake.name=Make Targets
@@ -43,5 +46,3 @@ ActionDefinition.uncomment.description= Uncomment the selected # style comment l
MakefileEditor.name=Makefile Editor
-PropertyScannerConfig.name=Scanner Configuration Discovery
-PreferenceScannerConfig.name=Scanner Configuration Discovery
diff --git a/build/org.eclipse.cdt.make.ui/plugin.xml b/build/org.eclipse.cdt.make.ui/plugin.xml
index 4140b78e3ee..5ec5a348f95 100644
--- a/build/org.eclipse.cdt.make.ui/plugin.xml
+++ b/build/org.eclipse.cdt.make.ui/plugin.xml
@@ -237,10 +237,7 @@
category="org.eclipse.ui.category.project"
id="org.eclipse.cdt.make.ui.targetCreateCommand">
-
- open
is
+ * non-blocking.
+ *
+ * @param parent
+ * the parent shell, or null
to create a top-level shell
+ */
+ public GoToBackProgressMonitorDialog(Shell parent, String jobText) {
+ super(parent);
+ setShellStyle(SWT.BORDER | SWT.TITLE | SWT.APPLICATION_MODAL); // no close button
+ setBlockOnOpen(false);
+ fJobText = jobText;
+ }
+ /**
+ * Enables the cancel button (asynchronously).
+ */
+ private void asyncSetOperationCancelButtonEnabled(final boolean b) {
+ if (getShell() != null) {
+ getShell().getDisplay().asyncExec(new Runnable() {
+
+ public void run() {
+ setOperationCancelButtonEnabled(b);
+ }
+ });
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
+ */
+ protected void buttonPressed(int buttonId) {
+ if (buttonId == IDialogConstants.BACK_ID) {
+ progressMonitor.setInBackground(true);
+ toBackgroundButton.setEnabled(false);
+ cancel.setEnabled(true);
+ }
+ super.buttonPressed(buttonId);
+ }
+
+ /**
+ * The cancel button has been pressed.
+ *
+ * @since 3.0
+ */
+ protected void cancelPressed() {
+ //NOTE: this was previously done from a listener installed on the cancel
+ //button. On GTK, the listener installed by Dialog.createButton is called
+ //first and this was throwing an exception because the cancel button
+ //was already disposed
+ cancel.setEnabled(false);
+ toBackgroundButton.setEnabled(false);
+ progressMonitor.setCanceled(true);
+ super.cancelPressed();
+ }
+ /*
+ * (non-Javadoc) Method declared on Window.
+ */
+ /**
+ * The ProgressMonitorDialog
implementation of this method only closes the dialog if there are no currently
+ * running runnables.
+ */
+ public boolean close() {
+ if (getNestingDepth() <= 0) {
+ clearCursors();
+ return super.close();
+ }
+ return false;
+ }
+
+ /**
+ * Clear the cursors in the dialog.
+ *
+ * @since 3.0
+ */
+ protected void clearCursors() {
+ if (cancel != null && !cancel.isDisposed()) {
+ cancel.setCursor(null);
+ }
+ Shell shell = getShell();
+ if (shell != null && !shell.isDisposed()) {
+ shell.setCursor(null);
+ }
+ if (arrowCursor != null)
+ arrowCursor.dispose();
+ if (waitCursor != null)
+ waitCursor.dispose();
+ arrowCursor = null;
+ waitCursor = null;
+ }
+ /*
+ * (non-Javadoc) Method declared in Window.
+ */
+ protected void configureShell(Shell shell) {
+ super.configureShell(shell);
+ shell.setText(JFaceResources.getString("ProgressMonitorDialog.title")); //$NON-NLS-1$
+ if (waitCursor == null)
+ waitCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
+ shell.setCursor(waitCursor);
+ }
+
+ /*
+ * (non-Javadoc) Method declared on Dialog.
+ */
+ protected void createButtonsForButtonBar(Composite parent) {
+ // cancel button
+ toBackgroundButton = createButton(parent, IDialogConstants.BACK_ID, "Run in Background", true); //$NON-NLS-1$
+ cancel = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true);
+
+ if (arrowCursor == null)
+ arrowCursor = new Cursor(cancel.getDisplay(), SWT.CURSOR_ARROW);
+ cancel.setCursor(arrowCursor);
+ toBackgroundButton.setCursor(arrowCursor);
+ setOperationCancelButtonEnabled(enableCancelButton);
+ }
+
+ /*
+ * (non-Javadoc) Method declared on Dialog.
+ */
+ protected Control createDialogArea(Composite parent) {
+
+ setMessage(DEFAULT_TASKNAME);
+ createMessageArea(parent);
+
+ //Only set for backwards compatibility
+ taskLabel = messageLabel;
+
+ // progress indicator
+ progressIndicator = new ProgressIndicator(parent);
+ GridData gd = new GridData();
+ gd.heightHint = convertVerticalDLUsToPixels(BAR_DLUS);
+ gd.horizontalAlignment = GridData.FILL;
+ gd.grabExcessHorizontalSpace = true;
+ gd.horizontalSpan = 2;
+ progressIndicator.setLayoutData(gd);
+
+ // label showing current task
+ subTaskLabel = new Label(parent, SWT.LEFT | SWT.WRAP);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.heightHint = convertVerticalDLUsToPixels(LABEL_DLUS);
+ gd.horizontalSpan = 2;
+ subTaskLabel.setLayoutData(gd);
+ subTaskLabel.setFont(parent.getFont());
+
+ return parent;
+ }
+
+ /*
+ * (non-Javadoc) Method declared in Window.
+ */
+ protected Point getInitialSize() {
+
+ Point calculatedSize = super.getInitialSize();
+ if (calculatedSize.x < 450)
+ calculatedSize.x = 450;
+ return calculatedSize;
+ }
+ /**
+ * Returns the progress monitor to use for operations run in this progress dialog.
+ *
+ * @return the progress monitor
+ */
+ public IProgressMonitor getProgressMonitor() {
+ return progressMonitor;
+ }
+ /*
+ * (non-Javadoc) Method declared on IRunnableContext. Runs the given IRunnableWithProgress
with the progress
+ * monitor for this progress dialog. The dialog is opened before it is run, and closed after it completes.
+ */
+ public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException,
+ InterruptedException {
+ Assert.isTrue(fork);
+ setCancelable(cancelable);
+ try {
+ aboutToRun();
+ progressMonitor.setInBackground(false);
+
+ MyJob job = new MyJob(runnable, getShell().getDisplay());
+ job.schedule();
+ job.block();
+ if (progressMonitor.isCanceled()) {
+ throw new InterruptedException();
+ }
+ } finally {
+ finishedRun();
+ }
+ }
+
+ /**
+ * Returns whether the dialog should be opened before the operation is run. Defaults to true
+ *
+ * @return true
to open the dialog before run, false
to only create the dialog, but not open it
+ * @since 3.0
+ */
+ public boolean getOpenOnRun() {
+ return openOnRun;
+ }
+
+ /**
+ * Sets whether the dialog should be opened before the operation is run. NOTE: Setting this to false and not forking a process
+ * may starve any asyncExec that tries to open the dialog later.
+ *
+ * @param openOnRun
+ * true
to open the dialog before run, false
to only create the dialog, but not open it
+ * @since 3.0
+ */
+ public void setOpenOnRun(boolean openOnRun) {
+ this.openOnRun = openOnRun;
+ }
+
+ /**
+ * Returns the nesting depth of running operations.
+ *
+ * @return the nesting depth of running operations
+ * @since 3.0
+ */
+ protected int getNestingDepth() {
+ return nestingDepth;
+ }
+
+ /**
+ * Increments the nesting depth of running operations.
+ *
+ * @since 3.0
+ */
+ protected void incrementNestingDepth() {
+ nestingDepth++;
+ }
+
+ /**
+ * Decrements the nesting depth of running operations.
+ *
+ * @since 3.0
+ *
+ */
+ protected void decrementNestingDepth() {
+ nestingDepth--;
+ }
+
+ /**
+ * Called just before the operation is run. Default behaviour is to open or create the dialog, based on the setting of
+ * getOpenOnRun
, and increment the nesting depth.
+ *
+ * @since 3.0
+ */
+ protected void aboutToRun() {
+ if (getOpenOnRun()) {
+ open();
+ } else {
+ create();
+ }
+ incrementNestingDepth();
+ }
+
+ /**
+ * Called just after the operation is run. Default behaviour is to decrement the nesting depth, and close the dialog.
+ *
+ * @since 3.0
+ */
+ protected void finishedRun() {
+ decrementNestingDepth();
+ close();
+ }
+
+ /**
+ * Sets whether the progress dialog is cancelable or not.
+ *
+ * @param cancelable
+ * true
if the end user can cancel this progress dialog, and false
if it cannot be
+ * canceled
+ */
+ public void setCancelable(boolean cancelable) {
+ if (cancel == null)
+ enableCancelButton = cancelable;
+ else
+ asyncSetOperationCancelButtonEnabled(cancelable);
+ }
+ /**
+ * Helper to enable/disable Cancel button for this dialog.
+ *
+ * @param b
+ * true
to enable the cancel button, and false
to disable it
+ * @since 3.0
+ */
+ protected void setOperationCancelButtonEnabled(boolean b) {
+ operationCancelableState = b;
+ cancel.setEnabled(b);
+ }
+
+ /*
+ * @see org.eclipse.jface.dialogs.IconAndMessageDialog#getImage()
+ */
+ protected Image getImage() {
+ if (progressMonitor.locked)
+ return JFaceResources.getImageRegistry().get(org.eclipse.jface.dialogs.Dialog.DLG_IMG_LOCKED);
+ else
+ return JFaceResources.getImageRegistry().get(org.eclipse.jface.dialogs.Dialog.DLG_IMG_INFO);
+ }
+
+ /**
+ * Set the message in the message label.
+ */
+ private void setMessage(String messageString) {
+ //must not set null text in a label
+ message = messageString == null ? "" : messageString; //$NON-NLS-1$
+ if (messageLabel == null || messageLabel.isDisposed())
+ return;
+ messageLabel.setText(message);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.window.Window#open()
+ */
+ public int open() {
+ //Check to be sure it is not already done. If it is just return OK.
+ if (!getOpenOnRun()) {
+ if (getNestingDepth() == 0)
+ return OK;
+ }
+ return super.open();
+ }
+
+}
\ No newline at end of file
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakeTargetsPreferencePage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakeTargetsPreferencePage.java
new file mode 100644
index 00000000000..5dcbbb400bb
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakeTargetsPreferencePage.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 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:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.make.internal.ui.preferences;
+
+import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+public class MakeTargetsPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
+
+ private static final String PREF_BUILD_TARGET_IN_BACKGROUND = "MakeTargetPrefs.buildTargetInBackground"; //$NON-NLS-1$
+ private static final String TARGET_BUILDS_IN_BACKGROUND = "MakeTargetPreferencePage.buildTargetInBackground.label"; //$NON-NLS-1$
+
+ public MakeTargetsPreferencePage() {
+ super(GRID);
+ setPreferenceStore(MakeUIPlugin.getDefault().getPreferenceStore());
+ }
+
+ /**
+ * @see FieldEditorPreferencePage#createControl(Composite)
+ */
+ protected void createFieldEditors() {
+ Composite parent = getFieldEditorParent();
+
+ BooleanFieldEditor tagetBackgroundEditor = new BooleanFieldEditor(PREF_BUILD_TARGET_IN_BACKGROUND,
+ MakeUIPlugin.getResourceString(TARGET_BUILDS_IN_BACKGROUND), parent);
+ addField(tagetBackgroundEditor);
+ }
+
+ public static boolean isBuildTargetInBackground() {
+ return MakeUIPlugin.getDefault().getPreferenceStore().getBoolean(PREF_BUILD_TARGET_IN_BACKGROUND);
+ }
+
+ public static void setBuildTargetInBackground(boolean enable) {
+ MakeUIPlugin.getDefault().getPreferenceStore().setValue(PREF_BUILD_TARGET_IN_BACKGROUND, enable);
+ }
+
+ /**
+ * Initializes the default values of this page in the preference bundle.
+ */
+ public static void initDefaults(IPreferenceStore prefs) {
+ prefs.setDefault(PREF_BUILD_TARGET_IN_BACKGROUND, true);
+ }
+
+ public void init(IWorkbench workbench) {
+ }
+}
\ No newline at end of file
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakePreferencePage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/NewMakeProjectPreferencePage.java
similarity index 80%
rename from build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakePreferencePage.java
rename to build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/NewMakeProjectPreferencePage.java
index ec629b5400d..629168e8e7a 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakePreferencePage.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/NewMakeProjectPreferencePage.java
@@ -22,25 +22,11 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
-/**
- * This class represents a preference page that
- * is contributed to the Preferences dialog. By
- * subclassing FieldEditorPreferencePage, we
- * can use the field support built into JFace that allows
- * us to create a page that is small and knows how to
- * save, restore and apply itself.
- *
- * This page is used to modify preferences only. They - * are stored in the preference store that belongs to - * the main plug-in class. That way, preferences can - * be accessed directly via the preference store. - */ - -public class MakePreferencePage extends PreferencePage implements IWorkbenchPreferencePage, ICOptionContainer { +public class NewMakeProjectPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, ICOptionContainer { private MakeProjectOptionBlock fOptionBlock; - public MakePreferencePage() { + public NewMakeProjectPreferencePage() { setPreferenceStore(MakeUIPlugin.getDefault().getPreferenceStore()); setDescription(MakeUIPlugin.getResourceString("MakePreferencePage.description")); //$NON-NLS-1$ fOptionBlock = new MakeProjectOptionBlock(this); diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetBuild.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetBuild.java index ed562b57d2a..ebff0d85cb8 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetBuild.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetBuild.java @@ -1,8 +1,7 @@ package org.eclipse.cdt.make.ui; /* - * (c) Copyright QNX Software Systems Ltd. 2002. - * All Rights Reserved. + * (c) Copyright QNX Software Systems Ltd. 2002. All Rights Reserved. */ import java.lang.reflect.InvocationTargetException; @@ -11,13 +10,17 @@ import java.util.List; import org.eclipse.cdt.make.core.IMakeTarget; import org.eclipse.cdt.make.internal.ui.MakeUIPlugin; +import org.eclipse.cdt.make.internal.ui.dialogs.GoToBackProgressMonitorDialog; +import org.eclipse.cdt.make.internal.ui.preferences.MakeTargetsPreferencePage; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IWorkspaceRunnable; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.operation.IRunnableContext; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.swt.widgets.Shell; @@ -33,8 +36,7 @@ import org.eclipse.ui.actions.BuildAction; public class TargetBuild { /** - * Causes all editors to save any modified resources depending on the user's - * preference. + * Causes all editors to save any modified resources depending on the user's preference. */ static void saveAllResources(IMakeTarget[] targets) { @@ -68,36 +70,74 @@ public class TargetBuild { } } } - + static public void runWithProgressDialog(Shell shell, IMakeTarget[] targets) { - ProgressMonitorDialog pd = new ProgressMonitorDialog(shell); + GoToBackProgressMonitorDialog pd = new GoToBackProgressMonitorDialog(shell, + MakeUIPlugin.getResourceString("TargetBuild.backgroundTask.name")); //$NON-NLS-1$ try { TargetBuild.run(true, pd, targets); } catch (InvocationTargetException e) { - MakeUIPlugin.errorDialog(shell, MakeUIPlugin.getResourceString("TargetBuild.execption.message"), e.getTargetException().toString(), e.getTargetException()); //$NON-NLS-1$ + MakeUIPlugin.errorDialog(shell, MakeUIPlugin.getResourceString("TargetBuild.execption.message"), //$NON-NLS-1$ + e.getTargetException().toString(), e.getTargetException()); } } - + + static public void buildTargets(Shell shell, final IMakeTarget[] targets) { + if (MakeTargetsPreferencePage.isBuildTargetInBackground()) { + new Job(MakeUIPlugin.getResourceString("TargetBuild.backgroundTask.name")) { //$NON-NLS-1$ + + protected IStatus run(IProgressMonitor monitor) { + monitor.beginTask(MakeUIPlugin.getResourceString("TargetBuild.monitor.beginTask"), targets.length); //$NON-NLS-1$ + try { + for (int i = 0; i < targets.length; i++) { + final IMakeTarget target = targets[i]; + IWorkspaceRunnable runnable = new IWorkspaceRunnable() { + + public void run(IProgressMonitor monitor) throws CoreException { + target.build(new SubProgressMonitor(monitor, 1)); + } + }; + MakeUIPlugin.getWorkspace().run(runnable, monitor); + } + } catch (CoreException e) { + return e.getStatus(); + } catch (OperationCanceledException e) { + } finally { + monitor.done(); + } + return Status.OK_STATUS; + } + }.schedule(); + } else { + runWithProgressDialog(shell, targets); + } + } + static public void run(boolean fork, IRunnableContext context, final IMakeTarget[] targets) throws InvocationTargetException { try { saveAllResources(targets); context.run(fork, true, new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + monitor.beginTask(MakeUIPlugin.getResourceString("TargetBuild.monitor.beginTask"), targets.length); //$NON-NLS-1$ try { - IWorkspaceRunnable runnable = new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - monitor.beginTask(MakeUIPlugin.getResourceString("TargetBuild.monitor.beginTask"), targets.length); //$NON-NLS-1$ - for( int i = 0; i < targets.length; i++) { - targets[i].build(new SubProgressMonitor(monitor, 1)); + for (int i = 0; i < targets.length; i++) { + final IMakeTarget target = targets[i]; + IWorkspaceRunnable runnable = new IWorkspaceRunnable() { + + public void run(IProgressMonitor monitor) throws CoreException { + target.build(new SubProgressMonitor(monitor, 1)); } - } - }; - MakeUIPlugin.getWorkspace().run(runnable, monitor); + }; + MakeUIPlugin.getWorkspace().run(runnable, monitor); + } } catch (CoreException e) { throw new InvocationTargetException(e); } catch (OperationCanceledException e) { throw new InterruptedException(e.getMessage()); + } finally { + monitor.done(); } } }); @@ -105,4 +145,4 @@ public class TargetBuild { return; } } -} +} \ No newline at end of file diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/BuildTargetDialog.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/BuildTargetDialog.java index a1c76a57d8d..77979af7a4c 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/BuildTargetDialog.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/BuildTargetDialog.java @@ -80,7 +80,7 @@ public class BuildTargetDialog extends Dialog { IMakeTarget selected = targetPart.getSelectedTarget(); super.okPressed(); if (selected != null) { - TargetBuild.runWithProgressDialog(getParentShell(), new IMakeTarget[] { selected }); + TargetBuild.buildTargets(getParentShell(), new IMakeTarget[] { selected }); } } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/SettingsBlock.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/SettingsBlock.java index 2596fa03904..51929a2351a 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/SettingsBlock.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/SettingsBlock.java @@ -55,6 +55,7 @@ public class SettingsBlock extends AbstractCOptionPage { private static final String MAKE_WORKBENCH_BUILD_AUTO = PREFIX + ".makeWorkbench.auto"; //$NON-NLS-1$ private static final String MAKE_WORKBENCH_BUILD_INCR = PREFIX + ".makeWorkbench.incremental"; //$NON-NLS-1$ private static final String MAKE_WORKBENCH_BUILD_FULL = PREFIX + ".makeWorkbench.full"; //$NON-NLS-1$ + private static final String MAKE_WORKBENCH_BUILD_CLEAN = PREFIX + ".makeWorkbench.clean"; //$NON-NLS-1$ private static final String MAKE_BUILD_DIR_GROUP = PREFIX + ".makeDir.group_label"; //$NON-NLS-1$ private static final String MAKE_BUILD_DIR_LABEL = PREFIX + ".makeDir.label"; //$NON-NLS-1$ @@ -70,9 +71,11 @@ public class SettingsBlock extends AbstractCOptionPage { Text targetFull; Text targetIncr; Text targetAuto; + Text targetClean; Button fullButton; Button incrButton; Button autoButton; + Button cleanButton; IMakeBuilderInfo fBuildInfo; Preferences fPrefs; @@ -154,6 +157,7 @@ public class SettingsBlock extends AbstractCOptionPage { targetAuto.setEnabled(autoButton.getSelection()); targetFull.setEnabled(fullButton.getSelection()); targetIncr.setEnabled(incrButton.getSelection()); + targetClean.setEnabled(cleanButton.getSelection()); getContainer().updateContainer(); } @@ -189,6 +193,14 @@ public class SettingsBlock extends AbstractCOptionPage { targetFull.setText(fBuildInfo.getFullBuildTarget()); ((GridData) (targetFull.getLayoutData())).horizontalAlignment = GridData.FILL; ((GridData) (targetFull.getLayoutData())).grabExcessHorizontalSpace = true; + + cleanButton = ControlFactory.createCheckBox(group, MakeUIPlugin.getResourceString(MAKE_WORKBENCH_BUILD_CLEAN)); + cleanButton.addSelectionListener(selectionAdapter); + cleanButton.setSelection(fBuildInfo.isCleanBuildEnabled()); + targetClean = ControlFactory.createTextField(group, SWT.SINGLE | SWT.BORDER); + targetClean.setText(fBuildInfo.getCleanBuildTarget()); + ((GridData) (targetClean.getLayoutData())).horizontalAlignment = GridData.FILL; + ((GridData) (targetClean.getLayoutData())).grabExcessHorizontalSpace = true; selectionAdapter.widgetSelected(null); } @@ -308,6 +320,8 @@ public class SettingsBlock extends AbstractCOptionPage { info.setIncrementalBuildTarget(targetIncr.getText().trim()); info.setFullBuildEnable(fullButton.getSelection()); info.setFullBuildTarget(targetFull.getText().trim()); + info.setCleanBuildEnable(cleanButton.getSelection()); + info.setCleanBuildTarget(targetClean.getText().trim()); if (buildLocation != null) { info.setBuildLocation(new Path(buildLocation.getText().trim())); } @@ -352,6 +366,8 @@ public class SettingsBlock extends AbstractCOptionPage { targetIncr.setText(info.getIncrementalBuildTarget()); fullButton.setSelection(info.isFullBuildEnabled()); targetFull.setText(info.getFullBuildTarget()); + cleanButton.setSelection(info.isCleanBuildEnabled()); + targetClean.setText(info.getCleanBuildTarget()); } boolean isStopOnError() { diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/BuildTargetAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/BuildTargetAction.java index 934cf8545ab..106a2ef90cc 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/BuildTargetAction.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/BuildTargetAction.java @@ -33,7 +33,7 @@ public class BuildTargetAction extends SelectionListenerAction { public void run() { if (canBuild()) { IMakeTarget[] targets = (IMakeTarget[]) getSelectedElements().toArray(new IMakeTarget[0]); - TargetBuild.runWithProgressDialog(shell, targets); + TargetBuild.buildTargets(shell, targets); } }