Search in sources :

Example 11 with ResourceDelta

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

the class CopyPasteManager method onResourceChanged.

@Override
public void onResourceChanged(ResourceChangedEvent event) {
    final ResourceDelta delta = event.getDelta();
    //delta should be removed and resources is not null
    if (delta.getKind() != REMOVED || resources == null) {
        return;
    }
    for (int i = 0; i < resources.length; i++) {
        final Resource resource = resources[i];
        if (delta.getResource().getLocation().isPrefixOf(resource.getLocation())) {
            int size = resources.length;
            int numMoved = resources.length - i - 1;
            if (numMoved > 0) {
                System.arraycopy(resources, i + 1, resources, i, numMoved);
            }
            resources = copyOf(resources, --size);
        }
    }
}
Also used : ResourceDelta(org.eclipse.che.ide.api.resources.ResourceDelta) Resource(org.eclipse.che.ide.api.resources.Resource)

Aggregations

ResourceDelta (org.eclipse.che.ide.api.resources.ResourceDelta)11 Resource (org.eclipse.che.ide.api.resources.Resource)7 Path (org.eclipse.che.ide.resource.Path)6 EditorPartPresenter (org.eclipse.che.ide.api.editor.EditorPartPresenter)4 Scheduler (com.google.gwt.core.client.Scheduler)2 Node (org.eclipse.che.ide.api.data.tree.Node)2 ResourceChangedEvent (org.eclipse.che.ide.api.resources.ResourceChangedEvent)2 ResourceNode (org.eclipse.che.ide.resources.tree.ResourceNode)2 Tree (org.eclipse.che.ide.ui.smartTree.Tree)2 Test (org.junit.Test)2 SVGResource (org.vectomatic.dom.svg.ui.SVGResource)2 CssResource (com.google.gwt.resources.client.CssResource)1 ArrayList (java.util.ArrayList)1 OperationException (org.eclipse.che.api.promises.client.OperationException)1 NodeSettings (org.eclipse.che.ide.api.data.tree.settings.NodeSettings)1 FileContentUpdateEvent (org.eclipse.che.ide.api.event.FileContentUpdateEvent)1 Container (org.eclipse.che.ide.api.resources.Container)1 ExternalResourceDelta (org.eclipse.che.ide.api.resources.ExternalResourceDelta)1 Project (org.eclipse.che.ide.api.resources.Project)1 VirtualFile (org.eclipse.che.ide.api.resources.VirtualFile)1