Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


org.eclipse.emf.transaction.util
Class ValidateEditSupport.Default

java.lang.Object
  extended by 
org.eclipse.emf.transaction.util.ValidateEditSupport.Default
All Implemented Interfaces:
ValidateEditSupport
Direct Known Subclasses:
WorkspaceValidateEditSupport
Enclosing interface:
ValidateEditSupport

public static class ValidateEditSupport.Default
extends Object
implements ValidateEditSupport

A default implementation of the ValidateEditSupport interface, that uses the editing domain's read-only resource map to determine whether a resource can be edited and depends on notifications of the Resource.isModified() property changing to track which resources need to be validated (note that this implies that the resource is tracking modifications). It does not do any user prompting.

In anticipation of rollback, this implementation resets any resources that were modified back to unmodified state (as it only validates those that were previously unmodified).

Since:
1.2

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.emf.transaction.util. ValidateEditSupport
ValidateEditSupport.Default
 
Constructor Summary
ValidateEditSupport.Default ()
          Initializes me.
 
Method Summary
protected   IStatus doValidateEdit ( Transaction transaction, Collection<? extends Resource> resources, Object context)
          Performs the actual edit validation.
 void finalizeForCommit ()
          The default implementation simply forgets the resources to validate.
 void finalizeForRollback ()
          Rolls back the modified state of the resources that were validated to let them once again be un-modified, then forgets them.
protected   Set< Resource> getResourcesToValidate ()
          Obtains the set of resources that we have determined need to be validated for edit, because they have changed from being unmodified to modified.
 void handleResourceChange ( Resource resource, Notification notification)
          Processes a notification from a resource that may either indicate that the resource should be added to the validate list (i.e., its persisted state is changed) or it should be removed from the validate list (e.g., because it has been unloaded).
  IStatus validateEdit ( Transaction transaction, Object context)
          Performs validate-edit for a transaction.
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidateEditSupport.Default

public ValidateEditSupport.Default()
Initializes me.

Method Detail

getResourcesToValidate

protected final 
Set<
Resource> getResourcesToValidate()
Obtains the set of resources that we have determined need to be validated for edit, because they have changed from being unmodified to modified.

Returns:
the resources to validate-edit

validateEdit

public 
IStatus validateEdit(
Transaction transaction,
                            
Object context)
Description copied from interface: ValidateEditSupport
Performs validate-edit for a transaction.

Specified by:
validateEdit in interface ValidateEditSupport
Parameters:
transaction - the root-level transaction that is attempting to commit
context - usually a org.eclipse.swt.widgets.Shell providing a UI context for interaction with the user to make resources modifiable, or null if no such context is available and the system should attempt to automatically validate
Returns:
a status indicating OK if validate-edit succeeded, otherwise some reason why it failed and the transaction should roll back

doValidateEdit

protected 
IStatus doValidateEdit(
Transaction transaction,
                                 
Collection<? extends 
Resource> resources,
                                 
Object context)
Performs the actual edit validation. May be overridden by subclasses to provide a different mechanism.

Parameters:
transaction - the transaction that is attempting to commit
resources - the resources to validate-edit
context - the validate-edit context, or null if none
Returns:
the result of the validate-edit attempt

finalizeForRollback

public void finalizeForRollback()
Rolls back the modified state of the resources that were validated to let them once again be un-modified, then forgets them.

Specified by:
finalizeForRollback in interface ValidateEditSupport

finalizeForCommit

public void finalizeForCommit()
The default implementation simply forgets the resources to validate.

Specified by:
finalizeForCommit in interface ValidateEditSupport

handleResourceChange

public void handleResourceChange(
Resource resource,
                                 
Notification notification)
Description copied from interface: ValidateEditSupport
Processes a notification from a resource that may either indicate that the resource should be added to the validate list (i.e., its persisted state is changed) or it should be removed from the validate list (e.g., because it has been unloaded).

Specified by:
handleResourceChange in interface ValidateEditSupport
Parameters:
resource - a resource to add or remove to/from the validate list
notification - a notification

Copyright 2002, 2007 IBM Corporation and others.
All Rights Reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire