Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Referencing Java language elements from OCL statements in EMF
Referencing Java language elements from OCL statements in EMF [message #1235839] Sat, 25 January 2014 12:40 Go to next message
Emre T is currently offline Emre TFriend
Messages: 119
Registered: April 2013
Senior Member
Hello there! I am building a model with EMF and I want to be able query/validate certain model elements with OCL. It is not being done programatically, though it might also be an option. I use EAnnotation to define the OCL statements for model elements. The OCL constructs in this case should be based on the Java language itself, like classes, constructors etc.

The trivial case looks like this: In the ecore model, there is an EClass named UtilityClass which inherits from Class Java (for this I am using EMFText and its java.ecore, found in org.eclipse.emftext.language.java/metamodel). I'm adding an EAnnotation to UtilityClass, which contains the OCL statement. Pseudo: A utility class must have only static methods and fields, and shouldn't have to be initialized. I am new to practical usage of OCL, therefor these questions. Don't I have to reference in this case the methods and fields from OCL to Java elements e.g. for later query/validation purposes?

Which packages should be registered for this in my ecore model, beside the one from EMFText, that is based on the metamodel of Java language? Or are there any other things, I need to be aware of?

Thank you..
Re: Referencing Java language elements from OCL statements in EMF [message #1235846 is a reply to message #1235839] Sat, 25 January 2014 12:56 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I recommend that you follow the OCLinEcore tutorial in the Eclipse OCL
Documentation and you will discover that the EAnnotations can all be hidden.

You can use the OCL Console for interactive queries.

Regards

Ed Willink


On 25/01/2014 12:40, Emre T wrote:
> Hello there! I am building a model with EMF and I want to be able
> query/validate certain model elements with OCL. It is not being done
> programatically, though it might also be an option. I use EAnnotation
> to define the OCL statements for model elements. The OCL constructs in
> this case should be based on the Java language itself, like classes,
> constructors etc.
> The trivial case looks like this: In the ecore model, there is an
> EClass named UtilityClass which inherits from Class Java (for this I
> am using EMFText and its java.ecore, found in
> org.eclipse.emftext.language.java/metamodel). I'm adding an
> EAnnotation to UtilityClass, which contains the OCL statement. Pseudo:
> A utility class must have only static methods and fields, and
> shouldn't have to be initialized. I am new to practical usage of OCL,
> therefor these questions. Don't I have to reference in this case the
> methods and fields from OCL to Java elements e.g. for later
> query/validation purposes?
>
> Which packages should be registered for this in my ecore model, beside
> the one from EMFText, that is based on the metamodel of Java language?
> Or are there any other things, I need to be aware of?
>
> Thank you..
Re: Referencing Java language elements from OCL statements in EMF [message #1235896 is a reply to message #1235846] Sat, 25 January 2014 16:19 Go to previous messageGo to next message
Emre T is currently offline Emre TFriend
Messages: 119
Registered: April 2013
Senior Member
Hello, are these the tutorials you have mentioned?

OCLinEcore -> http://wiki.eclipse.org/MDT/OCLinEcore and http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.ocl.doc%2Fhelp%2FCompleteOCLTutorial.html

And I honesty didn't understand what you mean by "you will discover that the EAnnotations can all be hidden". Why would I want the EAnnotations to be hidden? IS there a specific reason for that?

Best regards!
Re: Referencing Java language elements from OCL statements in EMF [message #1235904 is a reply to message #1235896] Sat, 25 January 2014 16:43 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

If you like editing OCL text in EAnnotations without any syntax help
good luck. I prefer using high levels of abstraction.

The OCL Documentation is available via Help Contents (and on line your
CompleteOCLTutorial is a sibling).

If you looked at it you would see no EAnnotations

import ecore : 'http://www.eclipse.org/emf/2002/Ecore#/';

package tutorial : tut = 'http://www.eclipse.org/mdt/ocl/oclinecore/tutorial'
{
class Library
{
attribute name : String;
property books#library : Book[*] { composes };
property loans : Loan[*] { composes };
property members#library : Member[*] { composes };
}

class Book
{
invariant SufficientCopies:
library.loans->select(book=self)->size() <= copies;
attribute name : String;
attribute copies : Integer;
property library#books : Library[?];
property loans : Loan[*] { derived,volatile }
{
derivation: library.loans->select(book=self);
}
operation isAvailable() : Boolean[?]
{
body: loans->size() < copies;
}
}

class Member
{
attribute name : String;
property library#members : Library[?];
}

class Loan
{
property book : Book;
property member : Member;
attribute date : ecore::EDate[?];
}
}



Regards

Ed Willink

On 25/01/2014 16:19, Emre T wrote:
> Hello, are these the tutorials you have mentioned?
>
> OCLinEcore -> http://wiki.eclipse.org/MDT/OCLinEcore and
> http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.ocl.doc%2Fhelp%2FCompleteOCLTutorial.html
>
> And I honesty didn't understand what you mean by "you will discover
> that the EAnnotations can all be hidden". Why would I want the
> EAnnotations to be hidden? IS there a specific reason for that?
>
> Best regards!
Re: Referencing Java language elements from OCL statements in EMF [message #1235957 is a reply to message #1235904] Sat, 25 January 2014 20:17 Go to previous messageGo to next message
Emre T is currently offline Emre TFriend
Messages: 119
Registered: April 2013
Senior Member
Hi Ed, thanks a lot, I think I got the answers which I needed.

I have already tried the OCLinEcore editor with different models containing various OCL statements in their EAnnotations. It's really cool actually to get some extra support for OCL such as error detection.

But I got the following error when I tried to load this specific Ecore model I'm currently working on:


!ENTRY org.eclipse.ui 4 0 2014-01-25 21:06:18.219
!MESSAGE FileDocumentProvider.createElementInfo
!STACK 1
org.eclipse.core.runtime.CoreException: Failed to load
0:0: Unresolved org.eclipse.emf.ecore.impl.EClassImpl@7283cef7 (eProxyURI: platform:/resource/org.emftext.language.java/metamodel/java.ecore#//members/Field)
0:0: Unresolved org.eclipse.emf.ecore.impl.EClassImpl@2c83ef7f (eProxyURI: platform:/resource/org.emftext.language.java/metamodel/java.ecore#//members/Method)
0:0: Unresolved org.eclipse.emf.ecore.impl.EGenericTypeImpl@2b88f4dd (expression: )
0:0: Unresolved org.eclipse.emf.ecore.impl.EGenericTypeImpl@2b88f4dd (expression: )
0:0: Unresolved org.eclipse.emf.ecore.impl.EGenericTypeImpl@82dbbca (expression: )
0:0: Unresolved org.eclipse.emf.ecore.impl.EGenericTypeImpl@82dbbca (expression: )
	at org.eclipse.ocl.examples.xtext.oclinecore.ui.model.OCLinEcoreDocumentProvider.diagnoseErrors(OCLinEcoreDocumentProvider.java:139)
	at org.eclipse.ocl.examples.xtext.oclinecore.ui.model.OCLinEcoreDocumentProvider.setDocumentContent(OCLinEcoreDocumentProvider.java:353)
	at org.eclipse.ui.editors.text.FileDocumentProvider.setDocumentContent(FileDocumentProvider.java:426)
	at org.eclipse.xtext.ui.editor.model.XtextDocumentProvider.setDocumentContent(XtextDocumentProvider.java:195)
	at org.eclipse.ocl.examples.xtext.oclinecore.ui.model.OCLinEcoreDocumentProvider.setDocumentContent(OCLinEcoreDocumentProvider.java:298)
	at org.eclipse.ui.editors.text.StorageDocumentProvider.createDocument(StorageDocumentProvider.java:229)
	at org.eclipse.xtext.ui.editor.model.XtextDocumentProvider.createDocument(XtextDocumentProvider.java:140)
	at org.eclipse.ui.editors.text.FileDocumentProvider.createElementInfo(FileDocumentProvider.java:737)
	at org.eclipse.xtext.ui.editor.model.XtextDocumentProvider.createElementInfo(XtextDocumentProvider.java:252)
	at org.eclipse.ui.texteditor.AbstractDocumentProvider.connect(AbstractDocumentProvider.java:400)
	at org.eclipse.ui.texteditor.AbstractTextEditor.doSetInput(AbstractTextEditor.java:4230)
	at org.eclipse.ui.texteditor.StatusTextEditor.doSetInput(StatusTextEditor.java:237)
	at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.doSetInput(AbstractDecoratedTextEditor.java:1480)
	at org.eclipse.ui.editors.text.TextEditor.doSetInput(TextEditor.java:169)
	at org.eclipse.xtext.ui.editor.XtextEditor.doSetInput(XtextEditor.java:232)
	at org.eclipse.ui.texteditor.AbstractTextEditor$19.run(AbstractTextEditor.java:3217)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
	at org.eclipse.ui.internal.WorkbenchWindow$13.run(WorkbenchWindow.java:1818)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:1815)
	at org.eclipse.ui.texteditor.AbstractTextEditor.internalInit(AbstractTextEditor.java:3235)
	at org.eclipse.ui.texteditor.AbstractTextEditor.init(AbstractTextEditor.java:3262)
	at org.eclipse.xtext.ui.editor.XtextEditor.init(XtextEditor.java:255)
	at org.eclipse.ui.internal.EditorReference.initialize(EditorReference.java:359)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:306)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:877)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:857)
	at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:119)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:333)
	at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:254)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:102)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:71)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:53)
	at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:129)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:949)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:633)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:735)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:706)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:700)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:685)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl$1.handleEvent(PartServiceImpl.java:90)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:41)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4650)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:205)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38)
	at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
	at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135)
	at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
	at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
	at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:80)
	at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:58)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
	at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:171)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:576)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:543)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:610)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.bringToTop(PartServiceImpl.java:322)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:1034)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3112)
	at org.eclipse.ui.internal.WorkbenchPage.access$21(WorkbenchPage.java:3034)
	at org.eclipse.ui.internal.WorkbenchPage$8.run(WorkbenchPage.java:3016)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3012)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2976)
	at org.eclipse.ui.actions.OpenWithMenu.openEditor(OpenWithMenu.java:338)
	at org.eclipse.ui.actions.OpenWithMenu$2.handleEvent(OpenWithMenu.java:180)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4166)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1489)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1474)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1279)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4012)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3651)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
!SUBENTRY 1 org.eclipse.ocl.examples.common 4 0 2014-01-25 21:06:18.221
!MESSAGE Failed to load
0:0: Unresolved org.eclipse.emf.ecore.impl.EClassImpl@7283cef7 (eProxyURI: platform:/resource/org.emftext.language.java/metamodel/java.ecore#//members/Field)
0:0: Unresolved org.eclipse.emf.ecore.impl.EClassImpl@2c83ef7f (eProxyURI: platform:/resource/org.emftext.language.java/metamodel/java.ecore#//members/Method)
0:0: Unresolved org.eclipse.emf.ecore.impl.EGenericTypeImpl@2b88f4dd (expression: )
0:0: Unresolved org.eclipse.emf.ecore.impl.EGenericTypeImpl@2b88f4dd (expression: )
0:0: Unresolved org.eclipse.emf.ecore.impl.EGenericTypeImpl@82dbbca (expression: )
0:0: Unresolved org.eclipse.emf.ecore.impl.EGenericTypeImpl@82dbbca (expression: )


I have further tried to load the mentioned resource (platform:/resource/org.emftext.language.java/metamodel/java.ecore#/) via different ways. From target platform (resource) or registered packages (plugin); and also in a runtime Eclipse instance. Ay ideas what the reason might be?

Thanks..
Re: Referencing Java language elements from OCL statements in EMF [message #1236145 is a reply to message #1235957] Sun, 26 January 2014 10:50 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
HI

Looks like a bug in handling the details of EGenericType. I fixed a
problem here a couple of months ago.

What version are you using? Can you try a Luna milestone build (e.g
http://www.eclipse.org/modeling/download.php?file=/modeling/mdt/ocl/downloads/drops/5.0.0/I201401230710/mdt-ocl-Update-I201401230710.zip)
which should be installable on Kepler.

Otherwise can you supply the model fioles that give a problem?

Regards

Ed Willink

On 25/01/2014 20:17, Emre T wrote:
> Hi Ed, thanks a lot, I think I got the answers which I needed.
> I have already tried the OCLinEcore editor with different models
> containing various OCL statements in their EAnnotations. It's really
> cool actually to get some extra support for OCL such as error detection.
> But I got the following error when I tried to load this specific Ecore
> model I'm currently working on:
>
>
> !ENTRY org.eclipse.ui 4 0 2014-01-25 21:06:18.219
> !MESSAGE FileDocumentProvider.createElementInfo
> !STACK 1
> org.eclipse.core.runtime.CoreException: Failed to load
> 0:0: Unresolved org.eclipse.emf.ecore.impl.EClassImpl@7283cef7
> (eProxyURI:
> platform:/resource/org.emftext.language.java/metamodel/java.ecore#//members/Field)
> 0:0: Unresolved org.eclipse.emf.ecore.impl.EClassImpl@2c83ef7f
> (eProxyURI:
> platform:/resource/org.emftext.language.java/metamodel/java.ecore#//members/Method)
> 0:0: Unresolved org.eclipse.emf.ecore.impl.EGenericTypeImpl@2b88f4dd
> (expression: )
> 0:0: Unresolved org.eclipse.emf.ecore.impl.EGenericTypeImpl@2b88f4dd
> (expression: )
> 0:0: Unresolved org.eclipse.emf.ecore.impl.EGenericTypeImpl@82dbbca
> (expression: )
> 0:0: Unresolved org.eclipse.emf.ecore.impl.EGenericTypeImpl@82dbbca
> (expression: )
> at
> org.eclipse.ocl.examples.xtext.oclinecore.ui.model.OCLinEcoreDocumentProvider.diagnoseErrors(OCLinEcoreDocumentProvider.java:139)
> at
> org.eclipse.ocl.examples.xtext.oclinecore.ui.model.OCLinEcoreDocumentProvider.setDocumentContent(OCLinEcoreDocumentProvider.java:353)
> at
> org.eclipse.ui.editors.text.FileDocumentProvider.setDocumentContent(FileDocumentProvider.java:426)
> at
> org.eclipse.xtext.ui.editor.model.XtextDocumentProvider.setDocumentContent(XtextDocumentProvider.java:195)
> at
> org.eclipse.ocl.examples.xtext.oclinecore.ui.model.OCLinEcoreDocumentProvider.setDocumentContent(OCLinEcoreDocumentProvider.java:298)
> at
> org.eclipse.ui.editors.text.StorageDocumentProvider.createDocument(StorageDocumentProvider.java:229)
> at
> org.eclipse.xtext.ui.editor.model.XtextDocumentProvider.createDocument(XtextDocumentProvider.java:140)
> at
> org.eclipse.ui.editors.text.FileDocumentProvider.createElementInfo(FileDocumentProvider.java:737)
> at
> org.eclipse.xtext.ui.editor.model.XtextDocumentProvider.createElementInfo(XtextDocumentProvider.java:252)
> at
> org.eclipse.ui.texteditor.AbstractDocumentProvider.connect(AbstractDocumentProvider.java:400)
> at
> org.eclipse.ui.texteditor.AbstractTextEditor.doSetInput(AbstractTextEditor.java:4230)
> at
> org.eclipse.ui.texteditor.StatusTextEditor.doSetInput(StatusTextEditor.java:237)
> at
> org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.doSetInput(AbstractDecoratedTextEditor.java:1480)
> at
> org.eclipse.ui.editors.text.TextEditor.doSetInput(TextEditor.java:169)
> at
> org.eclipse.xtext.ui.editor.XtextEditor.doSetInput(XtextEditor.java:232)
> at
> org.eclipse.ui.texteditor.AbstractTextEditor$19.run(AbstractTextEditor.java:3217)
> at
> org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
> at
> org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
> at
> org.eclipse.ui.internal.WorkbenchWindow$13.run(WorkbenchWindow.java:1818)
> at
> org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
> at
> org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:1815)
> at
> org.eclipse.ui.texteditor.AbstractTextEditor.internalInit(AbstractTextEditor.java:3235)
> at
> org.eclipse.ui.texteditor.AbstractTextEditor.init(AbstractTextEditor.java:3262)
> at org.eclipse.xtext.ui.editor.XtextEditor.init(XtextEditor.java:255)
> at
> org.eclipse.ui.internal.EditorReference.initialize(EditorReference.java:359)
> at
> org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:306)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601)
> at
> org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
> at
> org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:877)
> at
> org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:857)
> at
> org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:119)
> at
> org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:333)
> at
> org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:254)
> at
> org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
> at
> org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:102)
> at
> org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:71)
> at
> org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:53)
> at
> org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:129)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:949)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:633)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:735)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:706)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:700)
> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:685)
> at
> org.eclipse.e4.ui.internal.workbench.PartServiceImpl$1.handleEvent(PartServiceImpl.java:90)
> at
> org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:41)
> at
> org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180)
> at
> org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
> at org.eclipse.swt.widgets.Display.syncExec(Display.java:4650)
> at
> org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:205)
> at
> org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38)
> at
> org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197)
> at
> org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197)
> at
> org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
> at
> org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
> at
> org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
> at
> org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135)
> at
> org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
> at
> org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
> at
> org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:80)
> at
> org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:58)
> at
> org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
> at
> org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:171)
> at
> org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:576)
> at
> org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:543)
> at
> org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:610)
> at
> org.eclipse.e4.ui.internal.workbench.PartServiceImpl.bringToTop(PartServiceImpl.java:322)
> at
> org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:1034)
> at
> org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3112)
> at
> org.eclipse.ui.internal.WorkbenchPage.access$21(WorkbenchPage.java:3034)
> at
> org.eclipse.ui.internal.WorkbenchPage$8.run(WorkbenchPage.java:3016)
> at
> org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
> at
> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3012)
> at
> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2976)
> at
> org.eclipse.ui.actions.OpenWithMenu.openEditor(OpenWithMenu.java:338)
> at
> org.eclipse.ui.actions.OpenWithMenu$2.handleEvent(OpenWithMenu.java:180)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
> at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4166)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1489)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1474)
> at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1279)
> at
> org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4012)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3651)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
> at
> org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
> at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
> at
> org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
> at
> org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
> !SUBENTRY 1 org.eclipse.ocl.examples.common 4 0 2014-01-25 21:06:18.221
> !MESSAGE Failed to load
> 0:0: Unresolved org.eclipse.emf.ecore.impl.EClassImpl@7283cef7
> (eProxyURI:
> platform:/resource/org.emftext.language.java/metamodel/java.ecore#//members/Field)
> 0:0: Unresolved org.eclipse.emf.ecore.impl.EClassImpl@2c83ef7f
> (eProxyURI:
> platform:/resource/org.emftext.language.java/metamodel/java.ecore#//members/Method)
> 0:0: Unresolved org.eclipse.emf.ecore.impl.EGenericTypeImpl@2b88f4dd
> (expression: )
> 0:0: Unresolved org.eclipse.emf.ecore.impl.EGenericTypeImpl@2b88f4dd
> (expression: )
> 0:0: Unresolved org.eclipse.emf.ecore.impl.EGenericTypeImpl@82dbbca
> (expression: )
> 0:0: Unresolved org.eclipse.emf.ecore.impl.EGenericTypeImpl@82dbbca
> (expression: )
>
> I have further tried to load the mentioned resource
> (platform:/resource/org.emftext.language.java/metamodel/java.ecore#/)
> via different ways. From target platform (resource) or registered
> packages (plugin); and also in a runtime Eclipse instance. Ay ideas
> what the reason might be?
> Thanks..
Re: Referencing Java language elements from OCL statements in EMF [message #1236153 is a reply to message #1236145] Sun, 26 January 2014 11:18 Go to previous messageGo to next message
Emre T is currently offline Emre TFriend
Messages: 119
Registered: April 2013
Senior Member
Hi Ed,

I am on a Kepler instance and using the following versions of the features:

Eclipse Modeling Framework Runtime and Tools
Version: 2.9.2.v20131212-0558
Build id: R201312120558

Ecore Tools
Version: 1.2.0.201306071421

OCL (Object Constraint Language)
Version: 3.3.0.v20130909-1552
Build id: M201309091552

OCL Examples and Editors
Version: 3.3.1.v20130916-1423
Build id: M201309161423

And here is the text representation of the model I am working on:

<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="code" nsURI="http://TestModel/code/0.1" nsPrefix="code">
  <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
    <details key="settingDelegates" value="http://www.eclipse.org/emf/2002/Ecore/OCL"/>
    <details key="invocationDelegates" value="http://www.eclipse.org/emf/2002/Ecore/OCL"/>
    <details key="validationDelegates" value="http://www.eclipse.org/emf/2002/Ecore/OCL"/>
  </eAnnotations>
  <eClassifiers xsi:type="ecore:EClass" name="ImplementUtilityClass" eSuperTypes="../../org.emftext.language.java/metamodel/java.ecore#//classifiers/Class">
    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
      <details key="constraints" value="ClassCorrectlyImplemented"/>
    </eAnnotations>
    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL">
      <details key="ClassCorrectlyImplemented" value="Static methods&amp;fields and no instantiation //Pseudo"/>
    </eAnnotations>
    <eStructuralFeatures xsi:type="ecore:EReference" name="fields" upperBound="-1"
        eType="ecore:EClass ../../org.emftext.language.java/metamodel/java.ecore#//members/Field"
        containment="true"/>
    <eStructuralFeatures xsi:type="ecore:EReference" name="methods" upperBound="-1"
        eType="ecore:EClass ../../org.emftext.language.java/metamodel/java.ecore#//members/Method"
        containment="true"/>
  </eClassifiers>
</ecore:EPackage>


Also I am uploading the ecore file. And as you can see, the OCL expression is still in pseudo.

Thanks again!

P.S: I would like to try the Luna build of the OCL, but as the last resort, since there are lots of other projects which rely on the stable build of the Kepler MDT and I really don't want to mix things up. Smile
Re: Referencing Java language elements from OCL statements in EMF [message #1236586 is a reply to message #1236153] Mon, 27 January 2014 15:53 Go to previous messageGo to next message
Emre T is currently offline Emre TFriend
Messages: 119
Registered: April 2013
Senior Member
Ok, the problem is solved! Silly of me, that I haven't really paid attention to which proxies weren't resolved from where. OCLInEcore editor, as far as I can see, looks for the platform resources and not plugins? So after I have imported to unresolved proxies into my workspace, everything was fine.

But again, thanks for the help!
Re: Referencing Java language elements from OCL statements in EMF [message #1236610 is a reply to message #1236586] Mon, 27 January 2014 17:01 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

The OCLinEcore editor by default uses one model per-namespace URI
loading whichever of nsURI, platform:plugin, platform:/resource is
accessed first and remapping the others to the first. This avoids
problems with inconsistent access, but may just push them down to other
tools. You are strongly recommended to use only one form of access.

nsURI if you access something that you do not (re-)develop.
platform:/resource for you own models.

Regards

Ed Willink


On 27/01/2014 15:53, Emre T wrote:
> Ok, the problem is solved! Silly of me, that I haven't really paid
> attention to which proxies weren't resolved from where. OCLInEcore
> editor, as far as I can see, looks for the platform resources and not
> plugins? So after I have imported to unresolved proxies into my
> workspace, everything was fine.
>
> But again, thanks for the help!
Previous Topic:Defining a Data Type with operations visible in OCL
Next Topic:Unresolved Namespace at run-time
Goto Forum:
  


Current Time: Fri Apr 26 20:21:09 GMT 2024

Powered by FUDForum. Page generated in 0.04002 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top