private static boolean isModuleInfo(ITextEditor editor) { boolean isModuleInfo= false; if (editor != null && editor.getEditorSite() != null) { String id= editor.getEditorSite().getId(); if (JavaUI.ID_MODULE_INFO_EDITOR.equals(id) || JavaUI.ID_MODULE_INFO_CF_EDITOR.equals(id) || JavaUI.ID_MODULE_INFO_CF_EDITOR_NO_SOURCE.equals(id)) { isModuleInfo= true; } } return isModuleInfo; }
private void showErrorInStatusLine(final String message, ITextEditor textEditor) { Display display= textEditor.getEditorSite().getShell().getDisplay(); display.beep(); final IEditorStatusLine statusLine= textEditor.getAdapter(IEditorStatusLine.class); if (statusLine != null) { display.asyncExec(new Runnable() { /* * @see java.lang.Runnable#run() */ @Override public void run() { statusLine.setMessage(true, message, null); } }); } } }
private void showErrorInStatusLine(final String message, ITextEditor textEditor) { Display display= textEditor.getEditorSite().getShell().getDisplay(); display.beep(); final IEditorStatusLine statusLine= textEditor.getAdapter(IEditorStatusLine.class); if (statusLine != null) { display.asyncExec(new Runnable() { /* * @see java.lang.Runnable#run() */ @Override public void run() { statusLine.setMessage(true, message, null); } }); } } }
/** * Creates a new properties key hyperlink. * * @param region the region * @param key the properties key * @param editor the text editor */ public PropertyKeyHyperlink(IRegion region, String key, ITextEditor editor) { Assert.isNotNull(region); Assert.isNotNull(key); Assert.isNotNull(editor); fRegion= region; fPropertiesKey= key; fEditor= editor; IStorageEditorInput storageEditorInput= (IStorageEditorInput)fEditor.getEditorInput(); fShell= fEditor.getEditorSite().getShell(); try { fStorage= storageEditorInput.getStorage(); } catch (CoreException e) { fStorage= null; } }
/** * Creates a new properties key hyperlink. * * @param region the region * @param key the properties key * @param editor the text editor */ public PropertyKeyHyperlink(IRegion region, String key, ITextEditor editor) { Assert.isNotNull(region); Assert.isNotNull(key); Assert.isNotNull(editor); fRegion= region; fPropertiesKey= key; fEditor= editor; fIsFileEditorInput= fEditor.getEditorInput() instanceof IFileEditorInput; IStorageEditorInput storageEditorInput= (IStorageEditorInput)fEditor.getEditorInput(); fShell= fEditor.getEditorSite().getShell(); try { fStorage= storageEditorInput.getStorage(); } catch (CoreException e) { fStorage= null; } }
/** * Creates a new properties key hyperlink. * * @param region the region * @param key the properties key * @param editor the text editor */ public PropertyKeyHyperlink(IRegion region, String key, ITextEditor editor) { Assert.isNotNull(region); Assert.isNotNull(key); Assert.isNotNull(editor); fRegion= region; fPropertiesKey= key; fEditor= editor; fIsFileEditorInput= fEditor.getEditorInput() instanceof IFileEditorInput; IStorageEditorInput storageEditorInput= (IStorageEditorInput)fEditor.getEditorInput(); fShell= fEditor.getEditorSite().getShell(); try { fStorage= storageEditorInput.getStorage(); } catch (CoreException e) { fStorage= null; } }
/** * @see Action#run() */ public void run() { if (getBreakpoint() != null) { PropertyDialogAction action= new PropertyDialogAction(getEditor().getEditorSite(), new ISelectionProvider() { public void addSelectionChangedListener(ISelectionChangedListener listener) { } public ISelection getSelection() { return new StructuredSelection(getBreakpoint()); } public void removeSelectionChangedListener(ISelectionChangedListener listener) { } public void setSelection(ISelection selection) { } }); action.run(); } }
public void install(ISelectionListenerWithAST listener) { if (isEmpty()) { fPart.getEditorSite().getPage().addPostSelectionListener(fPostSelectionListener); ISelectionProvider selectionProvider= fPart.getSelectionProvider(); if (selectionProvider != null) selectionProvider.addSelectionChangedListener(fSelectionListener); } fAstListeners.add(listener); }
public void uninstall(ISelectionListenerWithAST listener) { fAstListeners.remove(listener); if (isEmpty()) { fPart.getEditorSite().getPage().removePostSelectionListener(fPostSelectionListener); ISelectionProvider selectionProvider= fPart.getSelectionProvider(); if (selectionProvider != null) selectionProvider.removeSelectionChangedListener(fSelectionListener); } }
public void install(ISelectionListenerWithAST listener) { if (isEmpty()) { fPart.getEditorSite().getPage().addPostSelectionListener(fPostSelectionListener); ISelectionProvider selectionProvider= fPart.getSelectionProvider(); if (selectionProvider != null) selectionProvider.addSelectionChangedListener(fSelectionListener); } fAstListeners.add(listener); }
public void uninstall(ISelectionListenerWithAST listener) { fAstListeners.remove(listener); if (isEmpty()) { fPart.getEditorSite().getPage().removePostSelectionListener(fPostSelectionListener); ISelectionProvider selectionProvider= fPart.getSelectionProvider(); if (selectionProvider != null) selectionProvider.removeSelectionChangedListener(fSelectionListener); } }
public void install(ISelectionListenerWithAST listener) { if (isEmpty()) { fPart.getEditorSite().getPage().addPostSelectionListener(fPostSelectionListener); ISelectionProvider selectionProvider= fPart.getSelectionProvider(); if (selectionProvider != null) selectionProvider.addSelectionChangedListener(fSelectionListener); } fAstListeners.add(listener); }
public void uninstall(ISelectionListenerWithAST listener) { fAstListeners.remove(listener); if (isEmpty()) { fPart.getEditorSite().getPage().removePostSelectionListener(fPostSelectionListener); ISelectionProvider selectionProvider= fPart.getSelectionProvider(); if (selectionProvider != null) selectionProvider.removeSelectionChangedListener(fSelectionListener); } }
/** * Focus has been revoked from the breadcrumb. */ private void focusLost() { if (!fHasFocus) return; fComposite.setBackground(null); fHasFocus= false; deinstallDisplayListeners(); deactivateBreadcrumb(); getTextEditor().getEditorSite().getActionBars().updateActionBars(); getTextEditor().getSelectionProvider().setSelection(fOldTextSelection); fOldTextSelection= null; }
/** * Focus has been revoked from the breadcrumb. */ private void focusLost() { if (!fHasFocus) return; fComposite.setBackground(null); fHasFocus= false; deinstallDisplayListeners(); deactivateBreadcrumb(); getTextEditor().getEditorSite().getActionBars().updateActionBars(); getTextEditor().getSelectionProvider().setSelection(fOldTextSelection); fOldTextSelection= null; }
public final void apply(final IDocument document) { final ISpellCheckEngine engine= SpellCheckEngine.getInstance(); final ISpellChecker checker= engine.getSpellChecker(); if (checker == null) return; final ITextEditor editor= getEditor(); if (!checker.acceptsWords()) { final Shell shell; if (editor != null) shell= editor.getEditorSite().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); SpellingProblem.removeAllInActiveEditor(editor, fWord); } }
/** * Focus has been transfered into the breadcrumb. */ private void focusGained() { if (fHasFocus) focusLost(); fComposite.setBackground(JFaceResources.getColorRegistry().get(ACTIVE_TAB_BG_END)); fHasFocus= true; installDisplayListeners(); activateBreadcrumb(); getTextEditor().getEditorSite().getActionBars().updateActionBars(); fOldTextSelection= getTextEditor().getSelectionProvider().getSelection(); getTextEditor().getSelectionProvider().setSelection(new StructuredSelection(this)); }
/** * Focus has been transfered into the breadcrumb. */ private void focusGained() { if (fHasFocus) focusLost(); fComposite.setBackground(JFaceResources.getColorRegistry().get(ACTIVE_TAB_BG_END)); fHasFocus= true; installDisplayListeners(); activateBreadcrumb(); getTextEditor().getEditorSite().getActionBars().updateActionBars(); fOldTextSelection= getTextEditor().getSelectionProvider().getSelection(); getTextEditor().getSelectionProvider().setSelection(new StructuredSelection(this)); }
return null; IEditorSite site= textEditor.getEditorSite(); if (site == null) return null;
@Override public void menuDetected(MenuDetectEvent event) { ISelectionProvider selectionProvider; if (fBreadcrumbViewer.isDropDownOpen()) { selectionProvider= fBreadcrumbViewer.getDropDownSelectionProvider(); } else { selectionProvider= fBreadcrumbViewer; } ActionGroup actionGroup= createContextMenuActionGroup(selectionProvider); if (actionGroup == null) return; try { MenuManager manager= new MenuManager(); actionGroup.setContext(new ActionContext(selectionProvider.getSelection())); actionGroup.fillContextMenu(manager); getTextEditor().getEditorSite().registerContextMenu(manager, selectionProvider, false); if (manager.isEmpty()) return; Menu menu= manager.createContextMenu(fBreadcrumbViewer.getControl()); menu.setLocation(event.x + 10, event.y + 10); menu.setVisible(true); while (!menu.isDisposed() && menu.isVisible()) { if (!menu.getDisplay().readAndDispatch()) menu.getDisplay().sleep(); } } finally { actionGroup.dispose(); } } });