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

org.eclipse.core.internal.localstore.IsSynchronizedVisitor 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, 2011 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
 *     James Blackburn (Broadcom Corp.) - ongoing development
 *******************************************************************************/
package org.eclipse.core.internal.localstore;

import org.eclipse.core.internal.resources.Resource;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;

/**
 * Visits a unified tree, and throws a ResourceChangedException on the first
 * node that is discovered to be out of sync.  The exception that is thrown
 * will not have any meaningful status, message, or stack trace. However it
 * does contain the target resource which can be used to bring the Resource
 * back into sync.
 */
public class IsSynchronizedVisitor extends CollectSyncStatusVisitor {
	static class ResourceChangedException extends RuntimeException {
		private static final long serialVersionUID = 1L;
		public final IResource target;

		public ResourceChangedException(IResource target) {
			this.target = target;
		}
	}

	/**
	 * Creates a new IsSynchronizedVisitor.
	 */
	public IsSynchronizedVisitor(IProgressMonitor monitor) {
		super("", monitor); //$NON-NLS-1$
	}

	/**
	 * @see CollectSyncStatusVisitor#changed(Resource)
	 */
	@Override
	protected void changed(Resource target) {
		throw new ResourceChangedException(target);
	}

	@Override
	protected void fileToFolder(UnifiedTreeNode node, Resource target) {
		changed((Resource) workspace.getRoot().getFolder(target.getFullPath()));
	}

	@Override
	protected void folderToFile(UnifiedTreeNode node, Resource target) {
		// Pass correct gender to changed for notification and async-refresh
		changed((Resource) workspace.getRoot().getFile(target.getFullPath()));
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy