Search in sources :

Example 11 with RevealResourceEvent

use of org.eclipse.che.ide.resources.reveal.RevealResourceEvent in project che by eclipse.

the class NewFolderAction method createFolder.

final void createFolder(String name) {
    Resource resource = appContext.getResource();
    if (!(resource instanceof Container)) {
        final Container parent = resource.getParent();
        checkState(parent != null, "Parent should be a container");
        resource = parent;
    }
    ((Container) resource).newFolder(name).then(new Operation<Folder>() {

        @Override
        public void apply(Folder folder) throws OperationException {
            eventBus.fireEvent(new RevealResourceEvent(folder));
        }
    }).catchError(new Operation<PromiseError>() {

        @Override
        public void apply(PromiseError error) throws OperationException {
            dialogFactory.createMessageDialog("Error", error.getMessage(), null).show();
        }
    });
}
Also used : Container(org.eclipse.che.ide.api.resources.Container) PromiseError(org.eclipse.che.api.promises.client.PromiseError) Resource(org.eclipse.che.ide.api.resources.Resource) Operation(org.eclipse.che.api.promises.client.Operation) Folder(org.eclipse.che.ide.api.resources.Folder) RevealResourceEvent(org.eclipse.che.ide.resources.reveal.RevealResourceEvent) OperationException(org.eclipse.che.api.promises.client.OperationException)

Aggregations

RevealResourceEvent (org.eclipse.che.ide.resources.reveal.RevealResourceEvent)11 OperationException (org.eclipse.che.api.promises.client.OperationException)7 Resource (org.eclipse.che.ide.api.resources.Resource)6 Operation (org.eclipse.che.api.promises.client.Operation)5 PromiseError (org.eclipse.che.api.promises.client.PromiseError)5 EditorPartPresenter (org.eclipse.che.ide.api.editor.EditorPartPresenter)3 Container (org.eclipse.che.ide.api.resources.Container)3 Path (org.eclipse.che.ide.resource.Path)3 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)2 Function (org.eclipse.che.api.promises.client.Function)2 FunctionException (org.eclipse.che.api.promises.client.FunctionException)2 Promise (org.eclipse.che.api.promises.client.Promise)2 RequestCall (org.eclipse.che.api.promises.client.callback.AsyncPromiseHelper.RequestCall)2 CancelCallback (org.eclipse.che.ide.api.dialogs.CancelCallback)2 ConfirmCallback (org.eclipse.che.ide.api.dialogs.ConfirmCallback)2 InputCallback (org.eclipse.che.ide.api.dialogs.InputCallback)2 File (org.eclipse.che.ide.api.resources.File)2 Folder (org.eclipse.che.ide.api.resources.Folder)2 Optional (com.google.common.base.Optional)1 Scheduler (com.google.gwt.core.client.Scheduler)1