@Override public Shell getShell() { return getSite().getShell(); } },
@Override public void selectionChanged(SelectionChangedEvent event) { if (fDisplay == null) fDisplay= getSite().getShell().getDisplay(); if (Display.getCurrent() == fDisplay) fRunnable.run(); else fDisplay.asyncExec(fRunnable); } };
@Override public void selectionChanged(SelectionChangedEvent event) { if (fDisplay == null) fDisplay= getSite().getShell().getDisplay(); if (Display.getCurrent() == fDisplay) fRunnable.run(); else fDisplay.asyncExec(fRunnable); } };
public void close(final boolean save) { enableSanityChecking(false); Display display= getSite().getShell().getDisplay(); display.asyncExec(new Runnable() { public void run() { if (fSourceViewer != null) getSite().getPage().closeEditor(AbstractTextEditor.this, save); } }); }
@Override public void close(final boolean save) { enableSanityChecking(false); Display display= getSite().getShell().getDisplay(); display.asyncExec(new Runnable() { @Override public void run() { if (fSourceViewer != null) getSite().getPage().closeEditor(AbstractTextEditor.this, save); } }); }
public void textChanged(TextEvent event) { /* * Also works for text events which do not base on a DocumentEvent. * This way, if the visible document of the viewer changes, all content * dependent actions are updated as well. */ if (fDisplay == null) fDisplay= getSite().getShell().getDisplay(); if (event.getDocumentEvent() != null) fUpdateLastEditPosition= true; if (!fIsRunnablePosted) { fIsRunnablePosted= true; fDisplay.asyncExec(fRunnable); } }
/** * Presents an error dialog to the user when a problem * happens during save. * <p> * Subclasses can decide to override the given title and message. * </p> * * @param title the dialog title * @param message the message to display * @param exception the exception to handle * @since 3.3 */ protected void openSaveErrorDialog(String title, String message, CoreException exception) { ErrorDialog.openError(getSite().getShell(), title, message, exception.getStatus()); }
/** * Presents an error dialog to the user when a problem * happens during save. * <p> * Subclasses can decide to override the given title and message. * </p> * * @param title the dialog title * @param message the message to display * @param exception the exception to handle * @since 3.3 */ protected void openSaveErrorDialog(String title, String message, CoreException exception) { ErrorDialog.openError(getSite().getShell(), title, message, exception.getStatus()); }
/** * Presents an error dialog to the user when a problem * happens during save. * <p> * Subclasses can decide to override the given title and message. * </p> * * @param title the dialog title * @param message the message to display * @param exception the exception to handle * @since 3.3 */ protected void openSaveErrorDialog(String title, String message, CoreException exception) { ErrorDialog.openError(getSite().getShell(), title, message, exception.getStatus()); }
@Override public void run() { if (fSourceViewer != null) getSite().getPage().closeEditor(AbstractTextEditor.this, save); } });
/** * Writes a check mark of the given situation into the navigation history. * @since 2.1 */ protected void markInNavigationHistory() { getSite().getPage().getNavigationHistory().markLocation(this); }
private void updateInsertModeAction() { // this may be called before the part is fully initialized (see configureInsertMode) // drop out in this case. if (getSite() == null) return; IAction action= getAction(ITextEditorActionConstants.TOGGLE_INSERT_MODE); if (action != null) { action.setEnabled(!fIsOverwriting); action.setChecked(fInsertMode == SMART_INSERT); } }
private void updateInsertModeAction() { // this may be called before the part is fully initialized (see configureInsertMode) // drop out in this case. if (getSite() == null) return; IAction action= getAction(ITextEditorActionConstants.TOGGLE_INSERT_MODE); if (action != null) { action.setEnabled(!fIsOverwriting); action.setChecked(fInsertMode == SMART_INSERT); } }
/** * Writes a check mark of the given situation into the navigation history. * @since 2.1 */ protected void markInNavigationHistory() { getSite().getPage().getNavigationHistory().markLocation(this); }
/** * Writes a check mark of the given situation into the navigation history. * @since 2.1 */ protected void markInNavigationHistory() { getSite().getPage().getNavigationHistory().markLocation(this); }
private void updateInsertModeAction() { // this may be called before the part is fully initialized (see configureInsertMode) // drop out in this case. if (getSite() == null) return; IAction action= getAction(ITextEditorActionConstants.TOGGLE_INSERT_MODE); if (action != null) { action.setEnabled(!fIsOverwriting); action.setChecked(fInsertMode == SMART_INSERT); } }
protected final void setInputWithNotify(IEditorInput input) { try { doSetInput(input); /* * The following bugs explain why we fire this property change: * https://bugs.eclipse.org/bugs/show_bug.cgi?id=90283 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=92049 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=92286 */ firePropertyChange(IEditorPart.PROP_INPUT); } catch (CoreException x) { String title= EditorMessages.Editor_error_setinput_title; String msg= EditorMessages.Editor_error_setinput_message; Shell shell= getSite().getShell(); ErrorDialog.openError(shell, title, msg, x.getStatus()); } }
/** * Hook which gets called when the editor has been saved. * Subclasses may extend. * @since 2.1 */ protected void editorSaved() { INavigationLocation[] locations= getSite().getPage().getNavigationHistory().getLocations(); IEditorInput input= getEditorInput(); for (int i= 0; i < locations.length; i++) { if (locations[i] instanceof TextSelectionNavigationLocation) { if(input.equals(locations[i].getInput())) { TextSelectionNavigationLocation location= (TextSelectionNavigationLocation) locations[i]; location.partSaved(this); } } } }
private void updateImages(IAction action, String commandId) { if (action.getImageDescriptor() != null) { return; } ICommandImageService imgService = getSite().getService(ICommandImageService.class); if (imgService == null) { return; } action.setImageDescriptor(imgService.getImageDescriptor(commandId)); action.setDisabledImageDescriptor(imgService.getImageDescriptor(commandId, ICommandImageService.TYPE_DISABLED)); action.setHoverImageDescriptor(imgService.getImageDescriptor(commandId, ICommandImageService.TYPE_HOVER)); }