org.eclipse.jdt.ui.JavaElementLabelProvider Java Examples
The following examples show how to use
org.eclipse.jdt.ui.JavaElementLabelProvider.
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: 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 #2
Source File: PackageSelectionDialogButtonField.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public PackageSelectionDialogButtonField(String label, String button, PackageBrowseAdapter adapter, IJavaProject root) { super(adapter); setContentAssistProcessor(new JavaPackageCompletionProcessor(new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_ROOT))); IPackageFragmentRoot[] roots; try { roots= root.getAllPackageFragmentRoots(); ((JavaPackageCompletionProcessor)getContentAssistProcessor()).setPackageFragmentRoot(roots[0]); } catch (JavaModelException e) { JavaPlugin.log(e); // if exception no content assist .. but thats no problem } setLabelText(label); setButtonLabel(button); adapter.setReceiver(this); }
Example #3
Source File: ReorgQueries.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private Runnable createQueryRunnable(final String question, final Object[] elements, final int[] result) { return new Runnable() { public void run() { ListDialog dialog= new YesNoListDialog(fShell, false); dialog.setAddCancelButton(false); dialog.setBlockOnOpen(true); dialog.setContentProvider(new ArrayContentProvider()); dialog.setLabelProvider(new JavaElementLabelProvider()); dialog.setTitle(fDialogTitle); dialog.setMessage(question); dialog.setInput(elements); dialog.open(); result[0]= dialog.getReturnCode(); } }; }
Example #4
Source File: ReorgQueries.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private Runnable createQueryRunnable(final String question, final Object[] elements, final int[] result) { return new Runnable() { public void run() { ListDialog dialog= new YesNoListDialog(fShell, true); dialog.setAddCancelButton(false); dialog.setBlockOnOpen(true); dialog.setContentProvider(new ArrayContentProvider()); dialog.setLabelProvider(new JavaElementLabelProvider()); dialog.setTitle(fDialogTitle); dialog.setMessage(question); dialog.setInput(elements); dialog.open(); result[0]= dialog.getReturnCode(); } }; }
Example #5
Source File: WizardUtils.java From txtUML with Eclipse Public License 1.0 | 6 votes |
public static IBaseLabelProvider getPostQualifiedLabelProvider() { return new DelegatingStyledCellLabelProvider(new JavaElementLabelProvider( JavaElementLabelProvider.SHOW_POST_QUALIFIED | JavaElementLabelProvider.SHOW_SMALL_ICONS)) { @Override protected StyledString getStyledText(Object element) { String nameWithQualifier = getStyledStringProvider().getStyledText(element).getString() + " "; int separatorIndex = nameWithQualifier.indexOf('-'); if (separatorIndex == -1) return new StyledString(nameWithQualifier); StyledString name = new StyledString(nameWithQualifier.substring(0, separatorIndex)); String qualifier = nameWithQualifier.substring(separatorIndex); return name.append(new StyledString(qualifier, StyledString.QUALIFIER_STYLER)); }; }; }
Example #6
Source File: FieldDialogImpl.java From jenerate with Eclipse Public License 1.0 | 6 votes |
private Composite createFieldComposite(final Composite composite) { Composite fieldComposite = new Composite(composite, SWT.NONE); GridLayout layout = new GridLayout(); fieldComposite.setLayout(layout); fieldViewer = CheckboxTableViewer.newCheckList(fieldComposite, SWT.MULTI | SWT.TOP | SWT.BORDER); GridData data = new GridData(GridData.FILL_BOTH); data.grabExcessHorizontalSpace = true; fieldViewer.getTable().setLayoutData(data); fieldViewer.setLabelProvider(new JavaElementLabelProvider()); fieldViewer.setContentProvider(new ArrayContentProvider()); fieldViewer.setInput(allFields); selectAllNonTransientFields(); return fieldComposite; }
Example #7
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 #8
Source File: MultiMainTypeSelectionDialog.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * Constructor. */ public MultiMainTypeSelectionDialog(Shell shell, IRunnableContext context, IJavaSearchScope scope, int style) { super(shell, new JavaElementLabelProvider( JavaElementLabelProvider.SHOW_PARAMETERS | JavaElementLabelProvider.SHOW_POST_QUALIFIED | JavaElementLabelProvider.SHOW_ROOT)); setMultipleSelection(true); Assert.isNotNull(context); Assert.isNotNull(scope); fRunnableContext= context; fScope= scope; fStyle= style; }
Example #9
Source File: JavadocTreeWizardPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
protected void createInputGroup(Composite composite) { createLabel(composite, SWT.NONE, JavadocExportMessages.JavadocTreeWizardPage_checkboxtreeandlistgroup_label, createGridData(6)); Composite c= new Composite(composite, SWT.NONE); GridLayout layout= new GridLayout(); layout.numColumns= 1; layout.makeColumnsEqualWidth= true; layout.marginWidth= 0; layout.marginHeight= 0; c.setLayout(layout); c.setLayoutData(createGridData(GridData.FILL_BOTH, 6, 0)); ITreeContentProvider treeContentProvider= new JavadocProjectContentProvider(); ITreeContentProvider listContentProvider= new JavadocMemberContentProvider(); fInputGroup= new CheckboxTreeAndListGroup(c, this, treeContentProvider, new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT), listContentProvider, new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT), SWT.NONE, convertWidthInCharsToPixels(60), convertHeightInCharsToPixels(7)); fInputGroup.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent e) { doValidation(TREESTATUS); } }); fInputGroup.setTreeComparator(new JavaElementComparator()); SWTUtil.setAccessibilityText(fInputGroup.getTree(), JavadocExportMessages.JavadocTreeWizardPage_tree_accessibility_message); SWTUtil.setAccessibilityText(fInputGroup.getTable(), JavadocExportMessages.JavadocTreeWizardPage_table_accessibility_message); IJavaElement[] elements= fStore.getInitialElements(); setTreeChecked(elements); if (elements.length > 0) { fInputGroup.setTreeSelection(new StructuredSelection(elements[0].getJavaProject())); } fInputGroup.aboutToOpen(); }
Example #10
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 #11
Source File: PackageSelectionDialog.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private static ILabelProvider createLabelProvider(int dialogFlags) { int flags= JavaElementLabelProvider.SHOW_DEFAULT; if ((dialogFlags & F_REMOVE_DUPLICATES) == 0) { flags= flags | JavaElementLabelProvider.SHOW_ROOT; } return new JavaElementLabelProvider(flags); }
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: FindAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private IJavaElement findType(ICompilationUnit cu, boolean silent) { IType[] types= null; try { types= cu.getAllTypes(); } catch (JavaModelException ex) { if (JavaModelUtil.isExceptionToBeLogged(ex)) ExceptionHandler.log(ex, SearchMessages.JavaElementAction_error_open_message); if (silent) return RETURN_WITHOUT_BEEP; else return null; } if (types.length == 1 || (silent && types.length > 0)) return types[0]; if (silent) return RETURN_WITHOUT_BEEP; if (types.length == 0) return null; String title= SearchMessages.JavaElementAction_typeSelectionDialog_title; String message = SearchMessages.JavaElementAction_typeSelectionDialog_message; int flags= (JavaElementLabelProvider.SHOW_DEFAULT); ElementListSelectionDialog dialog= new ElementListSelectionDialog(getShell(), new JavaElementLabelProvider(flags)); dialog.setTitle(title); dialog.setMessage(message); dialog.setElements(types); if (dialog.open() == Window.OK) return (IType)dialog.getFirstResult(); else return RETURN_WITHOUT_BEEP; }
Example #14
Source File: MainTypeSelectionDialog.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public MainTypeSelectionDialog(Shell shell, IRunnableContext context, IJavaSearchScope scope, int style) { super(shell, new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_BASICS | JavaElementLabelProvider.SHOW_OVERLAY_ICONS), new PackageRenderer()); Assert.isNotNull(context); Assert.isNotNull(scope); fRunnableContext= context; fScope= scope; fStyle= style; }
Example #15
Source File: TestabilityLaunchConfigurationTab.java From testability-explorer with Apache License 2.0 | 5 votes |
private void setUpWhitelistPackagesDialog() { IJavaProject project = getSelectedProject(); ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getControl().getShell(), new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_BASICS), new JavaPackageElementContentProvider()); dialog.setInput(project); dialog.addFilter(new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { if (element instanceof IPackageFragment) { return !((IPackageFragment) element).getElementName().equals(""); } if (element instanceof ICompilationUnit) { return false; } return true; } }); dialog.setMessage("Choose packages to whitelist:"); if (dialog.open() == Window.OK) { Object[] results = dialog.getResult(); String[] stringArray = new String[results.length]; for (int i = 0; i < results.length; i++) { if (results[i] instanceof IJavaElement) { stringArray[i] = ((IJavaElement) results[i]).getElementName(); } } whiteListList.add(stringArray); setTabDirty(); } }
Example #16
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 #17
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 #18
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 #19
Source File: ReorgUserInputPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private TreeViewer createViewer(Composite parent) { TreeViewer treeViewer= new TreeViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); GridData gd= new GridData(GridData.FILL_BOTH); gd.widthHint= convertWidthInCharsToPixels(40); gd.heightHint= convertHeightInCharsToPixels(15); treeViewer.getTree().setLayoutData(gd); treeViewer.setLabelProvider(new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_SMALL_ICONS)); treeViewer.setContentProvider(new DestinationContentProvider(getDestinationValidator())); treeViewer.setComparator(new JavaElementComparator()); treeViewer.setInput(JavaCore.create(ResourcesPlugin.getWorkspace().getRoot())); return treeViewer; }
Example #20
Source File: PackageFragmentRootSelectionDialog.java From ghidra with Apache License 2.0 | 5 votes |
/** * Creates a new package fragment root selection dialog. * * @param shell The parent shell for the dialog. * @param title The title of the dialog. * @param message The message of the dialog. * @param errorMessage the error message to display if an invalid selection is made. */ public PackageFragmentRootSelectionDialog(Shell shell, String title, String message, String errorMessage) { super(shell, new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT), new StandardJavaElementContentProvider()); setTitle(title); setMessage(message); setAllowMultiple(false); setInput(JavaCore.create(ResourcesPlugin.getWorkspace().getRoot())); setValidator(new ISelectionStatusValidator() { @Override public IStatus validate(Object[] sel) { if (sel.length == 1 && sel[0] instanceof IPackageFragmentRoot) { return new Status(IStatus.OK, Activator.PLUGIN_ID, IStatus.OK, "", null); } return new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, errorMessage, null); } }); addFilter(new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentObject, Object element) { if (element instanceof IPackageFragmentRoot) { IPackageFragmentRoot packageFragmentRoot = (IPackageFragmentRoot) element; return !packageFragmentRoot.isArchive() && !packageFragmentRoot.isExternal(); } return element instanceof IJavaModel || element instanceof IJavaProject; } }); }
Example #21
Source File: JavaProjectSelectionDialog.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
private JavaProjectSelectionDialog(Shell parent, List<IJavaProject> projects, IJavaProject initialSelection) { super(parent, new JavaElementLabelProvider( JavaElementLabelProvider.SHOW_DEFAULT)); setTitle("Project Selection"); setMessage("Choose a project:"); setElements(projects.toArray(new IJavaProject[0])); setInitialSelections(new Object[] {initialSelection}); setHelpAvailable(false); }
Example #22
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 #23
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 #24
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 #25
Source File: ClientBundleResourceSelectionDialog.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
private ClientBundleResourceSelectionDialog(Shell shell, IJavaProject javaProject, boolean multiSelection) { super(shell, new JavaElementLabelProvider( JavaElementLabelProvider.SHOW_DEFAULT), new StandardJavaElementContentProvider()); setValidator(new TypedElementSelectionValidator(new Class[] {IFile.class}, multiSelection)); setComparator(new JavaElementComparator()); setTitle("Resource Selection"); String message = MessageFormat.format("Choose {0} to bundle:", (multiSelection ? "one or more resources" : "a resource")); setMessage(message); addFilter(new ViewerFilter(javaProject)); }
Example #26
Source File: JavaSourcePackageFragmentRootCompletionProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public JavaSourcePackageFragmentRootCompletionProcessor() { fRoot= JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()); IPreferenceStore preferenceStore= JavaPlugin.getDefault().getPreferenceStore(); String triggers= preferenceStore.getString(PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA); fProposalAutoActivationSet= triggers.toCharArray(); fComparator= new CompletionProposalComparator(); fLabelProvider= new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_SMALL_ICONS); }
Example #27
Source File: CopyToClipboardAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private static ILabelProvider createLabelProvider(){ return new JavaElementLabelProvider( JavaElementLabelProvider.SHOW_VARIABLE + JavaElementLabelProvider.SHOW_PARAMETERS + JavaElementLabelProvider.SHOW_TYPE ); }
Example #28
Source File: SourceContainerDialog.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private SourceContainerDialog(Shell shell) { super(shell,new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT),new StandardJavaElementContentProvider()); setValidator(new PackageAndProjectSelectionValidator()); setComparator(new JavaElementComparator()); setTitle(NewWizardMessages.NewContainerWizardPage_ChooseSourceContainerDialog_title); setMessage(NewWizardMessages.NewContainerWizardPage_ChooseSourceContainerDialog_description); addFilter(new JavaTypedViewerFilter()); }
Example #29
Source File: JarManifestWizardPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
/** * Creates a selection dialog that lists all packages under the given package * fragment root. * The caller is responsible for opening the dialog with <code>Window.open</code>, * and subsequently extracting the selected packages (of type * <code>IPackageFragment</code>) via <code>SelectionDialog.getResult</code>. * * @param packageFragments the package fragments * @return a new selection dialog */ protected SelectionDialog createPackageDialog(Set<IJavaElement> packageFragments) { List<IPackageFragment> packages= new ArrayList<IPackageFragment>(packageFragments.size()); for (Iterator<IJavaElement> iter= packageFragments.iterator(); iter.hasNext();) { IPackageFragment fragment= (IPackageFragment)iter.next(); boolean containsJavaElements= false; int kind; try { kind= fragment.getKind(); containsJavaElements= fragment.getChildren().length > 0; } catch (JavaModelException ex) { ExceptionHandler.handle(ex, getContainer().getShell(), JarPackagerMessages.JarManifestWizardPage_error_jarPackageWizardError_title, Messages.format(JarPackagerMessages.JarManifestWizardPage_error_jarPackageWizardError_message, JavaElementLabels.getElementLabel(fragment, JavaElementLabels.ALL_DEFAULT))); continue; } if (kind != IPackageFragmentRoot.K_BINARY && containsJavaElements) packages.add(fragment); } StandardJavaElementContentProvider cp= new StandardJavaElementContentProvider() { @Override public boolean hasChildren(Object element) { // prevent the + from being shown in front of packages return !(element instanceof IPackageFragment) && super.hasChildren(element); } }; final DecoratingLabelProvider provider= new DecoratingLabelProvider(new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT), new ProblemsLabelDecorator(null)); ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(getContainer().getShell(), provider, cp); dialog.setDoubleClickSelects(false); dialog.setComparator(new JavaElementComparator()); dialog.setInput(JavaCore.create(JavaPlugin.getWorkspace().getRoot())); dialog.addFilter(new EmptyInnerPackageFilter()); dialog.addFilter(new LibraryFilter()); dialog.addFilter(new SealPackagesFilter(packages)); dialog.setValidator(new ISelectionStatusValidator() { public IStatus validate(Object[] selection) { StatusInfo res= new StatusInfo(); for (int i= 0; i < selection.length; i++) { if (!(selection[i] instanceof IPackageFragment)) { res.setError(JarPackagerMessages.JarManifestWizardPage_error_mustContainPackages); return res; } } res.setOK(); return res; } }); return dialog; }
Example #30
Source File: ModuleCompletionProcessor.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 4 votes |
public ModuleCompletionProcessor() { javaLabelProvider = new JavaElementLabelProvider( JavaElementLabelProvider.SHOW_SMALL_ICONS); allProposals = new ArrayList<ModuleCompletionProposal>(); }