1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-08 08:45:44 +02:00

- cleanup UI

- fixed problems with make target editor
This commit is contained in:
David Inglis 2004-01-13 18:54:39 +00:00
parent 44e85901c9
commit c1d289e14d
6 changed files with 72 additions and 67 deletions

View file

@ -27,11 +27,10 @@ WizardCheckboxTablePart.WizardCheckboxTablePart.counter={0} of {1} Selected
SettingsBlock.label=Make Builder
SettingsBlock.message=Make builder settings.
SettingsBlock.makeSetting.group_label=Build Setting
SettingsBlock.makeSetting.keepOnGoing=Keep Going On Error
SettingsBlock.makeSetting.stopOnError=Stop On Error
SettingsBlock.makeCmd.group_label=Build Command
SettingsBlock.makeCmd.use_default=Use Default
SettingsBlock.makeCmd.label=Build Command:
SettingsBlock.makeSetting.stopOnError=Stop on first build error.
SettingsBlock.makeCmd.group_label=Build command
SettingsBlock.makeCmd.use_default=Use default
SettingsBlock.makeCmd.label=Build command:
SettingsBlock.makeDir.group_label=Build Directory
SettingsBlock.makeDir.label=Build directory:
SettingsBlock.makeDir.browse=Browse...

View file

@ -76,6 +76,6 @@ public class LexicalSortingAction extends Action {
}
return 3;
}
};
}
}

View file

@ -45,7 +45,7 @@ public class MakefileSourceConfiguration extends SourceViewerConfiguration {
public SingleTokenScanner(TextAttribute attribute) {
setDefaultReturnToken(new Token(attribute));
}
};
}
/**
* Constructor for MakeConfiguration

View file

@ -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.util.ArrayList;
@ -194,7 +193,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
if (viewer instanceof AbstractTreeViewer) {
((AbstractTreeViewer) viewer).remove(affected.toArray());
} else {
((StructuredViewer) viewer).refresh(resource);
viewer.refresh(resource);
}
}
}
@ -212,7 +211,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
if (viewer instanceof AbstractTreeViewer) {
((AbstractTreeViewer) viewer).add(resource, affected.toArray());
} else {
((StructuredViewer) viewer).refresh(resource);
viewer.refresh(resource);
}
}
}
@ -223,7 +222,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
Control ctrl = viewer.getControl();
if (ctrl != null && !ctrl.isDisposed()) {
// Do a sync exec, not an async exec, since the resource delta
// must be traversed in this method. It is destroyed
// must be traversed in this method. It is destroyed
// when this method returns.
ctrl.getDisplay().syncExec(new Runnable() {
public void run() {

View file

@ -1,21 +1,19 @@
/*
/*******************************************************************************
* Created on 22-Aug-2003
*
*
* Copyright (c) 2002,2003 QNX Software Systems Ltd.
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
* Contributors: QNX Software Systems - Initial API and implementation
******************************************************************************/
package org.eclipse.cdt.make.ui.dialogs;
import org.eclipse.cdt.make.core.IMakeBuilderInfo;
import org.eclipse.cdt.make.core.IMakeTarget;
import org.eclipse.cdt.make.core.IMakeTargetManager;
import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.internal.ui.*;
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
import org.eclipse.cdt.make.internal.ui.MessageLine;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.cdt.utils.ui.controls.RadioButtonsArea;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@ -52,18 +50,14 @@ public class MakeTargetDialog extends Dialog {
private static final String SETTING_PREFIX = "SettingsBlock"; //$NON-NLS-1$
private static final String MAKE_SETTING_GROUP = SETTING_PREFIX + ".makeSetting.group_label"; //$NON-NLS-1$
private static final String MAKE_SETTING_KEEP_GOING = SETTING_PREFIX + ".makeSetting.keepOnGoing"; //$NON-NLS-1$
private static final String MAKE_SETTING_STOP_ERROR = SETTING_PREFIX + ".makeSetting.stopOnError"; //$NON-NLS-1$
private static final String MAKE_CMD_GROUP = SETTING_PREFIX + ".makeCmd.group_label"; //$NON-NLS-1$
private static final String MAKE_CMD_USE_DEFAULT = SETTING_PREFIX + ".makeCmd.use_default"; //$NON-NLS-1$
private static final String MAKE_CMD_LABEL = SETTING_PREFIX + ".makeCmd.label"; //$NON-NLS-1$
private static final String KEEP_ARG = "keep"; //$NON-NLS-1$
private static final String STOP_ARG = "stop"; //$NON-NLS-1$
Text targetNameText;
RadioButtonsArea stopRadioButtons;
Button stopOnErrorButton;
Text commandText;
Button defButton;
Text targetText;
@ -115,7 +109,6 @@ public class MakeTargetDialog extends Dialog {
buildCommand = buildInfo.getBuildCommand();
buildArguments = buildInfo.getBuildArguments();
targetString = buildInfo.getIncrementalBuildTarget();
targetName = "";
}
protected void configureShell(Shell newShell) {
@ -129,7 +122,9 @@ public class MakeTargetDialog extends Dialog {
super.configureShell(newShell);
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
protected Control createDialogArea(Composite parent) {
@ -152,14 +147,15 @@ public class MakeTargetDialog extends Dialog {
createNameControl(composite);
createTargetControl(composite);
createSettingControls(composite);
createBuildCmdControls(composite);
createSettingControls(composite);
return composite;
}
protected void createNameControl(Composite parent) {
Composite composite = ControlFactory.createComposite(parent, 2);
((GridLayout) composite.getLayout()).makeColumnsEqualWidth = false;
((GridLayout) composite.getLayout()).horizontalSpacing = 0;
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label label = ControlFactory.createLabel(composite, MakeUIPlugin.getResourceString(TARGET_NAME_LABEL));
((GridData) (label.getLayoutData())).horizontalAlignment = GridData.BEGINNING;
@ -167,7 +163,6 @@ public class MakeTargetDialog extends Dialog {
targetNameText = ControlFactory.createTextField(composite, SWT.SINGLE | SWT.BORDER);
((GridData) (targetNameText.getLayoutData())).horizontalAlignment = GridData.FILL;
((GridData) (targetNameText.getLayoutData())).grabExcessHorizontalSpace = true;
targetNameText.setText(targetName);
targetNameText.addListener(SWT.Modify, new Listener() {
public void handleEvent(Event e) {
String newName = targetNameText.getText().trim();
@ -185,25 +180,28 @@ public class MakeTargetDialog extends Dialog {
getButton(IDialogConstants.OK_ID).setEnabled(false);
}
}
});
}
protected void createSettingControls(Composite parent) {
String[][] radios = new String[][] { { MakeUIPlugin.getResourceString(MAKE_SETTING_STOP_ERROR), STOP_ARG }, {
MakeUIPlugin.getResourceString(MAKE_SETTING_KEEP_GOING), KEEP_ARG }
};
stopRadioButtons = new RadioButtonsArea(parent, MakeUIPlugin.getResourceString(MAKE_SETTING_GROUP), 1, radios);
if (isStopOnError)
stopRadioButtons.setSelectValue(STOP_ARG);
else
stopRadioButtons.setSelectValue(KEEP_ARG);
Group group = ControlFactory.createGroup(parent, MakeUIPlugin.getResourceString(MAKE_SETTING_GROUP), 1);
stopOnErrorButton = new Button(group, SWT.CHECK);
stopOnErrorButton.setText(MakeUIPlugin.getResourceString(MAKE_SETTING_STOP_ERROR));
if (isStopOnError) {
stopOnErrorButton.setSelection(true);
}
if (isDefaultCommand) {
stopOnErrorButton.setEnabled(true);
} else {
stopOnErrorButton.setEnabled(false);
}
}
protected void createBuildCmdControls(Composite parent) {
Group group = ControlFactory.createGroup(parent, MakeUIPlugin.getResourceString(MAKE_CMD_GROUP), 1);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
layout.horizontalSpacing = 0;
layout.makeColumnsEqualWidth = false;
group.setLayout(layout);
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@ -212,10 +210,10 @@ public class MakeTargetDialog extends Dialog {
public void widgetSelected(SelectionEvent e) {
if (defButton.getSelection() == true) {
commandText.setEnabled(false);
stopRadioButtons.setEnabled(true);
stopOnErrorButton.setEnabled(true);
} else {
commandText.setEnabled(true);
stopRadioButtons.setEnabled(false);
stopOnErrorButton.setEnabled(false);
}
}
});
@ -249,7 +247,7 @@ public class MakeTargetDialog extends Dialog {
if (isDefaultCommand) {
commandText.setEnabled(false);
} else {
stopRadioButtons.setEnabled(false);
commandText.setEnabled(true);
}
defButton.setSelection(isDefaultCommand);
}
@ -277,10 +275,28 @@ public class MakeTargetDialog extends Dialog {
createButton(parent, IDialogConstants.OK_ID, "Create", true);
}
createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
//do this here because setting the text will set enablement on the ok button
targetNameText.setFocus();
if (targetName != null) {
targetNameText.setText(targetName);
} else {
targetNameText.setText(generateUniqueName(targetString));
}
targetNameText.selectAll();
}
private String generateUniqueName(String targetString) {
String newName = targetString;
int i = 0;
while(fTargetManager.findTarget(fContainer, newName) != null) {
i++;
newName = targetString + " (" + Integer.toString(i) + ")";
}
return newName;
}
private boolean isStopOnError() {
return stopRadioButtons.getSelectedValue().equals(STOP_ARG);
return stopOnErrorButton.getSelection();
}
private boolean useDefaultBuildCmd() {

View file

@ -12,7 +12,6 @@ import org.eclipse.cdt.make.ui.IMakeHelpContextIds;
import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage;
import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.cdt.utils.ui.controls.RadioButtonsArea;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
@ -43,7 +42,6 @@ public class SettingsBlock extends AbstractCOptionPage {
private static final String MAKE_MESSAGE = PREFIX + ".message"; //$NON-NLS-1$
private static final String MAKE_SETTING_GROUP = PREFIX + ".makeSetting.group_label"; //$NON-NLS-1$
private static final String MAKE_SETTING_KEEP_GOING = PREFIX + ".makeSetting.keepOnGoing"; //$NON-NLS-1$
private static final String MAKE_SETTING_STOP_ERROR = PREFIX + ".makeSetting.stopOnError"; //$NON-NLS-1$
private static final String MAKE_CMD_GROUP = PREFIX + ".makeCmd.group_label"; //$NON-NLS-1$
@ -61,10 +59,7 @@ public class SettingsBlock extends AbstractCOptionPage {
private static final String MAKE_BUILD_DIR_LABEL = PREFIX + ".makeDir.label"; //$NON-NLS-1$
private static final String MAKE_BUILD_DIR_BROWSE = PREFIX + ".makeDir.browse"; //$NON-NLS-1$
private static final String KEEP_ARG = "keep"; //$NON-NLS-1$
private static final String STOP_ARG = "stop"; //$NON-NLS-1$
RadioButtonsArea stopRadioButtons;
Button stopOnErrorButton;
Button defButton;
Text buildCommand;
@ -90,18 +85,12 @@ public class SettingsBlock extends AbstractCOptionPage {
}
protected void createSettingControls(Composite parent) {
String[][] radios = new String[][] { { MakeUIPlugin.getResourceString(MAKE_SETTING_STOP_ERROR), STOP_ARG }, {
MakeUIPlugin.getResourceString(MAKE_SETTING_KEEP_GOING), KEEP_ARG }
};
stopRadioButtons = new RadioButtonsArea(parent, MakeUIPlugin.getResourceString(MAKE_SETTING_GROUP), 1, radios);
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
stopRadioButtons.setLayout(layout);
if (fBuildInfo.isStopOnError())
stopRadioButtons.setSelectValue(STOP_ARG);
else
stopRadioButtons.setSelectValue(KEEP_ARG);
Group group = ControlFactory.createGroup(parent, MakeUIPlugin.getResourceString(MAKE_SETTING_GROUP), 1);
stopOnErrorButton = new Button(group, SWT.CHECK);
stopOnErrorButton.setText(MakeUIPlugin.getResourceString(MAKE_SETTING_STOP_ERROR));
if (fBuildInfo.isStopOnError()) {
stopOnErrorButton.setSelection(true);
}
}
protected void createBuildCmdControls(Composite parent) {
@ -117,11 +106,11 @@ public class SettingsBlock extends AbstractCOptionPage {
public void widgetSelected(SelectionEvent e) {
if (defButton.getSelection() == true) {
buildCommand.setEnabled(false);
stopRadioButtons.setEnabled(true);
stopOnErrorButton.setEnabled(true);
getContainer().updateContainer();
} else {
buildCommand.setEnabled(true);
stopRadioButtons.setEnabled(false);
stopOnErrorButton.setEnabled(false);
getContainer().updateContainer();
}
}
@ -154,7 +143,7 @@ public class SettingsBlock extends AbstractCOptionPage {
if (fBuildInfo.isDefaultBuildCmd()) {
buildCommand.setEnabled(false);
} else {
stopRadioButtons.setEnabled(false);
stopOnErrorButton.setEnabled(false);
}
defButton.setSelection(fBuildInfo.isDefaultBuildCmd());
}
@ -254,8 +243,8 @@ public class SettingsBlock extends AbstractCOptionPage {
return;
}
createSettingControls(composite);
createBuildCmdControls(composite);
createSettingControls(composite);
createWorkBenchBuildControls(composite);
if (getContainer().getProject() != null) {
@ -335,9 +324,9 @@ public class SettingsBlock extends AbstractCOptionPage {
info = MakeCorePlugin.createBuildInfo(fPrefs, fBuilderID, true);
}
if (info.isStopOnError())
stopRadioButtons.setSelectValue(STOP_ARG);
stopOnErrorButton.setSelection(true);
else
stopRadioButtons.setSelectValue(KEEP_ARG);
stopOnErrorButton.setSelection(false);
if (info.getBuildCommand() != null) {
StringBuffer cmd = new StringBuffer(info.getBuildCommand().toOSString());
if (!info.isDefaultBuildCmd()) {
@ -351,8 +340,10 @@ public class SettingsBlock extends AbstractCOptionPage {
}
if (info.isDefaultBuildCmd()) {
buildCommand.setEnabled(false);
stopOnErrorButton.setEnabled(true);
} else {
stopRadioButtons.setEnabled(false);
buildCommand.setEnabled(true);
stopOnErrorButton.setEnabled(false);
}
defButton.setSelection(info.isDefaultBuildCmd());
autoButton.setSelection(info.isAutoBuildEnable());
@ -364,7 +355,7 @@ public class SettingsBlock extends AbstractCOptionPage {
}
private boolean isStopOnError() {
return stopRadioButtons.getSelectedValue().equals(STOP_ARG);
return stopOnErrorButton.getSelection();
}
private boolean useDefaultBuildCmd() {