0001: package newprocess.diagram.providers;
0002:
0003: import java.lang.reflect.InvocationTargetException;
0004: import java.util.Map;
0005:
0006: import newprocess.Actor;
0007: import newprocess.AsyncActivity;
0008: import newprocess.Condition;
0009: import newprocess.ConditionProxy;
0010: import newprocess.Event;
0011: import newprocess.Expression;
0012: import newprocess.Listener;
0013: import newprocess.Loader;
0014: import newprocess.Message;
0015: import newprocess.NewprocessPackage;
0016: import newprocess.Process;
0017: import newprocess.SyncActivity;
0018: import newprocess.diagram.edit.parts.ProcessEditPart;
0019: import newprocess.diagram.expressions.New_processAbstractExpression;
0020: import newprocess.diagram.part.New_processDiagramEditorPlugin;
0021: import newprocess.diagram.part.New_processDiagramEditorUtil;
0022: import newprocess.diagram.part.New_processVisualIDRegistry;
0023: import newprocess.impl.ActorImpl;
0024: import newprocess.impl.AsyncActivityImpl;
0025: import newprocess.impl.ConditionImpl;
0026: import newprocess.impl.ConditionProxyImpl;
0027: import newprocess.impl.EventImpl;
0028: import newprocess.impl.ExpressionImpl;
0029: import newprocess.impl.ListenerImpl;
0030: import newprocess.impl.LoaderImpl;
0031: import newprocess.impl.MessageImpl;
0032: import newprocess.impl.ProcessImpl;
0033: import newprocess.impl.SyncActivityImpl;
0034:
0035: import org.eclipse.core.resources.IFile;
0036: import org.eclipse.core.runtime.IProgressMonitor;
0037: import org.eclipse.core.runtime.IStatus;
0038: import org.eclipse.core.runtime.NullProgressMonitor;
0039: import org.eclipse.core.runtime.Status;
0040: import org.eclipse.emf.common.util.Diagnostic;
0041: import org.eclipse.emf.ecore.EObject;
0042: import org.eclipse.emf.ecore.util.Diagnostician;
0043: import org.eclipse.emf.transaction.TransactionalEditingDomain;
0044: import org.eclipse.emf.transaction.util.TransactionUtil;
0045: import org.eclipse.emf.validation.AbstractModelConstraint;
0046: import org.eclipse.emf.validation.IValidationContext;
0047: import org.eclipse.emf.validation.model.EvaluationMode;
0048: import org.eclipse.emf.validation.model.IClientSelector;
0049: import org.eclipse.emf.validation.service.IBatchValidator;
0050: import org.eclipse.emf.validation.service.ModelValidationService;
0051: import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
0052: import org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider;
0053: import org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor;
0054: import org.eclipse.gmf.runtime.diagram.ui.OffscreenEditPartFactory;
0055: import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
0056: import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart;
0057: import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
0058: import org.eclipse.gmf.runtime.notation.View;
0059: import org.eclipse.jface.action.Action;
0060: import org.eclipse.jface.action.IAction;
0061: import org.eclipse.jface.operation.IRunnableWithProgress;
0062: import org.eclipse.ui.IEditorPart;
0063: import org.eclipse.ui.IWorkbenchPart;
0064: import org.eclipse.ui.PlatformUI;
0065: import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
0066:
0067: /**
0068: * @generated
0069: */
0070: public class New_processValidationProvider extends
0071: AbstractContributionItemProvider {
0072: /**
0073: * @generated
0074: */
0075: private static boolean constraintsActive = false;
0076:
0077: /**
0078: * @generated
0079: */
0080: public static boolean shouldConstraintsBePrivate() {
0081: return false;
0082: }
0083:
0084: /**
0085: * @generated
0086: */
0087: protected IAction createAction(String actionId,
0088: IWorkbenchPartDescriptor partDescriptor) {
0089: if (ValidateAction.VALIDATE_ACTION_KEY.equals(actionId)) {
0090: return new ValidateAction(partDescriptor);
0091: }
0092: return super .createAction(actionId, partDescriptor);
0093: }
0094:
0095: /**
0096: * @generated
0097: */
0098: public static class ValidateAction extends Action {
0099: /**
0100: * @generated
0101: */
0102: public static final String VALIDATE_ACTION_KEY = "validateAction"; //$NON-NLS-1$
0103: /**
0104: * @generated
0105: */
0106: private IWorkbenchPartDescriptor workbenchPartDescriptor;
0107:
0108: /**
0109: * @generated
0110: */
0111: public ValidateAction(
0112: IWorkbenchPartDescriptor workbenchPartDescriptor) {
0113: setId(VALIDATE_ACTION_KEY);
0114: setText("Validate");
0115: this .workbenchPartDescriptor = workbenchPartDescriptor;
0116: }
0117:
0118: /**
0119: * @generated
0120: */
0121: public void run() {
0122: IWorkbenchPart workbenchPart = workbenchPartDescriptor
0123: .getPartPage().getActivePart();
0124: if (workbenchPart instanceof IDiagramWorkbenchPart) {
0125: final IDiagramWorkbenchPart part = (IDiagramWorkbenchPart) workbenchPart;
0126: try {
0127: new WorkspaceModifyDelegatingOperation(
0128: new IRunnableWithProgress() {
0129: public void run(IProgressMonitor monitor)
0130: throws InterruptedException,
0131: InvocationTargetException {
0132: runValidation(part
0133: .getDiagramEditPart(), part
0134: .getDiagram());
0135: }
0136: }).run(new NullProgressMonitor());
0137: } catch (Exception e) {
0138: New_processDiagramEditorPlugin.getInstance()
0139: .logError("Validation action failed", e); //$NON-NLS-1$
0140: }
0141: }
0142: }
0143:
0144: /**
0145: * @generated
0146: */
0147: public static void runValidation(View view) {
0148: try {
0149: if (New_processDiagramEditorUtil.openDiagram(view
0150: .eResource())) {
0151: IEditorPart editorPart = PlatformUI.getWorkbench()
0152: .getActiveWorkbenchWindow().getActivePage()
0153: .getActiveEditor();
0154: if (editorPart instanceof IDiagramWorkbenchPart) {
0155: runValidation(
0156: ((IDiagramWorkbenchPart) editorPart)
0157: .getDiagramEditPart(), view);
0158: } else {
0159: runNonUIValidation(view);
0160: }
0161: }
0162: } catch (Exception e) {
0163: New_processDiagramEditorPlugin.getInstance().logError(
0164: "Validation action failed", e); //$NON-NLS-1$
0165: }
0166: }
0167:
0168: /**
0169: * @generated
0170: */
0171: public static void runNonUIValidation(View view) {
0172: DiagramEditPart diagramEditPart = OffscreenEditPartFactory
0173: .getInstance().createDiagramEditPart(
0174: view.getDiagram());
0175: runValidation(diagramEditPart, view);
0176: }
0177:
0178: /**
0179: * @generated
0180: */
0181: public static void runValidation(
0182: DiagramEditPart diagramEditPart, View view) {
0183: final View target = view;
0184: final DiagramEditPart diagramPart = diagramEditPart;
0185: Runnable task = new Runnable() {
0186: public void run() {
0187: try {
0188: constraintsActive = true;
0189: validate(diagramPart, target);
0190: } finally {
0191: constraintsActive = false;
0192: }
0193: }
0194: };
0195: TransactionalEditingDomain txDomain = TransactionUtil
0196: .getEditingDomain(target);
0197: if (txDomain != null) {
0198: try {
0199: txDomain.runExclusive(task);
0200: } catch (Exception e) {
0201: New_processDiagramEditorPlugin.getInstance()
0202: .logError("Validation action failed", e); //$NON-NLS-1$
0203: }
0204: } else {
0205: task.run();
0206: }
0207: }
0208:
0209: /**
0210: * @generated
0211: */
0212: private static Diagnostic runEMFValidator(View target) {
0213: if (target.isSetElement() && target.getElement() != null) {
0214: return new Diagnostician() {
0215: public String getObjectLabel(EObject eObject) {
0216: return EMFCoreUtil.getQualifiedName(eObject,
0217: true);
0218: }
0219: }.validate(target.getElement());
0220: }
0221: return Diagnostic.OK_INSTANCE;
0222: }
0223:
0224: /**
0225: * @generated
0226: */
0227: private static void validate(DiagramEditPart diagramEditPart,
0228: View target) {
0229: IFile diagramFile = (target.eResource() != null) ? WorkspaceSynchronizer
0230: .getFile(target.eResource())
0231: : null;
0232: if (diagramFile != null) {
0233: New_processMarkerNavigationProvider
0234: .deleteMarkers(diagramFile);
0235: }
0236:
0237: Diagnostic diagnostic = runEMFValidator(target);
0238: if (diagramFile != null) {
0239: New_processMarkerNavigationProvider.createMarkers(
0240: diagramFile, diagnostic, diagramEditPart);
0241: }
0242:
0243: IBatchValidator validator = (IBatchValidator) ModelValidationService
0244: .getInstance().newValidator(EvaluationMode.BATCH);
0245: validator.setIncludeLiveConstraints(true);
0246: IStatus status = Status.OK_STATUS;
0247: if (target.isSetElement() && target.getElement() != null) {
0248: status = validator.validate(target.getElement());
0249: if (diagramFile != null) {
0250: New_processMarkerNavigationProvider.createMarkers(
0251: diagramFile, status, diagramEditPart);
0252: }
0253: }
0254:
0255: }
0256: }
0257:
0258: /**
0259: * @generated
0260: */
0261: static boolean isInDefaultEditorContext(Object object) {
0262: if (shouldConstraintsBePrivate() && !constraintsActive) {
0263: return false;
0264: }
0265: if (object instanceof View) {
0266: return constraintsActive
0267: && ProcessEditPart.MODEL_ID
0268: .equals(New_processVisualIDRegistry
0269: .getModelID((View) object));
0270: }
0271: return true;
0272: }
0273:
0274: /**
0275: * @generated
0276: */
0277: public static class DefaultCtx implements IClientSelector {
0278: /**
0279: * @generated
0280: */
0281: public boolean selects(Object object) {
0282: return isInDefaultEditorContext(object);
0283: }
0284: }
0285:
0286: /**
0287: * @generated
0288: */
0289: public static class Adapter11 extends AbstractModelConstraint {
0290: /**
0291: * @generated
0292: */
0293: private New_processAbstractExpression expression;
0294:
0295: /**
0296: * @generated
0297: */
0298: public Adapter11() {
0299: expression = new New_processAbstractExpression(
0300: NewprocessPackage.eINSTANCE.getProcess()) {
0301: protected Object doEvaluate(Object context, Map env) {
0302: Process self = (Process) context;
0303: return JavaAudits.processNameValidation(self);
0304: }
0305: };
0306: }
0307:
0308: /**
0309: * @generated
0310: */
0311: public IStatus validate(IValidationContext ctx) {
0312: Object evalCtx = ctx.getTarget();
0313: Object result = expression.evaluate(evalCtx);
0314: if (result instanceof Boolean
0315: && ((Boolean) result).booleanValue()) {
0316: return Status.OK_STATUS;
0317: }
0318: return ctx.createFailureStatus(new Object[] { EMFCoreUtil
0319: .getQualifiedName(ctx.getTarget(), true) });
0320: }
0321: }
0322:
0323: /**
0324: * @generated
0325: */
0326: public static class Adapter12 extends AbstractModelConstraint {
0327: /**
0328: * @generated
0329: */
0330: private New_processAbstractExpression expression;
0331:
0332: /**
0333: * @generated
0334: */
0335: public Adapter12() {
0336: expression = new New_processAbstractExpression(
0337: NewprocessPackage.eINSTANCE.getProcess()) {
0338: protected Object doEvaluate(Object context, Map env) {
0339: Process self = (Process) context;
0340: return JavaAudits
0341: .processImplementationValidation(self);
0342: }
0343: };
0344: }
0345:
0346: /**
0347: * @generated
0348: */
0349: public IStatus validate(IValidationContext ctx) {
0350: Object evalCtx = ctx.getTarget();
0351: Object result = expression.evaluate(evalCtx);
0352: if (result instanceof Boolean
0353: && ((Boolean) result).booleanValue()) {
0354: return Status.OK_STATUS;
0355: }
0356: return ctx.createFailureStatus(new Object[] { EMFCoreUtil
0357: .getQualifiedName(ctx.getTarget(), true) });
0358: }
0359: }
0360:
0361: /**
0362: * @generated
0363: */
0364: public static class Adapter13 extends AbstractModelConstraint {
0365: /**
0366: * @generated
0367: */
0368: private New_processAbstractExpression expression;
0369:
0370: /**
0371: * @generated
0372: */
0373: public Adapter13() {
0374: expression = new New_processAbstractExpression(
0375: NewprocessPackage.eINSTANCE.getProcess()) {
0376: protected Object doEvaluate(Object context, Map env) {
0377: Process self = (Process) context;
0378: return JavaAudits.processSubjectValidation(self);
0379: }
0380: };
0381: }
0382:
0383: /**
0384: * @generated
0385: */
0386: public IStatus validate(IValidationContext ctx) {
0387: Object evalCtx = ctx.getTarget();
0388: Object result = expression.evaluate(evalCtx);
0389: if (result instanceof Boolean
0390: && ((Boolean) result).booleanValue()) {
0391: return Status.OK_STATUS;
0392: }
0393: return ctx.createFailureStatus(new Object[] { EMFCoreUtil
0394: .getQualifiedName(ctx.getTarget(), true) });
0395: }
0396: }
0397:
0398: /**
0399: * @generated
0400: */
0401: public static class Adapter14 extends AbstractModelConstraint {
0402: /**
0403: * @generated
0404: */
0405: private New_processAbstractExpression expression;
0406:
0407: /**
0408: * @generated
0409: */
0410: public Adapter14() {
0411: expression = new New_processAbstractExpression(
0412: NewprocessPackage.eINSTANCE.getProcess()) {
0413: protected Object doEvaluate(Object context, Map env) {
0414: Process self = (Process) context;
0415: return JavaAudits.processNamespaceValidation(self);
0416: }
0417: };
0418: }
0419:
0420: /**
0421: * @generated
0422: */
0423: public IStatus validate(IValidationContext ctx) {
0424: Object evalCtx = ctx.getTarget();
0425: Object result = expression.evaluate(evalCtx);
0426: if (result instanceof Boolean
0427: && ((Boolean) result).booleanValue()) {
0428: return Status.OK_STATUS;
0429: }
0430: return ctx.createFailureStatus(new Object[] { EMFCoreUtil
0431: .getQualifiedName(ctx.getTarget(), true) });
0432: }
0433: }
0434:
0435: /**
0436: * @generated
0437: */
0438: public static class Adapter21 extends AbstractModelConstraint {
0439: /**
0440: * @generated
0441: */
0442: private New_processAbstractExpression expression;
0443:
0444: /**
0445: * @generated
0446: */
0447: public Adapter21() {
0448: expression = new New_processAbstractExpression(
0449: NewprocessPackage.eINSTANCE.getActor()) {
0450: protected Object doEvaluate(Object context, Map env) {
0451: Actor self = (Actor) context;
0452: return JavaAudits.processActorNameValidation(self);
0453: }
0454: };
0455: }
0456:
0457: /**
0458: * @generated
0459: */
0460: public IStatus validate(IValidationContext ctx) {
0461: Object evalCtx = ctx.getTarget();
0462: Object result = expression.evaluate(evalCtx);
0463: if (result instanceof Boolean
0464: && ((Boolean) result).booleanValue()) {
0465: return Status.OK_STATUS;
0466: }
0467: return ctx.createFailureStatus(new Object[] { EMFCoreUtil
0468: .getQualifiedName(ctx.getTarget(), true) });
0469: }
0470: }
0471:
0472: /**
0473: * @generated
0474: */
0475: public static class Adapter22 extends AbstractModelConstraint {
0476: /**
0477: * @generated
0478: */
0479: private New_processAbstractExpression expression;
0480:
0481: /**
0482: * @generated
0483: */
0484: public Adapter22() {
0485: expression = new New_processAbstractExpression(
0486: NewprocessPackage.eINSTANCE.getActor()) {
0487: protected Object doEvaluate(Object context, Map env) {
0488: Actor self = (Actor) context;
0489: return JavaAudits
0490: .processActorImplementationValidation(self);
0491: }
0492: };
0493: }
0494:
0495: /**
0496: * @generated
0497: */
0498: public IStatus validate(IValidationContext ctx) {
0499: Object evalCtx = ctx.getTarget();
0500: Object result = expression.evaluate(evalCtx);
0501: if (result instanceof Boolean
0502: && ((Boolean) result).booleanValue()) {
0503: return Status.OK_STATUS;
0504: }
0505: return ctx.createFailureStatus(new Object[] { EMFCoreUtil
0506: .getQualifiedName(ctx.getTarget(), true) });
0507: }
0508: }
0509:
0510: /**
0511: * @generated
0512: */
0513: public static class Adapter31 extends AbstractModelConstraint {
0514: /**
0515: * @generated
0516: */
0517: private New_processAbstractExpression expression;
0518:
0519: /**
0520: * @generated
0521: */
0522: public Adapter31() {
0523: expression = new New_processAbstractExpression(
0524: NewprocessPackage.eINSTANCE.getMessage()) {
0525: protected Object doEvaluate(Object context, Map env) {
0526: Message self = (Message) context;
0527: return JavaAudits
0528: .processMessageNameValidation(self);
0529: }
0530: };
0531: }
0532:
0533: /**
0534: * @generated
0535: */
0536: public IStatus validate(IValidationContext ctx) {
0537: Object evalCtx = ctx.getTarget();
0538: Object result = expression.evaluate(evalCtx);
0539: if (result instanceof Boolean
0540: && ((Boolean) result).booleanValue()) {
0541: return Status.OK_STATUS;
0542: }
0543: return ctx.createFailureStatus(new Object[] { EMFCoreUtil
0544: .getQualifiedName(ctx.getTarget(), true) });
0545: }
0546: }
0547:
0548: /**
0549: * @generated
0550: */
0551: public static class Adapter41 extends AbstractModelConstraint {
0552: /**
0553: * @generated
0554: */
0555: private New_processAbstractExpression expression;
0556:
0557: /**
0558: * @generated
0559: */
0560: public Adapter41() {
0561: expression = new New_processAbstractExpression(
0562: NewprocessPackage.eINSTANCE.getExpression()) {
0563: protected Object doEvaluate(Object context, Map env) {
0564: Expression self = (Expression) context;
0565: return JavaAudits
0566: .expressionExpressionValidation(self);
0567: }
0568: };
0569: }
0570:
0571: /**
0572: * @generated
0573: */
0574: public IStatus validate(IValidationContext ctx) {
0575: Object evalCtx = ctx.getTarget();
0576: Object result = expression.evaluate(evalCtx);
0577: if (result instanceof Boolean
0578: && ((Boolean) result).booleanValue()) {
0579: return Status.OK_STATUS;
0580: }
0581: return ctx.createFailureStatus(new Object[] { EMFCoreUtil
0582: .getQualifiedName(ctx.getTarget(), true) });
0583: }
0584: }
0585:
0586: /**
0587: * @generated
0588: */
0589: public static class Adapter51 extends AbstractModelConstraint {
0590: /**
0591: * @generated
0592: */
0593: private New_processAbstractExpression expression;
0594:
0595: /**
0596: * @generated
0597: */
0598: public Adapter51() {
0599: expression = new New_processAbstractExpression(
0600: NewprocessPackage.eINSTANCE.getSyncActivity()) {
0601: protected Object doEvaluate(Object context, Map env) {
0602: SyncActivity self = (SyncActivity) context;
0603: return JavaAudits.syncActivityNameValidation(self);
0604: }
0605: };
0606: }
0607:
0608: /**
0609: * @generated
0610: */
0611: public IStatus validate(IValidationContext ctx) {
0612: Object evalCtx = ctx.getTarget();
0613: Object result = expression.evaluate(evalCtx);
0614: if (result instanceof Boolean
0615: && ((Boolean) result).booleanValue()) {
0616: return Status.OK_STATUS;
0617: }
0618: return ctx.createFailureStatus(new Object[] { EMFCoreUtil
0619: .getQualifiedName(ctx.getTarget(), true) });
0620: }
0621: }
0622:
0623: /**
0624: * @generated
0625: */
0626: public static class Adapter52 extends AbstractModelConstraint {
0627: /**
0628: * @generated
0629: */
0630: private New_processAbstractExpression expression;
0631:
0632: /**
0633: * @generated
0634: */
0635: public Adapter52() {
0636: expression = new New_processAbstractExpression(
0637: NewprocessPackage.eINSTANCE.getSyncActivity()) {
0638: protected Object doEvaluate(Object context, Map env) {
0639: SyncActivity self = (SyncActivity) context;
0640: return JavaAudits
0641: .syncActivityImplementationValidation(self);
0642: }
0643: };
0644: }
0645:
0646: /**
0647: * @generated
0648: */
0649: public IStatus validate(IValidationContext ctx) {
0650: Object evalCtx = ctx.getTarget();
0651: Object result = expression.evaluate(evalCtx);
0652: if (result instanceof Boolean
0653: && ((Boolean) result).booleanValue()) {
0654: return Status.OK_STATUS;
0655: }
0656: return ctx.createFailureStatus(new Object[] { EMFCoreUtil
0657: .getQualifiedName(ctx.getTarget(), true) });
0658: }
0659: }
0660:
0661: /**
0662: * @generated
0663: */
0664: public static class Adapter61 extends AbstractModelConstraint {
0665: /**
0666: * @generated
0667: */
0668: private New_processAbstractExpression expression;
0669:
0670: /**
0671: * @generated
0672: */
0673: public Adapter61() {
0674: expression = new New_processAbstractExpression(
0675: NewprocessPackage.eINSTANCE.getAsyncActivity()) {
0676: protected Object doEvaluate(Object context, Map env) {
0677: AsyncActivity self = (AsyncActivity) context;
0678: return JavaAudits.asyncActivityNameValidation(self);
0679: }
0680: };
0681: }
0682:
0683: /**
0684: * @generated
0685: */
0686: public IStatus validate(IValidationContext ctx) {
0687: Object evalCtx = ctx.getTarget();
0688: Object result = expression.evaluate(evalCtx);
0689: if (result instanceof Boolean
0690: && ((Boolean) result).booleanValue()) {
0691: return Status.OK_STATUS;
0692: }
0693: return ctx.createFailureStatus(new Object[] { EMFCoreUtil
0694: .getQualifiedName(ctx.getTarget(), true) });
0695: }
0696: }
0697:
0698: /**
0699: * @generated
0700: */
0701: public static class Adapter62 extends AbstractModelConstraint {
0702: /**
0703: * @generated
0704: */
0705: private New_processAbstractExpression expression;
0706:
0707: /**
0708: * @generated
0709: */
0710: public Adapter62() {
0711: expression = new New_processAbstractExpression(
0712: NewprocessPackage.eINSTANCE.getAsyncActivity()) {
0713: protected Object doEvaluate(Object context, Map env) {
0714: AsyncActivity self = (AsyncActivity) context;
0715: return JavaAudits
0716: .asyncActivityImplementationValidation(self);
0717: }
0718: };
0719: }
0720:
0721: /**
0722: * @generated
0723: */
0724: public IStatus validate(IValidationContext ctx) {
0725: Object evalCtx = ctx.getTarget();
0726: Object result = expression.evaluate(evalCtx);
0727: if (result instanceof Boolean
0728: && ((Boolean) result).booleanValue()) {
0729: return Status.OK_STATUS;
0730: }
0731: return ctx.createFailureStatus(new Object[] { EMFCoreUtil
0732: .getQualifiedName(ctx.getTarget(), true) });
0733: }
0734: }
0735:
0736: /**
0737: * @generated
0738: */
0739: public static class Adapter71 extends AbstractModelConstraint {
0740: /**
0741: * @generated
0742: */
0743: private New_processAbstractExpression expression;
0744:
0745: /**
0746: * @generated
0747: */
0748: public Adapter71() {
0749: expression = new New_processAbstractExpression(
0750: NewprocessPackage.eINSTANCE.getEvent()) {
0751: protected Object doEvaluate(Object context, Map env) {
0752: Event self = (Event) context;
0753: return JavaAudits.eventNameValidation(self);
0754: }
0755: };
0756: }
0757:
0758: /**
0759: * @generated
0760: */
0761: public IStatus validate(IValidationContext ctx) {
0762: Object evalCtx = ctx.getTarget();
0763: Object result = expression.evaluate(evalCtx);
0764: if (result instanceof Boolean
0765: && ((Boolean) result).booleanValue()) {
0766: return Status.OK_STATUS;
0767: }
0768: return ctx.createFailureStatus(new Object[] { EMFCoreUtil
0769: .getQualifiedName(ctx.getTarget(), true) });
0770: }
0771: }
0772:
0773: /**
0774: * @generated
0775: */
0776: public static class Adapter72 extends AbstractModelConstraint {
0777: /**
0778: * @generated
0779: */
0780: private New_processAbstractExpression expression;
0781:
0782: /**
0783: * @generated
0784: */
0785: public Adapter72() {
0786: expression = new New_processAbstractExpression(
0787: NewprocessPackage.eINSTANCE.getEvent()) {
0788: protected Object doEvaluate(Object context, Map env) {
0789: Event self = (Event) context;
0790: return JavaAudits
0791: .eventImplementationValidation(self);
0792: }
0793: };
0794: }
0795:
0796: /**
0797: * @generated
0798: */
0799: public IStatus validate(IValidationContext ctx) {
0800: Object evalCtx = ctx.getTarget();
0801: Object result = expression.evaluate(evalCtx);
0802: if (result instanceof Boolean
0803: && ((Boolean) result).booleanValue()) {
0804: return Status.OK_STATUS;
0805: }
0806: return ctx.createFailureStatus(new Object[] { EMFCoreUtil
0807: .getQualifiedName(ctx.getTarget(), true) });
0808: }
0809: }
0810:
0811: /**
0812: * @generated
0813: */
0814: public static class Adapter81 extends AbstractModelConstraint {
0815: /**
0816: * @generated
0817: */
0818: private New_processAbstractExpression expression;
0819:
0820: /**
0821: * @generated
0822: */
0823: public Adapter81() {
0824: expression = new New_processAbstractExpression(
0825: NewprocessPackage.eINSTANCE.getListener()) {
0826: protected Object doEvaluate(Object context, Map env) {
0827: Listener self = (Listener) context;
0828: return JavaAudits.listenerNameValidation(self);
0829: }
0830: };
0831: }
0832:
0833: /**
0834: * @generated
0835: */
0836: public IStatus validate(IValidationContext ctx) {
0837: Object evalCtx = ctx.getTarget();
0838: Object result = expression.evaluate(evalCtx);
0839: if (result instanceof Boolean
0840: && ((Boolean) result).booleanValue()) {
0841: return Status.OK_STATUS;
0842: }
0843: return ctx.createFailureStatus(new Object[] { EMFCoreUtil
0844: .getQualifiedName(ctx.getTarget(), true) });
0845: }
0846: }
0847:
0848: /**
0849: * @generated
0850: */
0851: public static class Adapter82 extends AbstractModelConstraint {
0852: /**
0853: * @generated
0854: */
0855: private New_processAbstractExpression expression;
0856:
0857: /**
0858: * @generated
0859: */
0860: public Adapter82() {
0861: expression = new New_processAbstractExpression(
0862: NewprocessPackage.eINSTANCE.getListener()) {
0863: protected Object doEvaluate(Object context, Map env) {
0864: Listener self = (Listener) context;
0865: return JavaAudits
0866: .listenerImplementationValidation(self);
0867: }
0868: };
0869: }
0870:
0871: /**
0872: * @generated
0873: */
0874: public IStatus validate(IValidationContext ctx) {
0875: Object evalCtx = ctx.getTarget();
0876: Object result = expression.evaluate(evalCtx);
0877: if (result instanceof Boolean
0878: && ((Boolean) result).booleanValue()) {
0879: return Status.OK_STATUS;
0880: }
0881: return ctx.createFailureStatus(new Object[] { EMFCoreUtil
0882: .getQualifiedName(ctx.getTarget(), true) });
0883: }
0884: }
0885:
0886: /**
0887: * @generated
0888: */
0889: public static class Adapter91 extends AbstractModelConstraint {
0890: /**
0891: * @generated
0892: */
0893: private New_processAbstractExpression expression;
0894:
0895: /**
0896: * @generated
0897: */
0898: public Adapter91() {
0899: expression = new New_processAbstractExpression(
0900: NewprocessPackage.eINSTANCE.getConditionProxy()) {
0901: protected Object doEvaluate(Object context, Map env) {
0902: ConditionProxy self = (ConditionProxy) context;
0903: return JavaAudits.proxyConditionValidation(self);
0904: }
0905: };
0906: }
0907:
0908: /**
0909: * @generated
0910: */
0911: public IStatus validate(IValidationContext ctx) {
0912: Object evalCtx = ctx.getTarget();
0913: Object result = expression.evaluate(evalCtx);
0914: if (result instanceof Boolean
0915: && ((Boolean) result).booleanValue()) {
0916: return Status.OK_STATUS;
0917: }
0918: return ctx.createFailureStatus(new Object[] { EMFCoreUtil
0919: .getQualifiedName(ctx.getTarget(), true) });
0920: }
0921: }
0922:
0923: /**
0924: * @generated
0925: */
0926: public static class Adapter101 extends AbstractModelConstraint {
0927: /**
0928: * @generated
0929: */
0930: private New_processAbstractExpression expression;
0931:
0932: /**
0933: * @generated
0934: */
0935: public Adapter101() {
0936: expression = new New_processAbstractExpression(
0937: NewprocessPackage.eINSTANCE.getLoader()) {
0938: protected Object doEvaluate(Object context, Map env) {
0939: Loader self = (Loader) context;
0940: return JavaAudits.loaderNameValidation(self);
0941: }
0942: };
0943: }
0944:
0945: /**
0946: * @generated
0947: */
0948: public IStatus validate(IValidationContext ctx) {
0949: Object evalCtx = ctx.getTarget();
0950: Object result = expression.evaluate(evalCtx);
0951: if (result instanceof Boolean
0952: && ((Boolean) result).booleanValue()) {
0953: return Status.OK_STATUS;
0954: }
0955: return ctx.createFailureStatus(new Object[] { EMFCoreUtil
0956: .getQualifiedName(ctx.getTarget(), true) });
0957: }
0958: }
0959:
0960: /**
0961: * @generated
0962: */
0963: public static class Adapter102 extends AbstractModelConstraint {
0964: /**
0965: * @generated
0966: */
0967: private New_processAbstractExpression expression;
0968:
0969: /**
0970: * @generated
0971: */
0972: public Adapter102() {
0973: expression = new New_processAbstractExpression(
0974: NewprocessPackage.eINSTANCE.getLoader()) {
0975: protected Object doEvaluate(Object context, Map env) {
0976: Loader self = (Loader) context;
0977: return JavaAudits
0978: .loaderImplementationValidation(self);
0979: }
0980: };
0981: }
0982:
0983: /**
0984: * @generated
0985: */
0986: public IStatus validate(IValidationContext ctx) {
0987: Object evalCtx = ctx.getTarget();
0988: Object result = expression.evaluate(evalCtx);
0989: if (result instanceof Boolean
0990: && ((Boolean) result).booleanValue()) {
0991: return Status.OK_STATUS;
0992: }
0993: return ctx.createFailureStatus(new Object[] { EMFCoreUtil
0994: .getQualifiedName(ctx.getTarget(), true) });
0995: }
0996: }
0997:
0998: /**
0999: * @generated
1000: */
1001: public static class Adapter111 extends AbstractModelConstraint {
1002: /**
1003: * @generated
1004: */
1005: private New_processAbstractExpression expression;
1006:
1007: /**
1008: * @generated
1009: */
1010: public Adapter111() {
1011: expression = new New_processAbstractExpression(
1012: NewprocessPackage.eINSTANCE.getCondition()) {
1013: protected Object doEvaluate(Object context, Map env) {
1014: Condition self = (Condition) context;
1015: return JavaAudits.conditionNameValidation(self);
1016: }
1017: };
1018: }
1019:
1020: /**
1021: * @generated
1022: */
1023: public IStatus validate(IValidationContext ctx) {
1024: Object evalCtx = ctx.getTarget();
1025: Object result = expression.evaluate(evalCtx);
1026: if (result instanceof Boolean
1027: && ((Boolean) result).booleanValue()) {
1028: return Status.OK_STATUS;
1029: }
1030: return ctx.createFailureStatus(new Object[] { EMFCoreUtil
1031: .getQualifiedName(ctx.getTarget(), true) });
1032: }
1033: }
1034:
1035: /**
1036: * @generated
1037: */
1038: public static class Adapter112 extends AbstractModelConstraint {
1039: /**
1040: * @generated
1041: */
1042: private New_processAbstractExpression expression;
1043:
1044: /**
1045: * @generated
1046: */
1047: public Adapter112() {
1048: expression = new New_processAbstractExpression(
1049: NewprocessPackage.eINSTANCE.getCondition()) {
1050: protected Object doEvaluate(Object context, Map env) {
1051: Condition self = (Condition) context;
1052: return JavaAudits
1053: .conditionImplementationValidation(self);
1054: }
1055: };
1056: }
1057:
1058: /**
1059: * @generated
1060: */
1061: public IStatus validate(IValidationContext ctx) {
1062: Object evalCtx = ctx.getTarget();
1063: Object result = expression.evaluate(evalCtx);
1064: if (result instanceof Boolean
1065: && ((Boolean) result).booleanValue()) {
1066: return Status.OK_STATUS;
1067: }
1068: return ctx.createFailureStatus(new Object[] { EMFCoreUtil
1069: .getQualifiedName(ctx.getTarget(), true) });
1070: }
1071: }
1072:
1073: /**
1074: * @generated
1075: */
1076: static class JavaAudits {
1077:
1078: /**
1079: * @generated NOT
1080: * @author sh
1081: */
1082: private static Boolean processNamespaceValidation(Process self) {
1083: return ((ProcessImpl) self).validateNamespace(self);
1084: }
1085:
1086: /**
1087: * @generated NOT
1088: * @author sh
1089: */
1090: private static Boolean processNameValidation(Process self) {
1091: return ((ProcessImpl) self).validateName(self);
1092: }
1093:
1094: /**
1095: * @generated NOT
1096: * @author sh
1097: */
1098: private static Boolean processImplementationValidation(
1099: Process self) {
1100: return ((ProcessImpl) self).validateImplementation(self);
1101: }
1102:
1103: /**
1104: * @generated NOT
1105: * @author sh
1106: */
1107: private static Boolean processSubjectValidation(Process self) {
1108: return ((ProcessImpl) self).validateSubject(self);
1109: }
1110:
1111: /**
1112: * @generated NOT
1113: * @author sh
1114: */
1115: private static Boolean processActorNameValidation(Actor self) {
1116: return ((ActorImpl) self).validateName(self);
1117: }
1118:
1119: /**
1120: * @generated NOT
1121: * @author sh
1122: */
1123: private static Boolean processActorImplementationValidation(
1124: Actor self) {
1125: return ((ActorImpl) self).validateImplementation(self);
1126: }
1127:
1128: /**
1129: * @generated NOT
1130: * @author sh
1131: */
1132: private static Boolean processMessageNameValidation(Message self) {
1133: return ((MessageImpl) self).validateName(self);
1134: }
1135:
1136: /**
1137: * @generated NOT
1138: * @author sh
1139: */
1140: private static Boolean expressionExpressionValidation(
1141: Expression self) {
1142: return ((ExpressionImpl) self).validateExpression(self);
1143: }
1144:
1145: /**
1146: * @generated NOT
1147: * @author sh
1148: */
1149: private static Boolean syncActivityNameValidation(
1150: SyncActivity self) {
1151: return ((SyncActivityImpl) self).validateName(self);
1152: }
1153:
1154: /**
1155: * @generated NOT
1156: * @author sh
1157: */
1158: private static Boolean syncActivityImplementationValidation(
1159: SyncActivity self) {
1160: return ((SyncActivityImpl) self)
1161: .validateImplementation(self);
1162: }
1163:
1164: /**
1165: * @generated NOT
1166: * @author sh
1167: */
1168: private static Boolean asyncActivityNameValidation(
1169: AsyncActivity self) {
1170: return ((AsyncActivityImpl) self).validateName(self);
1171: }
1172:
1173: /**
1174: * @generated NOT
1175: * @author sh
1176: */
1177: private static Boolean asyncActivityImplementationValidation(
1178: AsyncActivity self) {
1179: return ((AsyncActivityImpl) self)
1180: .validateImplementation(self);
1181: }
1182:
1183: /**
1184: * @generated NOT
1185: * @author sh
1186: */
1187: private static Boolean eventNameValidation(Event self) {
1188: return ((EventImpl) self).validateName(self);
1189: }
1190:
1191: /**
1192: * @generated NOT
1193: * @author sh
1194: */
1195: private static Boolean eventImplementationValidation(Event self) {
1196: return ((EventImpl) self).validateImplementation(self);
1197: }
1198:
1199: /**
1200: * @generated NOT
1201: * @author sh
1202: */
1203: private static Boolean listenerNameValidation(Listener self) {
1204: return ((ListenerImpl) self).validateName(self);
1205: }
1206:
1207: /**
1208: * @generated NOT
1209: * @author sh
1210: */
1211: private static Boolean listenerImplementationValidation(
1212: Listener self) {
1213: return ((ListenerImpl) self).validateImplementation(self);
1214: }
1215:
1216: /**
1217: * @generated NOT
1218: * @author sh
1219: */
1220: private static Boolean proxyConditionValidation(
1221: ConditionProxy self) {
1222: return ((ConditionProxyImpl) self).validateCondition(self);
1223: }
1224:
1225: /**
1226: * @generated NOT
1227: * @author sh
1228: */
1229: private static Boolean loaderNameValidation(Loader self) {
1230: return ((LoaderImpl) self).validateName(self);
1231: }
1232:
1233: /**
1234: * @generated NOT
1235: * @author sh
1236: */
1237: private static Boolean loaderImplementationValidation(
1238: Loader self) {
1239: return ((LoaderImpl) self).validateImplementation(self);
1240: }
1241:
1242: /**
1243: * @generated NOT
1244: * @author sh
1245: */
1246: private static Boolean conditionNameValidation(Condition self) {
1247: return ((ConditionImpl) self).validateName(self);
1248: }
1249:
1250: /**
1251: * @generated NOT
1252: * @author sh
1253: */
1254: private static Boolean conditionImplementationValidation(
1255: Condition self) {
1256: return ((ConditionImpl) self).validateImplementation(self);
1257: }
1258: } //JavaAudits
1259: } //New_processValidationProvider
|