mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 08:55:25 +02:00
This commit is contained in:
parent
e7dfb880a4
commit
6c46cacd82
1 changed files with 32 additions and 2 deletions
|
@ -26,6 +26,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Preferences;
|
||||
import org.eclipse.jface.dialogs.IInputValidator;
|
||||
import org.eclipse.jface.dialogs.InputDialog;
|
||||
import org.eclipse.jface.window.Window;
|
||||
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.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.DirectoryDialog;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.List;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
@ -81,6 +83,34 @@ public class BuildPathInfoBlock extends AbstractCOptionPage {
|
|||
private Button symbolUp;
|
||||
private Button symbolDown;
|
||||
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() {
|
||||
super(MakeUIPlugin.getResourceString(LABEL));
|
||||
|
@ -351,7 +381,7 @@ public class BuildPathInfoBlock extends AbstractCOptionPage {
|
|||
String selItem = pathList.getItem(index);
|
||||
if (selItem != null) {
|
||||
InputDialog dialog =
|
||||
new InputDialog(
|
||||
new SelectPathInputDialog(
|
||||
shell,
|
||||
MakeUIPlugin.getResourceString(EDIT_PATH_TITLE),
|
||||
MakeUIPlugin.getResourceString(PATH_LABEL),
|
||||
|
@ -489,7 +519,7 @@ public class BuildPathInfoBlock extends AbstractCOptionPage {
|
|||
|
||||
protected void handleAddPath() {
|
||||
// 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;
|
||||
if (dialog.open() == Window.OK) {
|
||||
path = dialog.getValue();
|
||||
|
|
Loading…
Add table
Reference in a new issue