use of org.eclipse.che.ide.api.editor.EditorPartPresenter in project che by eclipse.
the class JavaFormatter method applyChanges.
private void applyChanges(List<Change> changes, Document document) {
HandlesUndoRedo undoRedo = null;
EditorPartPresenter editorPartPresenter = editorAgent.getActiveEditor();
if (editorPartPresenter instanceof UndoableEditor) {
undoRedo = ((UndoableEditor) editorPartPresenter).getUndoRedo();
}
try {
if (undoRedo != null) {
undoRedo.beginCompoundChange();
}
for (Change change : changes) {
document.replace(change.getOffset(), change.getLength(), change.getText());
}
} catch (final Exception e) {
Log.error(getClass(), e);
} finally {
if (undoRedo != null) {
undoRedo.endCompoundChange();
}
}
}
use of org.eclipse.che.ide.api.editor.EditorPartPresenter in project che by eclipse.
the class ParametersHintsAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent event) {
EditorPartPresenter activeEditor = editorAgent.getActiveEditor();
if (!(activeEditor instanceof TextEditor)) {
return;
}
parametersHintsPresenter.show((TextEditor) activeEditor);
}
use of org.eclipse.che.ide.api.editor.EditorPartPresenter 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.EditorPartPresenter in project che by eclipse.
the class BreakpointManagerImpl method setCurrentBreakpoint.
private void setCurrentBreakpoint(String filePath, int lineNumber) {
deleteCurrentBreakpoint();
EditorPartPresenter editor = getEditorForFile(filePath);
if (editor != null) {
VirtualFile activeFile = editor.getEditorInput().getFile();
doSetCurrentBreakpoint(activeFile, lineNumber);
}
}
use of org.eclipse.che.ide.api.editor.EditorPartPresenter in project che by eclipse.
the class EditorAgentImpl method onActivePartChanged.
@Override
public void onActivePartChanged(ActivePartChangedEvent event) {
activePart = event.getActivePart();
if (!(event.getActivePart() instanceof EditorPartPresenter)) {
return;
}
activeEditor = (EditorPartPresenter) event.getActivePart();
activeEditor.activate();
final String isLinkedWithEditor = preferencesManager.getValue(LinkWithEditorAction.LINK_WITH_EDITOR);
if (parseBoolean(isLinkedWithEditor)) {
final VirtualFile file = activeEditor.getEditorInput().getFile();
eventBus.fireEvent(new RevealResourceEvent(file.getLocation()));
}
}
Aggregations