Java Code Examples for org.eclipse.ui.dialogs.ListDialog#getResult()
The following examples show how to use
org.eclipse.ui.dialogs.ListDialog#getResult() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OpenXtextElementHandler.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Override public Object execute(ExecutionEvent event) throws ExecutionException { Shell activeShell = HandlerUtil.getActiveShell(event); ListDialog searchDialog = createSearchDialog(event, activeShell, searchEngine); int result = searchDialog.open(); if (result == Window.OK) { try { Object[] selections = searchDialog.getResult(); if (selections != null && selections.length > 0) { Object selection = selections[0]; if (selection instanceof IEObjectDescription) { IEObjectDescription selectedObjectDescription = (IEObjectDescription) selection; uriEditorOpener.open(selectedObjectDescription.getEObjectURI(), true); } } } catch (Exception e) { LOG.error("Error opening editor", e); throw new ExecutionException("Error opening editor", e); } } return null; }
Example 2
Source File: ConfigureProjectFromBluePrintAction.java From eclipse-cs with GNU Lesser General Public License v2.1 | 5 votes |
/** * {@inheritDoc} */ @Override public void run(IAction action) { IProject[] projects = CheckstyleUIPlugin.getWorkspace().getRoot().getProjects(); List<IProject> filteredProjects = new ArrayList<>(); for (int i = 0; i < projects.length; i++) { filteredProjects.add(projects[i]); } filteredProjects.removeAll(mSelectedProjects); ListDialog dialog = new ListDialog(mPart.getSite().getShell()); dialog.setInput(filteredProjects); dialog.setContentProvider(new ArrayContentProvider()); dialog.setLabelProvider(new WorkbenchLabelProvider()); dialog.setMessage(Messages.ConfigureProjectFromBluePrintAction_msgSelectBlueprintProject); dialog.setTitle(Messages.ConfigureProjectFromBluePrintAction_titleSelectBlueprintProject); if (Window.OK == dialog.open()) { Object[] result = dialog.getResult(); if (result.length > 0) { BulkConfigureJob job = new BulkConfigureJob((IProject) result[0], mSelectedProjects); job.schedule(); } } }
Example 3
Source File: NewMergeFileAssociationWizardPage.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
private void addVariables(Text target, Map bindings) { final List variables = new ArrayList(bindings.size()); ILabelProvider labelProvider = new LabelProvider() { public String getText(Object element) { return ((StringPair) element).s1 + " - " + ((StringPair) element).s2; //$NON-NLS-1$ } }; IStructuredContentProvider contentsProvider = new IStructuredContentProvider() { public Object[] getElements(Object inputElement) { return variables.toArray(new StringPair[variables.size()]); } public void dispose() { } public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } }; for (Iterator it = bindings.keySet().iterator(); it.hasNext();) { StringPair variable = new StringPair(); variable.s1 = (String) it.next(); // variable variable.s2 = (String) bindings.get(variable.s1); // description variables.add(variable); } ListDialog dialog = new ListDialog(this.getShell()); dialog.setContentProvider(contentsProvider); dialog.setAddCancelButton(true); dialog.setLabelProvider(labelProvider); dialog.setInput(variables); dialog.setTitle(Policy .bind("DiffMergePreferencePage.addVariableDialogTitle")); //$NON-NLS-1$ if (dialog.open() != ListDialog.OK) return; Object[] result = dialog.getResult(); for (int i = 0; i < result.length; i++) { target.insert("${" + ((StringPair) result[i]).s1 + "}"); //$NON-NLS-1$ //$NON-NLS-2$ } }
Example 4
Source File: DiffMergePreferencePage.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
/** * Add another variable to the given target. The variable is inserted at * current position A ListSelectionDialog is shown and the choose the * variables to add */ private void addVariables(Text target, Map bindings) { final List variables = new ArrayList(bindings.size()); ILabelProvider labelProvider = new LabelProvider() { public String getText(Object element) { return ((StringPair) element).s1 + " - " + ((StringPair) element).s2; //$NON-NLS-1$ } }; IStructuredContentProvider contentsProvider = new IStructuredContentProvider() { public Object[] getElements(Object inputElement) { return variables.toArray(new StringPair[variables.size()]); } public void dispose() { } public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } }; for (Iterator it = bindings.keySet().iterator(); it.hasNext();) { StringPair variable = new StringPair(); variable.s1 = (String) it.next(); // variable variable.s2 = (String) bindings.get(variable.s1); // description variables.add(variable); } ListDialog dialog = new ListDialog(this.getShell()); dialog.setContentProvider(contentsProvider); dialog.setAddCancelButton(true); dialog.setLabelProvider(labelProvider); dialog.setInput(variables); dialog.setTitle(Policy .bind("DiffMergePreferencePage.addVariableDialogTitle")); //$NON-NLS-1$ if (dialog.open() != ListDialog.OK) return; Object[] result = dialog.getResult(); for (int i = 0; i < result.length; i++) { target.insert("${" + ((StringPair) result[i]).s1 + "}"); //$NON-NLS-1$ //$NON-NLS-2$ } }
Example 5
Source File: MergeFileAssociationPreferencePage.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
private void addVariables(Text target, Map bindings) { final List variables = new ArrayList(bindings.size()); ILabelProvider labelProvider = new LabelProvider() { public String getText(Object element) { return ((StringPair) element).s1 + " - " + ((StringPair) element).s2; //$NON-NLS-1$ } }; IStructuredContentProvider contentsProvider = new IStructuredContentProvider() { public Object[] getElements(Object inputElement) { return variables.toArray(new StringPair[variables.size()]); } public void dispose() { } public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } }; for (Iterator it = bindings.keySet().iterator(); it.hasNext();) { StringPair variable = new StringPair(); variable.s1 = (String) it.next(); // variable variable.s2 = (String) bindings.get(variable.s1); // description variables.add(variable); } ListDialog dialog = new ListDialog(this.getShell()); dialog.setContentProvider(contentsProvider); dialog.setAddCancelButton(true); dialog.setLabelProvider(labelProvider); dialog.setInput(variables); dialog.setTitle(Policy .bind("DiffMergePreferencePage.addVariableDialogTitle")); //$NON-NLS-1$ if (dialog.open() != ListDialog.OK) return; Object[] result = dialog.getResult(); for (int i = 0; i < result.length; i++) { target.insert("${" + ((StringPair) result[i]).s1 + "}"); //$NON-NLS-1$ //$NON-NLS-2$ } }