Search in sources :

Example 6 with EAnnotation

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

the class ListBusinessItemViewFactory 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.ListBusinessItemEditPart.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(ListBusinessItemNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
}
Also used : EAnnotation(org.eclipse.emf.ecore.EAnnotation)

Example 7 with EAnnotation

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

the class ConcurrentAccessTest method setUp.

@Before
public void setUp() throws Exception {
    globalStateMemento = GlobalRegistries.makeCopyOfGlobalState();
    EPackage.Registry.INSTANCE.put(XMLTypePackage.eNS_URI, XMLTypePackage.eINSTANCE);
    ResourceSet resourceSet = new ResourceSetImpl();
    resource = new XtextResource(URI.createFileURI("something.ecore"));
    resourceSet.getResources().add(resource);
    EPackage start = EcoreFactory.eINSTANCE.createEPackage();
    resource.getContents().add(start);
    for (int i = 0; i < 100; i++) {
        File tempFile = temporaryFolder.createTempFile("Package" + i, ".ecore");
        URI fileURI = URI.createFileURI(tempFile.getAbsolutePath());
        Resource toBeProxified = resourceSet.createResource(fileURI);
        EPackage ePackage = EcoreFactory.eINSTANCE.createEPackage();
        ePackage.setNsURI("http://www.test.me/" + i);
        toBeProxified.getContents().add(ePackage);
        for (int j = 0; j < 100; j++) {
            EAnnotation annotation = EcoreFactory.eINSTANCE.createEAnnotation();
            annotation.setSource("Source" + j);
            start.getEAnnotations().add(annotation);
            EClass superClass = EcoreFactory.eINSTANCE.createEClass();
            superClass.setName("SuperClass" + j);
            ePackage.getEClassifiers().add(superClass);
            annotation.getReferences().add(superClass);
        }
        toBeProxified.save(null);
    }
    EcoreUtil.resolveAll(resourceSet);
    for (int i = 100; i >= 1; i--) {
        Resource toBeProxified = resourceSet.getResources().get(i);
        toBeProxified.unload();
        resourceSet.getResources().remove(toBeProxified);
    }
}
Also used : EAnnotation(org.eclipse.emf.ecore.EAnnotation) EClass(org.eclipse.emf.ecore.EClass) ResourceSetImpl(org.eclipse.emf.ecore.resource.impl.ResourceSetImpl) Resource(org.eclipse.emf.ecore.resource.Resource) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) File(java.io.File) URI(org.eclipse.emf.common.util.URI) EPackage(org.eclipse.emf.ecore.EPackage) Before(org.junit.Before)

Example 8 with EAnnotation

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

the class LazyLinkingResourceTest method testEObjectReference.

@Test
public void testEObjectReference() throws Exception {
    final EAnnotation source = EcoreFactory.eINSTANCE.createEAnnotation();
    final EObject referencedObject = XtextFactory.eINSTANCE.createGrammar();
    LazyLinkingResource res = new LazyLinkingResource();
    res.setLinkingHelper(new LinkingHelper() {

        @Override
        public String getCrossRefNodeAsString(INode node, boolean convert) {
            return node.getText();
        }
    });
    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 Lists.newArrayList(referencedObject);
        }
    });
    res.setDiagnosticMessageProvider(new LinkingDiagnosticMessageProvider());
    assertEquals(referencedObject, res.getEObject("foo"));
}
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) 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) LinkingHelper(org.eclipse.xtext.linking.impl.LinkingHelper) EReference(org.eclipse.emf.ecore.EReference) Test(org.junit.Test)

Example 9 with EAnnotation

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

the class DocumentBusinessItemViewFactory 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.DocumentBusinessItemEditPart.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(DocumentBusinessItemNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
}
Also used : EAnnotation(org.eclipse.emf.ecore.EAnnotation)

Example 10 with EAnnotation

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

the class EllipseBusinessItemViewFactory 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.EllipseBusinessItemEditPart.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(EllipseBusinessItemNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
}
Also used : EAnnotation(org.eclipse.emf.ecore.EAnnotation)

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