@Override public String selectArgument(IStringVariable variable, Shell shell) { ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, new LabelProvider()); dialog.setElements(System.getProperties().keySet().toArray()); dialog.setTitle(StringSubstitutionMessages.SystemPropertyArgumentSelector_0); dialog.setMessage(StringSubstitutionMessages.SystemPropertyArgumentSelector_1); if (dialog.open() == Window.OK) { return (String) dialog.getResult()[0]; } return null; }
public int open() { MainMethodSearchEngine engine= new MainMethodSearchEngine(); IType[] types; try { types= engine.searchMainMethods(fRunnableContext, fScope, fStyle); } catch (InterruptedException e) { return CANCEL; } catch (InvocationTargetException e) { //XX: to do ExceptionHandler.handle(e, JavaUIMessages.MultiMainTypeSelectionDialog_errorTitle, e.getMessage()); return CANCEL; } setElements(types); return super.open(); }
@Override public int open() { MainMethodSearchEngine engine= new MainMethodSearchEngine(); IType[] types; try { types= engine.searchMainMethods(fRunnableContext, fScope, fStyle); } catch (InterruptedException e) { return CANCEL; } catch (InvocationTargetException e) { //XX: to do ExceptionHandler.handle(e, JavaUIMessages.MultiMainTypeSelectionDialog_errorTitle, e.getMessage()); return CANCEL; } setElements(types); return super.open(); }
@Override public int open() { MainMethodSearchEngine engine= new MainMethodSearchEngine(); IType[] types; try { types= engine.searchMainMethods(fRunnableContext, fScope, fStyle); } catch (InterruptedException e) { return CANCEL; } catch (InvocationTargetException e) { //XX: to do ExceptionHandler.handle(e, JavaUIMessages.MultiMainTypeSelectionDialog_errorTitle, e.getMessage()); return CANCEL; } setElements(types); return super.open(); }
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(); } }
@Override protected void browse() { ElementListSelectionDialog dialog = new ElementListSelectionDialog(PDEPlugin.getActiveWorkbenchShell(), new IdAttributeLabelProvider()); dialog.setTitle(PDEUIMessages.IdAttributeRow_title); dialog.setMessage(PDEUIMessages.IdAttributeRow_message); dialog.setEmptyListMessage(PDEUIMessages.IdAttributeRow_emptyMessage); Map<String, IConfigurationElement> attributeMap = PDESchemaHelper.getValidAttributes(getAttribute()); dialog.setElements(attributeMap.entrySet().toArray()); dialog.setFilter("*"); //$NON-NLS-1$ if (dialog.open() == Window.OK) { Map.Entry<?, ?> entry = (Entry<?, ?>) dialog.getFirstResult(); text.setText(entry.getKey().toString()); } }
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(); } }
/** * Prompts the user to select an element from the given element types. * * @param elements the element types to choose from. * @return the selected element or <code>null</code> if none. */ private ElementDescription chooseElement(List<ElementDescription> elements) { final ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), new LabelProvider()); dialog.setElements(elements.toArray()); dialog.setTitle(MessageFormat.format(Messages.AbstractSarlScriptInteractiveSelector_3, getElementLabel())); dialog.setMessage(MessageFormat.format(Messages.AbstractSarlScriptInteractiveSelector_3, getElementLongLabel())); dialog.setMultipleSelection(false); final int result = dialog.open(); if (result == Window.OK) { return (ElementDescription) dialog.getFirstResult(); } return null; }
/** * Shows a dialog for resolving an ambiguous java element. * Utility method that can be called by subclasses. */ 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; } }
private ILaunchConfiguration chooseConfiguration(ILaunchConfiguration[] configs) { IDebugModelPresentation labelProvider = DebugUITools.newDebugModelPresentation(); ElementListSelectionDialog dialog = new ElementListSelectionDialog(PDEPlugin.getActiveWorkbenchShell(), labelProvider); dialog.setElements(configs); dialog.setTitle(PDEUIMessages.RuntimeWorkbenchShortcut_title); if (fMode.equals(ILaunchManager.DEBUG_MODE)) { dialog.setMessage(PDEUIMessages.RuntimeWorkbenchShortcut_select_debug); } else { dialog.setMessage(PDEUIMessages.RuntimeWorkbenchShortcut_select_run); } dialog.setMultipleSelection(false); int result = dialog.open(); labelProvider.dispose(); if (result == Window.OK) { return (ILaunchConfiguration) dialog.getFirstResult(); } return null; }
public static IJavaProject getSelectedProject(Shell parentShell) { ElementListSelectionDialog dialog= new ElementListSelectionDialog( parentShell, new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT) ); dialog.setTitle(ResourceUtil.getString("TestNGMainTab.projectdialog.title")); //$NON-NLS-1$ dialog.setMessage(ResourceUtil.getString("TestNGMainTab.projectdialog.message")); //$NON-NLS-1$ dialog.setElements(JDTUtil.getJavaProjects()); if(Window.OK == dialog.open()) { return (IJavaProject) dialog.getFirstResult(); } return null; } }
/** * Prompts the user to choose a JRE for the given project. * Returns the selected VM or <code>null</code>. * * @param title the title for the dialog * @param message the message for the dialog * @return selected VM or <code>null</code> */ protected IVMInstall chooseVMInstall(String title, String message) { ElementListSelectionDialog dialog = new ElementListSelectionDialog(JDIDebugUIPlugin.getActiveWorkbenchShell(), new JREsLabelProvider()); dialog.setElements(getAllVMs()); dialog.setTitle(title); dialog.setMessage(message); dialog.setMultipleSelection(false); dialog.open(); return (IVMInstall)dialog.getFirstResult(); }
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); } } } public static Object[] createPackageListInput(ICompilationUnit cu, String elementNameMatch){
public void run() { ElementListSelectionDialog dialog = new ElementListSelectionDialog(Display.getCurrent().getActiveShell(), new LaunchConfigurationLabelProvider()); dialog.setElements(existingLaunchConfigurations); dialog.setTitle("Choose Launch Configuration"); dialog.setMessage("Multiple launch configuration apply to your selection.\nPlease choose one:"); dialog.setMultipleSelection(false); if (dialog.open() != Window.OK) { return; } result.setResult((ILaunchConfiguration) dialog.getResult()[0]); } });
@Override 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); } } } public static Object[] createPackageListInput(ICompilationUnit cu, String elementNameMatch){
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()); } }
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()); } }
@Override 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); } } } public static Object[] createPackageListInput(ICompilationUnit cu, String elementNameMatch){
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()); } }
private void handleAdd() { ElementListSelectionDialog dialog = new ElementListSelectionDialog(PDEPlugin.getActiveWorkbenchShell(), new EELabelProvider()); dialog.setElements(getEnvironments()); dialog.setAllowDuplicates(false); dialog.setMultipleSelection(true); dialog.setTitle(PDEUIMessages.RequiredExecutionEnvironmentSection_dialog_title); dialog.setMessage(PDEUIMessages.RequiredExecutionEnvironmentSection_dialogMessage); dialog.create(); PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(), IHelpContextIds.EXECUTION_ENVIRONMENT_SELECTION); if (dialog.open() == Window.OK) { addExecutionEnvironments(dialog.getResult()); } }