All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.core.internal.localstore.RefreshLocalAliasVisitor Maven / Gradle / Ivy

Go to download

AspectJ tools most notably contains the AspectJ compiler (AJC). AJC applies aspects to Java classes during compilation, fully replacing Javac for plain Java classes and also compiling native AspectJ or annotation-based @AspectJ syntax. Furthermore, AJC can weave aspects into existing class files in a post-compile binary weaving step. This library is a superset of AspectJ weaver and hence also of AspectJ runtime.

There is a newer version: 1.9.22.1
Show newest version
/*******************************************************************************
 * Copyright (c) 2000, 2014 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.core.internal.localstore;

import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.internal.resources.Container;
import org.eclipse.core.internal.resources.Resource;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;

/**
 * Performs a local refresh, and additionally updates all aliases of the
 * refreshed resource.
 */
public class RefreshLocalAliasVisitor extends RefreshLocalVisitor {
	public RefreshLocalAliasVisitor(IProgressMonitor monitor) {
		super(monitor);
	}

	@Override
	protected void createResource(UnifiedTreeNode node, Resource target) throws CoreException {
		super.createResource(node, target);
		IFileStore store = node.getStore();
		if (store == null)
			return;
		IResource[] aliases = workspace.getAliasManager().computeAliases(target, store);
		if (aliases != null)
			for (IResource alias : aliases) {
				if (alias.getProject().isOpen() && !((Resource) alias).isFiltered()) {
					super.createResource(node, (Resource) alias);
				}
			}
	}

	@Override
	protected void deleteResource(UnifiedTreeNode node, Resource target) throws CoreException {
		super.deleteResource(node, target);
		IFileStore store = node.getStore();
		if (store == null)
			return;
		IResource[] aliases = workspace.getAliasManager().computeAliases(target, store);
		if (aliases != null) {
			boolean wasFilteredOut = false;
			if (store.fetchInfo() != null && store.fetchInfo().exists())
				wasFilteredOut = target.isFiltered();
			for (IResource aliase : aliases) {
				if (aliase.getProject().isOpen()) {
					if (wasFilteredOut) {
						if (((Resource) aliase).isFiltered())
							super.deleteResource(node, (Resource) aliase);
					} else
						super.deleteResource(node, (Resource) aliase);
				}
			}
		}
	}

	@Override
	protected void resourceChanged(UnifiedTreeNode node, Resource target) {
		super.resourceChanged(node, target);
		IFileStore store = node.getStore();
		if (store == null)
			return;
		IResource[] aliases = workspace.getAliasManager().computeAliases(target, store);
		if (aliases != null)
			for (IResource aliase : aliases) {
				if (aliase.getProject().isOpen())
					super.resourceChanged(node, (Resource) aliase);
			}
	}

	@Override
	protected void fileToFolder(UnifiedTreeNode node, Resource target) throws CoreException {
		super.fileToFolder(node, target);
		IFileStore store = node.getStore();
		if (store == null)
			return;
		IResource[] aliases = workspace.getAliasManager().computeAliases(target, store);
		if (aliases != null)
			for (IResource aliase : aliases)
				super.fileToFolder(node, (Resource) aliase);
	}

	@Override
	protected void folderToFile(UnifiedTreeNode node, Resource target) throws CoreException {
		super.folderToFile(node, target);
		IFileStore store = node.getStore();
		if (store == null)
			return;
		IResource[] aliases = workspace.getAliasManager().computeAliases(target, store);
		if (aliases != null)
			for (IResource aliase : aliases)
				super.folderToFile(node, (Resource) aliase);
	}

	@Override
	protected void refresh(Container parent) throws CoreException {
		parent.getLocalManager().refresh(parent, IResource.DEPTH_ZERO, true, null);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy