Saros
Distributed Collaborative Editing and Distributed Party Programming
|
Public Member Functions | |
IEditorPart | openEditor (SPath path) |
IEditorPart | openEditor (SPath path, boolean activate) |
boolean | openEditor (IEditorPart part) |
void | closeEditor (IEditorPart part) |
IEditorPart | getActiveEditor () |
IResource | getEditorResource (IEditorPart editorPart) |
ITextSelection | getSelection (IEditorPart editorPart) |
void | setEditable (final IEditorPart editorPart, final boolean newIsEditable) |
ILineRange | getViewport (IEditorPart editorPart) |
SPath | getActiveEditorPath () |
SPath | getEditorPath (IEditorPart editorPart) |
IDocumentProvider | getDocumentProvider (final IEditorInput input) |
IDocument | getDocument (final IEditorPart editorPart) |
Static Public Member Functions | |
static Set< IEditorPart > | getOpenEditors () |
static ILineRange | getViewport (ITextViewer viewer) |
static ITextViewer | getViewer (IEditorPart editorPart) |
static boolean | saveProject (final IProject projectToSave, final boolean confirm) |
Protected Attributes | |
final VerifyKeyListener | keyVerifier |
The central implementation of the IEditorAPI which basically encapsulates the interaction with the TextEditor.
Pretty much all methods in this class need to be called from SWT
void de.fu_berlin.inf.dpp.editor.internal.EditorAPI.closeEditor | ( | IEditorPart | part | ) |
Closes the given editorpart.
Needs to be called from an UI thread.
Implements de.fu_berlin.inf.dpp.editor.internal.IEditorAPI.
IEditorPart de.fu_berlin.inf.dpp.editor.internal.EditorAPI.getActiveEditor | ( | ) |
Implements de.fu_berlin.inf.dpp.editor.internal.IEditorAPI.
SPath de.fu_berlin.inf.dpp.editor.internal.EditorAPI.getActiveEditorPath | ( | ) |
Syntactic sugar for getting the path of the IEditorPart returned by getActiveEditor()
Implements de.fu_berlin.inf.dpp.editor.internal.IEditorAPI.
IDocument de.fu_berlin.inf.dpp.editor.internal.EditorAPI.getDocument | ( | final IEditorPart | editorPart | ) |
IDocumentProvider de.fu_berlin.inf.dpp.editor.internal.EditorAPI.getDocumentProvider | ( | final IEditorInput | input | ) |
SPath de.fu_berlin.inf.dpp.editor.internal.EditorAPI.getEditorPath | ( | IEditorPart | editorPart | ) |
Implements de.fu_berlin.inf.dpp.editor.internal.IEditorAPI.
IResource de.fu_berlin.inf.dpp.editor.internal.EditorAPI.getEditorResource | ( | IEditorPart | editorPart | ) |
Returns the resource currently displayed in the given editorPart.
null
, e.g. if the given editorPart is not operating on a resource, or has several resources. Implements de.fu_berlin.inf.dpp.editor.internal.IEditorAPI.
static Set<IEditorPart> de.fu_berlin.inf.dpp.editor.internal.EditorAPI.getOpenEditors | ( | ) | [static] |
This method will return all editors open in all IWorkbenchWindows.
This method will ask Eclipse to restore editors which have not been loaded yet (if Eclipse is started editors are loaded lazily), which is why it must run in the SWT thread. So calling this method might cause partOpen events to be sent.
ITextSelection de.fu_berlin.inf.dpp.editor.internal.EditorAPI.getSelection | ( | IEditorPart | editorPart | ) |
Returns the current text selection for given editor.
editorPart | the editorPart for which to get the text selection. |
Implements de.fu_berlin.inf.dpp.editor.internal.IEditorAPI.
static ITextViewer de.fu_berlin.inf.dpp.editor.internal.EditorAPI.getViewer | ( | IEditorPart | editorPart | ) | [static] |
Gets a ITextViewer instance for the given editor part.
editorPart | for which we want a TextViewer. |
null
if there is no TextViewer for the editorPart. ILineRange de.fu_berlin.inf.dpp.editor.internal.EditorAPI.getViewport | ( | IEditorPart | editorPart | ) |
Implements de.fu_berlin.inf.dpp.editor.internal.IEditorAPI.
static ILineRange de.fu_berlin.inf.dpp.editor.internal.EditorAPI.getViewport | ( | ITextViewer | viewer | ) | [static] |
IEditorPart de.fu_berlin.inf.dpp.editor.internal.EditorAPI.openEditor | ( | SPath | path | ) |
Opens the editor with given path. Needs to be called from an UI thread.
null
if the editor couldn't be opened. Implements de.fu_berlin.inf.dpp.editor.internal.IEditorAPI.
IEditorPart de.fu_berlin.inf.dpp.editor.internal.EditorAPI.openEditor | ( | SPath | path, |
boolean | activate | ||
) |
Opens the editor with given path. Needs to be called from an UI thread.
activate | true , if editor should get focus, otherwise false |
null
if the editor couldn't be opened. Implements de.fu_berlin.inf.dpp.editor.internal.IEditorAPI.
boolean de.fu_berlin.inf.dpp.editor.internal.EditorAPI.openEditor | ( | IEditorPart | part | ) |
Opens the given editor part.
Needs to be called from an UI thread.
true
if the editor part was successfully opened, false
otherwise Implements de.fu_berlin.inf.dpp.editor.internal.IEditorAPI.
static boolean de.fu_berlin.inf.dpp.editor.internal.EditorAPI.saveProject | ( | final IProject | projectToSave, |
final boolean | confirm | ||
) | [static] |
Saves the given project and returns true if the operation was successful or false if the user canceled.
TODO Tell the user why we do want to save!
confirm | true to ask the user before saving unsaved changes, and false to save unsaved changes without asking |
TODO saveAllEditors does not save the Documents that we are modifying in the background
void de.fu_berlin.inf.dpp.editor.internal.EditorAPI.setEditable | ( | final IEditorPart | editorPart, |
final boolean | newIsEditable | ||
) |
final VerifyKeyListener de.fu_berlin.inf.dpp.editor.internal.EditorAPI.keyVerifier [protected] |
new VerifyKeyListener() { @Override public void verifyKey(VerifyEvent event) { if (event.character > 0) { event.doit = false; Object adapter = getActiveEditor().getAdapter( IEditorStatusLine.class); if (adapter != null) { SarosView .showNotification("Read-Only Notification", "You have only read access and therefore can't perform modifications."); Display display = SWTUtils.getDisplay(); if (!display.isDisposed()) display.beep(); } } } }