Java Code Examples for org.eclipse.ui.dialogs.ElementListSelectionDialog#setMessage()
The following examples show how to use
org.eclipse.ui.dialogs.ElementListSelectionDialog#setMessage() .
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: DotnetTestTab.java From aCute with Eclipse Public License 2.0 | 6 votes |
private void displayClassSelectorDialog() { ElementListSelectionDialog dialog = new ElementListSelectionDialog(classBrowseButton.getShell(), new LabelProvider()); dialog.setTitle(Messages.DotnetTestTab_classSelection_title); dialog.setMessage(Messages.DotnetTestTab_classSelection_message); dialog.setElements(testMethods.keySet().toArray()); dialog.open(); String selected = (String) dialog.getFirstResult(); if (selected != null) { methodBrowseButton.setEnabled(true); methodLabel.setEnabled(true); methodText.setEnabled(true); classText.setText(selected); setDirty(true); updateLaunchConfigurationDialog(); } }
Example 2
Source File: DotnetTestTab.java From aCute with Eclipse Public License 2.0 | 6 votes |
private void displayMethodSelectorDialog() { ElementListSelectionDialog dialog = new ElementListSelectionDialog(classBrowseButton.getShell(), new LabelProvider()); dialog.setTitle(NLS.bind(Messages.DotnetTestTab_methodSelection_title, classText.getText())); dialog.setMessage(Messages.DotnetTestTab_methodSelection_message); List<String> methods = testMethods.get(classText.getText()); if(methods!=null) { dialog.setElements(methods.toArray()); } dialog.open(); String selected = (String) dialog.getFirstResult(); if (selected != null) { methodText.setText(selected); setDirty(true); updateLaunchConfigurationDialog(); } }
Example 3
Source File: AbstractLauncherTab.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
protected IProject chooseXdsProject() { ElementListSelectionDialog dialog= new ElementListSelectionDialog(getShell(), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider()); dialog.setTitle(Messages.LauncherTabMain_ProjectSelection); dialog.setMessage(Messages.LauncherTabMain_SelectXdsProject+':'); dialog.setElements(ProjectUtils.getXdsProjects().toArray()); IProject currentProject = getCurrentXdsProject(); if (currentProject != null) { dialog.setInitialSelections(new Object[] { currentProject }); } if (dialog.open() == Window.OK) { return (IProject) dialog.getFirstResult(); } return null; }
Example 4
Source File: AbstractLaunchShortcut.java From Pydev with Eclipse Public License 1.0 | 6 votes |
/** * COPIED/MODIFIED from AntLaunchShortcut */ protected ILaunchConfiguration chooseConfig(List<ILaunchConfiguration> configs) { if (configs.isEmpty()) { return null; } ILabelProvider labelProvider = DebugUITools.newDebugModelPresentation(); ElementListSelectionDialog dialog = new ElementListSelectionDialog(Display.getDefault().getActiveShell(), labelProvider); dialog.setElements(configs.toArray(new ILaunchConfiguration[configs.size()])); dialog.setTitle("Pick a Python configuration"); dialog.setMessage("Choose a python configuration to run"); dialog.setMultipleSelection(false); int result = dialog.open(); labelProvider.dispose(); if (result == Window.OK) { return (ILaunchConfiguration) dialog.getFirstResult(); } else { return null; } }
Example 5
Source File: LaunchConfigurationUtilities.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
/** * Returns a configuration from the given collection of configurations that * should be launched, or <code>null</code> to cancel. Default implementation * opens a selection dialog that allows the user to choose one of the * specified launch configurations. Returns the chosen configuration, or * <code>null</code> if the user cancels. * * @param configList list of configurations to choose from * @return configuration to launch or <code>null</code> to cancel */ public static ILaunchConfiguration chooseConfiguration( List<ILaunchConfiguration> configList, Shell shell) { IDebugModelPresentation labelProvider = DebugUITools.newDebugModelPresentation(); try { ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, labelProvider); dialog.setElements(configList.toArray()); dialog.setTitle("Choose a launch configuration:"); dialog.setMessage("More than one launch configuration is applicable; please choose one:"); dialog.setMultipleSelection(false); int result = dialog.open(); if (result == Window.OK) { return (ILaunchConfiguration) dialog.getFirstResult(); } return null; } finally { labelProvider.dispose(); } }
Example 6
Source File: AbstractSarlLaunchShortcut.java From sarl with Apache License 2.0 | 6 votes |
/** * Returns a configuration from the given collection of configurations that should be launched, * or {@code null} to cancel. Default implementation opens a selection dialog that allows * the user to choose one of the specified launch configurations. Returns the chosen configuration, * or {@code null} if the user cancels. * * @param configList list of configurations to choose from. * @return configuration to launch or {@code null} to cancel. */ @SuppressWarnings("static-method") protected ILaunchConfiguration chooseConfiguration(List<ILaunchConfiguration> configList) { final IDebugModelPresentation labelProvider = DebugUITools.newDebugModelPresentation(); final ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider); dialog.setElements(configList.toArray()); dialog.setTitle(Messages.AbstractSarlLaunchShortcut_0); dialog.setMessage(Messages.AbstractSarlLaunchShortcut_1); dialog.setMultipleSelection(false); final int result = dialog.open(); labelProvider.dispose(); if (result == Window.OK) { return (ILaunchConfiguration) dialog.getFirstResult(); } return null; }
Example 7
Source File: NewSourceFolderWizardPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private IJavaProject chooseProject() { IJavaProject[] projects; try { projects= JavaCore.create(fWorkspaceRoot).getJavaProjects(); } catch (JavaModelException e) { JavaPlugin.log(e); projects= new IJavaProject[0]; } ILabelProvider labelProvider= new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT); ElementListSelectionDialog dialog= new ElementListSelectionDialog(getShell(), labelProvider); dialog.setTitle(NewWizardMessages.NewSourceFolderWizardPage_ChooseProjectDialog_title); dialog.setMessage(NewWizardMessages.NewSourceFolderWizardPage_ChooseProjectDialog_description); dialog.setElements(projects); dialog.setInitialSelections(new Object[] { fCurrJProject }); dialog.setHelpAvailable(false); if (dialog.open() == Window.OK) { return (IJavaProject) dialog.getFirstResult(); } return null; }
Example 8
Source File: SelectionConverter.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * Shows a dialog for resolving an ambiguous Java element. Utility method that can be called by subclasses. * * @param elements the elements to select from * @param shell the parent shell * @param title the title of the selection dialog * @param message the message of the selection dialog * @return returns the selected element or <code>null</code> if the dialog has been cancelled */ public static IJavaElement selectJavaElement(IJavaElement[] elements, Shell shell, String title, String message) { int nResults= elements.length; if (nResults == 0) return null; if (nResults == 1) return elements[0]; int flags= JavaElementLabelProvider.SHOW_DEFAULT | JavaElementLabelProvider.SHOW_QUALIFIED | JavaElementLabelProvider.SHOW_ROOT; ElementListSelectionDialog dialog= new ElementListSelectionDialog(shell, new JavaElementLabelProvider(flags)); dialog.setTitle(title); dialog.setMessage(message); dialog.setElements(elements); if (dialog.open() == Window.OK) { return (IJavaElement) dialog.getFirstResult(); } return null; }
Example 9
Source File: BaseLaunchShortcut.java From goclipse with Eclipse Public License 1.0 | 5 votes |
protected ILaunchConfiguration chooseConfiguration(Indexable<ILaunchConfiguration> configs) throws OperationCancellation { IDebugModelPresentation labelProvider = DebugUITools.newDebugModelPresentation(); try { ElementListSelectionDialog dialog = new ElementListSelectionDialog(getActiveShell(), labelProvider); dialog.setTitle(LangUIMessages.LaunchShortcut_selectLaunch_title); dialog.setMessage(LangUIMessages.LaunchShortcut_selectLaunch_message); dialog.setMultipleSelection(false); return ControlUtils.setElementsAndOpenDialog(dialog, configs); } finally { labelProvider.dispose(); } }
Example 10
Source File: CdtProjectFieldEditor.java From ghidra with Apache License 2.0 | 5 votes |
@Override protected String changePressed() { ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), new LabelProvider()); dialog.setTitle("CDT project selection"); dialog.setMessage("Select an open CDT project:"); dialog.setElements(CdtUtils.getCDTProjects().stream().map(p -> p.getName()).toArray()); dialog.open(); Object[] result = dialog.getResult(); if (result != null && result.length > 0 && result[0] instanceof String) { return (String) result[0]; } return null; }
Example 11
Source File: AddImportOnSelectionAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public TypeNameMatch chooseImport(TypeNameMatch[] results, String containerName) { int nResults= results.length; if (nResults == 0) { return null; } else if (nResults == 1) { return results[0]; } if (containerName.length() != 0) { for (int i= 0; i < nResults; i++) { TypeNameMatch curr= results[i]; if (containerName.equals(curr.getTypeContainerName())) { return curr; } } } fIsShowing= true; ElementListSelectionDialog dialog= new ElementListSelectionDialog(fShell, new TypeNameMatchLabelProvider(TypeNameMatchLabelProvider.SHOW_FULLYQUALIFIED)) { @Override protected FilteredList createFilteredList(Composite parent) { FilteredList filteredList= super.createFilteredList(parent); filteredList.setComparator(ADD_IMPORT_COMPARATOR); return filteredList; } }; dialog.setTitle(JavaEditorMessages.AddImportOnSelection_dialog_title); dialog.setMessage(JavaEditorMessages.AddImportOnSelection_dialog_message); dialog.setElements(results); if (dialog.open() == Window.OK) { fIsShowing= false; TypeNameMatch result= (TypeNameMatch) dialog.getFirstResult(); QualifiedTypeNameHistory.remember(result.getFullyQualifiedName()); return result; } fIsShowing= false; return null; }
Example 12
Source File: NewTypeWizardPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Opens a selection dialog that allows to select a package. * * @return returns the selected package or <code>null</code> if the dialog has been canceled. * The caller typically sets the result to the package input field. * <p> * Clients can override this method if they want to offer a different dialog. * </p> * * @since 3.2 */ protected IPackageFragment choosePackage() { IPackageFragmentRoot froot= getPackageFragmentRoot(); IJavaElement[] packages= null; try { if (froot != null && froot.exists()) { packages= froot.getChildren(); } } catch (JavaModelException e) { JavaPlugin.log(e); } if (packages == null) { packages= new IJavaElement[0]; } ElementListSelectionDialog dialog= new ElementListSelectionDialog(getShell(), new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT)); dialog.setIgnoreCase(false); dialog.setTitle(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_title); dialog.setMessage(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_description); dialog.setEmptyListMessage(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_empty); dialog.setElements(packages); dialog.setHelpAvailable(false); IPackageFragment pack= getPackageFragment(); if (pack != null) { dialog.setInitialSelections(new Object[] { pack }); } if (dialog.open() == Window.OK) { return (IPackageFragment) dialog.getFirstResult(); } return null; }
Example 13
Source File: PySourceLocatorBase.java From Pydev with Eclipse Public License 1.0 | 5 votes |
/** * Ask the user to select one file of the given list of files (if some is available) * * @param files the files available for selection. * @return the selected file (from the files passed) or null if there was no file available for * selection or if the user canceled it. */ private IFile selectWorkspaceFile(final IFile[] files) { if (files == null || files.length == 0) { return null; } if (files.length == 1) { return files[0]; } final List<IFile> selected = new ArrayList<IFile>(); Runnable r = new Runnable() { @Override public void run() { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, new PyFileLabelProvider()); dialog.setElements(files); dialog.setTitle("Select Workspace File"); dialog.setMessage("File may be matched to multiple files in the workspace."); if (dialog.open() == Window.OK) { selected.add((IFile) dialog.getFirstResult()); } } }; if (Display.getCurrent() == null) { //not ui-thread Display.getDefault().syncExec(r); } else { r.run(); } if (selected.size() > 0) { return selected.get(0); } return null; }
Example 14
Source File: NLSAccessorConfigurationDialog.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void browseForPropertyFile() { ElementListSelectionDialog dialog= new ElementListSelectionDialog(getShell(), new JavaElementLabelProvider()); dialog.setIgnoreCase(false); dialog.setTitle(NLSUIMessages.NLSAccessorConfigurationDialog_Property_File_Selection); dialog.setMessage(NLSUIMessages.NLSAccessorConfigurationDialog_Choose_the_property_file); dialog.setElements(createFileListInput()); dialog.setFilter('*' + NLSRefactoring.PROPERTY_FILE_EXT); if (dialog.open() == Window.OK) { IFile selectedFile= (IFile) dialog.getFirstResult(); if (selectedFile != null) fResourceBundleFile.setText(selectedFile.getName()); } }
Example 15
Source File: PackageSelectionStringButtonAdapter.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public void changeControlPressed(DialogField field) { IPackageFragmentRoot root= fPackageSelectionField.getSelectedFragmentRoot(); IJavaElement[] packages= null; try { if (root != null && root.exists()) { packages= root.getChildren(); } } catch (JavaModelException e) { // no need to react } if (packages == null) { packages= new IJavaElement[0]; } ElementListSelectionDialog dialog= new ElementListSelectionDialog(field.getLabelControl(null).getShell(), new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT)); dialog.setIgnoreCase(true); dialog.setTitle(fTitle); dialog.setMessage(fMessage); dialog.setEmptyListMessage(fEmtpyListMessage); dialog.setElements(packages); // TODO initial selection // List selection = new ArrayList(); // selection.add(fPackageSelectionField.fPackageSelection.getPackageFragment()); // dialog.setInitialElementSelections(selection); if (dialog.open() == Window.OK) { IPackageFragment fragment= (IPackageFragment)dialog.getFirstResult(); fPackageSelectionField.setSelected(fragment); } }
Example 16
Source File: PackageBrowseAdapter.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public void changeControlPressed(DialogField field) { ElementListSelectionDialog dialog= new ElementListSelectionDialog( Display.getCurrent().getActiveShell(), new JavaElementLabelProvider()); dialog.setIgnoreCase(false); dialog.setTitle(NLSUIMessages.PackageBrowseAdapter_package_selection); dialog.setMessage(NLSUIMessages.PackageBrowseAdapter_choose_package); dialog.setElements(createPackageListInput(fCu, null)); if (dialog.open() == Window.OK) { IPackageFragment selectedPackage= (IPackageFragment)dialog.getFirstResult(); if (selectedPackage != null) { fReceiver.setPackage(selectedPackage); } } }
Example 17
Source File: NewHostPageWizardPage.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
private IJavaProject chooseProject() { IJavaProject[] projects; try { projects = JavaCore.create(Util.getWorkspaceRoot()).getJavaProjects(); } catch (JavaModelException e) { JavaPlugin.log(e); projects = new IJavaProject[0]; } // Filter the list to only show GWT projects List<IJavaProject> gwtProjects = new ArrayList<IJavaProject>(); for (IJavaProject project : projects) { if (GWTNature.isGWTProject(project.getProject())) { gwtProjects.add(project); } } // TODO: refactor this into utility function ILabelProvider labelProvider = new JavaElementLabelProvider( JavaElementLabelProvider.SHOW_DEFAULT); ElementListSelectionDialog dialog = new ElementListSelectionDialog( getShell(), labelProvider); dialog.setTitle("Project Selection"); dialog.setMessage("Choose a project for the new HTML page"); dialog.setElements(gwtProjects.toArray(new IJavaProject[0])); dialog.setInitialSelections(new Object[] {getJavaProject()}); dialog.setHelpAvailable(false); if (dialog.open() == Window.OK) { return (IJavaProject) dialog.getFirstResult(); } return null; }
Example 18
Source File: NewModuleWizardPage.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
private IPackageFragment choosePackage() { IPackageFragmentRoot root = getPackageFragmentRoot(); IJavaElement[] packages = null; try { if (root != null && root.exists()) { packages = root.getChildren(); } } catch (JavaModelException e) { JavaPlugin.log(e); } if (packages == null) { packages = new IJavaElement[0]; } ElementListSelectionDialog dialog = new ElementListSelectionDialog( getShell(), new JavaElementLabelProvider( JavaElementLabelProvider.SHOW_DEFAULT)); dialog.setIgnoreCase(false); dialog.setTitle(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_title); dialog.setMessage(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_description); dialog.setEmptyListMessage(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_empty); dialog.setElements(packages); dialog.setHelpAvailable(false); if (dialog.open() == Window.OK) { return (IPackageFragment) dialog.getFirstResult(); } return null; }
Example 19
Source File: GWTCompileDialog.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
private IJavaProject chooseProject() { IJavaProject[] javaProjects; try { javaProjects = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()).getJavaProjects(); } catch (JavaModelException e) { GWTPluginLog.logError(e); javaProjects = new IJavaProject[0]; } // Filter the list to only show GWT projects List<IJavaProject> gwtProjects = new ArrayList<IJavaProject>(); for (IJavaProject javaProject : javaProjects) { if (GWTNature.isGWTProject(javaProject.getProject())) { gwtProjects.add(javaProject); } } ILabelProvider labelProvider = new JavaElementLabelProvider( JavaElementLabelProvider.SHOW_DEFAULT); ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider); dialog.setTitle("Project Selection"); dialog.setMessage("Choose a project to compile"); dialog.setElements(gwtProjects.toArray(new IJavaProject[0])); dialog.setInitialSelections(new Object[] {JavaCore.create(project)}); dialog.setHelpAvailable(false); if (dialog.open() == Window.OK) { return (IJavaProject) dialog.getFirstResult(); } return null; }
Example 20
Source File: BaseLaunchShortcut.java From goclipse with Eclipse Public License 1.0 | 5 votes |
protected ILaunchable chooseLaunchable(ILaunchable[] launchTargets) throws OperationCancellation { ElementListSelectionDialog dialog = new ElementListSelectionDialog(getActiveShell(), createLaunchTargetLabelProvider()); dialog.setTitle(LangUIMessages.LaunchShortcut_selectLaunchableToLaunch); dialog.setMessage(LangUIMessages.LaunchShortcut_selectLaunchableToLaunch); return ControlUtils.setElementsAndOpenDialog(dialog, launchTargets); }