Skip to main content



      Home
Home » Modeling » EMF » UnsupportedOperationException from Model and UMLPackage(... when model.setName() or adding the model to the resource)
UnsupportedOperationException from Model and UMLPackage [message #1724645] Thu, 25 February 2016 03:56 Go to next message
Eclipse UserFriend
Hello everybody,
when setting the model name or when adding the model to the resource I get UnsupportedOperationException:

	Resource.Factory.Registry lResourceFactoryRegistry = Resource.Factory.Registry.INSTANCE;
	Map<String,Object> lExtensionToFactoryMap = lResourceFactoryRegistry.getExtensionToFactoryMap();
	lExtensionToFactoryMap.put( "xmi", new XMIResourceFactoryImpl());
	ResourceSet lResourceSet = new ResourceSetImpl();
	String lOutFilePath = "D:\\workspaces\\trunk\\testdata\\XMI\\04_uml-generated\\XMI.xmi";
	mResource = lResourceSet.createResource( URI.createFileURI( lOutFilePath));
	assert mResource != null;
	Model lModel = UMLFactory.eINSTANCE.createModel();
	lModel.setName( "MyModel");    
	// => java.lang.UnsupportedOperationException
	mResource.getContents().add( lModel);    
	// => ExceptionInInitializerError at UMLPackage
	// Caused by: java.lang.UnsupportedOperationException 
	// at org.eclipse.emf.ecore.impl.MinimalEObjectImpl.eBasicAdapters(MinimalEObjectImpl.java:300)


My eclipse imports are:
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Model;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;

Have I downloaded a wrong jar? I am using:
- eclipse.jdt.core_3.1.0.jar
- eclipse-emf-common-2.3.0.jar
- org.eclipse.emf.ecore.jar
- org.eclipse.emf.ecore.xmi.jar
- org.eclipse.uml2.common-1.5.0.v201005031530.jar
- org.eclipse.uml2.uml_3.1.1.v201008191505.jar

Kind regards - Thomas
Re: UnsupportedOperationException from Model and UMLPackage [message #1724653 is a reply to message #1724645] Thu, 25 February 2016 04:40 Go to previous messageGo to next message
Eclipse UserFriend
Hi

- org.eclipse.uml2.common-1.5.0.v201005031530.jar
- org.eclipse.uml2.uml_3.1.1.v201008191505.jar

This is five years old. You have definitely got the wrong code.

Regards

Ed Willink


On 25/02/2016 08:56, Thomas Taeger wrote:
> Hello everybody,
> when setting the model name or when adding the model to the resource I
> get UnsupportedOperationException:
>
> Resource.Factory.Registry lResourceFactoryRegistry =
> Resource.Factory.Registry.INSTANCE;
> Map<String,Object> lExtensionToFactoryMap =
> lResourceFactoryRegistry.getExtensionToFactoryMap();
> lExtensionToFactoryMap.put( "xmi", new XMIResourceFactoryImpl());
> ResourceSet lResourceSet = new ResourceSetImpl();
> String lOutFilePath =
> "D:\\workspaces\\trunk\\testdata\\XMI\\04_uml-generated\\XMI.xmi";
> mResource = lResourceSet.createResource( URI.createFileURI(
> lOutFilePath));
> assert mResource != null;
> Model lModel = UMLFactory.eINSTANCE.createModel();
> lModel.setName( "MyModel"); // =>
> java.lang.UnsupportedOperationException
> mResource.getContents().add( lModel); // =>
> ExceptionInInitializerError at UMLPackage
> // Caused by: java.lang.UnsupportedOperationException // at
> org.eclipse.emf.ecore.impl.MinimalEObjectImpl.eBasicAdapters(MinimalEObjectImpl.java:300)
>
>
> My eclipse imports are:
> import org.eclipse.emf.common.util.URI;
> import org.eclipse.emf.ecore.resource.Resource;
> import org.eclipse.emf.ecore.resource.ResourceSet;
> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
> import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
> import org.eclipse.uml2.uml.Class;
> import org.eclipse.uml2.uml.Model;
> import org.eclipse.uml2.uml.Package;
> import org.eclipse.uml2.uml.UMLFactory;
>
> Have I downloaded a wrong jar? I am using:
> - eclipse.jdt.core_3.1.0.jar
> - eclipse-emf-common-2.3.0.jar
> - org.eclipse.emf.ecore.jar
> - org.eclipse.emf.ecore.xmi.jar
> - org.eclipse.uml2.common-1.5.0.v201005031530.jar
> - org.eclipse.uml2.uml_3.1.1.v201008191505.jar
>
> Kind regards - Thomas
Re: UnsupportedOperationException from Model and UMLPackage [message #1724682 is a reply to message #1724653] Thu, 25 February 2016 07:50 Go to previous messageGo to next message
Eclipse UserFriend
Ed Willink wrote on Thu, 25 February 2016 09:40
Hi

- org.eclipse.uml2.common-1.5.0.v201005031530.jar
- org.eclipse.uml2.uml_3.1.1.v201008191505.jar

This is five years old. You have definitely got the wrong code.

Most of the jars I had found via Google, always hoping that they are the actual ones.

What is the best a) place and b) procedure to decide and download the actual eclipse jars (for Windows PCs)?
Preferrably only those that are really needed for compiling and running my program, not the whole bulk of possible eclipse jars.

Kind regards - Thomas
Re: UnsupportedOperationException from Model and UMLPackage [message #1724697 is a reply to message #1724682] Thu, 25 February 2016 08:37 Go to previous messageGo to next message
Eclipse UserFriend
On 25-Feb-16 13:50, Thomas Taeger wrote:
> Ed Willink wrote on Thu, 25 February 2016 09:40
>> Hi
>>
>> - org.eclipse.uml2.common-1.5.0.v201005031530.jar
>> - org.eclipse.uml2.uml_3.1.1.v201008191505.jar
>>
>> This is five years old. You have definitely got the wrong code.
>
> Most of the jars I had found via Google, always hoping that they are the
> actual ones.

That's the worst thing you can do...

> What is the best a) place and b) procedure to decide and download the
> actual eclipse jars (for Windows PCs)? Preferrably only those that are
> really needed for compiling and running my program, not the whole bulk
> of possible eclipse jars.
> Kind regards - Thomas
>

a) The project update sites

b) Write your program as an eclipse plugin. Even if you don't later
intend to run it in eclipse. If you only have dependencies that are able
to run standalone, then so can your own program. Manage dependencies
with Manifest.MF and use a Target platform.
Re: UnsupportedOperationException from Model and UMLPackage [message #1724736 is a reply to message #1724697] Thu, 25 February 2016 11:02 Go to previous messageGo to next message
Eclipse UserFriend
Felix Dorner wrote on Thu, 25 February 2016 13:37
On 25-Feb-16 13:50,
b) Write your program as an eclipse plugin. Even if you don't later
intend to run it in eclipse. If you only have dependencies that are able
to run standalone, [...].


For scenarios you are accustomed to such an integrating the program into Eclipse (plugin) might seem natural, but within my program the EMF related code is just 0.1% of the code. Therefor making my program an eclipse plugin would be oversized and architecturally strange.

The way an EMF beginner usually goes is reading an example, coding his first steps, then imagining the necessary imports and finally wundering in which jars these imports could be found.

In the web site findjar.com for many classes the containing jar can be found, but not the location and not the actual version of the jar. So how can I take the raw knowledge of the jar into the Eclipse Update function (Eclipse > Help > Install new software OR > Check for updates)?

Kind regards - Thomas
Re: UnsupportedOperationException from Model and UMLPackage [message #1724748 is a reply to message #1724736] Thu, 25 February 2016 12:15 Go to previous messageGo to next message
Eclipse UserFriend
On 25-Feb-16 17:02, Thomas Taeger wrote:
> Felix Dorner wrote on Thu, 25 February 2016 13:37
>> On 25-Feb-16 13:50, b) Write your program as an eclipse plugin. Even
>> if you don't later intend to run it in eclipse. If you only have
>> dependencies that are able to run standalone, [...].
>
>
> For scenarios you are accustomed to such an integrating the program into
> Eclipse (plugin) might seem natural, but within my program the EMF
> related code is just 0.1% of the code. Therefor making my program an
> eclipse plugin would be oversized and architecturally strange.

Then make only the 0.1% of that an eclipse plugin :)
So how do you manage the dependencies of the other 99,9%?
Re: UnsupportedOperationException from Model and UMLPackage [message #1724752 is a reply to message #1724748] Thu, 25 February 2016 12:37 Go to previous messageGo to next message
Eclipse UserFriend
Felix Dorner wrote on Thu, 25 February 2016 17:15
On 25-Feb-16 17:02, Then make only the 0.1% of that an eclipse plugin Smile

Ok, logically ok ... (but how ...).
So I as an EMF newcomer immediately face making an Eclipse plugin ...?
I will wait for the EMF book that I have ordered so maybe I can decide more easily.

But generally the question "how to find xyz.jar" is asked too often to be ignored.

Best regards - Thomas
Re: UnsupportedOperationException from Model and UMLPackage [message #1724755 is a reply to message #1724752] Thu, 25 February 2016 12:52 Go to previous messageGo to next message
Eclipse UserFriend
Hi

I think you misunderstand how minimal an Eclipse plugin can be.

If you just Configure->Convert to Plugin projects, you select projects
that magically have a MANIFEST.MF to specify your dependencies and that
sorts out the classpath for you. Bye Bye numerous nightmares.

Regards

Ed Willink


On 25/02/2016 17:37, Thomas Taeger wrote:
> Felix Dorner wrote on Thu, 25 February 2016 17:15
>> On 25-Feb-16 17:02, Then make only the 0.1% of that an eclipse plugin :)
>
> Ok, logically ok ... (but how ...).
> So I as an EMF newcomer immediately face making an Eclipse plugin ...?
> I will wait for the EMF book that I have ordered so maybe I can decide
> more easily.
>
> But generally the question "how to find xyz.jar" is asked too often to
> be ignored.
>
> Best regards - Thomas
Re: UnsupportedOperationException from Model and UMLPackage [message #1724951 is a reply to message #1724755] Sat, 27 February 2016 13:00 Go to previous messageGo to next message
Eclipse UserFriend
1. First I again tried to find the more actual jars for the imports and runtime dependencies via Help > Install new software:
- eclipse.jdt.core_3.1.0.jar
changed to -> org.eclipse.jdt.core_3.10.0.v20140902-0626.jar
- eclipse-emf-common-2.3.0.jar
changed to -> org.eclipse.emf.common_2.11.0.v20150805-0538.jar
- org.eclipse.emf.ecore.jar
changed to -> org.eclipse.emf.ecore_2.11.1.v20150805-0538.jar
changed to , Users\...\.p2\...\org.eclipse.emf.ecore_2.11.2.v20160208-0816.jar
- org.eclipse.emf.ecore.xmi.jar
changed to -> org.eclipse.emf.ecore.xmi_2.11.1.v20150805-0538.jar
changed to , Users\...\.p2\...\org.eclipse.emf.ecore.xmi_2.11.1.v20160208-0816.jar
- org.eclipse.uml2.common-1.5.0.v201005031530.jar
changed to -> Users\...\.p2\...\org.eclipse.uml2.common_2.1.0.v20160201-0816.jar
- org.eclipse.uml2.uml_3.1.1.v201008191505.jar
changed to -> Users\...\.p2\...\org.eclipse.uml2.uml_5.1.2.v20160201-0816.jar
- For org.eclipse.uml2.types.TypesPackage:
I tried -> Users\...\.p2\...\org.eclipse.uml2.types_2.0.0.v20160201-0816.jar
No success. So I removed these jars too from the project properties for preparing the next step:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ed Willink wrote on Thu, 25 February 2016 17:52
If you just Configure->Convert to Plugin projects, [...]

2. Concerning "Configure Convert to Plugin projects":

In Eclipse > Package Explorer > MoCoEMF (my EMF project) > Context Menu > Convert there are several "Convert ..." offered, but no one like "Convert to Plugin projects". What is the right navigation?

I tried other navigations, e.g. via a new plug-in project:
Eclipse > File > New > Project > Plug-in Project > Next:
Project name: (MoCoEMF - already exists as non-plug-in
=> Error: A project with that name already exists in the workspace.)
Project name: MoCoEMF-plug-in
Use default location: (D:workspaces\trunk\MoCoEMF-plug-in)
Create a Java project: src, bin
Target platformm: This plug-in is targeted to run with: Eclipse version 3.5 or greater
> Next => Content:
Properties:
ID: MoCoEMF-plug-in
Version: 1.0.0.qualifier
Name: MoCoEMF-plug-in
Vendor: (none)
Execution Environment: JavaSE-1.8
Options:
|v| Generate an activator, a Java class that controls the plug-in's life cycle
- - Activator: mocoemf_plug_in.Activator
> Next
Create a plug-in using one of the templates: no

=> MoCoEMF-plug-in and the Activator are created, but most imports still are unsatisfied.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Still the question is: How and from where to get the required jars?

Best regards - Thomas

Eclipse Modeling Tools
Version: Mars.1 Release (4.5.1)
Build id: 20150924-1200

[Updated on: Sat, 27 February 2016 13:08] by Moderator

Re: UnsupportedOperationException from Model and UMLPackage [message #1724966 is a reply to message #1724951] Sun, 28 February 2016 03:30 Go to previous messageGo to next message
Eclipse UserFriend
Thomas,

Learning some of the concepts seems important:

https://wiki.eclipse.org/PDE/Target_Definitions
http://help.eclipse.org/mars/index.jsp?topic=/org.eclipse.pde.doc.user/concepts/target.htm

You'll want to create a target definition that points at the update
sites of the versions of the things you want to use. Likely you can
just point at the Mars update site to get the latest released versions
of what you need.



On 27.02.2016 19:00, Thomas Taeger wrote:
> 1. First I again tried to find the more actual jars for the imports
> and runtime dependencies via Help > Install new software:
> - eclipse.jdt.core_3.1.0.jar changed to ->
> org.eclipse.jdt.core_3.10.0.v20140902-0626.jar
> - eclipse-emf-common-2.3.0.jar changed to ->
> org.eclipse.emf.common_2.11.0.v20150805-0538.jar
> - org.eclipse.emf.ecore.jar changed to ->
> org.eclipse.emf.ecore_2.11.1.v20150805-0538.jar
> changed to ,
> Users\...\.p2\...\org.eclipse.emf.ecore_2.11.2.v20160208-0816.jar
> - org.eclipse.emf.ecore.xmi.jar changed to ->
> org.eclipse.emf.ecore.xmi_2.11.1.v20150805-0538.jar
> changed to ,
> Users\...\.p2\...\org.eclipse.emf.ecore.xmi_2.11.1.v20160208-0816.jar
> - org.eclipse.uml2.common-1.5.0.v201005031530.jar changed to ->
> Users\...\.p2\...\org.eclipse.uml2.common_2.1.0.v20160201-0816.jar
> - org.eclipse.uml2.uml_3.1.1.v201008191505.jar changed to ->
> Users\...\.p2\...\org.eclipse.uml2.uml_5.1.2.v20160201-0816.jar
> - For org.eclipse.uml2.types.TypesPackage:
> I tried ->
> Users\...\.p2\...\org.eclipse.uml2.types_2.0.0.v20160201-0816.jar
> No success. So I removed these jars too from the project properties
> for preparing the next step:
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> - - - - - Ed Willink wrote on Thu, 25 February 2016 17:52
>> If you just Configure->Convert to Plugin projects, [...]
>
> 2. Concerning "Configure Convert to Plugin projects":
>
> In Eclipse > Package Explorer > MoCoEMF (my EMF project) > Context
> Menu > Convert there are several "Convert ..." offered, but no one
> like "Convert to Plugin projects". What is the right navigation?
>
> I tried other navigations, e.g. via a new plug-in project: Eclipse >
> File > New > Project > Plug-in Project > Next:
> Project name: (MoCoEMF - already exists as non-plug-in => Error: A
> project with that name already exists in the workspace.)
> Project name: MoCoEMF-plug-in
> Use default location: (D:workspaces\trunk\MoCoEMF-plug-in)
> Create a Java project: src, bin
> Target platformm: This plug-in is targeted to run with: Eclipse
> version 3.5 or greater
>> Next => Content:
> Properties: ID: MoCoEMF-plug-in
> Version: 1.0.0.qualifier
> Name: MoCoEMF-plug-in
> Vendor: (none)
> Execution Environment: JavaSE-1.8
> Options:
> |v| Generate an activator, a Java class that controls the plug-in's
> life cycle
> - - Activator: mocoemf_plug_in.Activator
>> Next
> Create a plug-in using one of the templates: no
>
> => MoCoEMF-plug-in und the Activator are created, but most imports
> still are unsatisfied.
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> - - - - -
> Still the question is: How and from where to get the required jars?
>
> Best regards - Thomas
>
Re: UnsupportedOperationException from Model and UMLPackage [message #1725063 is a reply to message #1724966] Mon, 29 February 2016 08:31 Go to previous messageGo to next message
Eclipse UserFriend
Hello Ed, thank you for your links:
Ed Merks wrote on Sun, 28 February 2016 08:30

Learning some of the concepts seems important:
https://wiki.eclipse.org/PDE/Target_Definitions
http://help.eclipse.org/mars/index.jsp?topic=/org.eclipse.pde.doc.user/concepts/target.htm
You'll want to create a target definition that points at the update
sites of the versions of the things you want to use. Likely you can
just point at the Mars update site to get the latest released versions
of what you need.
>


But on searching the p2 installer then at https://wiki.eclipse.org/Equinox/p2/Installer I got:
"NOTE: The installer does not seem to be downloadable using the instructions on this page. Apparently it is not regularly maintained right now and the builds for it have been disabled. Older versions and the current source code of the installer are available, and the director application exposes roughly the same capabilities, though at the command line rather than through a GUI. [...] This page was last modified 14:36, 8 May 2013".
It turns aout to be even more complicated than expected.

Can you tell me a link to the a p2 installer (GUI or command line version plus documentation)?

Best regards - Thomas
Re: UnsupportedOperationException from Model and UMLPackage [message #1725064 is a reply to message #1725063] Mon, 29 February 2016 08:42 Go to previous messageGo to next message
Eclipse UserFriend
On 29-Feb-16 14:31, Thomas Taeger wrote:

> It turns aout to be even more complicated than expected.
> Can you tell me a link to the a p2 installer (GUI or command line
> version plus documentation)?

You took a wrong turn somewhere, but this can happen, especially in the
beginning.

So let's start again: You want to develop a software that depends on the
eclipse uml2 plugins. So what you do to get started, you create a new
plugin project. You then double click on its 'plugin.xml' or
META-INF/MANIFEST.MF file and select the "Dependencies" tab.

You then click "Add..."

Then type "org.eclipse.uml2". If you have org.eclipse.uml2 in your
current target platform definition, you can select it and press OK.
If you do not, then you will need a target definition which contains it.
If that's the case, just tell us and we'll help with that. Otherwise: In
this very moment, you can look in the project explorer in your project
there should be a Classpath container (The little bookshelf symbol)
which you can expand. Now here is the list of all "jars" that you would
need to start coding against uml2.

Felix
Re: UnsupportedOperationException from Model and UMLPackage [message #1725065 is a reply to message #1725064] Mon, 29 February 2016 08:44 Go to previous messageGo to next message
Eclipse UserFriend
On 29-Feb-16 14:42, Felix Dorner wrote:

> there should be a Classpath container (The little bookshelf symbol)
> which you can expand.
More specifically, I wanted to say there is a Classpath container that
is named "Plugin Dependencies"
Re: UnsupportedOperationException from Model and UMLPackage [message #1725095 is a reply to message #1725064] Mon, 29 February 2016 12:38 Go to previous messageGo to next message
Eclipse UserFriend
Felix Dorner wrote on Mon, 29 February 2016 13:42
You then double click on its 'plugin.xml' or META-INF/MANIFEST.MF file [...] Now there is the list of all "jars" that you would need to start coding against uml2.


Yes, perfect so far.

But the import statements still are red and do not recognize the jars, see the both images:

http://www./thomastaeger.de/img/MoCoEMF-PackageExplorer-initial.jpg

http://www./thomastaeger.de/img/MoCoEMF-imports-initial.jpg

Thank you so much - Thomas
Re: UnsupportedOperationException from Model and UMLPackage [message #1725110 is a reply to message #1725095] Mon, 29 February 2016 15:57 Go to previous messageGo to next message
Eclipse UserFriend
Thomas Taeger wrote on Mon, 29 February 2016 17:38
But the import statements still are red and do not recognize the jars.

OK, I got the jars to be activated by selecting all the jars in C:\Users\Thomas.Taeger\.p2\pool\plugins - ca. 2,200 jars! - and adding them to the libraries via
Eclipse > package Explorer > MoCoEMF > Project > Properties > Java Build Path > Libraries > Add external jars > Select all > Open

But I can not believe that this is the normal procedure because in Eclipse > Package Explorer > MoCoEMF > JRE System Library there are just 18 jars listed - maybe even more than I really need.

I thought that .p2 would stop that nonsense? But how to reduce that lot of jars to just the needed ones efficiently?

Or, even better, how to automate?

Best regards - Thomas
Re: UnsupportedOperationException from Model and UMLPackage [message #1725111 is a reply to message #1725095] Mon, 29 February 2016 15:57 Go to previous messageGo to next message
Eclipse UserFriend
On 29-Feb-16 18:38, Thomas Taeger wrote:
> Felix Dorner wrote on Mon, 29 February 2016 13:42
>> You then double click on its 'plugin.xml' or META-INF/MANIFEST.MF file [...] Now there is the list of all "jars" that you would need to start coding against uml2.
>
>
> Yes, perfect so far.
>
> But the import statements still are red and do not recognize the jars, see the both images:

Ok, sorry. I have no clue how to use uml2, so I just guessed ... wrong.
Try to add org.eclipse.uml2.uml instead, this should do it.

Felix
Re: UnsupportedOperationException from Model and UMLPackage [message #1725112 is a reply to message #1725110] Mon, 29 February 2016 15:59 Go to previous messageGo to next message
Eclipse UserFriend
On 29-Feb-16 21:57, Thomas Taeger wrote:
> Thomas Taeger wrote on Mon, 29 February 2016 17:38
>> But the import statements still are red and do not recognize the jars.
>
> OK, I got the jars to be activated by selecting all the jars in
> C:\Users\Thomas.Taeger\.p2\pool\plugins - ca. 2,200 jars! - and adding
> them to the libraries via Eclipse > package Explorer > MoCoEMF >
> Project > Properties > Java Build Path > Libraries > Add external jars
> > Select all > Open

Noooooooooooooooooooooooooooooooooooooooooooo!

Literally, never never never never edit the build path of a plugin
through anything else but the PDE Manifest editor.
Re: UnsupportedOperationException from Model and UMLPackage [message #1725113 is a reply to message #1725112] Mon, 29 February 2016 16:35 Go to previous messageGo to next message
Eclipse UserFriend
Felix Dorner wrote on Mon, 29 February 2016 20:59
... never edit the build path of a plugin through anything else but the PDE Manifest editor.

Ok, a new component comes into play, the "PDE Manifest editor". For me the learning curve is pritty moderate.

Instead of thinking about what NOT to do I am urgendly seaking the way how to do.

How am I to reduce the jars in Project > Properties > Java Build Path > Libraries ?
Just leaving them off and letting p2 doing the job does not work (as I tried).

Best regards - Thomas
Re: UnsupportedOperationException from Model and UMLPackage [message #1725114 is a reply to message #1725113] Mon, 29 February 2016 16:54 Go to previous messageGo to next message
Eclipse UserFriend
On 29-Feb-16 22:35, Thomas Taeger wrote:
> Felix Dorner wrote on Mon, 29 February 2016 20:59
>> ... never edit the build path of a plugin through anything else but
>> the PDE Manifest editor.
>
> Ok, a new component comes into play, the "PDE Manifest editor". For me
> the learning curve is pritty moderate.

Sorry.

> How am I to reduce the jars in Project > Properties > Java Build Path >
> Libraries ? Just leaving them off and letting p2 doing the job does not
> work (as I tried).

Did you read my other reply?
Re: UnsupportedOperationException from Model and UMLPackage [message #1725137 is a reply to message #1725114] Tue, 01 March 2016 03:45 Go to previous messageGo to next message
Eclipse UserFriend
Felix Dorner wrote on Mon, 29 February 2016 21:54
Did you read my other reply?

You were right, adding
- org.eclipse.uml2.uml....jar
helped a lot.
Additionally
- org.eclipse.emf.common....jar
- org.eclipse.emf.ecore....jar
- org.eclipse.emf.ecore.xmi....jar
- org.eclipse.uml2.types....jar (post-edited)
were needed, see:

http://www.thomastaeger.de/img/MoCoEMF-jars-minimal.jpg

http://www.thomastaeger.de/img/MoCoEMF-imports-ok.jpg

Is there another way instead of guessing and trying the jars that need to be added as external jars in Eclipse's Java Build Path?
Any mechanism in p2?

Now I can concentrate on the next runtime error ...
Felix, I thank you a lot! - Thomas

[Updated on: Tue, 01 March 2016 04:30] by Moderator

Re: UnsupportedOperationException from Model and UMLPackage [message #1725143 is a reply to message #1725137] Tue, 01 March 2016 04:07 Go to previous messageGo to next message
Eclipse UserFriend
Hi

The whole point of using the MANIFEST.MF is that it sorts out all these
problems for you.

Potentially you just use a Java editor quickfix to add the missing
bundle, and all imported bundles are there automatically.

You may use the Manifest editor directly to add leaf dependencies. Again
others are provided automatically.

When you come to releasing your code you should use the Manifest editor
to specify the appropriate version bounds since the defaults from the
quickfix are typically X.Y.Z rather an (X.Y.Z,X+1.0.0].

You may add all intermediate dependencies explicitly; it is a matter of
taste. I prefer to omit them and let PDE inherit version bounds for me.
Other developers prefer to set them all explicitly and must therefore
set all their version ranges too.

Regards

Ed Willink


On 01/03/2016 08:45, Thomas Taeger wrote:
> Felix Dorner wrote on Mon, 29 February 2016 21:54
>> Did you read my other reply?
>
> You were right, adding - org.eclipse.uml2.uml....jar helped a lot.
> Additionally - org.eclipse.emf.common....jar
> - org.eclipse.emf.ecore....jar
> - org.eclipse.emf.ecore.xmi....jar
> were needed, see:
>
>
>
>
>
> Is there another way instead of guessing and trying the jars that need
> to be added as external jars in Eclipse's Java Build Path? Any
> mechanism in p2?
>
> Now I can concentrate on the next runtime error ...
> Felix, I thank you a lot! - Thomas
>
Re: UnsupportedOperationException from Model and UMLPackage [message #1725159 is a reply to message #1725143] Tue, 01 March 2016 05:14 Go to previous messageGo to next message
Eclipse UserFriend
Hello Ed,
thank you for trying to explain again.

The said Manifest Editor is that thing that opens by clicking on MANIFEST.MF within Eclipse's package explorer and looks like:

http://www.thomastaeger.de/img/MoCoEMF-RequiredPlugIns-and-ImportedPackages.jpg
- Right?
- What does this screen tell me?
- In "Required Plug-ins" clicking on "Add" allows me to select unknown plug-ins out of a number of more then 2,000 plug-ins. Again I do not know what to do or even what it means.
- Which dependencies can I enter if I do not know even know the dependent part? When I get a runtime exception then the class name is shown, not a jar name nor a plugin name.

Ed Willink wrote on Tue, 01 March 2016 09:07

The whole point of using the MANIFEST.MF is that it sorts out all these
problems for you.

I like that great goal, but I can not see the way to there.

Quote:

Potentially you just use a Java editor quickfix to add the missing
bundle, and all imported bundles are there automatically.

What did tell me the name of "the missing bundle" that I could add here?
In which window can I edit that quickfix?

Quote:

You may use the Manifest editor directly to add leaf dependencies. Again
others are provided automatically.

That sounds really great. I just need the information / name which leaf dependency I should add.

Quote:

When you come to releasing your code you should use the Manifest editor
to specify the appropriate version bounds since the defaults from the
quickfix are typically X.Y.Z rather an (X.Y.Z,X+1.0.0].

You may add all intermediate dependencies explicitly; it is a matter of
taste. I prefer to omit them and let PDE inherit version bounds for me.
Other developers prefer to set them all explicitly and must therefore
set all their version ranges too.

For the moment this is too high for me. But the questions before are enough to be answered.

Best regards - Thomas
Re: UnsupportedOperationException from Model and UMLPackage [message #1725164 is a reply to message #1725159] Tue, 01 March 2016 05:26 Go to previous messageGo to next message
Eclipse UserFriend
Hi

You seem to be encountering very basic 'first step' problems.

EMF is not a 'first step'.

I suggest that you follow some basic tutorials on the use of Java and
Eclipse before making any attempt to progress further.

Regards

Ed Willink


On 01/03/2016 10:14, Thomas Taeger wrote:
> Hello Ed, thank you for trying to explain again.
>
> The said Manifest Editor is that thing that opens by clicking on
> MANIFEST.MF within Eclipse's package explorer and looks like:
>
>
> - Right?
> - What does this screen tell me?
> - In "Required Plug-ins" clicking on "Add" allows me to select unknown
> plug-ins out of a number of more then 2,000 plug-ins. Again I do not
> know what to do or even what it means.
> - Which dependencies can I enter if I do not know even know the
> dependent part? When I get a runtime exception then the class name is
> shown, not a jar name nor a plugin name.
>
> Ed Willink wrote on Tue, 01 March 2016 09:07
>> The whole point of using the MANIFEST.MF is that it sorts out all
>> these problems for you.
>
> I like that great goal, but I can not see the way to there.
>
> Quote:
>> Potentially you just use a Java editor quickfix to add the missing
>> bundle, and all imported bundles are there automatically.
>
> What did tell me the name of "the missing bundle" that I could add
> here? In which window can I edit that quickfix?
>
> Quote:
>> You may use the Manifest editor directly to add leaf dependencies.
>> Again others are provided automatically.
>
> That sounds really great. I just need the information / name which
> leaf dependency I should add.
>
> Quote:
>> When you come to releasing your code you should use the Manifest
>> editor to specify the appropriate version bounds since the defaults
>> from the quickfix are typically X.Y.Z rather an (X.Y.Z,X+1.0.0].
>>
>> You may add all intermediate dependencies explicitly; it is a matter
>> of taste. I prefer to omit them and let PDE inherit version bounds
>> for me. Other developers prefer to set them all explicitly and must
>> therefore set all their version ranges too.
>
> For the moment this is too high for me. But the questions before are
> enough to be answered.
> Best regards - Thomas
>
Re: UnsupportedOperationException from Model and UMLPackage [message #1725191 is a reply to message #1725164] Tue, 01 March 2016 09:08 Go to previous messageGo to next message
Eclipse UserFriend
Ed Willink wrote on Tue, 01 March 2016 10:26
I suggest that you follow some basic tutorials on the use of Java

Hi, please distinguish between Java experience and Eclipse Plug-in tooling.

I wish us all an Eclipse Plug-in documentation quality being as good as the Eclipse quality.

Thomas

[Updated on: Tue, 01 March 2016 09:23] by Moderator

Re: UnsupportedOperationException from Model and UMLPackage [message #1725318 is a reply to message #1725191] Wed, 02 March 2016 08:45 Go to previous messageGo to next message
Eclipse UserFriend
As Ed has said, neither EMF nor Eclipse plug-in development are as simple as basic Java development. You would be well-served to go through some tutorials to learn the basics of those topics, it will most likely answer all the questions you've had in this thread. The topics are just too broad and involved to be covered in a forum thread.
Here are some excellent tutorials on Eclipse platform (plug-ins and RCP) development: http://www.vogella.com/tutorials/eclipse.html
Also open the Help from your Eclipse installation and look at the sections Platform Plug-in Development Guide, Plug-in Development Environment , and EMF Developer Guide sections.
Some more resources:
http://eclipsesource.com/blogs/tutorials/emf-tutorial/
http://www.vogella.com/tutorials/EclipseEMF/article.html
Re: UnsupportedOperationException from Model and UMLPackage [message #1725441 is a reply to message #1725064] Thu, 03 March 2016 09:28 Go to previous messageGo to next message
Eclipse UserFriend
Felix Dorner wrote on Mon, 29 February 2016 13:42
If you have org.eclipse.uml2 in your current target platform definition, you can select it and press OK.
If you do not, then you will need a target definition which contains it.
If that's the case, just tell us and we'll help with that.

Hi Felix, today I am trying with a fresh install of Eclipse and EMF. I
- Removed the old Eclipse directory
- Downloaded actual eclipse-jee-mars-R-win32-x86_64.zip
- Unzipped it to new Eclipse directory C:\progs\
- Started Eclipse for setting the workspace
| End

EMF-Installation:
https://www.eclipse.org/modeling/emf/downloads/? => emf-xsd-Update-2.11.1.zip
containing binary\, features\, plugins\ and 2 jars
Unzip emf-xsd-Update-2.11.1.zip to C:\progs\eclipse\ => merging features\ and merging plugins\ without overwriting any
Eclipse | Package Explorer | MoCoEMF | Project | Properties | Java build path | Libraries:
Removed the old emf and uml2 jars =>
only JRE System Library [JavaSE-1.8] and Plug-in Dependencies (all based on the new directory C:\progs\eclipse\plugins\) | Ok
Eclipse restart
Eclipse | Package Explorer | MoCoEMF | Project | Properties | Plug-in Development | Runtime Classpath: /MoCoEMF/bin | OK
Eclipse restart

The imports that my program needs are:
// C:\Users\Thomas.Taeger\.p2\pool\plugins\:
// org.eclipse.emf.common_....jar:
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
// org.eclipse.emf.ecore._....jar:
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
// org.eclipse.emf.ecore.xmi_....jar
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
// org.eclipse.uml2.types_....jar:
// org.eclipse.uml2.uml_....jar:
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.Model;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Operation;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.Port;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.Type;
import org.eclipse.uml2.uml.UMLFactory;

In Eclipse | Package Explorer | MoCoEMF | META-INF | MANIFEST.MF | Dependencies:
org.eclipse.core.runtime exists, but org.eclipse.uml2[.uml] not yet =>
| Add... | Select a Plug-in:
org.eclipse.uml2[.uml] is not offered => I need that target platform | Cancel

Getting a target definition and setting it as the target platform:
Eclipse | Window | Preferences... | Plug-in Development | Target Platform
| Add... => "Create a target definition":
Here I got lost:

Initialize the target definition with: Default target for the running platform
=> "Target Content":
Name: "EMF Platform" (instead of "Running Platform")
Locations: ${eclipse_home} 924 plug-ins available
Content:
|v| ... all selected ...
| Add: ????
Implicit Dependencies
| Add... ????
????

Can you please help me with creating a target definition?

Best regards - Thomas
Re: UnsupportedOperationException from Model and UMLPackage [message #1725446 is a reply to message #1725441] Thu, 03 March 2016 09:48 Go to previous messageGo to next message
Eclipse UserFriend
Thomas Taeger wrote on Thu, 03 March 2016 14:28
EMF-Installation:
https://www.eclipse.org/modeling/emf/downloads/? => emf-xsd-Update-2.11.1.zip
containing binary\, features\, plugins\ and 2 jars
Unzip emf-xsd-Update-2.11.1.zip to C:\progs\eclipse\ => merging features\ and merging plugins\ without overwriting any
Eclipse | Package Explorer | MoCoEMF | Project | Properties | Java build path | Libraries:
Removed the old emf and uml2 jars =>
only JRE System Library [JavaSE-1.8] and Plug-in Dependencies (all based on the new directory C:\progs\eclipse\plugins\) | Ok
Eclipse restart
Eclipse | Package Explorer | MoCoEMF | Project | Properties | Plug-in Development | Runtime Classpath: /MoCoEMF/bin | OK
Eclipse restart


First, you don't install a feature or plug-in into Eclipse by manually extracting ZIP files and "merging" contents. That will not work and likely result in a hosed up installation. Eclipse provides the Install New Software wizard (under the Help menu) to install stuff into your existing Eclipse. Details can be found here. You probably want the EMF SDK feature(s). Note that since you're doing EMF and Eclipse plug-in development, you might want to start with the Modeling Tools or Committers packages. In any case you can always add features you need. Just don't try manually extracting files on top of your installation.

Second, you seem to be restarting Eclipse quite often as you try things, but that's not necessary. The only time Eclipse needs a restart is after installing or uninstalling a feature or plug-in(s), and it will prompt you. Changing your projects inside Eclipse does NOT require restart. In general, Eclipse will tell you when a restart is needed, otherwise you don't need to.

Finally, in general it seems your inclination is to do things manually (such as extracting files into your Eclipse installation, editing classpath files, etc). Fight that inclination; in general, plug-in development tools are there to do almost everything you need to do. In other words, there's almost always going to be a GUI, so if you find yourself doing stuff "manually" stop and look through the tutorials and/or documentation first. And of course specific questions are welcomed around here.

Oh yeah, about help creating a Target Definition... did you read the tutorial(s) that was pointed out earlier in this thread?

[Updated on: Thu, 03 March 2016 09:49] by Moderator

Re: UnsupportedOperationException from Model and UMLPackage [message #1725494 is a reply to message #1725441] Thu, 03 March 2016 15:51 Go to previous message
Eclipse UserFriend
On 03-Mar-16 15:28, Thomas Taeger wrote:

> Can you please help me with creating a target definition?
Yes but only after you read what Eric mentioned in his other reply, in
particular Platform Plug-in Development Guide, Plug-in Development
Environment , and EMF Developer Guide on
http://help.eclipse.org/mars/index.jsp
Previous Topic:NPE on selecting 2 eobjects from 2 projects
Next Topic:[CDO] How does CDO has support for history view?
Goto Forum:
  


Current Time: Tue Aug 19 18:50:32 EDT 2025

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

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

Back to the top