|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.wst.common.componentcore.ArtifactEdit
Provides a Facade pattern for accessing Module Content Metamodels for Web Tools Platform flexible modules.
ArtifactEdit hides the management of accessing edit models (ArtifactEditModel
)
correctly. Each project may have multiple (ArtifactEditModel
)s depending on the number
of modules contained by the project. Clients should use ArtifactEdit or an appropriate subclass
when working with the content models of WTP modules.
Each ArtifactEdit facade is designed to manage the EditModel lifecycle for clients. However,
while each ArtifactEdit is designed to be passed around as needed, clients must enforce the
ArtifactEdit lifecycle. The most common method of acquiring a ArtifactEdit instance facade is to
use #getArtifactEditForRead(WorkbenchComponent)
or
#getArtifactEditForWrite(WorkbenchComponent)
.
When clients have concluded their use of the instance, clients must call dispose()
.
This class is experimental until fully documented.
ModuleCoreNature
,
ArtifactEditModel
Field Summary | |
---|---|
static java.lang.Class |
ADAPTER_TYPE
|
Constructor Summary | |
---|---|
ArtifactEdit(org.eclipse.wst.common.componentcore.internal.ArtifactEditModel anArtifactEditModel)
Creates an instance facade for the given ArtifactEditModel . |
|
ArtifactEdit(ComponentHandle aHandle,
boolean toAccessAsReadOnly)
Creates an instance facade for the given WorkbenchComponent . |
|
ArtifactEdit(ModuleCoreNature aNature,
IVirtualComponent aModule,
boolean toAccessAsReadOnly)
Creates an instance facade for the given WorkbenchComponent . |
Method Summary | |
---|---|
void |
addListener(org.eclipse.wst.common.internal.emfworkbench.integration.EditModelListener listener)
Add a listener to track lifecylce events from the underlying EditModel. |
void |
deleteResource(Resource aResource)
|
void |
dispose()
Clients must call the following method when they have finished using the model, even if the ArtifactEdit instance facade was created as read-only. |
static ArtifactEdit |
getArtifactEditForRead(ComponentHandle aHandle)
Returns an instance facade to manage the underlying edit model for the given WorkbenchComponent . |
static ArtifactEdit |
getArtifactEditForRead(IVirtualComponent aModule)
Returns an instance facade to manage the underlying edit model for the given WorkbenchComponent . |
static ArtifactEdit |
getArtifactEditForWrite(ComponentHandle aHandle)
Returns an instance facade to manage the underlying edit model for the given WorkbenchComponent . |
static ArtifactEdit |
getArtifactEditForWrite(IVirtualComponent aModule)
Returns an instance facade to manage the underlying edit model for the given WorkbenchComponent . |
org.eclipse.emf.common.command.CommandStack |
getCommandStack()
|
ComponentHandle |
getComponentHandle()
|
EObject |
getContentModelRoot()
Returns the root object for read or write access (depending on how the current ArtifactEdit was loaded). |
boolean |
hasEditModel(org.eclipse.wst.common.internal.emfworkbench.integration.EditModel editModel)
This method may be removed soon. |
boolean |
isDirty()
|
boolean |
isReadOnly()
|
static boolean |
isValidEditableModule(IVirtualComponent aModule)
Note: This method is for internal use only. |
void |
removeListener(org.eclipse.wst.common.internal.emfworkbench.integration.EditModelListener listener)
Remove the supplied listener |
void |
save(IProgressMonitor aMonitor)
Force a save of the underlying model. |
void |
saveIfNecessary(IProgressMonitor aMonitor)
Save the underlying model only if no other clients are currently using the model. |
void |
saveIfNecessaryWithPrompt(IProgressMonitor monitor,
org.eclipse.wst.common.frameworks.internal.operations.IOperationHandler operationHandler,
boolean wasDirty)
Save only if necessary. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.Class ADAPTER_TYPE
Constructor Detail |
public ArtifactEdit(org.eclipse.wst.common.componentcore.internal.ArtifactEditModel anArtifactEditModel)
Creates an instance facade for the given ArtifactEditModel
.
anArtifactEditModel
- public ArtifactEdit(ModuleCoreNature aNature, IVirtualComponent aModule, boolean toAccessAsReadOnly)
Creates an instance facade for the given WorkbenchComponent
.
Note: This method is for internal use only. Clients should not call this method.
aNature
- A non-null ModuleCoreNature
for an accessible projectaModule
- A non-null WorkbenchComponent
pointing to a module from the given
ModuleCoreNature
public ArtifactEdit(ComponentHandle aHandle, boolean toAccessAsReadOnly) throws java.lang.IllegalArgumentException
Creates an instance facade for the given WorkbenchComponent
.
Method Detail |
public static ArtifactEdit getArtifactEditForRead(IVirtualComponent aModule)
Returns an instance facade to manage the underlying edit model for the given
WorkbenchComponent
. Instances of ArtifactEdit that are returned through this method
must be dispose()
ed of when no longer in use.
Use to acquire an ArtifactEdit facade for a specific WorkbenchComponent
that
will not be used for editing. Invocations of any save*() API on an instance returned from
this method will throw exceptions.
The following method may return null.
Note: This method is for internal use only. Clients should not call this method.
aModule
- A valid WorkbenchComponent
with a handle that resolves to an
accessible project in the workspace
public static ArtifactEdit getArtifactEditForWrite(IVirtualComponent aModule)
Returns an instance facade to manage the underlying edit model for the given
WorkbenchComponent
. Instances of ArtifactEdit that are returned through this method
must be dispose()
ed of when no longer in use.
Use to acquire an ArtifactEdit facade for a specific WorkbenchComponent
that
will be used for editing.
The following method may return null.
Note: This method is for internal use only. Clients should not call this method.
aModule
- A valid WorkbenchComponent
with a handle that resolves to an
accessible project in the workspace
public static ArtifactEdit getArtifactEditForRead(ComponentHandle aHandle)
Returns an instance facade to manage the underlying edit model for the given
WorkbenchComponent
. Instances of ArtifactEdit that are returned through this method
must be dispose()
ed of when no longer in use.
Use to acquire an ArtifactEdit facade for a specific WorkbenchComponent
that
will not be used for editing. Invocations of any save*() API on an instance returned from
this method will throw exceptions.
The following method may return null.
public static ArtifactEdit getArtifactEditForWrite(ComponentHandle aHandle)
Returns an instance facade to manage the underlying edit model for the given
WorkbenchComponent
. Instances of ArtifactEdit that are returned through this method
must be dispose()
ed of when no longer in use.
Use to acquire an ArtifactEdit facade for a specific WorkbenchComponent
that
will be used for editing.
The following method may return null.
public static boolean isValidEditableModule(IVirtualComponent aModule)
Note: This method is for internal use only. Clients should not call this method.
IEditModelFactory
and is contained by an accessible projectpublic void save(IProgressMonitor aMonitor)
Force a save of the underlying model. The following method should be used with care. Unless
required, use saveIfNecessary(IProgressMonitor)
instead.
save
in interface IEditModelHandler
aMonitor
- A valid progress monitor or null
java.lang.IllegalStateException
- If the ModuleCore object was created as read-onlyorg.eclipse.wst.common.componentcore.IEditModelHandler#save()
public void saveIfNecessary(IProgressMonitor aMonitor)
Save the underlying model only if no other clients are currently using the model. If the model is not shared, it will be saved. If it is shared, the save will be deferred.
saveIfNecessary
in interface IEditModelHandler
aMonitor
- A valid progress monitor or null
java.lang.IllegalStateException
- If the ModuleCore object was created as read-onlyorg.eclipse.wst.common.componentcore.IEditModelHandler#saveIfNecessary()
public void saveIfNecessaryWithPrompt(IProgressMonitor monitor, org.eclipse.wst.common.frameworks.internal.operations.IOperationHandler operationHandler, boolean wasDirty)
public void dispose()
Clients must call the following method when they have finished using the model, even if the ArtifactEdit instance facade was created as read-only.
dispose
in interface IEditModelHandler
IEditModelHandler.dispose()
public EObject getContentModelRoot()
Returns the root object for read or write access (depending on how the current ArtifactEdit was loaded).
public void addListener(org.eclipse.wst.common.internal.emfworkbench.integration.EditModelListener listener)
Add a listener to track lifecylce events from the underlying EditModel.
listener
- A non-null EditModelListenerpublic void removeListener(org.eclipse.wst.common.internal.emfworkbench.integration.EditModelListener listener)
Remove the supplied listener
listener
- A non-null EditModelListenerpublic boolean hasEditModel(org.eclipse.wst.common.internal.emfworkbench.integration.EditModel editModel)
This method may be removed soon. Avoid adding dependencies to it.
This method is considered internal and not published as API.
editModel
-
public ComponentHandle getComponentHandle()
public org.eclipse.emf.common.command.CommandStack getCommandStack()
public void deleteResource(Resource aResource)
public boolean isDirty()
public boolean isReadOnly()
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |