Search in sources :

Example 1 with EditorPartStack

use of org.eclipse.che.ide.api.parts.EditorPartStack in project che by eclipse.

the class EditorAgentImpl method restoreSplit.

private List<Promise<Void>> restoreSplit(JsonObject files, EditorPartStack editorPartStack, Map<EditorPartPresenter, EditorPartStack> activeEditors) {
    JsonObject splitFirst = files.getObject("SPLIT_FIRST");
    String direction = files.getString("DIRECTION");
    double size = files.getNumber("SIZE");
    EditorPartStack split = editorMultiPartStack.split(editorPartStack, new Constraints(Direction.valueOf(direction), null), size);
    List<Promise<Void>> restoreFirst = restore(splitFirst, editorPartStack, activeEditors);
    JsonObject splitSecond = files.getObject("SPLIT_SECOND");
    List<Promise<Void>> restoreSecond = restore(splitSecond, split, activeEditors);
    List<Promise<Void>> result = new ArrayList<>();
    result.addAll(restoreFirst);
    result.addAll(restoreSecond);
    return result;
}
Also used : Promise(org.eclipse.che.api.promises.client.Promise) Constraints(org.eclipse.che.ide.api.constraints.Constraints) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) ArrayList(java.util.ArrayList) JsonObject(elemental.json.JsonObject) EditorPartStack(org.eclipse.che.ide.api.parts.EditorPartStack)

Example 2 with EditorPartStack

use of org.eclipse.che.ide.api.parts.EditorPartStack in project che by eclipse.

the class OrionEditorPresenter method updateTabReference.

private void updateTabReference(File file, Path oldPath) {
    final PartPresenter activePart = editorMultiPartStackPresenter.getActivePart();
    final EditorPartStack activePartStack = editorMultiPartStackPresenter.getPartStackByPart(activePart);
    if (activePartStack == null) {
        return;
    }
    final EditorTab editorTab = activePartStack.getTabByPath(oldPath);
    if (editorTab != null) {
        editorTab.setFile(file);
    }
}
Also used : EditorTab(org.eclipse.che.ide.api.parts.EditorTab) PartPresenter(org.eclipse.che.ide.api.parts.PartPresenter) EditorPartStack(org.eclipse.che.ide.api.parts.EditorPartStack)

Example 3 with EditorPartStack

use of org.eclipse.che.ide.api.parts.EditorPartStack 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 4 with EditorPartStack

use of org.eclipse.che.ide.api.parts.EditorPartStack in project che by eclipse.

the class EditorMultiPartStackPresenter method removePart.

/** {@inheritDoc} */
@Override
public void removePart(PartPresenter part) {
    EditorPartStack editorPartStack = getPartStackByPart(part);
    if (editorPartStack == null) {
        return;
    }
    editorPartStack.removePart(part);
    if (editorPartStack.getActivePart() == null) {
        removePartStack(editorPartStack);
    }
}
Also used : EditorPartStack(org.eclipse.che.ide.api.parts.EditorPartStack)

Example 5 with EditorPartStack

use of org.eclipse.che.ide.api.parts.EditorPartStack in project che by eclipse.

the class EditorMultiPartStackPresenter method setActivePart.

/** {@inheritDoc} */
@Override
public void setActivePart(@NotNull PartPresenter part) {
    activeEditor = part;
    EditorPartStack editorPartStack = getPartStackByPart(part);
    if (editorPartStack != null) {
        activeEditorPartStack = editorPartStack;
        editorPartStack.setActivePart(part);
    }
}
Also used : EditorPartStack(org.eclipse.che.ide.api.parts.EditorPartStack)

Aggregations

EditorPartStack (org.eclipse.che.ide.api.parts.EditorPartStack)16 EditorPartPresenter (org.eclipse.che.ide.api.editor.EditorPartPresenter)7 JsonObject (elemental.json.JsonObject)3 PartPresenter (org.eclipse.che.ide.api.parts.PartPresenter)3 OperationException (org.eclipse.che.api.promises.client.OperationException)2 Promise (org.eclipse.che.api.promises.client.Promise)2 HasDataObject (org.eclipse.che.ide.api.data.HasDataObject)2 EditorTab (org.eclipse.che.ide.api.parts.EditorTab)2 Lists.newArrayList (com.google.common.collect.Lists.newArrayList)1 ArrayOf (elemental.util.ArrayOf)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Operation (org.eclipse.che.api.promises.client.Operation)1 Constraints (org.eclipse.che.ide.api.constraints.Constraints)1 AsyncEditorProvider (org.eclipse.che.ide.api.editor.AsyncEditorProvider)1 EditorProvider (org.eclipse.che.ide.api.editor.EditorProvider)1 FileType (org.eclipse.che.ide.api.filetypes.FileType)1 Resource (org.eclipse.che.ide.api.resources.Resource)1 VirtualFile (org.eclipse.che.ide.api.resources.VirtualFile)1 ProjectExplorerPresenter (org.eclipse.che.ide.part.explorer.project.ProjectExplorerPresenter)1