Search in sources :

Example 76 with Resource

use of org.eclipse.che.ide.api.resources.Resource in project che by eclipse.

the class LockUnlockPresenter method showDialog.

private void showDialog(final boolean lock) {
    final Project project = appContext.getRootProject();
    checkState(project != null);
    final Resource[] resources = appContext.getResources();
    checkState(!Arrays.isNullOrEmpty(resources));
    final String withoutForceLabel = getWithoutForceLabel(lock);
    final String withForceLabel = getWithForceLabel(lock);
    final String cancelLabel = getCancelLabel(lock);
    final ConfirmCallback withoutForceCallback = new ConfirmCallback() {

        @Override
        public void accepted() {
            doAction(lock, false, toRelative(project, resources));
        }
    };
    final ConfirmCallback withForceCallback = new ConfirmCallback() {

        @Override
        public void accepted() {
            doAction(lock, true, toRelative(project, resources));
        }
    };
    final ChoiceDialog dialog = this.choiceDialogFactory.createChoiceDialog(getTitle(lock), getContent(lock), withoutForceLabel, withForceLabel, cancelLabel, withoutForceCallback, withForceCallback, null);
    dialog.show();
}
Also used : ChoiceDialog(org.eclipse.che.plugin.svn.ide.common.threechoices.ChoiceDialog) Project(org.eclipse.che.ide.api.resources.Project) ConfirmCallback(org.eclipse.che.ide.api.dialogs.ConfirmCallback) Resource(org.eclipse.che.ide.api.resources.Resource)

Example 77 with Resource

use of org.eclipse.che.ide.api.resources.Resource in project che by eclipse.

the class AddPresenter method showAdd.

public void showAdd() {
    final Project project = appContext.getRootProject();
    checkState(project != null);
    final Resource[] resources = appContext.getResources();
    checkState(!Arrays.isNullOrEmpty(resources));
    final StatusNotification notification = new StatusNotification(constants.addStarted(resources.length), PROGRESS, FLOAT_MODE);
    notificationManager.notify(notification);
    service.add(project.getLocation(), toRelative(project, resources), null, false, true, false, false).then(new Operation<CLIOutputResponse>() {

        @Override
        public void apply(CLIOutputResponse response) throws OperationException {
            printResponse(response.getCommand(), response.getOutput(), response.getErrOutput(), constants.commandAdd());
            if (response.getErrOutput() == null || response.getErrOutput().size() == 0) {
                notification.setTitle(constants.addSuccessful());
                notification.setStatus(SUCCESS);
            } else {
                notification.setTitle(constants.addWarning());
                notification.setStatus(FAIL);
            }
        }
    }).catchError(new Operation<PromiseError>() {

        @Override
        public void apply(PromiseError error) throws OperationException {
            notification.setTitle(constants.addFailed() + ": " + error.getMessage());
            notification.setStatus(FAIL);
        }
    });
}
Also used : Project(org.eclipse.che.ide.api.resources.Project) PromiseError(org.eclipse.che.api.promises.client.PromiseError) Resource(org.eclipse.che.ide.api.resources.Resource) StatusNotification(org.eclipse.che.ide.api.notification.StatusNotification) Operation(org.eclipse.che.api.promises.client.Operation) CLIOutputResponse(org.eclipse.che.plugin.svn.shared.CLIOutputResponse) OperationException(org.eclipse.che.api.promises.client.OperationException)

Example 78 with Resource

use of org.eclipse.che.ide.api.resources.Resource in project che by eclipse.

the class CommitPresenter method commitSelection.

private void commitSelection(String message, boolean keepLocks) {
    final Project project = appContext.getRootProject();
    checkState(project != null);
    final Resource[] resources = appContext.getResources();
    checkState(!Arrays.isNullOrEmpty(resources));
    doCommit(message, toRelative(project, resources), keepLocks);
}
Also used : Project(org.eclipse.che.ide.api.resources.Project) Resource(org.eclipse.che.ide.api.resources.Resource)

Example 79 with Resource

use of org.eclipse.che.ide.api.resources.Resource in project che by eclipse.

the class CommitPresenter method loadSelectionChanges.

private void loadSelectionChanges() {
    final Project project = appContext.getRootProject();
    checkState(project != null);
    final Resource[] resources = appContext.getResources();
    checkState(!Arrays.isNullOrEmpty(resources));
    service.status(project.getLocation(), toRelative(project, resources), null, false, false, false, true, false, null).then(new Operation<CLIOutputResponse>() {

        @Override
        public void apply(CLIOutputResponse response) throws OperationException {
            List<StatusItem> statusItems = parseChangesList(response);
            view.setChangesList(statusItems);
            cache.put(Changes.SELECTION, statusItems);
        }
    }).catchError(new Operation<PromiseError>() {

        @Override
        public void apply(PromiseError error) throws OperationException {
            Log.error(CommitPresenter.class, error.getMessage());
        }
    });
}
Also used : StatusItem(org.eclipse.che.plugin.svn.shared.StatusItem) Project(org.eclipse.che.ide.api.resources.Project) PromiseError(org.eclipse.che.api.promises.client.PromiseError) Resource(org.eclipse.che.ide.api.resources.Resource) Operation(org.eclipse.che.api.promises.client.Operation) CLIOutputResponse(org.eclipse.che.plugin.svn.shared.CLIOutputResponse) OperationException(org.eclipse.che.api.promises.client.OperationException)

Example 80 with Resource

use of org.eclipse.che.ide.api.resources.Resource in project che by eclipse.

the class ResolvePresenter method showConflictsDialog.

public void showConflictsDialog() {
    final Project project = appContext.getRootProject();
    checkState(project != null);
    final Resource[] resources = appContext.getResources();
    checkState(!Arrays.isNullOrEmpty(resources));
    service.showConflicts(project.getLocation(), toRelative(project, resources)).then(new Operation<CLIOutputResponse>() {

        @Override
        public void apply(CLIOutputResponse response) throws OperationException {
            conflictsList = parseConflictsList(response.getOutput());
            if (conflictsList.isEmpty()) {
                dialogFactory.createMessageDialog(constants.resolveNoConflictTitle(), constants.resolveNoConflictContent(), null).show();
                return;
            }
            for (String file : conflictsList) {
                view.addConflictingFile(file);
            }
            view.showDialog();
        }
    }).catchError(new Operation<PromiseError>() {

        @Override
        public void apply(PromiseError error) throws OperationException {
        }
    });
}
Also used : Project(org.eclipse.che.ide.api.resources.Project) PromiseError(org.eclipse.che.api.promises.client.PromiseError) Resource(org.eclipse.che.ide.api.resources.Resource) Operation(org.eclipse.che.api.promises.client.Operation) CLIOutputResponse(org.eclipse.che.plugin.svn.shared.CLIOutputResponse) OperationException(org.eclipse.che.api.promises.client.OperationException)

Aggregations

Resource (org.eclipse.che.ide.api.resources.Resource)146 Project (org.eclipse.che.ide.api.resources.Project)73 OperationException (org.eclipse.che.api.promises.client.OperationException)48 Operation (org.eclipse.che.api.promises.client.Operation)46 PromiseError (org.eclipse.che.api.promises.client.PromiseError)40 Container (org.eclipse.che.ide.api.resources.Container)32 Path (org.eclipse.che.ide.resource.Path)30 VirtualFile (org.eclipse.che.ide.api.resources.VirtualFile)22 Optional (com.google.common.base.Optional)15 File (org.eclipse.che.ide.api.resources.File)14 CLIOutputResponse (org.eclipse.che.plugin.svn.shared.CLIOutputResponse)14 List (java.util.List)13 Promise (org.eclipse.che.api.promises.client.Promise)13 FunctionException (org.eclipse.che.api.promises.client.FunctionException)12 EditorPartPresenter (org.eclipse.che.ide.api.editor.EditorPartPresenter)12 ArrayList (java.util.ArrayList)11 Function (org.eclipse.che.api.promises.client.Function)9 ResourceChangedEvent (org.eclipse.che.ide.api.resources.ResourceChangedEvent)9 JavaUtil.isJavaProject (org.eclipse.che.ide.ext.java.client.util.JavaUtil.isJavaProject)9 TextEditor (org.eclipse.che.ide.api.editor.texteditor.TextEditor)8