1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-01 05:15:43 +02:00
This commit is contained in:
David Inglis 2004-02-27 21:11:42 +00:00
parent e7dfb880a4
commit 6c46cacd82

View file

@ -26,6 +26,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Preferences; import org.eclipse.core.runtime.Preferences;
import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.window.Window; import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
@ -39,6 +40,7 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Button;
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.DirectoryDialog;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List; import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
@ -81,6 +83,34 @@ public class BuildPathInfoBlock extends AbstractCOptionPage {
private Button symbolUp; private Button symbolUp;
private Button symbolDown; private Button symbolDown;
private Shell shell; private Shell shell;
/**
* This class add a "browse" button to the selection to be used for the path
*/
class SelectPathInputDialog extends InputDialog {
public SelectPathInputDialog(Shell parentShell, String dialogTitle, String dialogMessage, String initialValue, IInputValidator validator) {
super(parentShell, dialogTitle, dialogMessage, initialValue, validator);
}
protected void createButtonsForButtonBar(Composite parent) {
super.createButtonsForButtonBar(parent);
Button browse = createButton(parent, 3, "Browse...", true);
browse.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent ev) {
DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.OPEN);
String currentName = getText().getText();
if(currentName != null && currentName.trim().length() != 0) {
dialog.setFilterPath(currentName);
}
String dirname = dialog.open();
if(dirname != null) {
getText().setText(dirname);
}
}
});
}
}
public BuildPathInfoBlock() { public BuildPathInfoBlock() {
super(MakeUIPlugin.getResourceString(LABEL)); super(MakeUIPlugin.getResourceString(LABEL));
@ -351,7 +381,7 @@ public class BuildPathInfoBlock extends AbstractCOptionPage {
String selItem = pathList.getItem(index); String selItem = pathList.getItem(index);
if (selItem != null) { if (selItem != null) {
InputDialog dialog = InputDialog dialog =
new InputDialog( new SelectPathInputDialog(
shell, shell,
MakeUIPlugin.getResourceString(EDIT_PATH_TITLE), MakeUIPlugin.getResourceString(EDIT_PATH_TITLE),
MakeUIPlugin.getResourceString(PATH_LABEL), MakeUIPlugin.getResourceString(PATH_LABEL),
@ -489,7 +519,7 @@ public class BuildPathInfoBlock extends AbstractCOptionPage {
protected void handleAddPath() { protected void handleAddPath() {
// Popup an entry dialog // Popup an entry dialog
InputDialog dialog = new InputDialog(shell, MakeUIPlugin.getResourceString(PATH_TITLE), MakeUIPlugin.getResourceString(PATH_LABEL), "", null); //$NON-NLS-1$ InputDialog dialog = new SelectPathInputDialog(shell, MakeUIPlugin.getResourceString(PATH_TITLE), MakeUIPlugin.getResourceString(PATH_LABEL), "", null); //$NON-NLS-1$
String path = null; String path = null;
if (dialog.open() == Window.OK) { if (dialog.open() == Window.OK) {
path = dialog.getValue(); path = dialog.getValue();