org.eclipse.ui.dialogs.ResourceSelectionDialog Java Examples
The following examples show how to use
org.eclipse.ui.dialogs.ResourceSelectionDialog.
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: InputComponent.java From corrosion with Eclipse Public License 2.0 | 5 votes |
public void createResourceSelection(Supplier<IAdaptable> rootSupplier) { createSelectionButton(); browseButton.addSelectionListener(widgetSelectedAdapter(e -> { ResourceSelectionDialog dialog = new ResourceSelectionDialog(browseButton.getShell(), rootSupplier.get(), this.labelString); dialog.setTitle(Messages.LaunchUI_selection); int returnCode = dialog.open(); Object[] results = dialog.getResult(); if (returnCode == 0 && results.length > 0) { text.setText(((IResource) results[0]).getFullPath().makeRelative().toString()); editListener.modifyText(null); } })); }
Example #2
Source File: INSDComponentPage.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * Creates a new button * <p> * The <code>Dialog</code> implementation of this framework method creates a standard push * button, registers for selection events including button presses and registers default buttons * with its shell. The button id is stored as the buttons client data. Note that the parent's * layout is assumed to be a GridLayout and the number of columns in this layout is incremented. * Subclasses may override. * </p> * * @param parent the parent composite * @param label the label from the button * @param defaultButton <code>true</code> if the button is to be the default button, and <code>false</code> * otherwise * @param text the text * @return the button */ protected Button addButton(Composite parent, String label, boolean defaultButton, final Text text) { Button button = new Button(parent, SWT.PUSH); button.setText(label); if (defaultButton) { Shell shell = parent.getShell(); if (shell != null) { shell.setDefaultButton(button); } button.setFocus(); } button.setFont(parent.getFont()); SelectionListener listener = new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ResourceSelectionDialog dialog = new ResourceSelectionDialog(getShell(), currentContainer, "Selection Dialog"); dialog.setTitle("Selection Dialog"); dialog.setMessage("Please select a file:"); dialog.open(); Object[] result = dialog.getResult(); if (result[0] != null) { IResource res = (IResource) result[0]; text.setText(res.getProjectRelativePath().toOSString()); } } }; button.addSelectionListener(listener); return button; }