mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Source code changes for C8 "Clone configurations". Also removed the SummaryFieldEditor since that functionality has now been implemented by the MultilineFieldEditor
This commit is contained in:
parent
3d8404184b
commit
18b0c0e692
6 changed files with 175 additions and 185 deletions
|
@ -55,8 +55,10 @@ BuildPropertyPage.error.Unknown_tree_element=Unknown type of element in tree of
|
||||||
BrowseEntryDialog.error.Folder_name_invalid=Folder name invalid
|
BrowseEntryDialog.error.Folder_name_invalid=Folder name invalid
|
||||||
|
|
||||||
# ----------- New Configuration -----------
|
# ----------- New Configuration -----------
|
||||||
NewConfiguration.label.name=Configuration name:
|
NewConfiguration.label.name=Name:
|
||||||
NewConfiguration.label.copy=Copy default settings from:
|
NewConfiguration.label.group=Copy settings from
|
||||||
|
NewConfiguration.label.copy=Default configuration:
|
||||||
|
NewConfiguration.label.clone=Existing configuration:
|
||||||
NewConfiguration.error.title=Error
|
NewConfiguration.error.title=Error
|
||||||
NewConfiguration.error.duplicateName=A configuration named "{0}" already exists.
|
NewConfiguration.error.duplicateName=A configuration named "{0}" already exists.
|
||||||
|
|
||||||
|
@ -70,7 +72,7 @@ ManageConfig.label.configs=Manage configurations
|
||||||
ManageConfig.label.restore=Restore
|
ManageConfig.label.restore=Restore
|
||||||
ManageConfig.label.configs.current=Current:
|
ManageConfig.label.configs.current=Current:
|
||||||
ManageConfig.label.configs.deleted=Deleted:
|
ManageConfig.label.configs.deleted=Deleted:
|
||||||
ManageConfig.label.new.config.dialog=Create
|
ManageConfig.label.new.config.dialog=Create configuration
|
||||||
|
|
||||||
# ----------- Build Property Common -----------
|
# ----------- Build Property Common -----------
|
||||||
BuildPropertyCommon.label.title=Enter Value
|
BuildPropertyCommon.label.title=Enter Value
|
||||||
|
|
|
@ -94,14 +94,7 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
||||||
fieldsList.add(listField);
|
fieldsList.add(listField);
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
SummaryFieldEditor summaryField = new SummaryFieldEditor(
|
|
||||||
opt.getId(), opt.getName(), category.getTool(),
|
|
||||||
getFieldEditorParent());
|
|
||||||
addField(summaryField);
|
|
||||||
fieldsList.add(summaryField);
|
|
||||||
break;
|
break;
|
||||||
// default :
|
|
||||||
// break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,6 +89,7 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
|
||||||
private static final String ADD_TIP = TIP + ".addconf"; //$NON-NLS-1$
|
private static final String ADD_TIP = TIP + ".addconf"; //$NON-NLS-1$
|
||||||
private static final String MANAGE_TITLE = PREFIX + ".manage.title"; //$NON-NLS-1$
|
private static final String MANAGE_TITLE = PREFIX + ".manage.title"; //$NON-NLS-1$
|
||||||
private static final int[] DEFAULT_SASH_WEIGHTS = new int[] { 20, 30 };
|
private static final int[] DEFAULT_SASH_WEIGHTS = new int[] { 20, 30 };
|
||||||
|
private static final String ID_SEPARATOR = "."; //$NON-NLS-1$
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dialog widgets
|
* Dialog widgets
|
||||||
|
@ -598,7 +599,18 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
|
||||||
if (id < 0) {
|
if (id < 0) {
|
||||||
id *= -1;
|
id *= -1;
|
||||||
}
|
}
|
||||||
String newId = parent.getId() + "." + id; //$NON-NLS-1$
|
|
||||||
|
// Create ID for the new component based on the parent ID and random component
|
||||||
|
String newId = parent.getId();
|
||||||
|
int index = newId.lastIndexOf(ID_SEPARATOR);
|
||||||
|
if (index > 0) {
|
||||||
|
String lastComponent = newId.substring(index + 1, newId.length());
|
||||||
|
if (Character.isDigit(lastComponent.charAt(0))) {
|
||||||
|
// Strip the last component
|
||||||
|
newId = newId.substring(0, index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newId += ID_SEPARATOR + id;
|
||||||
IConfiguration newConfig = selectedTarget.createConfiguration(parent, newId);
|
IConfiguration newConfig = selectedTarget.createConfiguration(parent, newId);
|
||||||
newConfig.setName(name);
|
newConfig.setName(name);
|
||||||
// Update the config lists
|
// Update the config lists
|
||||||
|
|
|
@ -474,25 +474,15 @@ public class ManageConfigDialog extends Dialog {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Get all the predefined configs
|
NewConfigurationDialog dialog = new NewConfigurationDialog(getShell(),
|
||||||
IConfiguration [] allDefinedConfigs = null;
|
managedTarget,
|
||||||
if (parentTarget != null) {
|
ManagedBuilderUIPlugin.getResourceString(CONF_DLG));
|
||||||
allDefinedConfigs = parentTarget.getConfigurations();
|
if (dialog.open() == NewConfigurationDialog.OK) {
|
||||||
}
|
// Get the new name and configuration to base the new config on
|
||||||
|
String newConfigName = dialog.getNewName();
|
||||||
// There should be predefined configurations ....
|
getNewConfigs().put(newConfigName, dialog.getParentConfiguration());
|
||||||
if (allDefinedConfigs != null && allDefinedConfigs.length != 0) {
|
currentConfigList.add(newConfigName);
|
||||||
NewConfigurationDialog dialog = new NewConfigurationDialog(getShell(),
|
currentConfigList.setSelection(currentConfigList.getItemCount() - 1);
|
||||||
allDefinedConfigs,
|
|
||||||
managedTarget,
|
|
||||||
ManagedBuilderUIPlugin.getResourceString(CONF_DLG));
|
|
||||||
if (dialog.open() == NewConfigurationDialog.OK) {
|
|
||||||
// Get the new name and configuration to base the new config on
|
|
||||||
String newConfigName = dialog.getNewName();
|
|
||||||
getNewConfigs().put(newConfigName, dialog.getParentConfiguration());
|
|
||||||
currentConfigList.add(newConfigName);
|
|
||||||
currentConfigList.setSelection(currentConfigList.getItemCount() - 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the buttons based on the choices
|
// Update the buttons based on the choices
|
||||||
|
|
|
@ -14,7 +14,6 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITarget;
|
import org.eclipse.cdt.managedbuilder.core.ITarget;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
|
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
|
||||||
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
|
||||||
import org.eclipse.jface.dialogs.Dialog;
|
import org.eclipse.jface.dialogs.Dialog;
|
||||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||||
import org.eclipse.jface.dialogs.MessageDialog;
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
|
@ -23,11 +22,14 @@ import org.eclipse.swt.events.ModifyEvent;
|
||||||
import org.eclipse.swt.events.ModifyListener;
|
import org.eclipse.swt.events.ModifyListener;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
import org.eclipse.swt.events.SelectionListener;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Button;
|
import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Combo;
|
import org.eclipse.swt.widgets.Combo;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
import org.eclipse.swt.widgets.Group;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
@ -38,36 +40,48 @@ public class NewConfigurationDialog extends Dialog {
|
||||||
private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$
|
private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$
|
||||||
private static final String ERROR = PREFIX + ".error"; //$NON-NLS-1$
|
private static final String ERROR = PREFIX + ".error"; //$NON-NLS-1$
|
||||||
private static final String NAME = LABEL + ".name"; //$NON-NLS-1$
|
private static final String NAME = LABEL + ".name"; //$NON-NLS-1$
|
||||||
|
private static final String GROUP = LABEL + ".group"; //$NON-NLS-1$
|
||||||
private static final String COPY = LABEL + ".copy"; //$NON-NLS-1$
|
private static final String COPY = LABEL + ".copy"; //$NON-NLS-1$
|
||||||
|
private static final String CLONE = LABEL + ".clone"; //$NON-NLS-1$
|
||||||
private static final String TITLE = ERROR + ".title"; //$NON-NLS-1$
|
private static final String TITLE = ERROR + ".title"; //$NON-NLS-1$
|
||||||
private static final String DUPLICATE = ERROR + ".duplicateName"; //$NON-NLS-1$
|
private static final String DUPLICATE = ERROR + ".duplicateName"; //$NON-NLS-1$
|
||||||
|
|
||||||
// Widgets
|
// Widgets
|
||||||
private Combo configSelector;
|
private Button btnClone;
|
||||||
|
private Button btnCopy;
|
||||||
private Button btnOk;
|
private Button btnOk;
|
||||||
private Text configName;
|
private Text configName;
|
||||||
|
private Combo copyConfigSelector;
|
||||||
|
private Combo cloneConfigSelector;
|
||||||
|
|
||||||
// Bookeeping
|
// Bookeeping
|
||||||
private IConfiguration[] definedConfigurations;
|
private boolean clone;
|
||||||
|
private IConfiguration[] defaultConfigs;
|
||||||
|
private IConfiguration[] definedConfigs;
|
||||||
private IConfiguration parentConfig;
|
private IConfiguration parentConfig;
|
||||||
private ITarget target;
|
private ITarget target;
|
||||||
private String newName;
|
private String newName;
|
||||||
private String [] allNames;
|
|
||||||
private String title = ""; //$NON-NLS-1$
|
private String title = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param parentShell
|
* @param parentShell
|
||||||
*/
|
*/
|
||||||
protected NewConfigurationDialog(Shell parentShell, IConfiguration[] configs, ITarget managedTarget, String title) {
|
protected NewConfigurationDialog(Shell parentShell, ITarget managedTarget, String title) {
|
||||||
super(parentShell);
|
super(parentShell);
|
||||||
this.title = title;
|
this.title = title;
|
||||||
setShellStyle(getShellStyle()|SWT.RESIZE);
|
setShellStyle(getShellStyle()|SWT.RESIZE);
|
||||||
newName = new String();
|
newName = new String();
|
||||||
parentConfig = null;
|
parentConfig = null;
|
||||||
definedConfigurations = configs == null ? new IConfiguration[0] : configs;
|
|
||||||
allNames = getConfigurationNames();
|
|
||||||
this.target = managedTarget;
|
this.target = managedTarget;
|
||||||
|
|
||||||
|
// The default behaviour is to clone the settings
|
||||||
|
clone = true;
|
||||||
|
|
||||||
|
// Populate the list of default and defined configurations
|
||||||
|
definedConfigs = target.getConfigurations();
|
||||||
|
ITarget grandparent = target.getParent();
|
||||||
|
defaultConfigs = grandparent.getConfigurations();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -78,12 +92,25 @@ public class NewConfigurationDialog extends Dialog {
|
||||||
protected void buttonPressed(int buttonId) {
|
protected void buttonPressed(int buttonId) {
|
||||||
if (buttonId == IDialogConstants.OK_ID) {
|
if (buttonId == IDialogConstants.OK_ID) {
|
||||||
newName = configName.getText().trim();
|
newName = configName.getText().trim();
|
||||||
String baseConfigName = configSelector.getItem(configSelector.getSelectionIndex());
|
String baseConfigName = new String();
|
||||||
for (int i = 0; i < definedConfigurations.length; i++) {
|
if (clone) {
|
||||||
IConfiguration config = definedConfigurations[i];
|
baseConfigName = cloneConfigSelector.getItem(cloneConfigSelector.getSelectionIndex());
|
||||||
if (config.getName().equals(baseConfigName)) {
|
for (int i = 0; i < definedConfigs.length; i++) {
|
||||||
parentConfig = config;
|
IConfiguration config = definedConfigs[i];
|
||||||
break;
|
if (config.getName().equals(baseConfigName)) {
|
||||||
|
parentConfig = config;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Get the parent config out of the default config list
|
||||||
|
baseConfigName = copyConfigSelector.getItem(copyConfigSelector.getSelectionIndex());
|
||||||
|
for (int i = 0; i < defaultConfigs.length; i++) {
|
||||||
|
IConfiguration config = defaultConfigs[i];
|
||||||
|
if (config.getName().equals(baseConfigName)) {
|
||||||
|
parentConfig = config;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -116,17 +143,23 @@ public class NewConfigurationDialog extends Dialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Control createDialogArea(Composite parent) {
|
protected Control createDialogArea(Composite parent) {
|
||||||
Composite composite = ControlFactory.createComposite(parent, 3);
|
Composite composite = new Composite(parent, SWT.NULL);
|
||||||
GridData gd;
|
composite.setFont(parent.getFont());
|
||||||
|
composite.setLayout(new GridLayout(3, false));
|
||||||
|
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
|
|
||||||
// Add a label and a text widget
|
// Add a label and a text widget
|
||||||
Label nameLabel = ControlFactory.createLabel(composite, ManagedBuilderUIPlugin.getResourceString(NAME));
|
final Label nameLabel = new Label(composite, SWT.LEFT);
|
||||||
gd = new GridData();
|
nameLabel.setFont(parent.getFont());
|
||||||
|
nameLabel.setText(ManagedBuilderUIPlugin.getResourceString(NAME));
|
||||||
|
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||||
gd.horizontalSpan = 1;
|
gd.horizontalSpan = 1;
|
||||||
nameLabel.setLayoutData(gd);
|
nameLabel.setLayoutData(gd);
|
||||||
configName = ControlFactory.createTextField(composite);
|
configName = new Text(composite, SWT.SINGLE | SWT.BORDER);
|
||||||
|
configName.setFont(composite.getFont());
|
||||||
gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
|
gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
|
||||||
gd.horizontalSpan = 2;
|
gd.horizontalSpan = 2;
|
||||||
|
gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
|
||||||
configName.setLayoutData(gd);
|
configName.setLayoutData(gd);
|
||||||
configName.addModifyListener(new ModifyListener() {
|
configName.addModifyListener(new ModifyListener() {
|
||||||
public void modifyText(ModifyEvent e) {
|
public void modifyText(ModifyEvent e) {
|
||||||
|
@ -134,24 +167,72 @@ public class NewConfigurationDialog extends Dialog {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add a label and combo box to select the base config
|
// Create a group fro the radio buttons
|
||||||
Label configLabel = ControlFactory.createLabel(composite, ManagedBuilderUIPlugin.getResourceString(COPY));
|
final Group group = new Group(composite, SWT.NONE);
|
||||||
gd = new GridData();
|
group.setFont(composite.getFont());
|
||||||
gd.horizontalSpan = 1;
|
group.setText(ManagedBuilderUIPlugin.getResourceString(GROUP));
|
||||||
configLabel.setLayoutData(gd);
|
GridLayout layout = new GridLayout(3, false);
|
||||||
configSelector = ControlFactory.createSelectCombo(composite, allNames, newName);
|
group.setLayout(layout);
|
||||||
|
gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||||
|
gd.horizontalSpan = 3;
|
||||||
|
group.setLayoutData(gd);
|
||||||
|
|
||||||
|
SelectionListener radioListener = new SelectionAdapter() {
|
||||||
|
public void widgetSelected(SelectionEvent event) {
|
||||||
|
clone = btnClone.getSelection();
|
||||||
|
updateComboState();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// Add a radio button and combo box to copy from default config
|
||||||
|
btnCopy = new Button(group, SWT.RADIO);
|
||||||
|
btnCopy.setFont(group.getFont());
|
||||||
|
btnCopy.setText(ManagedBuilderUIPlugin.getResourceString(COPY));
|
||||||
|
setButtonLayoutData(btnCopy);
|
||||||
|
btnCopy.addSelectionListener(radioListener);
|
||||||
|
|
||||||
|
copyConfigSelector = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
|
||||||
|
copyConfigSelector.setFont(group.getFont());
|
||||||
|
copyConfigSelector.setItems(getDefaultConfigNames());
|
||||||
|
int index = copyConfigSelector.indexOf(newName);
|
||||||
|
copyConfigSelector.select(index < 0 ? 0 : index);
|
||||||
gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
|
gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
|
||||||
gd.horizontalSpan = 2;
|
gd.horizontalSpan = 2;
|
||||||
configSelector.setLayoutData(gd);
|
gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
|
||||||
configSelector.addSelectionListener(new SelectionAdapter() {
|
copyConfigSelector.setLayoutData(gd);
|
||||||
|
copyConfigSelector.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
updateButtonState();
|
updateButtonState();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
copyConfigSelector.setEnabled(false);
|
||||||
|
|
||||||
|
// Create a radio button and combo for clonable configs
|
||||||
|
btnClone = new Button(group, SWT.RADIO);
|
||||||
|
btnClone.setFont(group.getFont());
|
||||||
|
btnClone.setText(ManagedBuilderUIPlugin.getResourceString(CLONE));
|
||||||
|
setButtonLayoutData(btnClone);
|
||||||
|
btnClone.addSelectionListener(radioListener);
|
||||||
|
btnClone.setSelection(true);
|
||||||
|
|
||||||
|
cloneConfigSelector = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
|
||||||
|
cloneConfigSelector.setFont(group.getFont());
|
||||||
|
cloneConfigSelector.setItems(getDefinedConfigNames());
|
||||||
|
index = cloneConfigSelector.indexOf(newName);
|
||||||
|
cloneConfigSelector.select(index < 0 ? 0 : index);
|
||||||
|
gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
|
||||||
|
gd.horizontalSpan = 2;
|
||||||
|
gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
|
||||||
|
cloneConfigSelector.setLayoutData(gd);
|
||||||
|
cloneConfigSelector.addSelectionListener(new SelectionAdapter() {
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
updateButtonState();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return composite;
|
return composite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the <code>IConfiguration</code> the user selected as
|
* @return the <code>IConfiguration</code> the user selected as
|
||||||
* the parent of the new configuration.
|
* the parent of the new configuration.
|
||||||
|
@ -161,17 +242,33 @@ public class NewConfigurationDialog extends Dialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns an array of configuration names
|
* Returns the array of configuration names defined for all targets
|
||||||
|
* of this type in the plugin manifest. This list will be used to
|
||||||
|
* populate the the configurations to copy default settings from.
|
||||||
*/
|
*/
|
||||||
private String [] getConfigurationNames() {
|
private String [] getDefaultConfigNames() {
|
||||||
String [] names = new String[definedConfigurations.length];
|
String [] names = new String[defaultConfigs.length];
|
||||||
for (int index = 0; index < definedConfigurations.length; ++index) {
|
for (int index = 0; index < defaultConfigs.length; ++index) {
|
||||||
IConfiguration config = definedConfigurations[index];
|
IConfiguration config = defaultConfigs[index];
|
||||||
names[index] = config.getName();
|
names[index] = config.getName();
|
||||||
}
|
}
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the array of configuration names defined for this target.
|
||||||
|
* This list will be used to populate the list of configurations to
|
||||||
|
* clone.
|
||||||
|
*/
|
||||||
|
private String [] getDefinedConfigNames() {
|
||||||
|
String [] names = new String[definedConfigs.length];
|
||||||
|
for (int index = 0; index < definedConfigs.length; ++index) {
|
||||||
|
IConfiguration config = definedConfigs[index];
|
||||||
|
names[index] = config.getName();
|
||||||
|
}
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return <code>String</code> containing the name chosen by the user for the
|
* @return <code>String</code> containing the name chosen by the user for the
|
||||||
* new configuration.
|
* new configuration.
|
||||||
|
@ -179,7 +276,14 @@ public class NewConfigurationDialog extends Dialog {
|
||||||
public String getNewName() {
|
public String getNewName() {
|
||||||
return newName;
|
return newName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* Answers <code>true</code> if the name entered by the user clashes
|
||||||
|
* with an existing configuration name.
|
||||||
|
*
|
||||||
|
* @param newName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
protected boolean isDuplicateName(String newName) {
|
protected boolean isDuplicateName(String newName) {
|
||||||
// Return true if there is already a config of that name defined on the target
|
// Return true if there is already a config of that name defined on the target
|
||||||
IConfiguration [] configs = target.getConfigurations();
|
IConfiguration [] configs = target.getConfigurations();
|
||||||
|
@ -192,17 +296,26 @@ public class NewConfigurationDialog extends Dialog {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* (non-Javadoc)
|
||||||
* Enable the OK button if there is a valid name in the text widget
|
* Enable the OK button if there is a valid name in the text widget
|
||||||
* and there is a valid selection in the base configuration combo
|
* and there is a valid selection in the base configuration combo
|
||||||
*/
|
*/
|
||||||
private void updateButtonState() {
|
private void updateButtonState() {
|
||||||
if (btnOk != null) {
|
if (btnOk != null) {
|
||||||
int selectionIndex = configSelector.getSelectionIndex();
|
int selectionIndex = copyConfigSelector.getSelectionIndex();
|
||||||
btnOk.setEnabled(validateName() && selectionIndex != -1);
|
btnOk.setEnabled(validateName() && selectionIndex != -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* Radio button selection event handler calls this helper method to
|
||||||
|
* enable or disable the radio buttons.
|
||||||
|
*/
|
||||||
|
protected void updateComboState() {
|
||||||
|
cloneConfigSelector.setEnabled(clone);
|
||||||
|
copyConfigSelector.setEnabled(!clone);
|
||||||
|
}
|
||||||
|
|
||||||
private boolean validateName() {
|
private boolean validateName() {
|
||||||
String currentName = configName.getText().trim();
|
String currentName = configName.getText().trim();
|
||||||
int nameLength = currentName.length();
|
int nameLength = currentName.length();
|
||||||
|
|
|
@ -1,120 +0,0 @@
|
||||||
package org.eclipse.cdt.managedbuilder.ui.properties;
|
|
||||||
|
|
||||||
/**********************************************************************
|
|
||||||
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Common Public License v0.5
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/cpl-v05.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* IBM Rational Software - Initial API and implementation
|
|
||||||
***********************************************************************/
|
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
|
||||||
import org.eclipse.jface.preference.FieldEditor;
|
|
||||||
import org.eclipse.swt.SWT;
|
|
||||||
import org.eclipse.swt.layout.GridData;
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
|
||||||
import org.eclipse.swt.widgets.Label;
|
|
||||||
import org.eclipse.swt.widgets.Text;
|
|
||||||
|
|
||||||
public class SummaryFieldEditor extends FieldEditor {
|
|
||||||
// Whitespace character
|
|
||||||
private static final String WHITESPACE = " "; //$NON-NLS-1$
|
|
||||||
|
|
||||||
// The top level composite
|
|
||||||
protected Composite parent;
|
|
||||||
// The tool this category belongs to
|
|
||||||
protected ITool tool;
|
|
||||||
// The text widget to hold summary of all commands for the tool
|
|
||||||
protected Text summary;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param name
|
|
||||||
* @param labelText
|
|
||||||
* @param parent
|
|
||||||
*/
|
|
||||||
public SummaryFieldEditor(String name, String labelText, ITool tool, Composite parent) {
|
|
||||||
super(name, labelText, parent);
|
|
||||||
this.tool = tool;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.preference.FieldEditor#adjustForNumColumns(int)
|
|
||||||
*/
|
|
||||||
protected void adjustForNumColumns(int numColumns) {
|
|
||||||
// For now grab the excess space
|
|
||||||
GridData gd = (GridData) summary.getLayoutData();
|
|
||||||
gd.horizontalSpan = numColumns - 1;
|
|
||||||
gd.grabExcessHorizontalSpace = true;
|
|
||||||
gd.grabExcessVerticalSpace = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.preference.FieldEditor#doFillIntoGrid(org.eclipse.swt.widgets.Composite, int)
|
|
||||||
*/
|
|
||||||
protected void doFillIntoGrid(Composite parent, int numColumns) {
|
|
||||||
this.parent = parent;
|
|
||||||
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
|
|
||||||
gd.horizontalSpan = numColumns;
|
|
||||||
this.parent.setLayoutData(gd);
|
|
||||||
|
|
||||||
// Add the label
|
|
||||||
Label label = getLabelControl(parent);
|
|
||||||
GridData labelData = new GridData();
|
|
||||||
labelData.horizontalSpan = numColumns;
|
|
||||||
label.setLayoutData(labelData);
|
|
||||||
|
|
||||||
// Create the multi-line, read-only field
|
|
||||||
summary = new Text(parent, SWT.MULTI|SWT.READ_ONLY|SWT.WRAP);
|
|
||||||
GridData summaryData = new GridData(GridData.FILL_BOTH);
|
|
||||||
summaryData.horizontalSpan = numColumns;
|
|
||||||
summary.setLayoutData(summaryData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.preference.FieldEditor#doLoad()
|
|
||||||
*/
|
|
||||||
protected void doLoad() {
|
|
||||||
// Look at the data store for every option defined for the tool
|
|
||||||
// IOption[] options = tool.getOptions();
|
|
||||||
// for (int index = 0; index < options.length; ++index) {
|
|
||||||
// IOption option = options[index];
|
|
||||||
// String command = option.getCommand();
|
|
||||||
// if (command == null) {
|
|
||||||
// command = "";
|
|
||||||
// }
|
|
||||||
// String id = option.getId();
|
|
||||||
// String values = getPreferenceStore().getString(id);
|
|
||||||
// String[] valuesList = BuildToolsSettingsStore.parseString(values);
|
|
||||||
// for (int j = 0; j < valuesList.length; ++j) {
|
|
||||||
// String entry = valuesList[j];
|
|
||||||
// summary.append(command + entry + WHITESPACE);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.preference.FieldEditor#doLoadDefault()
|
|
||||||
*/
|
|
||||||
protected void doLoadDefault() {
|
|
||||||
doLoad();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.preference.FieldEditor#doStore()
|
|
||||||
*/
|
|
||||||
protected void doStore() {
|
|
||||||
// This is a read-only summary field, so don't store data
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.preference.FieldEditor#getNumberOfControls()
|
|
||||||
*/
|
|
||||||
public int getNumberOfControls() {
|
|
||||||
// There is just the label from the parent and the text field
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue