|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.electrocodeogram.cpc.core.api.hub.event.CPCEvent
org.electrocodeogram.cpc.core.api.hub.event.EclipseEvent
org.electrocodeogram.cpc.core.api.hub.event.EclipseFileChangeEvent
public class EclipseFileChangeEvent
This event is generated whenever a file is moved or removed.
Package/folder renames/moves and project renames will also generate corresponding events
of this type for all contained files.
This event is only generated for files which are of interest to CPC
(see: CoreConfigurationUtils.isSupportedFile(String)).
Due to performance considerations this event will not be generated for files which are
only modified. If you require knowledge about simple file content modifications, you
should register your own IResourceChangeListener directly with Eclipse.
Generated by CPCResourceChangeListener and by the IEventHubListener which
consumes EclipseFileChangeEvents and updates the IStoreProvider.
See also: setPostStoreProviderMoveUpdate(boolean).
| Nested Class Summary | |
|---|---|
static class |
EclipseFileChangeEvent.Type
The type of the EclipseFileChangeEvent. |
| Field Summary | |
|---|---|
protected java.lang.String |
newFilePath
|
protected java.lang.String |
newProject
|
protected boolean |
postStoreProviderMoveUpdate
|
protected EclipseFileChangeEvent.Type |
type
|
| Fields inherited from class org.electrocodeogram.cpc.core.api.hub.event.EclipseEvent |
|---|
fileLocatedInWorkspace, fileLocatedInWorkspaceCached, filePath, project, supportedFile, supportedFileCached, user |
| Constructor Summary | |
|---|---|
EclipseFileChangeEvent(java.lang.String user,
java.lang.String project)
Creates a new EclipseFileChangeEvent for the given
user and project. |
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Clones this EclipseFileChangeEvent instance. |
java.lang.String |
getNewFilePath()
Retrieves the new relative path of this file after a move. |
java.lang.String |
getNewProject()
Retrieves the new project name for this file after a move. |
EclipseFileChangeEvent.Type |
getType()
Retrieves the type of this event. |
boolean |
isPostStoreProviderMoveUpdate()
True if this event was generated after the IStoreProvider has been updated to
reflect the new location of the file corresponding to this event. |
boolean |
isValid()
Checks if this event has been fully initialised. |
void |
setNewFilePath(java.lang.String newFilePath)
Sets the new relative path of this file after a move. |
void |
setNewProject(java.lang.String newProject)
Sets the new project name for this file after a move. |
void |
setPostStoreProviderMoveUpdate(boolean postStoreProviderUpdate)
To be used only by the code which updates the IStoreProvider to reflect a file move. |
void |
setType(EclipseFileChangeEvent.Type type)
Sets the type of this event. |
java.lang.String |
toString()
Every event should implement a sensible toString method for use in debugging log messages. |
| Methods inherited from class org.electrocodeogram.cpc.core.api.hub.event.EclipseEvent |
|---|
getFilePath, getProject, getUser, isFileLocatedInWorkspace, isSupportedFile, setFilePath, subToString |
| Methods inherited from class org.electrocodeogram.cpc.core.api.hub.event.CPCEvent |
|---|
checkSeal, compareTo, getCreationTime, seal |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected EclipseFileChangeEvent.Type type
protected java.lang.String newProject
protected java.lang.String newFilePath
protected boolean postStoreProviderMoveUpdate
| Constructor Detail |
|---|
public EclipseFileChangeEvent(java.lang.String user,
java.lang.String project)
EclipseFileChangeEvent for the given
user and project.
user - the current user, never null.project - the project for the file affected by this event, never null.| Method Detail |
|---|
public EclipseFileChangeEvent.Type getType()
public void setType(EclipseFileChangeEvent.Type type)
type - the type of this event, never null.public java.lang.String getNewProject()
EclipseFileChangeEvent.Type.MOVED, never null otherwise.public void setNewProject(java.lang.String newProject)
EclipseFileChangeEvent.Type.MOVED.
Required and non-null otherwise.
newProject - new project name after move, may be NULL.public java.lang.String getNewFilePath()
getNewProject().
EclipseFileChangeEvent.Type.MOVED, never null otherwise.public void setNewFilePath(java.lang.String newFilePath)
EclipseFileChangeEvent.Type.MOVED.
Required and non-null otherwise.
newFilePath - new project relative path after move, may be null.public boolean isPostStoreProviderMoveUpdate()
IStoreProvider has been updated to
reflect the new location of the file corresponding to this event.
NOTE: The CPC Sensor will not generate events with this value set to true.
It is up to the code which processes EclipseFileChangeEvents and updates the
IStoreProvider to create a new event with this value being set to true.
IStoreProvider was already updated or false if this
can not be guaranteed. false is also returned for all other event types besides
EclipseFileChangeEvent.Type.MOVED.public void setPostStoreProviderMoveUpdate(boolean postStoreProviderUpdate)
IStoreProvider to reflect a file move.
Typically an IEventHubListener which consumes EclipseFileChangeEvents.
The code which sets this value to true must be able to guarantee that the new event
will never be dispatched before the original EclipseFileChangeEvent with the value
false was dispatched.
NOTE: The new EclipseFileChangeEvent should be generated by calling
clone() and not by manually copying over all fields.
isPostStoreProviderMoveUpdate(),
clone()
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
EclipseFileChangeEvent instance.
clone in class CPCEventjava.lang.CloneNotSupportedException - never thrownsetPostStoreProviderMoveUpdate(boolean)public boolean isValid()
CPCEventSubclasses should override this method but should never return true. Instead they should delegate to the super class implementation once all validity checks on their level have passed.
The CPCEvent.isValid() implementation always returns true.
isValid in class EclipseEventIEventHubRegistry.dispatch(CPCEvent)public java.lang.String toString()
CPCEvent
toString in class CPCEvent
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||