public abstract class DynamicConstraint extends java.lang.Object implements IConstraint
IConstraint
interface.
Framework usage:
In a Library of constraints:
public static DynamicConstraint c1 = new DynamicConstraint(1, "c1", IConstraint.WARNING, "c1 message") {ERROR, INFO, WARNING
Constructor and Description |
---|
DynamicConstraint()
Creates the constraint and add it to the
ConstraintList . |
DynamicConstraint(java.lang.String name,
int severity,
java.lang.String messagePattern)
Creates the constraint and add it to the
ConstraintList . |
Modifier and Type | Method and Description |
---|---|
org.eclipse.core.runtime.IStatus |
check(org.eclipse.emf.common.notify.Notification notification)
Checks the constraints against the
Notification . |
org.eclipse.core.runtime.IStatus |
check(org.eclipse.emf.common.notify.Notification notification,
DiagramStatus.DesignView currentView,
org.polarsys.chess.chessmlprofile.Core.Domain theDomain)
Execute
#checkConstraint(Notification, DesignView) method given the current DiagramStatus.DesignView . |
org.eclipse.core.runtime.IStatus |
check(org.eclipse.emf.common.notify.Notification notification,
org.polarsys.chess.chessmlprofile.Core.Domain theDomain)
Check.
|
abstract boolean |
checkConstraint(org.eclipse.emf.common.notify.Notification notification,
DiagramStatus.DesignView currentView,
org.polarsys.chess.chessmlprofile.Core.Domain currentDomain)
This is the method to implement in order to perform all the checks required by this constraint.
|
java.lang.String |
getMessage()
Gets the message.
|
java.lang.String |
getName()
Gets the name.
|
int |
getSeverity()
Gets the severity.
|
SettableStatus |
getStatus()
Gets the status.
|
void |
setMessage(java.lang.String message)
Sets the message.
|
void |
setName(java.lang.String name)
Sets the name.
|
void |
setSeverity(int severity)
Sets the severity.
|
void |
setStatus(int severity,
java.lang.String messagePattern)
Sets the status (see
IStatus ). |
void |
setStatusMessage(java.lang.String message)
Sets the message.
|
void |
showUserNotification()
Utility method to show to the user the constraint message in case of failure.
|
public DynamicConstraint()
ConstraintList
.public DynamicConstraint(java.lang.String name, int severity, java.lang.String messagePattern)
ConstraintList
.name
- the name of the constraintseverity
- the severity, see IConstraint
constantsmessagePattern
- the message pattern of the constraintpublic java.lang.String getName()
IConstraint
getName
in interface IConstraint
public void setName(java.lang.String name)
IConstraint
setName
in interface IConstraint
name
- the name of the constraintpublic int getSeverity()
IConstraint
getSeverity
in interface IConstraint
IStatus
constants for a list of severitiespublic void setSeverity(int severity)
IConstraint
setSeverity
in interface IConstraint
severity
- the severity level to be setpublic SettableStatus getStatus()
IConstraint
getStatus
in interface IConstraint
IStatus
public void showUserNotification()
IConstraint
showUserNotification
in interface IConstraint
public java.lang.String getMessage()
IConstraint
getMessage
in interface IConstraint
public void setMessage(java.lang.String message)
IConstraint
setMessage
in interface IConstraint
message
- the message of the constraint to be setpublic void setStatusMessage(java.lang.String message)
message
- the new status messagepublic void setStatus(int severity, java.lang.String messagePattern)
IConstraint
IStatus
).setStatus
in interface IConstraint
severity
- the severity of the IStatusmessagePattern
- the message of the IStatuspublic org.eclipse.core.runtime.IStatus check(org.eclipse.emf.common.notify.Notification notification, DiagramStatus.DesignView currentView, org.polarsys.chess.chessmlprofile.Core.Domain theDomain)
#checkConstraint(Notification, DesignView)
method given the current DiagramStatus.DesignView
.notification
- the notificationcurrentView
- the current viewtheDomain
- the the domainpublic org.eclipse.core.runtime.IStatus check(org.eclipse.emf.common.notify.Notification notification, org.polarsys.chess.chessmlprofile.Core.Domain theDomain)
notification
- the notificationtheDomain
- the the domainpublic org.eclipse.core.runtime.IStatus check(org.eclipse.emf.common.notify.Notification notification)
IConstraint
Notification
.check
in interface IConstraint
notification
- the notification to be checked againstIStatus
public abstract boolean checkConstraint(org.eclipse.emf.common.notify.Notification notification, DiagramStatus.DesignView currentView, org.polarsys.chess.chessmlprofile.Core.Domain currentDomain)
notification
- the Notification
this constraint is run againstcurrentView
- the current DiagramStatus.DesignView
currentDomain
- the current domain