use of org.eclipse.che.ide.api.editor.texteditor.TextEditor in project che by eclipse.
the class QuickDocumentationAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
EditorPartPresenter activeEditor = editorAgent.getActiveEditor();
if (activeEditor == null) {
return;
}
if (activeEditor instanceof TextEditor && activeEditor instanceof HasCompletionInformation) {
if (((TextEditor) activeEditor).getEditorWidget().isCompletionProposalsShowing()) {
((HasCompletionInformation) activeEditor).showCompletionInformation();
return;
}
}
quickDocumentation.showDocumentation();
}
use of org.eclipse.che.ide.api.editor.texteditor.TextEditor in project che by eclipse.
the class EditorAgentImpl method finalizeInit.
private void finalizeInit(final VirtualFile file, final OpenEditorCallback callback, final EditorPartPresenter editor, EditorProvider editorProvider) {
openedEditors.add(editor);
openedEditorsToProviders.put(editor, editorProvider.getId());
workspaceAgent.setActivePart(editor);
editor.addPropertyListener(new PropertyListener() {
@Override
public void propertyChanged(PartPresenter source, int propId) {
if (propId == EditorPartPresenter.PROP_INPUT) {
if (editor instanceof HasReadOnlyProperty) {
((HasReadOnlyProperty) editor).setReadOnly(file.isReadOnly());
}
if (editor instanceof TextEditor) {
editorContentSynchronizerProvider.get().trackEditor(editor);
}
callback.onEditorOpened(editor);
eventBus.fireEvent(new EditorOpenedEvent(file, editor));
}
}
});
}
use of org.eclipse.che.ide.api.editor.texteditor.TextEditor in project che by eclipse.
the class EditorAgentImpl method storeEditors.
private JsonArray storeEditors(EditorPartStack partStack) {
JsonArray result = Json.createArray();
int i = 0;
List<EditorPartPresenter> parts = partStack.getParts();
for (EditorPartPresenter part : parts) {
JsonObject file = Json.createObject();
file.put("PATH", part.getEditorInput().getFile().getLocation().toString());
file.put("EDITOR_PROVIDER", openedEditorsToProviders.get(part));
if (part instanceof TextEditor) {
file.put("CURSOR_OFFSET", ((TextEditor) part).getCursorOffset());
file.put("TOP_VISIBLE_LINE", ((TextEditor) part).getTopVisibleLine());
}
if (partStack.getActivePart().equals(part)) {
file.put("ACTIVE", true);
}
result.set(i++, file);
}
return result;
}
Aggregations