Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Setting up Eclipse for Reflective API
Setting up Eclipse for Reflective API [message #414841] Sun, 25 November 2007 17:31 Go to next message
Mark Melia is currently offline Mark Melia
Messages: 142
Registered: July 2009
Senior Member
Hi,

I want to use EMF's reflective api. I have up to now being using eclipse
graphical editor, but now with a new project i want to try out the
reflective api. What I have done is set up a new java project and copied
in some code from an example, but this wont compile as the project doesnt
know where the EMF jars are - am i meant add the EMF plugin jars to my
project to get this working?

Any help would be much appriciated.

Thanks,
Mark
Re: Setting up Eclipse for Reflective API [message #414842 is a reply to message #414841] Sun, 25 November 2007 17:47 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26137
Registered: July 2009
Senior Member
Mark,

In general, it's easiest to set up a plugin project and then in the
MANIFEST.MF you can add dependencies on EMF's plugins without worrying
about the physical location of the jars. If you use
File->New->Project...->Eclipse Modeling Framework->Empty EMF Project you
end up with something that's already set up to have dependencies on
EMF's core runtime and you can then edit the MANIFEST.MF to add
dependencies on the org.eclipse.emf.ecore.xmi plugin or anything else
you want to use in your project...


Mark Melia wrote:
> Hi,
>
> I want to use EMF's reflective api. I have up to now being using
> eclipse graphical editor, but now with a new project i want to try out
> the reflective api. What I have done is set up a new java project and
> copied in some code from an example, but this wont compile as the
> project doesnt know where the EMF jars are - am i meant add the EMF
> plugin jars to my project to get this working?
>
> Any help would be much appriciated.
> Thanks,
> Mark
>
Re: Setting up Eclipse for Reflective API [message #414843 is a reply to message #414842] Sun, 25 November 2007 18:47 Go to previous messageGo to next message
Mark Melia is currently offline Mark Melia
Messages: 142
Registered: July 2009
Senior Member
Hi Ed,

Thanks for the quick reply! I have done what you have said and have an
empty EMF project - this works perfectly as I can create ecore models, but
I now want to add a java class to use the reflective api (i think) but I
cant seem to do this as the project is not a java project.

Also, if I wanted to use this on a web server - is there some way of
figuring out what EMF jars are being used so I can put them in the
classpath at runtime?

Again, thanks for your help, much appreciated.

Mark
Re: Setting up Eclipse for Reflective API [message #414844 is a reply to message #414843] Sun, 25 November 2007 20:07 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26137
Registered: July 2009
Senior Member
Mark,

Comments below.

Mark Melia wrote:
> Hi Ed,
>
> Thanks for the quick reply! I have done what you have said and have an
> empty EMF project - this works perfectly as I can create ecore models,
> but I now want to add a java class to use the reflective api (i think)
> but I cant seem to do this as the project is not a java project.
Certainly the project EMF creates for you will always be a Java
project. Only if it's a project with a Java nature will you be able to
build Java files effectively. How did you create the project you are using?
> Also, if I wanted to use this on a web server - is there some way of
> figuring out what EMF jars are being used so I can put them in the
> classpath at runtime?
If you look in the plugins folder of your Eclipse installation, you'll
see that each EMF plugin is a jar, i.e., org.eclipse.emf.common_*.jar.
So exactly the plugins you'd normally depend on when build your own
plugin (which you can see listed in the "Plug-in Dependencies" "folder"
in the Package Explorere) you can add their corresponding jars to the
classpath.
>
> Again, thanks for your help, much appreciated.
>
> Mark
>
>
>
Re: Setting up Eclipse for Reflective API [message #414845 is a reply to message #414844] Sun, 25 November 2007 21:36 Go to previous messageGo to next message
Mark Melia is currently offline Mark Melia
Messages: 142
Registered: July 2009
Senior Member
Hi Ed,

Thanks again, I created the project by
File -> New -> Project
Empty EMF Project .

Can you point me to where I can find out more information about where to
set the project as "Java Nature".

Mark

Ed Merks wrote:

> Mark,

> Comments below.

> Mark Melia wrote:
>> Hi Ed,
>>
>> Thanks for the quick reply! I have done what you have said and have an
>> empty EMF project - this works perfectly as I can create ecore models,
>> but I now want to add a java class to use the reflective api (i think)
>> but I cant seem to do this as the project is not a java project.
> Certainly the project EMF creates for you will always be a Java
> project. Only if it's a project with a Java nature will you be able to
> build Java files effectively. How did you create the project you are using?
>> Also, if I wanted to use this on a web server - is there some way of
>> figuring out what EMF jars are being used so I can put them in the
>> classpath at runtime?
> If you look in the plugins folder of your Eclipse installation, you'll
> see that each EMF plugin is a jar, i.e., org.eclipse.emf.common_*.jar.
> So exactly the plugins you'd normally depend on when build your own
> plugin (which you can see listed in the "Plug-in Dependencies" "folder"
> in the Package Explorere) you can add their corresponding jars to the
> classpath.
>>
>> Again, thanks for your help, much appreciated.
>>
>> Mark
>>
>>
>>
Re: Setting up Eclipse for Reflective API [message #414848 is a reply to message #414845] Mon, 26 November 2007 11:12 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26137
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040709040700060705000108
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Mark,

If in the Package Explorer you use the little drop down arrow button in
the upper corner to bring up the "Filters..." menu and make sure the .*
resource filter is not check marked, you'll be able to see the files
that start with . like the .project that's in the root of every
project. In there is were the natures are specified, including the
*javanature*.

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>library</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>*
<nature>org.eclipse.jdt.core.javanature</nature>*
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>

I don't think there's a way via the IDE to just set the Java nature. I
think you have to create the right type of project to begin with.
There's lots of online help within the IDE for JDT, so that's a good
place to find out more about everything (Help->Help Contents).


Mark Melia wrote:
> Hi Ed,
>
> Thanks again, I created the project by File -> New -> Project
> Empty EMF Project .
>
> Can you point me to where I can find out more information about where
> to set the project as "Java Nature".
>
> Mark
>
> Ed Merks wrote:
>
>> Mark,
>
>> Comments below.
>
>> Mark Melia wrote:
>>> Hi Ed,
>>>
>>> Thanks for the quick reply! I have done what you have said and have
>>> an empty EMF project - this works perfectly as I can create ecore
>>> models, but I now want to add a java class to use the reflective api
>>> (i think) but I cant seem to do this as the project is not a java
>>> project.
>> Certainly the project EMF creates for you will always be a Java
>> project. Only if it's a project with a Java nature will you be able
>> to build Java files effectively. How did you create the project you
>> are using?
>>> Also, if I wanted to use this on a web server - is there some way of
>>> figuring out what EMF jars are being used so I can put them in the
>>> classpath at runtime?
>> If you look in the plugins folder of your Eclipse installation,
>> you'll see that each EMF plugin is a jar, i.e.,
>> org.eclipse.emf.common_*.jar. So exactly the plugins you'd normally
>> depend on when build your own plugin (which you can see listed in the
>> "Plug-in Dependencies" "folder" in the Package Explorere) you can add
>> their corresponding jars to the classpath.
>>>
>>> Again, thanks for your help, much appreciated.
>>>
>>> Mark
>>>
>>>
>>>
>
>


--------------040709040700060705000108
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Mark,<br>
<br>
If in the Package Explorer you use the little drop down arrow button in
the upper corner to bring up the "Filters..." menu and make sure the .*
resource filter is not check marked, you'll be able to see the files
that start with . like the .project that's in the root of every
project.
Previous Topic:Automation for Genmodel, Model-Generation and others
Next Topic:how to use treeViewer getExpandedElements method
Goto Forum:
  


Current Time: Thu Oct 23 02:33:35 GMT 2014

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

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