Java Code Examples for org.eclipse.ui.dialogs.ElementTreeSelectionDialog#setTitle()
The following examples show how to use
org.eclipse.ui.dialogs.ElementTreeSelectionDialog#setTitle() .
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: HiveTab.java From neoscada with Eclipse Public License 1.0 | 6 votes |
protected void chooseWorkspace () { final ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog ( getShell (), new WorkbenchLabelProvider (), new WorkbenchContentProvider () ); dialog.setTitle ( "Select driver exporter configuration file" ); dialog.setMessage ( "Choose a driver exporter file for the configuration" ); dialog.setInput ( ResourcesPlugin.getWorkspace ().getRoot () ); dialog.setComparator ( new ResourceComparator ( ResourceComparator.NAME ) ); dialog.setAllowMultiple ( true ); dialog.setDialogBoundsSettings ( getDialogBoundsSettings ( HiveTab.WORKSPACE_SELECTION_DIALOG ), Dialog.DIALOG_PERSISTSIZE ); if ( dialog.open () == IDialogConstants.OK_ID ) { final IResource resource = (IResource)dialog.getFirstResult (); if ( resource != null ) { final String arg = resource.getFullPath ().toString (); final String fileLoc = VariablesPlugin.getDefault ().getStringVariableManager ().generateVariableExpression ( "workspace_loc", arg ); //$NON-NLS-1$ this.fileText.setText ( fileLoc ); makeDirty (); } } }
Example 2
Source File: WorkspaceTools.java From depan with Apache License 2.0 | 6 votes |
/** * Open a dialog box asking the user to select an existing project under the * current workspace. * * @param parentShell * @param title */ public static IResource selectFile(Shell parentShell, String title) { ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog( parentShell, new WorkbenchLabelProvider(), new WorkbenchContentProvider() ); dialog.setInput(ResourcesPlugin.getWorkspace().getRoot()); dialog.setTitle(title); dialog.setAllowMultiple(false); if(dialog.open() == ElementTreeSelectionDialog.OK) { return (IResource) dialog.getFirstResult(); } return null; }
Example 3
Source File: JarManifestWizardPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Creates and returns a dialog to choose an existing workspace file. * @param title the title * @param message the dialog message * @return the dialog */ protected ElementTreeSelectionDialog createWorkspaceFileSelectionDialog(String title, String message) { int labelFlags= JavaElementLabelProvider.SHOW_BASICS | JavaElementLabelProvider.SHOW_OVERLAY_ICONS | JavaElementLabelProvider.SHOW_SMALL_ICONS; final DecoratingLabelProvider provider= new DecoratingLabelProvider(new JavaElementLabelProvider(labelFlags), new ProblemsLabelDecorator(null)); ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(getShell(), provider, new StandardJavaElementContentProvider()); dialog.setComparator(new JavaElementComparator()); dialog.setAllowMultiple(false); dialog.setValidator(new ISelectionStatusValidator() { public IStatus validate(Object[] selection) { StatusInfo res= new StatusInfo(); // only single selection if (selection.length == 1 && (selection[0] instanceof IFile)) res.setOK(); else res.setError(""); //$NON-NLS-1$ return res; } }); dialog.addFilter(new EmptyInnerPackageFilter()); dialog.addFilter(new LibraryFilter()); dialog.setTitle(title); dialog.setMessage(message); dialog.setStatusLineAboveButtons(true); dialog.setInput(JavaCore.create(JavaPlugin.getWorkspace().getRoot())); return dialog; }
Example 4
Source File: NativeLibrariesConfigurationBlock.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private String chooseInternal() { String initSelection= fPathField.getText(); ILabelProvider lp= new WorkbenchLabelProvider(); ITreeContentProvider cp= new WorkbenchContentProvider(); Class<?>[] acceptedClasses= new Class[] { IProject.class, IFolder.class }; TypedElementSelectionValidator validator= new TypedElementSelectionValidator(acceptedClasses, true); ViewerFilter filter= new TypedViewerFilter(acceptedClasses); IResource initSel= null; IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot(); if (initSelection.length() > 0) { initSel= root.findMember(new Path(initSelection)); } if (initSel == null) { initSel= root.findMember(fEntry.getPath()); } ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(fShell, lp, cp); dialog.setAllowMultiple(false); dialog.setValidator(validator); dialog.addFilter(filter); dialog.setComparator(new ResourceComparator(ResourceComparator.NAME)); dialog.setTitle(NewWizardMessages.NativeLibrariesDialog_intfiledialog_title); dialog.setMessage(NewWizardMessages.NativeLibrariesDialog_intfiledialog_message); dialog.setInput(root); dialog.setInitialSelection(initSel); dialog.setHelpAvailable(false); if (dialog.open() == Window.OK) { IResource res= (IResource) dialog.getFirstResult(); return res.getFullPath().makeRelative().toString(); } return null; }
Example 5
Source File: NewSourceFolderWizardPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private IFolder chooseFolder(String title, String message, IPath initialPath) { Class<?>[] acceptedClasses= new Class[] { IFolder.class }; ISelectionStatusValidator validator= new TypedElementSelectionValidator(acceptedClasses, false); ViewerFilter filter= new TypedViewerFilter(acceptedClasses, null); ILabelProvider lp= new WorkbenchLabelProvider(); ITreeContentProvider cp= new WorkbenchContentProvider(); IProject currProject= fCurrJProject.getProject(); ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(getShell(), lp, cp); dialog.setValidator(validator); dialog.setTitle(title); dialog.setMessage(message); dialog.addFilter(filter); dialog.setInput(currProject); dialog.setComparator(new ResourceComparator(ResourceComparator.NAME)); IResource res= currProject.findMember(initialPath); if (res != null) { dialog.setInitialSelection(res); } if (dialog.open() == Window.OK) { return (IFolder) dialog.getFirstResult(); } return null; }
Example 6
Source File: AddSourceFolderWizardPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private IFolder chooseFolder(String title, String message, IPath initialPath) { Class<?>[] acceptedClasses= new Class[] { IFolder.class }; ISelectionStatusValidator validator= new TypedElementSelectionValidator(acceptedClasses, false); ViewerFilter filter= new TypedViewerFilter(acceptedClasses, null); ILabelProvider lp= new WorkbenchLabelProvider(); ITreeContentProvider cp= new WorkbenchContentProvider(); IProject currProject= fNewElement.getJavaProject().getProject(); ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(getShell(), lp, cp) { @Override protected Control createDialogArea(Composite parent) { Control result= super.createDialogArea(parent); PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IJavaHelpContextIds.BP_CHOOSE_EXISTING_FOLDER_TO_MAKE_SOURCE_FOLDER); return result; } }; dialog.setValidator(validator); dialog.setTitle(title); dialog.setMessage(message); dialog.addFilter(filter); dialog.setInput(currProject); dialog.setComparator(new ResourceComparator(ResourceComparator.NAME)); IResource res= currProject.findMember(initialPath); if (res != null) { dialog.setInitialSelection(res); } if (dialog.open() == Window.OK) { return (IFolder) dialog.getFirstResult(); } return null; }
Example 7
Source File: ControlUtils.java From goclipse with Eclipse Public License 1.0 | 5 votes |
public static String openProgramPathDialog(IProject project, Button button) throws OperationCancellation { ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog( button.getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider()); dialog.setTitle(LangUIMessages.ProgramPathDialog_title); dialog.setMessage(LangUIMessages.ProgramPathDialog_message); dialog.setInput(project); dialog.setComparator(new ResourceComparator(ResourceComparator.NAME)); if(dialog.open() == IDialogConstants.OK_ID) { IResource resource = (IResource) dialog.getFirstResult(); return resource.getProjectRelativePath().toPortableString(); } throw new OperationCancellation(); }