Search in sources :

Example 16 with EAnnotation

use of org.eclipse.emf.ecore.EAnnotation in project tdi-studio-se by Talend.

the class DecisionBusinessItemViewFactory method decorateView.

/**
     * @generated
     */
protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
    if (semanticHint == null) {
        semanticHint = BusinessVisualIDRegistry.getType(org.talend.designer.business.model.business.diagram.edit.parts.DecisionBusinessItemEditPart.VISUAL_ID);
        view.setType(semanticHint);
    }
    super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
    if (!BusinessProcessEditPart.MODEL_ID.equals(BusinessVisualIDRegistry.getModelID(containerView))) {
        EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
        //$NON-NLS-1$
        shortcutAnnotation.setSource("Shortcut");
        //$NON-NLS-1$
        shortcutAnnotation.getDetails().put("modelID", BusinessProcessEditPart.MODEL_ID);
        view.getEAnnotations().add(shortcutAnnotation);
    }
    getViewService().createNode(semanticAdapter, view, BusinessVisualIDRegistry.getType(DecisionBusinessItemNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
}
Also used : EAnnotation(org.eclipse.emf.ecore.EAnnotation)

Example 17 with EAnnotation

use of org.eclipse.emf.ecore.EAnnotation in project tdi-studio-se by Talend.

the class TerminalBusinessItemViewFactory method decorateView.

/**
     * @generated
     */
protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
    if (semanticHint == null) {
        semanticHint = BusinessVisualIDRegistry.getType(org.talend.designer.business.model.business.diagram.edit.parts.TerminalBusinessItemEditPart.VISUAL_ID);
        view.setType(semanticHint);
    }
    super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
    if (!BusinessProcessEditPart.MODEL_ID.equals(BusinessVisualIDRegistry.getModelID(containerView))) {
        EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
        //$NON-NLS-1$
        shortcutAnnotation.setSource("Shortcut");
        //$NON-NLS-1$
        shortcutAnnotation.getDetails().put("modelID", BusinessProcessEditPart.MODEL_ID);
        view.getEAnnotations().add(shortcutAnnotation);
    }
    getViewService().createNode(semanticAdapter, view, BusinessVisualIDRegistry.getType(TerminalBusinessItemNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
}
Also used : EAnnotation(org.eclipse.emf.ecore.EAnnotation)

Example 18 with EAnnotation

use of org.eclipse.emf.ecore.EAnnotation in project xtext-core by eclipse.

the class LazyLinkingResourceTest method testWarningInsteadOfError.

@Test
public void testWarningInsteadOfError() throws Exception {
    final EAnnotation source = EcoreFactory.eINSTANCE.createEAnnotation();
    LazyLinkingResource res = new LazyLinkingResource();
    res.setEncoder(new LazyURIEncoder() {

        @Override
        public boolean isCrossLinkFragment(Resource res, String s) {
            return "foo".equals(s);
        }

        @Override
        public Triple<EObject, EReference, INode> decode(Resource res, String uriFragment) {
            return Tuples.create((EObject) source, EcorePackage.Literals.EANNOTATION__REFERENCES, (INode) new LeafNode());
        }
    });
    res.setLinkingService(new ILinkingService() {

        @Override
        public List<EObject> getLinkedObjects(EObject context, EReference reference, INode node) throws IllegalNodeException {
            return Collections.emptyList();
        }
    });
    res.setDiagnosticMessageProvider(new LinkingDiagnosticMessageProvider() {

        @Override
        public DiagnosticMessage getUnresolvedProxyMessage(ILinkingDiagnosticContext context) {
            return new DiagnosticMessage("myMessage", Severity.WARNING, null);
        }
    });
    assertTrue(res.getWarnings().isEmpty());
    assertNull(res.getEObject("foo"));
    assertEquals(1, res.getWarnings().size());
    assertTrue(res.getErrors().isEmpty());
    assertEquals("myMessage", res.getWarnings().get(0).getMessage());
}
Also used : INode(org.eclipse.xtext.nodemodel.INode) Resource(org.eclipse.emf.ecore.resource.Resource) Triple(org.eclipse.xtext.util.Triple) EAnnotation(org.eclipse.emf.ecore.EAnnotation) DiagnosticMessage(org.eclipse.xtext.diagnostics.DiagnosticMessage) EObject(org.eclipse.emf.ecore.EObject) InternalEObject(org.eclipse.emf.ecore.InternalEObject) LeafNode(org.eclipse.xtext.nodemodel.impl.LeafNode) IllegalNodeException(org.eclipse.xtext.linking.impl.IllegalNodeException) ILinkingService(org.eclipse.xtext.linking.ILinkingService) LinkingDiagnosticMessageProvider(org.eclipse.xtext.linking.impl.LinkingDiagnosticMessageProvider) List(java.util.List) InternalEList(org.eclipse.emf.ecore.util.InternalEList) EReference(org.eclipse.emf.ecore.EReference) Test(org.junit.Test)

Aggregations

EAnnotation (org.eclipse.emf.ecore.EAnnotation)18 Resource (org.eclipse.emf.ecore.resource.Resource)3 List (java.util.List)2 EObject (org.eclipse.emf.ecore.EObject)2 EReference (org.eclipse.emf.ecore.EReference)2 InternalEObject (org.eclipse.emf.ecore.InternalEObject)2 InternalEList (org.eclipse.emf.ecore.util.InternalEList)2 ILinkingService (org.eclipse.xtext.linking.ILinkingService)2 IllegalNodeException (org.eclipse.xtext.linking.impl.IllegalNodeException)2 LinkingDiagnosticMessageProvider (org.eclipse.xtext.linking.impl.LinkingDiagnosticMessageProvider)2 INode (org.eclipse.xtext.nodemodel.INode)2 LeafNode (org.eclipse.xtext.nodemodel.impl.LeafNode)2 Triple (org.eclipse.xtext.util.Triple)2 Test (org.junit.Test)2 File (java.io.File)1 URI (org.eclipse.emf.common.util.URI)1 EClass (org.eclipse.emf.ecore.EClass)1 EPackage (org.eclipse.emf.ecore.EPackage)1 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)1 ResourceSetImpl (org.eclipse.emf.ecore.resource.impl.ResourceSetImpl)1