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

org.eclipse.core.resources.IResourceChangeEvent Maven / Gradle / Ivy

The newest version!
/*******************************************************************************
 * Copyright (c) 2000, 2009 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.core.resources;

import org.eclipse.core.runtime.IProgressMonitor;

/**
 * Resource change events describe changes to resources.
 * 

* There are currently five different types of resource change events: *

    *
  • * Before-the-fact batch reports of arbitrary creations, * deletions and modifications to one or more resources expressed * as a hierarchical resource delta. Event type is * PRE_BUILD, and getDelta returns * the hierarchical delta rooted at the workspace root. * The getBuildKind method returns * the kind of build that is about to occur, and the getSource * method returns the scope of the build (either the workspace or a single project). * These events are broadcast to interested parties immediately * before each build operation. If autobuilding is not enabled, these events still * occur at times when autobuild would have occurred. The workspace is open * for change during notification of these events. The delta reported in this event * cycle is identical across all listeners registered for this type of event. * Resource changes attempted during a PRE_BUILD callback * must be done in the thread doing the notification. *
  • *
  • * After-the-fact batch reports of arbitrary creations, * deletions and modifications to one or more resources expressed * as a hierarchical resource delta. Event type is * POST_BUILD, and getDelta returns * the hierarchical delta rooted at the workspace root. * The getBuildKind method returns * the kind of build that occurred, and the getSource * method returns the scope of the build (either the workspace or a single project). * These events are broadcast to interested parties at the end of every build operation. * If autobuilding is not enabled, these events still occur at times when autobuild * would have occurred. The workspace is open for change during notification of * these events. The delta reported in this event cycle is identical across * all listeners registered for this type of event. * Resource changes attempted during a POST_BUILD callback * must be done in the thread doing the notification. *
  • *
  • * After-the-fact batch reports of arbitrary creations, * deletions and modifications to one or more resources expressed * as a hierarchical resource delta. Event type is * POST_CHANGE, and getDelta returns * the hierarchical delta. The resource delta is rooted at the * workspace root. These events are broadcast to interested parties after * a set of resource changes and happen whether or not autobuilding is enabled. * The workspace is closed for change during notification of these events. * The delta reported in this event cycle is identical across all listeners registered for * this type of event. *
  • *
  • * Before-the-fact reports of the impending closure of a single * project. Event type is PRE_CLOSE, * and getResource returns the project being closed. * The workspace is closed for change during notification of these events. *
  • *
  • * Before-the-fact reports of the impending deletion of a single * project. Event type is PRE_DELETE, * and getResource returns the project being deleted. * The workspace is closed for change during notification of these events. *
  • *
  • * Before-the-fact reports of the impending refresh of a single project or the workspace. * Event type is PRE_REFRESH and the getSource * method returns the scope of the refresh (either the workspace or a single project). * If the event is fired by a project refresh the getResource * method returns the project being refreshed. * The workspace is closed for changes during notification of these events. *
  • *
*

* In order to handle additional event types that may be introduced * in future releases of the platform, clients should do not write code * that presumes the set of event types is closed. *

* * @noimplement This interface is not intended to be implemented by clients. * @noextend This interface is not intended to be extended by clients. */ public interface IResourceChangeEvent { /** * Event type constant (bit mask) indicating an after-the-fact * report of creations, deletions, and modifications * to one or more resources expressed as a hierarchical * resource delta as returned by getDelta. * See class comments for further details. * * @see #getType() * @see #getDelta() */ public static final int POST_CHANGE = 1; /** * Event type constant (bit mask) indicating a before-the-fact * report of the impending closure of a single * project as returned by getResource. * See class comments for further details. * * @see #getType() * @see #getResource() */ public static final int PRE_CLOSE = 2; /** * Event type constant (bit mask) indicating a before-the-fact * report of the impending deletion of a single * project as returned by getResource. * See class comments for further details. * * @see #getType() * @see #getResource() */ public static final int PRE_DELETE = 4; /** * @deprecated This event type has been renamed to * PRE_BUILD */ public static final int PRE_AUTO_BUILD = 8; /** * Event type constant (bit mask) indicating a before-the-fact * report of a build. The event contains a hierarchical resource delta * as returned by getDelta. * See class comments for further details. * * @see #getBuildKind() * @see #getSource() * @since 3.0 */ public static final int PRE_BUILD = 8; /** * @deprecated This event type has been renamed to * POST_BUILD */ public static final int POST_AUTO_BUILD = 16; /** * Event type constant (bit mask) indicating an after-the-fact * report of a build. The event contains a hierarchical resource delta * as returned by getDelta. * See class comments for further details. * * @see #getBuildKind() * @see #getSource() * @since 3.0 */ public static final int POST_BUILD = 16; /** * Event type constant (bit mask) indicating a before-the-fact * report of refreshing the workspace or a project. * See class comments for further details. * * @see #getType() * @see #getSource() * @see #getResource() * @since 3.4 */ public static final int PRE_REFRESH = 32; /** * Returns all marker deltas of the specified type that are associated * with resource deltas for this event. If includeSubtypes * is false, only marker deltas whose type exactly matches * the given type are returned. Returns an empty array if there * are no matching marker deltas. *

* Calling this method is equivalent to walking the entire resource * delta for this event, and collecting all marker deltas of a given type. * The speed of this method will be proportional to the number of changed * markers, regardless of the size of the resource delta tree. *

* @param type the type of marker to consider, or null to indicate all types * @param includeSubtypes whether or not to consider sub-types of the given type * @return an array of marker deltas * @since 2.0 */ public IMarkerDelta[] findMarkerDeltas(String type, boolean includeSubtypes); /** * Returns the kind of build that caused this event, * or 0 if not applicable to this type of event. *

* If the event is a PRE_BUILD or POST_BUILD * then this will be the kind of build that occurred to cause the event. *

* * @see IProject#build(int, IProgressMonitor) * @see IWorkspace#build(int, IProgressMonitor) * @see IncrementalProjectBuilder#AUTO_BUILD * @see IncrementalProjectBuilder#FULL_BUILD * @see IncrementalProjectBuilder#INCREMENTAL_BUILD * @see IncrementalProjectBuilder#CLEAN_BUILD * @return the kind of build, or 0 if not applicable * @since 3.1 */ public int getBuildKind(); /** * Returns a resource delta, rooted at the workspace, describing the set * of changes that happened to resources in the workspace. * Returns null if not applicable to this type of event. * * @return the resource delta, or null if not * applicable */ public IResourceDelta getDelta(); /** * Returns the resource in question or null * if not applicable to this type of event. *

* If the event is of type PRE_CLOSE, * PRE_DELETE, or PRE_REFRESH, then the resource * will be the affected project. Otherwise the resource will be null. *

* @return the resource, or null if not applicable */ public IResource getResource(); /** * Returns an object identifying the source of this event. *

* If the event is a PRE_BUILD, POST_BUILD, * or PRE_REFRESH then this will be the scope of the build * (either the {@link IWorkspace} or a single {@link IProject}). *

* * @return an object identifying the source of this event * @see java.util.EventObject */ public Object getSource(); /** * Returns the type of event being reported. * * @return one of the event type constants * @see #POST_CHANGE * @see #POST_BUILD * @see #PRE_BUILD * @see #PRE_CLOSE * @see #PRE_DELETE * @see #PRE_REFRESH */ public int getType(); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy