Search in sources :

Example 71 with Path

use of org.eclipse.che.ide.resource.Path in project che by eclipse.

the class MovePresenter method onMoveClicked.

/** {@inheritDoc} */
@Override
public void onMoveClicked() {
    final Project project = appContext.getRootProject();
    checkState(project != null);
    final Path source = getSource();
    final String comment = view.isURLSelected() ? view.getComment() : null;
    final StatusNotification notification = new StatusNotification(locale.moveNotificationStarted(source.toString()), PROGRESS, FLOAT_MODE);
    notificationManager.notify(notification);
    performOperationWithCredentialsRequestIfNeeded(new RemoteSubversionOperation<CLIOutputResponse>() {

        @Override
        public Promise<CLIOutputResponse> perform(Credentials credentials) {
            notification.setStatus(PROGRESS);
            notification.setTitle(locale.moveNotificationStarted(source.toString()));
            return service.move(project.getLocation(), source, getTarget(), comment, credentials);
        }
    }, notification).then(new Operation<CLIOutputResponse>() {

        @Override
        public void apply(CLIOutputResponse response) throws OperationException {
            notification.setTitle(locale.moveNotificationSuccessful());
            notification.setStatus(SUCCESS);
        }
    }).catchError(new Operation<PromiseError>() {

        @Override
        public void apply(PromiseError arg) throws OperationException {
            notification.setTitle(locale.moveNotificationFailed());
            notification.setStatus(FAIL);
        }
    });
    view.onClose();
}
Also used : Path(org.eclipse.che.ide.resource.Path) StatusNotification(org.eclipse.che.ide.api.notification.StatusNotification) Operation(org.eclipse.che.api.promises.client.Operation) Project(org.eclipse.che.ide.api.resources.Project) Promise(org.eclipse.che.api.promises.client.Promise) PromiseError(org.eclipse.che.api.promises.client.PromiseError) CLIOutputResponse(org.eclipse.che.plugin.svn.shared.CLIOutputResponse) Credentials(org.eclipse.che.ide.api.subversion.Credentials) OperationException(org.eclipse.che.api.promises.client.OperationException)

Example 72 with Path

use of org.eclipse.che.ide.resource.Path in project che by eclipse.

the class PlainJavaPagePresenter method onNodeSelected.

@Override
public void onNodeSelected(List<Node> nodes) {
    String projectName = dataObject.getName();
    List<String> nodeRelativePath = new LinkedList<>();
    for (Node node : nodes) {
        Path nodeLocation = ((ResourceNode) node).getData().getLocation();
        nodeRelativePath.add(nodeLocation.makeRelativeTo(valueOf(projectName)).toString());
    }
    if (isSourceSelected) {
        view.setSourceFolder(convertAttributeValuesToString(nodeRelativePath));
    } else {
        view.setLibraryFolder(convertAttributeValuesToString(nodeRelativePath));
    }
    onCoordinatesChanged();
}
Also used : Path(org.eclipse.che.ide.resource.Path) Node(org.eclipse.che.ide.api.data.tree.Node) ResourceNode(org.eclipse.che.ide.resources.tree.ResourceNode) LinkedList(java.util.LinkedList)

Aggregations

Path (org.eclipse.che.ide.resource.Path)72 Resource (org.eclipse.che.ide.api.resources.Resource)27 Operation (org.eclipse.che.api.promises.client.Operation)15 OperationException (org.eclipse.che.api.promises.client.OperationException)15 PromiseError (org.eclipse.che.api.promises.client.PromiseError)13 ArrayList (java.util.ArrayList)11 Project (org.eclipse.che.ide.api.resources.Project)11 Promise (org.eclipse.che.api.promises.client.Promise)10 EditorPartPresenter (org.eclipse.che.ide.api.editor.EditorPartPresenter)10 List (java.util.List)8 Test (org.junit.Test)7 ResourceDelta (org.eclipse.che.ide.api.resources.ResourceDelta)6 VirtualFile (org.eclipse.che.ide.api.resources.VirtualFile)6 Optional (com.google.common.base.Optional)5 Function (org.eclipse.che.api.promises.client.Function)5 FunctionException (org.eclipse.che.api.promises.client.FunctionException)5 Container (org.eclipse.che.ide.api.resources.Container)5 ResourceChangedEvent (org.eclipse.che.ide.api.resources.ResourceChangedEvent)5 HashMap (java.util.HashMap)4 ProjectConfigDto (org.eclipse.che.api.workspace.shared.dto.ProjectConfigDto)4