mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 04:45:38 +02:00
Added a browse button for list options
This commit is contained in:
parent
66c786380a
commit
bde7613ebe
5 changed files with 215 additions and 30 deletions
|
@ -226,8 +226,10 @@
|
|||
</optionCategory>
|
||||
<option
|
||||
name="%Option.Posix.InclPaths"
|
||||
browseNeeded="directory"
|
||||
category="cygwin.gnu.c.compiler.category.dirs"
|
||||
command="-I"
|
||||
browseType="directory"
|
||||
valueType="includePath"
|
||||
id="cygwin.gnu.c.compiler.general.include.paths">
|
||||
<listOptionValue
|
||||
|
@ -570,8 +572,10 @@
|
|||
</optionCategory>
|
||||
<option
|
||||
name="%Option.Posix.InclPaths"
|
||||
browseNeeded="directory"
|
||||
category="cygwin.gnu.compiler.category.dirs"
|
||||
command="-I"
|
||||
browseType="directory"
|
||||
valueType="includePath"
|
||||
id="cygwin.compiler.general.include.paths">
|
||||
<listOptionValue
|
||||
|
@ -891,15 +895,19 @@
|
|||
</optionCategory>
|
||||
<option
|
||||
name="%Option.Posix.Libs"
|
||||
browseNeeded="file"
|
||||
category="cygwin.gnu.c.linker.category.libs"
|
||||
command="-l"
|
||||
browseType="file"
|
||||
valueType="libs"
|
||||
id="cygwin.gnu.c.link.libs">
|
||||
</option>
|
||||
<option
|
||||
name="%Option.Posix.Libsearch"
|
||||
browseNeeded="directory"
|
||||
category="cygwin.gnu.c.linker.category.libs"
|
||||
command="-L"
|
||||
browseType="directory"
|
||||
valueType="stringList"
|
||||
id="cygwin.gnu.c.link.paths">
|
||||
</option>
|
||||
|
@ -924,7 +932,9 @@
|
|||
</option>
|
||||
<option
|
||||
name="%Option.Posix.UserObjs"
|
||||
browseNeeded="file"
|
||||
category="cygwin.gnu.c.linker.category.other"
|
||||
browseType="file"
|
||||
valueType="userObjs"
|
||||
id="cygwin.gnu.c.link.ld.userobjs">
|
||||
</option>
|
||||
|
@ -988,15 +998,19 @@
|
|||
</optionCategory>
|
||||
<option
|
||||
name="%Option.Posix.Libs"
|
||||
browseNeeded="file"
|
||||
category="cygwin.gnu.linker.category.libs"
|
||||
command="-l"
|
||||
browseType="file"
|
||||
valueType="libs"
|
||||
id="cygwin.link.libs">
|
||||
</option>
|
||||
<option
|
||||
name="%Option.Posix.Libsearch"
|
||||
browseNeeded="directory"
|
||||
category="cygwin.gnu.linker.category.libs"
|
||||
command="-L"
|
||||
browseType="directory"
|
||||
valueType="stringList"
|
||||
id="cygwin.link.ld.paths">
|
||||
</option>
|
||||
|
@ -1021,7 +1035,9 @@
|
|||
</option>
|
||||
<option
|
||||
name="%Option.Posix.UserObjs"
|
||||
browseNeeded="file"
|
||||
category="cygwin.gnu.linker.category.other"
|
||||
browseType="file"
|
||||
valueType="userObjs"
|
||||
id="cygwin.gnu.link.ld.userobjs">
|
||||
</option>
|
||||
|
@ -1152,6 +1168,7 @@
|
|||
name="%Option.Posix.Libs"
|
||||
category="cygwin.gnu.c.solink.category.libs"
|
||||
command="-l"
|
||||
browseType="file"
|
||||
valueType="libs"
|
||||
id="cygwin.gnu.c.solink.libs">
|
||||
</option>
|
||||
|
@ -1159,6 +1176,7 @@
|
|||
name="%Option.Posix.Libsearch"
|
||||
category="cygwin.gnu.c.solink.category.libs"
|
||||
command="-L"
|
||||
browseType="directory"
|
||||
valueType="stringList"
|
||||
id="cygwin.gnu.c.solink.paths">
|
||||
</option>
|
||||
|
@ -1184,6 +1202,7 @@
|
|||
<option
|
||||
name="%Option.Posix.UserObjs"
|
||||
category="cygwin.gnu.c.solink.category.other"
|
||||
browseType="file"
|
||||
valueType="userObjs"
|
||||
id="cygwin.gnu.c.solink.userobjs">
|
||||
</option>
|
||||
|
@ -1242,6 +1261,7 @@
|
|||
name="%Option.Posix.Libs"
|
||||
category="cygwin.gnu.solink.category.libs"
|
||||
command="-l"
|
||||
browseType="file"
|
||||
valueType="libs"
|
||||
id="cygwin.solink.libs">
|
||||
</option>
|
||||
|
@ -1249,6 +1269,7 @@
|
|||
name="%Option.Posix.Libsearch"
|
||||
category="cygwin.gnu.solink.category.libs"
|
||||
command="-L"
|
||||
browseType="directory"
|
||||
valueType="stringList"
|
||||
id="cygwin.solink.ld.paths">
|
||||
</option>
|
||||
|
@ -1274,6 +1295,7 @@
|
|||
<option
|
||||
name="%Option.Posix.UserObjs"
|
||||
category="cygwin.gnu.solink.category.other"
|
||||
browseType="file"
|
||||
valueType="userObjs"
|
||||
id="cygwin.gnu.solink.userobjs">
|
||||
</option>
|
||||
|
@ -1568,6 +1590,7 @@
|
|||
name="%Option.Posix.InclPaths"
|
||||
category="linux.gnu.c.compiler.category.dirs"
|
||||
command="-I"
|
||||
browseType="directory"
|
||||
valueType="includePath"
|
||||
id="linux.gnu.c.compiler.general.include.paths">
|
||||
</option>
|
||||
|
@ -1860,6 +1883,7 @@
|
|||
name="%Option.Posix.InclPaths"
|
||||
category="linux.gnu.compiler.category.dirs"
|
||||
command="-I"
|
||||
browseType="directory"
|
||||
valueType="includePath"
|
||||
id="linux.gnu.compiler.dirs.incpaths">
|
||||
<listOptionValue
|
||||
|
@ -2159,6 +2183,7 @@
|
|||
name="%Option.Posix.Libs"
|
||||
category="linux.gnu.c.linker.category.libs"
|
||||
command="-l"
|
||||
browseType="file"
|
||||
valueType="libs"
|
||||
id="linux.gnu.c.link.libs">
|
||||
</option>
|
||||
|
@ -2166,6 +2191,7 @@
|
|||
name="%Option.Posix.Libsearch"
|
||||
category="linux.gnu.c.linker.category.libs"
|
||||
command="-L"
|
||||
browseType="directory"
|
||||
valueType="stringList"
|
||||
id="linux.gnu.c.link.paths">
|
||||
</option>
|
||||
|
@ -2190,6 +2216,7 @@
|
|||
<option
|
||||
name="%Option.Posix.UserObjs"
|
||||
category="linux.gnu.c.linker.category.other"
|
||||
browseType="file"
|
||||
valueType="userObjs"
|
||||
id="linux.gnu.c.link.ld.userobjs">
|
||||
</option>
|
||||
|
@ -2255,6 +2282,7 @@
|
|||
name="%Option.Posix.Libs"
|
||||
category="linux.gnu.linker.category.libs"
|
||||
command="-l"
|
||||
browseType="file"
|
||||
valueType="libs"
|
||||
id="linux.gnu.linker.libs.libs">
|
||||
</option>
|
||||
|
@ -2262,6 +2290,7 @@
|
|||
name="%Option.Posix.Libsearch"
|
||||
category="linux.gnu.linker.category.libs"
|
||||
command="-L"
|
||||
browseType="directory"
|
||||
valueType="stringList"
|
||||
id="linux.gnu.linker.libs.paths">
|
||||
</option>
|
||||
|
@ -2286,6 +2315,7 @@
|
|||
<option
|
||||
name="%Option.Posix.UserObjs"
|
||||
category="linux.gnu.linker.category.other"
|
||||
browseType="file"
|
||||
valueType="userObjs"
|
||||
id="linux.gnu.linker.userobjs">
|
||||
</option>
|
||||
|
@ -2414,6 +2444,7 @@
|
|||
name="%Option.Posix.Libs"
|
||||
category="linux.gnu.c.solink.category.libs"
|
||||
command="-l"
|
||||
browseType="file"
|
||||
valueType="libs"
|
||||
id="linux.gnu.c.solink.libs">
|
||||
</option>
|
||||
|
@ -2421,6 +2452,7 @@
|
|||
name="%Option.Posix.Libsearch"
|
||||
category="linux.gnu.c.solink.category.libs"
|
||||
command="-L"
|
||||
browseType="directory"
|
||||
valueType="stringList"
|
||||
id="linux.gnu.c.solink.paths">
|
||||
</option>
|
||||
|
@ -2446,6 +2478,7 @@
|
|||
<option
|
||||
name="%Option.Posix.UserObjs"
|
||||
category="linux.gnu.c.solink.category.other"
|
||||
browseType="file"
|
||||
valueType="userObjs"
|
||||
id="linux.gnu.c.solink.userobjs">
|
||||
</option>
|
||||
|
@ -2505,6 +2538,7 @@
|
|||
name="%Option.Posix.Libs"
|
||||
category="linux.gnu.solink.category.libs"
|
||||
command="-l"
|
||||
browseType="file"
|
||||
valueType="libs"
|
||||
id="linux.gnu.solink.libs.libs">
|
||||
</option>
|
||||
|
@ -2512,6 +2546,7 @@
|
|||
name="%Option.Posix.Libsearch"
|
||||
category="linux.gnu.solink.category.libs"
|
||||
command="-L"
|
||||
browseType="directory"
|
||||
valueType="stringList"
|
||||
id="linux.gnu.solink.libs.paths">
|
||||
</option>
|
||||
|
@ -2537,6 +2572,7 @@
|
|||
<option
|
||||
name="%Option.Posix.UserObjs"
|
||||
category="linux.gnu.solink.category.other"
|
||||
browseType="file"
|
||||
valueType="userObjs"
|
||||
id="linux.gnu.solink.userobjs">
|
||||
</option>
|
||||
|
@ -2744,6 +2780,7 @@
|
|||
name="%Option.Posix.InclPaths"
|
||||
category="solaris.gnu.c.compiler.category.dirs"
|
||||
command="-I"
|
||||
browseType="directory"
|
||||
valueType="includePath"
|
||||
id="solaris.gnu.c.compiler.general.include.paths">
|
||||
</option>
|
||||
|
@ -3021,6 +3058,7 @@
|
|||
name="%Option.Posix.InclPaths"
|
||||
category="solaris.gnu.compiler.category.dirs"
|
||||
command="-I"
|
||||
browseType="directory"
|
||||
valueType="includePath"
|
||||
id="solaris.gnu.compiler.dirs.incpaths">
|
||||
<listOptionValue
|
||||
|
@ -3320,6 +3358,7 @@
|
|||
name="%Option.Posix.Libs"
|
||||
category="solaris.gnu.c.linker.category.libs"
|
||||
command="-l"
|
||||
browseType="file"
|
||||
valueType="libs"
|
||||
id="solaris.gnu.c.link.libs">
|
||||
</option>
|
||||
|
@ -3327,6 +3366,7 @@
|
|||
name="%Option.Posix.Libsearch"
|
||||
category="solaris.gnu.c.linker.category.libs"
|
||||
command="-L"
|
||||
browseType="directory"
|
||||
valueType="stringList"
|
||||
id="solaris.gnu.c.link.paths">
|
||||
</option>
|
||||
|
@ -3351,6 +3391,7 @@
|
|||
<option
|
||||
name="%Option.Posix.UserObjs"
|
||||
category="solaris.gnu.c.linker.category.other"
|
||||
browseType="file"
|
||||
valueType="userObjs"
|
||||
id="solaris.gnu.c.link.ld.userobjs">
|
||||
</option>
|
||||
|
@ -3416,6 +3457,7 @@
|
|||
name="%Option.Posix.Libs"
|
||||
category="solaris.gnu.linker.category.libs"
|
||||
command="-l"
|
||||
browseType="file"
|
||||
valueType="libs"
|
||||
id="solaris.gnu.linker.libs.libs">
|
||||
</option>
|
||||
|
@ -3423,6 +3465,7 @@
|
|||
name="%Option.Posix.Libsearch"
|
||||
category="solaris.gnu.linker.category.libs"
|
||||
command="-L"
|
||||
browseType="directory"
|
||||
valueType="stringList"
|
||||
id="solaris.gnu.linker.libs.paths">
|
||||
</option>
|
||||
|
@ -3447,6 +3490,7 @@
|
|||
<option
|
||||
name="%Option.Posix.UserObjs"
|
||||
category="solaris.gnu.linker.category.other"
|
||||
browseType="file"
|
||||
valueType="userObjs"
|
||||
id="solaris.gnu.linker.userobjs">
|
||||
</option>
|
||||
|
@ -3579,6 +3623,7 @@
|
|||
name="%Option.Posix.Libs"
|
||||
category="solaris.gnu.c.solink.category.libs"
|
||||
command="-l"
|
||||
browseType="file"
|
||||
valueType="libs"
|
||||
id="solaris.gnu.c.solink.libs">
|
||||
</option>
|
||||
|
@ -3586,6 +3631,7 @@
|
|||
name="%Option.Posix.Libsearch"
|
||||
category="solaris.gnu.c.solink.category.libs"
|
||||
command="-L"
|
||||
browseType="directory"
|
||||
valueType="stringList"
|
||||
id="solaris.gnu.c.solink.paths">
|
||||
</option>
|
||||
|
@ -3611,6 +3657,7 @@
|
|||
<option
|
||||
name="%Option.Posix.UserObjs"
|
||||
category="solaris.gnu.c.solink.category.other"
|
||||
browseType="file"
|
||||
valueType="userObjs"
|
||||
id="solaris.gnu.c.solink.userobjs">
|
||||
</option>
|
||||
|
@ -3670,6 +3717,7 @@
|
|||
name="%Option.Posix.Libs"
|
||||
category="solaris.gnu.solink.category.libs"
|
||||
command="-l"
|
||||
browseType="file"
|
||||
valueType="libs"
|
||||
id="solaris.gnu.solink.libs.libs">
|
||||
</option>
|
||||
|
@ -3677,6 +3725,7 @@
|
|||
name="%Option.Posix.Libsearch"
|
||||
category="solaris.gnu.solink.category.libs"
|
||||
command="-L"
|
||||
browseType="directory"
|
||||
valueType="stringList"
|
||||
id="solaris.gnu.solink.libs.paths">
|
||||
</option>
|
||||
|
@ -3702,6 +3751,7 @@
|
|||
<option
|
||||
name="%Option.Posix.UserObjs"
|
||||
category="solaris.gnu.solink.category.other"
|
||||
browseType="file"
|
||||
valueType="userObjs"
|
||||
id="solaris.gnu.solink.userobjs">
|
||||
</option>
|
||||
|
|
|
@ -52,7 +52,11 @@ BuildPropertyPage.manage.title=Manage
|
|||
BuildPropertyPage.error.Unknown_tree_element=Unknown type of element in tree of type {0}
|
||||
|
||||
# ----------- Entry Dialog -----------
|
||||
BrowseEntryDialog.error.Folder_name_invalid=Folder name invalid
|
||||
BrowseEntryDialog.error.Folder_name_invalid = Folder name invalid
|
||||
BrowseEntryDialog.title.file = Select File
|
||||
BrowseEntryDialog.title.directory = Select Directory
|
||||
BrowseEntryDialog.message.file = File:
|
||||
BrowseEntryDialog.message.directory = Directory:
|
||||
|
||||
# ----------- New Configuration -----------
|
||||
NewConfiguration.label.name=Name:
|
||||
|
|
|
@ -11,9 +11,14 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
|
|||
* IBM Rational Software - Initial API and implementation
|
||||
* **********************************************************************/
|
||||
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.IOption;
|
||||
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
|
||||
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.jface.dialogs.IInputValidator;
|
||||
import org.eclipse.jface.dialogs.InputDialog;
|
||||
import org.eclipse.jface.preference.FieldEditor;
|
||||
import org.eclipse.jface.util.Assert;
|
||||
|
@ -40,18 +45,83 @@ import org.eclipse.swt.widgets.Shell;
|
|||
import org.eclipse.swt.widgets.Widget;
|
||||
|
||||
public class BuildOptionListFieldEditor extends FieldEditor {
|
||||
/**
|
||||
* Multi-purpose dialog to prompt the user for a value, path, or file.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
class SelectPathInputDialog extends InputDialog {
|
||||
// Constants for externalized strings
|
||||
private static final String BROWSE = "BuildPropertyCommon.label.browse"; //$NON-NLS-1$
|
||||
private int type;
|
||||
|
||||
/**
|
||||
* @param parentShell
|
||||
* @param dialogTitle
|
||||
* @param dialogMessage
|
||||
* @param initialValue
|
||||
* @param validator
|
||||
* @param type
|
||||
*/
|
||||
public SelectPathInputDialog(Shell parentShell, String dialogTitle, String dialogMessage, String initialValue, IInputValidator validator, int type) {
|
||||
super(parentShell, dialogTitle, dialogMessage, initialValue, validator);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
|
||||
*/
|
||||
protected void createButtonsForButtonBar(Composite parent) {
|
||||
super.createButtonsForButtonBar(parent);
|
||||
if (type != IOption.BROWSE_NONE) {
|
||||
final Button browse = createButton(parent, 3, ManagedBuilderUIPlugin.getResourceString(BROWSE), true);
|
||||
browse.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent ev) {
|
||||
String currentName;
|
||||
String result;
|
||||
switch (type) {
|
||||
case IOption.BROWSE_DIR :
|
||||
DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.OPEN);
|
||||
currentName = getText().getText();
|
||||
if(currentName != null && currentName.trim().length() != 0) {
|
||||
dialog.setFilterPath(currentName);
|
||||
}
|
||||
result = dialog.open();
|
||||
if(result != null) {
|
||||
getText().setText(result);
|
||||
}
|
||||
break;
|
||||
case IOption.BROWSE_FILE:
|
||||
FileDialog browseDialog = new FileDialog(getShell());
|
||||
currentName = getText().getText();
|
||||
if (currentName != null && currentName.trim().length() != 0) {
|
||||
browseDialog.setFilterPath(currentName);
|
||||
}
|
||||
result = browseDialog.open();
|
||||
if (result != null) {
|
||||
getText().setText(result);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Label constants
|
||||
private static final String TITLE = "BuildPropertyCommon.label.title"; //$NON-NLS-1$
|
||||
private static final String NEW = "BuildPropertyCommon.label.new"; //$NON-NLS-1$
|
||||
private static final String REMOVE = "BuildPropertyCommon.label.remove"; //$NON-NLS-1$
|
||||
private static final String UP = "BuildPropertyCommon.label.up"; //$NON-NLS-1$
|
||||
private static final String DOWN = "BuildPropertyCommon.label.down"; //$NON-NLS-1$
|
||||
private static final String EDIT = "BuildPropertyCommon.label.editVar"; //$NON-NLS-1$
|
||||
|
||||
// Browse strategy constants
|
||||
public static final int BROWSE_NONE = 0;
|
||||
public static final int BROWSE_FILE = 1;
|
||||
public static final int BROWSE_DIR = 2;
|
||||
private static final String LABEL = "BuildPropertyCommon.label"; //$NON-NLS-1$
|
||||
private static final String TITLE = LABEL + ".title"; //$NON-NLS-1$
|
||||
private static final String NEW = LABEL + ".new"; //$NON-NLS-1$
|
||||
private static final String REMOVE = LABEL + ".remove"; //$NON-NLS-1$
|
||||
private static final String UP = LABEL + ".up"; //$NON-NLS-1$
|
||||
private static final String DOWN = LABEL + ".down"; //$NON-NLS-1$
|
||||
private static final String EDIT = LABEL + ".editVar"; //$NON-NLS-1$
|
||||
private static final String FILE_TITLE = "BrowseEntryDialog.title.file"; //$NON-NLS-1$
|
||||
private static final String DIR_TITLE = "BrowseEntryDialog.title.directory"; //$NON-NLS-1$
|
||||
private static final String FILE_MSG = "BrowseEntryDialog.message.file"; //$NON-NLS-1$
|
||||
private static final String DIR_MSG = "BrowseEntryDialog.message.directory"; //$NON-NLS-1$
|
||||
|
||||
// The top-level control for the field editor.
|
||||
private Composite top;
|
||||
|
@ -64,6 +134,8 @@ public class BuildOptionListFieldEditor extends FieldEditor {
|
|||
private String fieldName;
|
||||
private SelectionListener selectionListener;
|
||||
private int browseType;
|
||||
private IConfiguration configuration;
|
||||
private IResource owner;
|
||||
|
||||
// The button for adding the contents of the text field to the list
|
||||
private Button addButton;
|
||||
|
@ -84,7 +156,8 @@ public class BuildOptionListFieldEditor extends FieldEditor {
|
|||
public BuildOptionListFieldEditor(String name, String labelText, Composite parent) {
|
||||
super(name, labelText, parent);
|
||||
this.fieldName = labelText;
|
||||
browseType = BROWSE_NONE;
|
||||
browseType = IOption.BROWSE_NONE;
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -347,6 +420,32 @@ public class BuildOptionListFieldEditor extends FieldEditor {
|
|||
getPreferenceStore().setValue(getPreferenceName(), s);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @return Returns the configuration.
|
||||
*/
|
||||
private IConfiguration getConfiguration() {
|
||||
if (configuration == null) {
|
||||
BuildToolsSettingsStore store = (BuildToolsSettingsStore)getPreferenceStore();
|
||||
if (store != null) {
|
||||
configuration = store.getOwner();
|
||||
}
|
||||
}
|
||||
return configuration;
|
||||
}
|
||||
|
||||
/*(non-Javadoc)
|
||||
* @return Returns the owner.
|
||||
*/
|
||||
private IResource getOwner() {
|
||||
if (owner == null) {
|
||||
IConfiguration config = getConfiguration();
|
||||
if (config != null) {
|
||||
owner = config.getOwner();
|
||||
}
|
||||
}
|
||||
return owner;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* Answers a <code>String</code> containing the value the user entered, or
|
||||
* <code>null</code> if the user cancelled the interaction.
|
||||
|
@ -356,25 +455,46 @@ public class BuildOptionListFieldEditor extends FieldEditor {
|
|||
protected String getNewInputObject() {
|
||||
// Create a dialog to prompt for a new list item
|
||||
String input = null;
|
||||
|
||||
if (browseType == BROWSE_DIR) {
|
||||
DirectoryDialog browseDialog = new DirectoryDialog(getShell());
|
||||
if (browseDialog != null) {
|
||||
input = browseDialog.open();
|
||||
}
|
||||
} else if (browseType == BROWSE_FILE) {
|
||||
// dialog = new BrowseEntryDialog(getShell(), ManagedBuilderUIPlugin.getResourceString(TITLE), fieldName, new String());
|
||||
FileDialog browseDialog = new FileDialog(getShell());
|
||||
if (browseDialog != null) {
|
||||
input = browseDialog.open();
|
||||
}
|
||||
String title = new String();
|
||||
String message = new String();
|
||||
String initVal = new String();
|
||||
IPath path = null;
|
||||
|
||||
if (browseType == IOption.BROWSE_DIR) {
|
||||
title = ManagedBuilderUIPlugin.getResourceString(DIR_TITLE);
|
||||
message = ManagedBuilderUIPlugin.getResourceString(DIR_MSG);
|
||||
path = getOwner().getLocation();
|
||||
initVal = path == null ? initVal : path.toString();
|
||||
} else if (browseType == IOption.BROWSE_FILE) {
|
||||
title = ManagedBuilderUIPlugin.getResourceString(FILE_TITLE);
|
||||
message = ManagedBuilderUIPlugin.getResourceString(FILE_MSG);
|
||||
path = getOwner().getLocation();
|
||||
initVal = path == null ? initVal : path.toString();
|
||||
} else {
|
||||
InputDialog basicDialog = new InputDialog(getShell(), ManagedBuilderUIPlugin.getResourceString(TITLE), fieldName, new String(), null);
|
||||
if (basicDialog != null && basicDialog.open() == InputDialog.OK) {
|
||||
input = basicDialog.getValue();
|
||||
}
|
||||
title = ManagedBuilderUIPlugin.getResourceString(TITLE);
|
||||
message = fieldName;
|
||||
}
|
||||
|
||||
|
||||
// Prompt for value
|
||||
SelectPathInputDialog dialog = new SelectPathInputDialog(getShell(), title, message, initVal, null, browseType);
|
||||
if (dialog.open() == SelectPathInputDialog.OK) {
|
||||
input = dialog.getValue().trim();
|
||||
}
|
||||
|
||||
// Convert the value based on the type of input we expect
|
||||
switch (browseType) {
|
||||
case IOption.BROWSE_DIR:
|
||||
case IOption.BROWSE_FILE:
|
||||
String[] segments = input.split("\\s"); //$NON-NLS-1$
|
||||
if (segments.length > 1) {
|
||||
// Double-quote paths with whitespaces
|
||||
input = "\"" + input + "\"";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,6 +90,7 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
|||
case IOption.OBJECTS :
|
||||
BuildOptionListFieldEditor listField = new BuildOptionListFieldEditor(
|
||||
opt.getId(), opt.getName(), getFieldEditorParent());
|
||||
listField.setBrowseStrategy(opt.getBrowseType());
|
||||
addField(listField);
|
||||
fieldsList.add(listField);
|
||||
break;
|
||||
|
|
|
@ -183,6 +183,16 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
|
|||
return getDefaultLong(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Accessor to extract the configuration that owns the property store.
|
||||
*
|
||||
* @return Returns the <code>IConfiguration</code> that owns the receiver.
|
||||
* @since 2.0
|
||||
*/
|
||||
public IConfiguration getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* Answers the map containing the strings associated with each option
|
||||
* ID.
|
||||
|
|
Loading…
Add table
Reference in a new issue