Search in sources :

Example 76 with Project

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

the class AddRemoteRepositoryPresenter method onOkClicked.

/** {@inheritDoc} */
@Override
public void onOkClicked() {
    final String name = view.getName();
    final String url = view.getUrl().trim();
    final Project project = appContext.getRootProject();
    service.remoteAdd(appContext.getDevMachine(), project.getLocation(), name, url).then(new Operation<Void>() {

        @Override
        public void apply(Void arg) throws OperationException {
            callback.onSuccess(null);
            view.close();
        }
    }).catchError(new Operation<PromiseError>() {

        @Override
        public void apply(PromiseError error) throws OperationException {
            callback.onFailure(error.getCause());
        }
    });
}
Also used : Project(org.eclipse.che.ide.api.resources.Project) PromiseError(org.eclipse.che.api.promises.client.PromiseError) Operation(org.eclipse.che.api.promises.client.Operation) OperationException(org.eclipse.che.api.promises.client.OperationException)

Example 77 with Project

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

the class CheckoutReferenceAction method actionPerformed.

/** {@inheritDoc} */
@Override
public void actionPerformed(ActionEvent e) {
    final Project project = appContext.getRootProject();
    checkState(project != null, "Null project occurred");
    presenter.showDialog(project);
}
Also used : Project(org.eclipse.che.ide.api.resources.Project)

Example 78 with Project

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

the class CommitAction method actionPerformed.

/** {@inheritDoc} */
@Override
public void actionPerformed(ActionEvent e) {
    final Project project = appContext.getRootProject();
    checkState(project != null, "Null project occurred");
    presenter.showDialog(project);
}
Also used : Project(org.eclipse.che.ide.api.resources.Project)

Example 79 with Project

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

the class CompareWithBranchAction method actionPerformed.

/** {@inheritDoc} */
@Override
public void actionPerformed(ActionEvent e) {
    final Project project = appContext.getRootProject();
    final Resource resource = appContext.getResource();
    checkState(project != null, "Null project occurred");
    presenter.showBranches(project, resource);
}
Also used : Project(org.eclipse.che.ide.api.resources.Project) Resource(org.eclipse.che.ide.api.resources.Resource)

Example 80 with Project

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

the class CompareWithLatestAction method actionPerformed.

/** {@inheritDoc} */
@Override
public void actionPerformed(ActionEvent e) {
    final Project project = appContext.getRootProject();
    final Resource resource = appContext.getResource();
    checkState(project != null, "Null project occurred");
    checkState(project.getLocation().isPrefixOf(resource.getLocation()), "Given selected item is not descendant of given project");
    final String selectedItemPath = resource.getLocation().removeFirstSegments(project.getLocation().segmentCount()).removeTrailingSeparator().toString();
    service.diff(appContext.getDevMachine(), project.getLocation(), selectedItemPath.isEmpty() ? null : singletonList(selectedItemPath), NAME_STATUS, false, 0, REVISION, false).then(new Operation<String>() {

        @Override
        public void apply(String diff) throws OperationException {
            if (diff.isEmpty()) {
                dialogFactory.createMessageDialog(locale.compareMessageIdenticalContentTitle(), locale.compareMessageIdenticalContentText(), null).show();
            } else {
                final String[] changedFiles = diff.split("\n");
                if (changedFiles.length == 1) {
                    project.getFile(changedFiles[0].substring(2)).then(new Operation<Optional<File>>() {

                        @Override
                        public void apply(Optional<File> file) throws OperationException {
                            if (file.isPresent()) {
                                comparePresenter.showCompareWithLatest(file.get(), defineStatus(changedFiles[0].substring(0, 1)), REVISION);
                            }
                        }
                    });
                } else {
                    Map<String, Status> items = new HashMap<>();
                    for (String item : changedFiles) {
                        items.put(item.substring(2, item.length()), defineStatus(item.substring(0, 1)));
                    }
                    changedListPresenter.show(items, REVISION, null, project);
                }
            }
        }
    }).catchError(new Operation<PromiseError>() {

        @Override
        public void apply(PromiseError arg) throws OperationException {
            notificationManager.notify(locale.diffFailed(), FAIL, NOT_EMERGE_MODE);
        }
    });
}
Also used : Status(org.eclipse.che.ide.ext.git.client.compare.FileStatus.Status) FileStatus.defineStatus(org.eclipse.che.ide.ext.git.client.compare.FileStatus.defineStatus) Optional(com.google.common.base.Optional) HashMap(java.util.HashMap) Resource(org.eclipse.che.ide.api.resources.Resource) Operation(org.eclipse.che.api.promises.client.Operation) Project(org.eclipse.che.ide.api.resources.Project) PromiseError(org.eclipse.che.api.promises.client.PromiseError) File(org.eclipse.che.ide.api.resources.File) OperationException(org.eclipse.che.api.promises.client.OperationException)

Aggregations

Project (org.eclipse.che.ide.api.resources.Project)127 Resource (org.eclipse.che.ide.api.resources.Resource)74 OperationException (org.eclipse.che.api.promises.client.OperationException)53 Operation (org.eclipse.che.api.promises.client.Operation)51 PromiseError (org.eclipse.che.api.promises.client.PromiseError)48 VirtualFile (org.eclipse.che.ide.api.resources.VirtualFile)24 CLIOutputResponse (org.eclipse.che.plugin.svn.shared.CLIOutputResponse)18 Promise (org.eclipse.che.api.promises.client.Promise)16 EditorPartPresenter (org.eclipse.che.ide.api.editor.EditorPartPresenter)14 Container (org.eclipse.che.ide.api.resources.Container)14 List (java.util.List)12 StatusNotification (org.eclipse.che.ide.api.notification.StatusNotification)12 Path (org.eclipse.che.ide.resource.Path)12 Optional (com.google.common.base.Optional)11 ArrayList (java.util.ArrayList)10 File (org.eclipse.che.ide.api.resources.File)10 Credentials (org.eclipse.che.ide.api.subversion.Credentials)10 FunctionException (org.eclipse.che.api.promises.client.FunctionException)9 JavaUtil.isJavaProject (org.eclipse.che.ide.ext.java.client.util.JavaUtil.isJavaProject)9 TextEditor (org.eclipse.che.ide.api.editor.texteditor.TextEditor)8