List of usage examples for org.eclipse.jface.dialogs IDialogConstants IGNORE_ID
int IGNORE_ID
To view the source code for org.eclipse.jface.dialogs IDialogConstants IGNORE_ID.
Click Source Link
From source file:de.jcup.egradle.eclipse.ui.MultipleInputDialog.java
License:Apache License
public void createVariablesField(String labelText, String initialValue, boolean allowEmpty) { Label label = new Label(panel, SWT.NONE); label.setText(labelText);/* w w w . j a v a2s . com*/ label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); Composite comp = new Composite(panel, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; comp.setLayout(layout); comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); final Text text = new Text(comp, SWT.SINGLE | SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = 200; text.setLayoutData(data); text.setData(FIELD_NAME, labelText); // make sure rows are the same height on both panels. label.setSize(label.getSize().x, text.getSize().y); if (initialValue != null) { text.setText(initialValue); } if (!allowEmpty) { validators.add(new Validator() { @Override public boolean validate() { return !text.getText().equals(EMPTY_STRING); } }); text.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { validateFields(); } }); } Button button = createButton(comp, IDialogConstants.IGNORE_ID, "Varia&bles...", false); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell()); int code = dialog.open(); if (code == IDialogConstants.OK_ID) { String variable = dialog.getVariableExpression(); if (variable != null) { text.insert(variable); } } } }); controlList.add(text); }
From source file:de.jcup.egradle.eclipse.ui.MultipleInputDialog.java
License:Apache License
public void createMultilineVariablesField(String labelText, String initialValue, boolean allowEmpty) { Label label = new Label(panel, SWT.NONE); label.setText(labelText);/*w w w . ja va2s . c om*/ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd.horizontalSpan = 2; label.setLayoutData(gd); final Text text = new Text(panel, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL); gd = new GridData(GridData.FILL_BOTH); gd.widthHint = 300; gd.heightHint = 4 * text.getLineHeight(); gd.horizontalSpan = 2; text.setLayoutData(gd); text.setData(FIELD_NAME, labelText); text.addTraverseListener(new TraverseListener() { @Override public void keyTraversed(TraverseEvent e) { if (e.detail == SWT.TRAVERSE_RETURN && e.stateMask == SWT.SHIFT) { e.doit = true; } } }); // make sure rows are the same height on both panels. label.setSize(label.getSize().x, text.getSize().y); if (initialValue != null) { text.setText(initialValue); } if (!allowEmpty) { validators.add(new Validator() { @Override public boolean validate() { return !text.getText().equals(EMPTY_STRING); } }); text.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { validateFields(); } }); } Composite comp = SWTFactory.createComposite(panel, panel.getFont(), 1, 2, GridData.HORIZONTAL_ALIGN_END); GridLayout ld = (GridLayout) comp.getLayout(); ld.marginHeight = 1; ld.marginWidth = 0; ld.horizontalSpacing = 0; Button button = createButton(comp, IDialogConstants.IGNORE_ID, "Varia&bles...", false); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell()); int code = dialog.open(); if (code == IDialogConstants.OK_ID) { String variable = dialog.getVariableExpression(); if (variable != null) { text.insert(variable); } } } }); controlList.add(text); }
From source file:de.uni_jena.iaa.linktype.atomic.core.workspace.PickWorkspaceDialog.java
License:Apache License
@Override protected void createButtonsForButtonBar(Composite parent) { // clone workspace needs a lot of checks Button clone = createButton(parent, IDialogConstants.IGNORE_ID, "Clone", false); clone.addListener(SWT.Selection, new Listener() { @Override/*from w ww .j a va 2 s .c o m*/ public void handleEvent(Event arg0) { try { String txt = _workspacePathCombo.getText(); File workspaceDirectory = new File(txt); if (!workspaceDirectory.exists()) { MessageDialog.openError(PickWorkspaceDialog.this.getShell(), "Error", "The currently entered workspace path does not exist. Please enter a valid path."); return; } if (!workspaceDirectory.canRead()) { MessageDialog.openError(PickWorkspaceDialog.this.getShell(), "Error", "The currently entered workspace path is not readable. Please check file system permissions."); return; } // check for workspace file (empty indicator that it's a workspace) File wsFile = new File(txt + File.separator + WS_IDENTIFIER); if (!wsFile.exists()) { MessageDialog.openError(PickWorkspaceDialog.this.getShell(), "Error", "The currently entered workspace path does not contain a valid workspace."); return; } DirectoryDialog dd = new DirectoryDialog(PickWorkspaceDialog.this.getShell()); dd.setFilterPath(txt); String directory = dd.open(); if (directory == null) { return; } File targetDirectory = new File(directory); if (targetDirectory.getAbsolutePath().equals(workspaceDirectory.getAbsolutePath())) { MessageDialog.openError(PickWorkspaceDialog.this.getShell(), "Error", "Source and target workspaces are the same"); return; } // recursive check, if new directory is a subdirectory of our workspace, that's a big no-no or we'll // create directories forever if (isTargetSubdirOfDir(workspaceDirectory, targetDirectory)) { MessageDialog.openError(PickWorkspaceDialog.this.getShell(), "Error", "Target folder is a subdirectory of the current workspace"); return; } try { copyFiles(workspaceDirectory, targetDirectory); } catch (Exception err) { MessageDialog.openError(PickWorkspaceDialog.this.getShell(), "Error", "There was an error cloning the workspace: " + err.getMessage()); return; } boolean setActive = MessageDialog.openConfirm(PickWorkspaceDialog.this.getShell(), "Workspace Cloned", "Would you like to set the newly cloned workspace to be the active one?"); if (setActive) { _workspacePathCombo.setText(directory); } } catch (Exception err) { MessageDialog.openError(PickWorkspaceDialog.this.getShell(), "Error", "There was an internal error, please check the logs"); err.printStackTrace(); } } }); createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:edu.washington.cs.cupid.usage.internal.Activator.java
License:Open Source License
@Override public void start(BundleContext context) throws Exception { super.start(context); plugin = this; pluginLog = Platform.getLog(context.getBundle()); collector = CupidDataCollector.getInstance(); final IPreferenceStore preferences = getPreferenceStore(); if (preferences.getString(PreferenceConstants.P_UUID).equals("")) { preferences.setValue(PreferenceConstants.P_UUID, UUID.randomUUID().toString()); }/* w ww . j a va 2 s . c o m*/ preferences.addPropertyChangeListener(this); if (preferences.getBoolean(PreferenceConstants.P_ENABLE_COLLECTION)) { collector.start(); collector.upload.schedule(1000 * 10 /* 10 s */); } if (!preferences.getBoolean(PreferenceConstants.P_SHOWN_ENABLE_DIALOG)) { new UIJob("Cupid Data Collection Dialog") { @Override public IStatus runInUIThread(IProgressMonitor monitor) { IShellProvider workbench = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (workbench != null) { Shell shell = workbench.getShell(); if (shell != null) { DataCollectorDialog dialog = new DataCollectorDialog(shell); dialog.create(); dialog.setBlockOnOpen(true); if (dialog.open() == Dialog.OK) { preferences.setValue(PreferenceConstants.P_ENABLE_COLLECTION, true); } else { preferences.setValue(PreferenceConstants.P_ENABLE_COLLECTION, false); } preferences.setValue(PreferenceConstants.P_SHOWN_ENABLE_DIALOG, true); } } return Status.OK_STATUS; } }.schedule(); } boolean doSurvey = preferences.getBoolean(PreferenceConstants.P_REMIND_SURVEY); Date next = new Date(preferences.getLong(PreferenceConstants.P_NEXT_SURVEY_DATE)); Date today = new Date(); if (doSurvey && today.after(next)) { new UIJob("Usage Survey Job") { @Override public IStatus runInUIThread(IProgressMonitor monitor) { IShellProvider workbench = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (workbench != null) { SurveyDialog dialog = new SurveyDialog(workbench.getShell()); int result = dialog.open(); if (result == IDialogConstants.ABORT_ID) { preferences.setValue(PreferenceConstants.P_REMIND_SURVEY, false); } else if (result == IDialogConstants.OK_ID) { preferences.setValue(PreferenceConstants.P_REMIND_SURVEY, false); } else if (result == IDialogConstants.IGNORE_ID) { preferences.setValue(PreferenceConstants.P_REMIND_SURVEY, true); preferences.setValue(PreferenceConstants.P_NEXT_SURVEY_DATE, SurveyDialog.addDaysToDate(new Date(), 7).getTime()); } else if (result == IDialogConstants.CANCEL_ID) { // NOP } else { Activator.getDefault().logError("Unexpected result from Cupid survey dialog", null); } } return Status.OK_STATUS; } }.schedule(); } }
From source file:eu.geclipse.jsdl.ui.internal.dialogs.MultipleInputDialog.java
License:Open Source License
protected void createBrowseField(final String labelText, final String initialValue, final boolean allowEmpty, final boolean connected, final boolean allowLocal) { Label label = new Label(this.panel, SWT.NONE); label.setText(labelText);/*from w w w .j a va 2s . c om*/ label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); Composite comp = new Composite(this.panel, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; comp.setLayout(layout); comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); final Text text = new Text(comp, SWT.SINGLE | SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = 200; text.setLayoutData(data); text.setData(FIELD_NAME, labelText); // make sure rows are the same height on both panels. label.setSize(label.getSize().x, text.getSize().y); if (initialValue != null) { text.setText(initialValue); } if (!allowEmpty) { this.validators.add(new Validator() { @Override public boolean validate() { return !text.getText().equals(""); //$NON-NLS-1$ } }); text.addModifyListener(new ModifyListener() { public void modifyText(final ModifyEvent e) { validateFields(); } }); } Button button = createButton(comp, IDialogConstants.IGNORE_ID, Messages.getString("MultilpeInputDialog.browse_button"), //$NON-NLS-1$ false); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { { GridFileDialog dialog = new GridFileDialog(getShell(), GridFileDialog.STYLE_NONE); if (dialog.open() == Window.OK) { URI[] uris = dialog.getSelectedURIs(); if ((uris != null) && (uris.length > 0)) { text.setText(uris[0].toString()); } else { text.setText(""); //$NON-NLS-1$ } } // // IGridConnectionElement connection = GridFileDialog.openFileDialog( // getShell(), // "Choose a file", // null, // allowLocal ); // if( connection != null ) { // try { // String filename = connection.getConnectionFileStore().toString(); // if( connection.getConnectionFileStore() // .getFileSystem() // .getScheme() // .equalsIgnoreCase( "file" ) ) // { // filename = "file://" + filename; // } // if( filename != null ) { // text.setText( filename ); // } // } catch( CoreException cExc ) { // ProblemException exception = new ProblemException( // ICoreProblems.NET_CONNECTION_FAILED, // cExc, // Activator.PLUGIN_ID ); // ProblemDialog.openProblem( getShell(), // "error", // "error", // exception ); // } // } } } }); this.controlList.add(text); if (connected) { // mamy target, trzeba dodac listenera do source if (this.connectedFields.containsKey(labelText)) { String sourceName = this.connectedFields.get(labelText); Text sourceControl = null; int sourceIndex = -1; int targetIndex = -1; for (Control control : this.controlList) { if (control.getData(FIELD_NAME).equals(sourceName)) { sourceControl = (Text) control; sourceIndex = this.controlList.indexOf(control); } else { if (control.getData(FIELD_NAME).equals(labelText)) { targetIndex = this.controlList.indexOf(control); } } } final int targetPosition = targetIndex; final int sourcePosition = sourceIndex; if (sourceControl != null) { sourceControl.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { // controlList.get( targetPosition ).setText( controlList.get( // sourcePosition ).getText() ); } }); sourceControl.addFocusListener(new FocusListener() { public void focusGained(FocusEvent e) { // do nothing } public void focusLost(FocusEvent e) { String value = ""; Path p = new Path(MultipleInputDialog.this.controlList.get(sourcePosition).getText()); value = p.lastSegment(); if (MultipleInputDialog.this.controlList.get(targetPosition).getText() != null && MultipleInputDialog.this.controlList.get(targetPosition).getText() .length() == 0) { MultipleInputDialog.this.controlList.get(targetPosition).setText(value); } } }); } } else { // mamy source, do niego dodac listenera, znalezc target // szukanie targetu String targetName = null; for (String name : this.connectedFields.keySet()) { if (this.connectedFields.get(name).equals(labelText)) { targetName = name; } } // Text targetControl = null; int sourceIndex = -1; int targetIndex = -1; for (Control control : this.controlList) { if (control.getData(FIELD_NAME).equals(targetName)) { // targetControl = ( Text )control; targetIndex = this.controlList.indexOf(control); } else { if (control.getData(FIELD_NAME).equals(labelText)) { sourceIndex = this.controlList.indexOf(control); } } } final int sourcePosition = sourceIndex; final int targetPosition = targetIndex; text.addModifyListener(new ModifyListener() { public void modifyText(final ModifyEvent e) { // controlList.get( targetPosition ).setText( controlList.get( // sourcePosition ).getText() ); } }); text.addFocusListener(new FocusListener() { public void focusGained(final FocusEvent e) { // do nothing } public void focusLost(final FocusEvent e) { String value = ""; Path p = new Path(MultipleInputDialog.this.controlList.get(sourcePosition).getText()); value = p.lastSegment(); if (MultipleInputDialog.this.controlList.get(targetPosition).getText() != null && MultipleInputDialog.this.controlList.get(targetPosition).getText() .length() == 0) { MultipleInputDialog.this.controlList.get(targetPosition).setText(value); } } }); } } }
From source file:msi.gama.application.workspace.PickWorkspaceDialog.java
@Override protected void createButtonsForButtonBar(final Composite parent) { /* Clone workspace needs a lot of checks */ final Button clone = createButton(parent, IDialogConstants.IGNORE_ID, "Clone existing workspace", false); clone.addListener(SWT.Selection, arg0 -> cloneCurrentWorkspace()); createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:msi.gama.gui.swt.dialogs.PickWorkspaceDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(final Composite parent) { /* Clone workspace needs a lot of checks */ Button clone = createButton(parent, IDialogConstants.IGNORE_ID, "Clone current workspace", false); clone.addListener(SWT.Selection, new Listener() { @Override/*www . ja v a 2 s . c o m*/ public void handleEvent(final Event arg0) { cloneCurrentWorkspace(); // try { // String txt = workspacePathCombo.getText(); // File workspaceDirectory = new File(txt); // if ( !workspaceDirectory.exists() ) { // MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", // "The path entered does not exist. Please enter a valid path."); // return; // } // // if ( !workspaceDirectory.canRead() ) { // MessageDialog // .openError(Display.getDefault().getActiveShell(), "Error", // "The currently entered workspace path is not readable. Please check file system permissions."); // return; // } // // // check for workspace file (empty indicator that it's a workspace) // File wsFile = new File(txt + File.separator + WS_IDENTIFIER); // if ( !wsFile.exists() ) { // boolean b = // MessageDialog.openConfirm(Display.getDefault().getActiveShell(), "Confirm cloning", // "A new workspace will be created at location " + txt + // " and the current workspace contents will be copied to it. Confirm ?"); // if ( !b ) { return; } // if ( !checkAndCreateWorkspaceRoot(txt) ) { return; } // } else { // boolean b = // MessageDialog // .openConfirm( // Display.getDefault().getActiveShell(), // "Existing workspace", // "The path entered is a path to an existing workspace. All its contents will be erased and replaced by the current workspace contents. Proceed anyway ?"); // if ( !b ) { return; } // } // // DirectoryDialog dd = new DirectoryDialog(Display.getDefault().getActiveShell()); // dd.setFilterPath(txt); // String directory = dd.open(); // if ( directory == null ) { return; } // // File targetDirectory = new File(directory); // if ( targetDirectory.getAbsolutePath().equals(workspaceDirectory.getAbsolutePath()) ) { // MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", // "Source and target workspaces are the same"); // return; // } // // // recursive check, if new directory is a subdirectory of // // our workspace, that's a big no-no or we'll // // create directories forever // if ( isTargetSubdirOfDir(workspaceDirectory, targetDirectory) ) { // MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", // "The path entered is a subdirectory of the current workspace"); // return; // } // // try { // copyFiles(workspaceDirectory, targetDirectory); // } catch (Exception err) { // MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", // "There was an error cloning the workspace: " + err.getMessage()); // return; // } // // boolean setActive = // MessageDialog.openConfirm(Display.getDefault().getActiveShell(), "Workspace Cloned", // "Would you like to set the newly cloned workspace to be the active one?"); // if ( setActive ) { // workspacePathCombo.setText(directory); // } // } catch (Exception err) { // MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", // "There was an internal error, please check the logs"); // err.printStackTrace(); // } } }); createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:net.bioclipse.ui.dialogs.PickWorkspaceDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { // clone workspace needs a lot of checks Button clone = createButton(parent, IDialogConstants.IGNORE_ID, "Clone Selected", false); clone.addListener(SWT.Selection, new Listener() { public void handleEvent(Event arg0) { try { String txt = _workspacePathCombo.getText(); File workspaceDirectory = new File(txt); if (!workspaceDirectory.exists()) { MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", "The currently entered workspace path does not exist. Please enter a valid path."); return; }// w w w .ja v a2s .c o m if (!workspaceDirectory.canRead()) { MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", "The currently entered workspace path is not readable. Please check file system permissions."); return; } DirectoryDialog dd = new DirectoryDialog(Display.getDefault().getActiveShell()); dd.setText("Select folder for clone"); dd.setFilterPath(new File(txt).getParentFile().getAbsolutePath()); String directory = dd.open(); if (directory == null) { return; } File targetDirectory = new File(directory); if (targetDirectory.getAbsolutePath().equals(workspaceDirectory.getAbsolutePath())) { MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", "Source and target workspaces are the same"); return; } // recursive check, if new directory is a subdirectory of our workspace, that's a big no-no or we'll // create directories forever if (isTargetSubdirOfDir(workspaceDirectory, targetDirectory)) { MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", "Target folder is a subdirectory of the current workspace"); return; } try { copyFiles(workspaceDirectory, targetDirectory); } catch (Exception err) { MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", "There was an error cloning the workspace: " + err.getMessage()); return; } boolean setActive = MessageDialog.openQuestion(Display.getDefault().getActiveShell(), "Workspace Cloned", "Would you like to set the newly cloned workspace to be the active one?"); if (setActive) { _workspacePathCombo.setText(directory); } } catch (Exception err) { MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", "There was an internal error, please check the logs"); err.printStackTrace(); } } }); createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:net.bpelunit.framework.client.eclipse.dialog.field.FileField.java
License:Open Source License
@Override protected void createControl(Composite parent) { Label label = new Label(parent, SWT.NONE); label.setText(getLabelText());//w w w . j a va2 s. co m label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); Composite comp = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; comp.setLayout(layout); comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fText = new Text(comp, SWT.SINGLE | SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = 200; fText.setLayoutData(data); // make sure rows are the same height on both panels. label.setSize(label.getSize().x, fText.getSize().y); if (getInitialValue() != null) { fText.setText(getInitialValue()); } fCurrentSelection = fText.getText(); fText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { fCurrentSelection = fText.getText(); getDialog().validateFields(); } }); Button button = createButton(comp, IDialogConstants.IGNORE_ID, "&Browse...", false); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { String selected = FileSelector.getFile(getDialog().getShell(), fText.getText(), fFileValidator, fFilter, fRoot, fCurrentDir); if (selected != null) { fCurrentSelection = fText.getText(); fText.setText(selected); getDialog().validateFields(); } } }); }
From source file:net.bpelunit.framework.client.eclipse.dialog.field.SelectionField.java
License:Open Source License
@Override public void createControl(Composite composite) { Label label = new Label(composite, SWT.NONE); label.setText(getLabelText());/* w ww. ja v a 2s. c o m*/ label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); Composite comp = new Composite(composite, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; comp.setLayout(layout); comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fText = new Text(comp, SWT.SINGLE | SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = 200; fText.setLayoutData(data); // make sure rows are the same height on both panels. label.setSize(label.getSize().x, fText.getSize().y); if (getInitialValue() != null) { fText.setText(getInitialValue()); } fCurrentSelection = fText.getText(); fText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { fCurrentSelection = fText.getText(); getDialog().validateFields(); for (ModifyListener ml : fModifyListeners) { ml.modifyText(e); } } }); Button button = createButton(comp, IDialogConstants.IGNORE_ID, fButtonTitle, false); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), new SimpleLabelProvider()); dialog.setElements(fChoices); dialog.setTitle("Options"); dialog.setMessage("Select one of the options."); dialog.setMultipleSelection(false); int code = dialog.open(); if (code == IDialogConstants.OK_ID) { Object[] res = dialog.getResult(); if (res != null && res.length > 0) { String variable = (String) res[0]; fCurrentSelection = variable; fText.setText(variable); getDialog().validateFields(); } } } }); }