Search in sources :

Example 16 with EditorPartPresenter

use of org.eclipse.che.ide.api.editor.EditorPartPresenter in project che by eclipse.

the class EditorContentSynchronizerImpl method onActivePartChanged.

@Override
public void onActivePartChanged(ActivePartChangedEvent event) {
    PartPresenter activePart = event.getActivePart();
    if (!(activePart instanceof EditorPartPresenter)) {
        return;
    }
    EditorPartPresenter activeEditor = (EditorPartPresenter) activePart;
    Path path = activeEditor.getEditorInput().getFile().getLocation();
    if (editorGroups.containsKey(path)) {
        editorGroups.get(path).onActiveEditorChanged(activeEditor);
    }
}
Also used : Path(org.eclipse.che.ide.resource.Path) PartPresenter(org.eclipse.che.ide.api.parts.PartPresenter) EditorPartPresenter(org.eclipse.che.ide.api.editor.EditorPartPresenter) EditorPartPresenter(org.eclipse.che.ide.api.editor.EditorPartPresenter)

Example 17 with EditorPartPresenter

use of org.eclipse.che.ide.api.editor.EditorPartPresenter in project che by eclipse.

the class EditorAgentImpl method closeEditor.

private void closeEditor(EditorTab tab) {
    checkArgument(tab != null, "Null editor tab occurred");
    EditorPartPresenter editor = tab.getRelativeEditorPart();
    if (editor == null) {
        return;
    }
    openedEditors.remove(editor);
    openedEditorsToProviders.remove(editor);
    editor.close(false);
    if (editor instanceof TextEditor) {
        editorContentSynchronizerProvider.get().unTrackEditor(editor);
    }
    if (activeEditor != null && activeEditor == editor) {
        activeEditor = null;
    }
}
Also used : TextEditor(org.eclipse.che.ide.api.editor.texteditor.TextEditor) EditorPartPresenter(org.eclipse.che.ide.api.editor.EditorPartPresenter)

Example 18 with EditorPartPresenter

use of org.eclipse.che.ide.api.editor.EditorPartPresenter in project che by eclipse.

the class ReopenClosedFileAction method updateInPerspective.

/** {@inheritDoc} */
@Override
public void updateInPerspective(@NotNull ActionEvent event) {
    EditorPartStack currentPartStack = getEditorPane(event);
    EditorPartPresenter lastClosed = currentPartStack.getLastClosed();
    event.getPresentation().setEnabled(lastClosed != null);
}
Also used : EditorPartPresenter(org.eclipse.che.ide.api.editor.EditorPartPresenter) EditorPartStack(org.eclipse.che.ide.api.parts.EditorPartStack)

Example 19 with EditorPartPresenter

use of org.eclipse.che.ide.api.editor.EditorPartPresenter in project che by eclipse.

the class SwitchPreviousEditorAction method actionPerformed.

/** {@inheritDoc} */
@Override
public void actionPerformed(ActionEvent event) {
    final EditorPartPresenter activeEditor = editorAgent.getActiveEditor();
    checkNotNull(activeEditor, "Null editor occurred");
    final EditorPartPresenter previousEditor = getPreviousEditorBaseOn(activeEditor);
    editorAgent.activateEditor(previousEditor);
}
Also used : EditorPartPresenter(org.eclipse.che.ide.api.editor.EditorPartPresenter)

Example 20 with EditorPartPresenter

use of org.eclipse.che.ide.api.editor.EditorPartPresenter in project che by eclipse.

the class EditorMultiPartStackPresenter method onActivePartChanged.

@Override
public void onActivePartChanged(ActivePartChangedEvent event) {
    PartPresenter activePart = event.getActivePart();
    if (activePart instanceof EditorPartPresenter) {
        activeEditor = activePart;
        activeEditorPartStack = getPartStackByPart(activePart);
    }
}
Also used : PartPresenter(org.eclipse.che.ide.api.parts.PartPresenter) EditorPartPresenter(org.eclipse.che.ide.api.editor.EditorPartPresenter) EditorPartPresenter(org.eclipse.che.ide.api.editor.EditorPartPresenter)

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