Search in sources :

Example 1 with Resource

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

the class ConvertFolderToProjectAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent event) {
    Resource folder = getSelectedItem();
    if (folder == null) {
        return;
    }
    Path location = folder.getLocation();
    if (location == null) {
        return;
    }
    MutableProjectConfig mutableProjectConfig = new MutableProjectConfig();
    mutableProjectConfig.setPath(location.toString());
    mutableProjectConfig.setName(folder.getName());
    projectConfigWizard.show(mutableProjectConfig);
}
Also used : Path(org.eclipse.che.ide.resource.Path) MutableProjectConfig(org.eclipse.che.ide.api.project.MutableProjectConfig) Resource(org.eclipse.che.ide.api.resources.Resource)

Example 2 with Resource

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

the class DownloadProjectAction method actionPerformed.

/** {@inheritDoc} */
@Override
public void actionPerformed(ActionEvent e) {
    final Resource resource = appContext.getResource();
    if (resource == null || resource.getResourceType() != PROJECT) {
        return;
    }
    final Project project = (Project) resource;
    downloadContainer.setUrl(project.getURL());
}
Also used : Project(org.eclipse.che.ide.api.resources.Project) Resource(org.eclipse.che.ide.api.resources.Resource)

Example 3 with Resource

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

the class FullTextSearchAction method actionPerformed.

/** {@inheritDoc} */
@Override
public void actionPerformed(ActionEvent e) {
    final Resource[] resources = appContext.getResources();
    final Path searchPath;
    if (resources == null || resources.length == 0 || resources.length > 1) {
        searchPath = Path.ROOT;
    } else {
        if (resources[0] instanceof Container) {
            searchPath = resources[0].getLocation();
        } else {
            final Container parent = resources[0].getParent();
            searchPath = parent != null ? parent.getLocation() : Path.ROOT;
        }
    }
    presenter.showDialog(searchPath);
}
Also used : Path(org.eclipse.che.ide.resource.Path) Container(org.eclipse.che.ide.api.resources.Container) Resource(org.eclipse.che.ide.api.resources.Resource)

Example 4 with Resource

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

the class ProjectConfigurationAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    final Resource[] resources = appContext.getResources();
    checkState(resources != null && resources.length == 1);
    final Resource resource = resources[0];
    checkState(resource instanceof Container);
    if (resource.getResourceType() == PROJECT) {
        final MutableProjectConfig config = new MutableProjectConfig((Project) resource);
        projectWizard.show(config);
    }
}
Also used : Container(org.eclipse.che.ide.api.resources.Container) MutableProjectConfig(org.eclipse.che.ide.api.project.MutableProjectConfig) Resource(org.eclipse.che.ide.api.resources.Resource)

Example 5 with Resource

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

the class RefreshPathAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    final Resource[] resources = appContext.getResources();
    if (resources == null || resources.length != 1) {
        return;
    }
    final Resource resource = resources[0];
    if (resource instanceof Container) {
        ((Container) resource).synchronize();
    } else {
        final Container parent = resource.getParent();
        if (parent != null) {
            parent.synchronize();
        }
    }
}
Also used : Container(org.eclipse.che.ide.api.resources.Container) Resource(org.eclipse.che.ide.api.resources.Resource)

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