Search in sources :

Example 46 with EditorPartPresenter

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);
}
Also used : UndoableEditor(org.eclipse.che.ide.api.editor.texteditor.UndoableEditor) HandlesUndoRedo(org.eclipse.che.ide.api.editor.texteditor.HandlesUndoRedo) EditorPartPresenter(org.eclipse.che.ide.api.editor.EditorPartPresenter)

Example 47 with EditorPartPresenter

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);
        }
    }
}
Also used : HandlesTextOperations(org.eclipse.che.ide.api.editor.texteditor.HandlesTextOperations) EditorPartPresenter(org.eclipse.che.ide.api.editor.EditorPartPresenter)

Example 48 with EditorPartPresenter

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);
}
Also used : EditorPartPresenter(org.eclipse.che.ide.api.editor.EditorPartPresenter) Test(org.junit.Test)

Example 49 with EditorPartPresenter

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();
}
Also used : EditorPartPresenter(org.eclipse.che.ide.api.editor.EditorPartPresenter) Test(org.junit.Test)

Example 50 with EditorPartPresenter

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);
}
Also used : EditorPartPresenter(org.eclipse.che.ide.api.editor.EditorPartPresenter) Test(org.junit.Test)

Aggregations

EditorPartPresenter (org.eclipse.che.ide.api.editor.EditorPartPresenter)79 TextEditor (org.eclipse.che.ide.api.editor.texteditor.TextEditor)21 VirtualFile (org.eclipse.che.ide.api.resources.VirtualFile)19 OperationException (org.eclipse.che.api.promises.client.OperationException)13 Project (org.eclipse.che.ide.api.resources.Project)13 Resource (org.eclipse.che.ide.api.resources.Resource)11 Test (org.junit.Test)10 Operation (org.eclipse.che.api.promises.client.Operation)9 Path (org.eclipse.che.ide.resource.Path)8 File (org.eclipse.che.ide.api.resources.File)7 Scheduler (com.google.gwt.core.client.Scheduler)6 EditorPartStack (org.eclipse.che.ide.api.parts.EditorPartStack)6 PartPresenter (org.eclipse.che.ide.api.parts.PartPresenter)6 Optional (com.google.common.base.Optional)5 OpenEditorCallbackImpl (org.eclipse.che.ide.api.editor.OpenEditorCallbackImpl)5 LanguageServerEditorConfiguration (org.eclipse.che.plugin.languageserver.ide.editor.LanguageServerEditorConfiguration)5 HandlesTextOperations (org.eclipse.che.ide.api.editor.texteditor.HandlesTextOperations)4 ResourceDelta (org.eclipse.che.ide.api.resources.ResourceDelta)4 ClassContent (org.eclipse.che.ide.ext.java.shared.dto.ClassContent)4 JsonObject (elemental.json.JsonObject)3