Search in sources :

Example 21 with EditorPartPresenter

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

the class CloseOtherAction method actionPerformed.

/** {@inheritDoc} */
@Override
public void actionPerformed(ActionEvent event) {
    EditorPartStack currentPartStack = getEditorPane(event);
    EditorPartPresenter currentEditor = getEditorTab(event).getRelativeEditorPart();
    for (EditorPartPresenter editorPart : editorAgent.getOpenedEditorsFor(currentPartStack)) {
        if (currentEditor != editorPart) {
            editorAgent.closeEditor(editorPart);
        }
    }
}
Also used : EditorPartPresenter(org.eclipse.che.ide.api.editor.EditorPartPresenter) EditorPartStack(org.eclipse.che.ide.api.parts.EditorPartStack)

Example 22 with EditorPartPresenter

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

the class CloseOtherAction method isFilesToCloseExist.

private boolean isFilesToCloseExist(ActionEvent event) {
    EditorPartStack currentPartStack = getEditorPane(event);
    EditorPartPresenter currentEditor = getEditorTab(event).getRelativeEditorPart();
    for (EditorPartPresenter openedEditor : editorAgent.getOpenedEditorsFor(currentPartStack)) {
        if (currentEditor != openedEditor) {
            return true;
        }
    }
    return false;
}
Also used : EditorPartPresenter(org.eclipse.che.ide.api.editor.EditorPartPresenter) EditorPartStack(org.eclipse.che.ide.api.parts.EditorPartStack)

Example 23 with EditorPartPresenter

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

the class ReopenClosedFileAction method actionPerformed.

/** {@inheritDoc} */
@Override
public void actionPerformed(ActionEvent event) {
    EditorPartStack currentPartStack = getEditorPane(event);
    EditorPartPresenter lastClosed = currentPartStack.getLastClosed();
    VirtualFile file = lastClosed.getEditorInput().getFile();
    eventBus.fireEvent(FileEvent.createOpenFileEvent(file));
}
Also used : VirtualFile(org.eclipse.che.ide.api.resources.VirtualFile) EditorPartPresenter(org.eclipse.che.ide.api.editor.EditorPartPresenter) EditorPartStack(org.eclipse.che.ide.api.parts.EditorPartStack)

Example 24 with EditorPartPresenter

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

the class TestResultViewImpl method gotoClass.

@Override
public void gotoClass(String packagePath, int line) {
    lastWentLine = line;
    final Project project = appContext.getRootProject();
    String testSrcPath = project.getPath() + "/" + DEFAULT_TEST_SOURCE_FOLDER;
    appContext.getWorkspaceRoot().getFile(testSrcPath + packagePath).then(new Operation<Optional<File>>() {

        @Override
        public void apply(Optional<File> file) throws OperationException {
            if (file.isPresent()) {
                eventBus.fireEvent(FileEvent.createOpenFileEvent(file.get()));
                Timer t = new Timer() {

                    @Override
                    public void run() {
                        EditorPartPresenter editorPart = editorAgent.getActiveEditor();
                        Document doc = ((TextEditor) editorPart).getDocument();
                        doc.setCursorPosition(new TextPosition(lastWentLine - 1, 0));
                    }
                };
                t.schedule(500);
            }
        }
    }).catchError(new Operation<PromiseError>() {

        @Override
        public void apply(PromiseError error) throws OperationException {
            Log.info(TestResultViewImpl.class, error);
        }
    });
}
Also used : Optional(com.google.common.base.Optional) Operation(org.eclipse.che.api.promises.client.Operation) Document(org.eclipse.che.ide.api.editor.document.Document) Project(org.eclipse.che.ide.api.resources.Project) TextEditor(org.eclipse.che.ide.api.editor.texteditor.TextEditor) Timer(com.google.gwt.user.client.Timer) PromiseError(org.eclipse.che.api.promises.client.PromiseError) TextPosition(org.eclipse.che.ide.api.editor.text.TextPosition) EditorPartPresenter(org.eclipse.che.ide.api.editor.EditorPartPresenter) File(org.eclipse.che.ide.api.resources.File) OperationException(org.eclipse.che.api.promises.client.OperationException)

Example 25 with EditorPartPresenter

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

the class RunClassTestAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    EditorPartPresenter editorPart = editorAgent.getActiveEditor();
    final VirtualFile file = editorPart.getEditorInput().getFile();
    String fqn = JavaUtil.resolveFQN(file);
    Map<String, String> parameters = new HashMap<>();
    parameters.put("fqn", fqn);
    parameters.put("runClass", "true");
    parameters.put("updateClasspath", "true");
    delegate.doRunTests(e, parameters);
}
Also used : VirtualFile(org.eclipse.che.ide.api.resources.VirtualFile) HashMap(java.util.HashMap) 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