use of org.eclipse.che.ide.api.editor.EditorPartPresenter in project che by eclipse.
the class RedoAction method updateInPerspective.
@Override
public void updateInPerspective(@NotNull ActionEvent event) {
EditorPartPresenter activeEditor = editorAgent.getActiveEditor();
boolean mustEnable = false;
if (activeEditor != null && activeEditor instanceof UndoableEditor) {
final HandlesUndoRedo undoRedo = ((UndoableEditor) activeEditor).getUndoRedo();
if (undoRedo != null) {
mustEnable = undoRedo.redoable();
}
}
event.getPresentation().setEnabled(mustEnable);
}
use of org.eclipse.che.ide.api.editor.EditorPartPresenter in project che by eclipse.
the class FormatterAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
final EditorPartPresenter editor = editorAgent.getActiveEditor();
HandlesTextOperations handlesOperations;
if (editor instanceof HandlesTextOperations) {
handlesOperations = (HandlesTextOperations) editor;
if (handlesOperations.canDoOperation(TextEditorOperations.FORMAT)) {
handlesOperations.doOperation(TextEditorOperations.FORMAT);
}
}
}
use of org.eclipse.che.ide.api.editor.EditorPartPresenter in project che by eclipse.
the class EditorPartStackPresenterTest method shouldReturnLastPart.
@Test
public void shouldReturnLastPart() {
presenter.addPart(partPresenter1);
presenter.addPart(partPresenter2);
presenter.addPart(partPresenter3);
EditorPartPresenter result = presenter.getPreviousFor(partPresenter1);
assertNotNull(result);
assertEquals(partPresenter3, result);
}
use of org.eclipse.che.ide.api.editor.EditorPartPresenter in project che by eclipse.
the class EditorContentSynchronizerImplTest method shouldCreateNewEditorGroup.
@Test
public void shouldCreateNewEditorGroup() {
EditorPartPresenter openedEditor = mock(EditorPartPresenter.class);
when(openedEditor.getEditorInput()).thenReturn(editorInput);
editorContentSynchronizer.trackEditor(activeEditor);
verify(editorGroupSyncProvider).get();
}
use of org.eclipse.che.ide.api.editor.EditorPartPresenter in project che by eclipse.
the class EditorContentSynchronizerImplTest method shouldAddEditorIntoExistGroup.
@Test
public void shouldAddEditorIntoExistGroup() {
EditorPartPresenter openedEditor1 = mock(EditorPartPresenter.class);
EditorPartPresenter openedEditor2 = mock(EditorPartPresenter.class);
when(openedEditor1.getEditorInput()).thenReturn(editorInput);
when(openedEditor2.getEditorInput()).thenReturn(editorInput);
editorContentSynchronizer.trackEditor(openedEditor1);
editorContentSynchronizer.trackEditor(openedEditor2);
reset(editorGroupSyncProvider);
editorContentSynchronizer.trackEditor(activeEditor);
verify(editorGroupSyncProvider, never()).get();
verify(editorGroupSynchronization).addEditor(activeEditor);
}
Aggregations