Java Code Examples for org.eclipse.jdt.internal.ui.JavaPlugin#getActiveWorkbenchShell()
The following examples show how to use
org.eclipse.jdt.internal.ui.JavaPlugin#getActiveWorkbenchShell() .
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: GotoTypeAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public void run() { Shell shell= JavaPlugin.getActiveWorkbenchShell(); SelectionDialog dialog= null; try { dialog= JavaUI.createTypeDialog(shell, new ProgressMonitorDialog(shell), SearchEngine.createWorkspaceScope(), IJavaElementSearchConstants.CONSIDER_ALL_TYPES, false); } catch (JavaModelException e) { String title= getDialogTitle(); String message= PackagesMessages.GotoType_error_message; ExceptionHandler.handle(e, title, message); return; } dialog.setTitle(getDialogTitle()); dialog.setMessage(PackagesMessages.GotoType_dialog_message); if (dialog.open() == IDialogConstants.CANCEL_ID) { return; } Object[] types= dialog.getResult(); if (types != null && types.length > 0) { gotoType((IType) types[0]); } }
Example 2
Source File: NewNameQueries.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private Shell getShell() { Assert.isTrue(fWizard == null || fShell == null); if (fWizard != null) return fWizard.getContainer().getShell(); if (fShell != null) return fShell; return JavaPlugin.getActiveWorkbenchShell(); }
Example 3
Source File: CreateTargetQueries.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private Shell getShell() { Assert.isTrue(fWizard == null || fShell == null); if (fWizard != null) return fWizard.getContainer().getShell(); else if (fShell != null) return fShell; else return JavaPlugin.getActiveWorkbenchShell(); }
Example 4
Source File: AbstractOpenWizardAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Returns the configured shell. If no shell has been configured using {@link #setShell(Shell)}, * the shell of the currently active workbench is returned. * @return the configured shell */ protected Shell getShell() { if (fShell == null) { return JavaPlugin.getActiveWorkbenchShell(); } return fShell; }
Example 5
Source File: HistoryListAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public void run() { IMember[][] historyEntries= fView.getHistoryEntries(); HistoryListDialog dialog= new HistoryListDialog(JavaPlugin.getActiveWorkbenchShell(), historyEntries); if (dialog.open() == Window.OK) { fView.setHistoryEntries(dialog.getRemaining()); fView.setInputElements(dialog.getResult()); } }
Example 6
Source File: JavaSearchScopeFactory.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public IWorkingSet[] queryWorkingSets() throws InterruptedException { Shell shell= JavaPlugin.getActiveWorkbenchShell(); if (shell == null) return null; IWorkingSetSelectionDialog dialog= PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSetSelectionDialog(shell, true); if (dialog.open() != Window.OK) { throw new InterruptedException(); } IWorkingSet[] workingSets= dialog.getSelection(); if (workingSets.length > 0) return workingSets; return null; // 'no working set' selected }
Example 7
Source File: AddWordProposal.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public final void apply(final IDocument document) { final ISpellCheckEngine engine= SpellCheckEngine.getInstance(); final ISpellChecker checker= engine.getSpellChecker(); if (checker == null) return; if (!checker.acceptsWords()) { final Shell shell; if (fContext != null && fContext.getSourceViewer() != null) shell= fContext.getSourceViewer().getTextWidget().getShell(); else shell= JavaPlugin.getActiveWorkbenchShell(); if (!canAskToConfigure() || !askUserToConfigureUserDictionary(shell)) return; String[] preferencePageIds= new String[] { "org.eclipse.ui.editors.preferencePages.Spelling" }; //$NON-NLS-1$ PreferencesUtil.createPreferenceDialogOn(shell, preferencePageIds[0], preferencePageIds, null).open(); } if (checker.acceptsWords()) { checker.addWord(fWord); if (fContext != null && fContext.getSourceViewer() != null) SpellingProblem.removeAll(fContext.getSourceViewer(), fWord); } }
Example 8
Source File: HistoryListAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public void run() { List<IJavaElement[]> historyEntries= fView.getHistoryEntries(); IJavaElement[][] entries= historyEntries.toArray(new IJavaElement[historyEntries.size()][]); HistoryListDialog dialog= new HistoryListDialog(JavaPlugin.getActiveWorkbenchShell(), entries); if (dialog.open() == Window.OK) { fView.setHistoryEntries(dialog.getRemaining()); fView.setInputElements(dialog.getResult()); } }
Example 9
Source File: CompletionProposalComputerRegistry.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Log the status and inform the user about a misbehaving extension. * * @param descriptor the descriptor of the misbehaving extension * @param status a status object that will be logged */ void informUser(CompletionProposalComputerDescriptor descriptor, IStatus status) { JavaPlugin.log(status); String title= JavaTextMessages.CompletionProposalComputerRegistry_error_dialog_title; CompletionProposalCategory category= descriptor.getCategory(); IContributor culprit= descriptor.getContributor(); Set<String> affectedPlugins= getAffectedContributors(category, culprit); final String avoidHint; final String culpritName= culprit == null ? null : culprit.getName(); if (affectedPlugins.isEmpty()) avoidHint= Messages.format(JavaTextMessages.CompletionProposalComputerRegistry_messageAvoidanceHint, new Object[] {culpritName, category.getDisplayName()}); else avoidHint= Messages.format(JavaTextMessages.CompletionProposalComputerRegistry_messageAvoidanceHintWithWarning, new Object[] {culpritName, category.getDisplayName(), toString(affectedPlugins)}); String message= status.getMessage(); // inlined from MessageDialog.openError MessageDialog dialog = new MessageDialog(JavaPlugin.getActiveWorkbenchShell(), title, null /* default image */, message, MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0) { @Override protected Control createCustomArea(Composite parent) { Link link= new Link(parent, SWT.NONE); link.setText(avoidHint); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { PreferencesUtil.createPreferenceDialogOn(getShell(), "org.eclipse.jdt.ui.preferences.CodeAssistPreferenceAdvanced", null, null).open(); //$NON-NLS-1$ } }); GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false); gridData.widthHint= this.getMinimumMessageWidth(); link.setLayoutData(gridData); return link; } }; dialog.open(); }
Example 10
Source File: AbstractJavaCompletionProposal.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public IInformationControlCreator getInformationControlCreator() { Shell shell= JavaPlugin.getActiveWorkbenchShell(); if (shell == null || !BrowserInformationControl.isAvailable(shell)) return null; if (fCreator == null) { /* * FIXME: Take control creators (and link handling) out of JavadocHover, * see https://bugs.eclipse.org/bugs/show_bug.cgi?id=232024 */ JavadocHover.PresenterControlCreator presenterControlCreator= new JavadocHover.PresenterControlCreator(getSite()); fCreator= new JavadocHover.HoverControlCreator(presenterControlCreator, true); } return fCreator; }
Example 11
Source File: SourceAttachmentBlock.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private Shell getShell() { if (fSWTWidget != null) { return fSWTWidget.getShell(); } return JavaPlugin.getActiveWorkbenchShell(); }
Example 12
Source File: LibrariesWorkbookPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private Shell getShell() { if (fSWTControl != null) { return fSWTControl.getShell(); } return JavaPlugin.getActiveWorkbenchShell(); }
Example 13
Source File: VariableBlock.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private Shell getShell() { if (fControl != null) { return fControl.getShell(); } return JavaPlugin.getActiveWorkbenchShell(); }
Example 14
Source File: JavaHistoryActionImpl.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
final Shell getShell() { if (fEditor != null) return fEditor.getEditorSite().getShell(); return JavaPlugin.getActiveWorkbenchShell(); }
Example 15
Source File: ProjectsWorkbookPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private Shell getShell() { if (fSWTControl != null) { return fSWTControl.getShell(); } return JavaPlugin.getActiveWorkbenchShell(); }
Example 16
Source File: BuildPathsBlock.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private Shell getShell() { if (fSWTWidget != null) { return fSWTWidget.getShell(); } return JavaPlugin.getActiveWorkbenchShell(); }
Example 17
Source File: OpenJavaSearchPageAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
protected void beep() { Shell shell= JavaPlugin.getActiveWorkbenchShell(); if (shell != null && shell.getDisplay() != null) shell.getDisplay().beep(); }
Example 18
Source File: HintTextGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private Shell getShell() { return JavaPlugin.getActiveWorkbenchShell(); }
Example 19
Source File: JarPackageActionDelegate.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
/** * Returns the active shell. * @return the active shell. */ protected Shell getShell() { if (fShell != null) return fShell; return JavaPlugin.getActiveWorkbenchShell(); }
Example 20
Source File: AbstractOpenWizardAction.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 3 votes |
/** * Returns the configured shell. If no shell has been configured using * {@link #setShell(Shell)}, the shell of the currently active workbench is * returned. * * @return the configured shell */ protected Shell getShell() { if (shell == null) { return JavaPlugin.getActiveWorkbenchShell(); } return shell; }