Home » Eclipse Projects » Eclipse Platform » Obtaining *all* referenced projects (including plugins and external folders)
Obtaining *all* referenced projects (including plugins and external folders) [message #331500] |
Wed, 10 September 2008 14:46 |
Patrick Schoenbach Messages: 110 Registered: July 2009 |
Senior Member |
|
|
Hi,
at the moment, our plugin uses getReferencedProjects() of IProject to
find out the referenced projects. However, this does not work if
projects in a second runtime Eclipse instance contain references to the
workspace of the "outer" Eclipse instance.
How do I get all referenced projects including references to external
folders?
--
Regards,
Patrick
--
Patrick Schönbach
Software Engineer
PGP public key available. Key ID: 0B7DDE39
Or email to pgp@robustsoft.de with subject 'pschoenb'.
Fingerprint: BE80 0E7E B68E CE99 623C 902D 62A6 806A 0B7D DE39
web: http://www.itemis.de
mail: schoenbach@itemis.de
xing: https://www.xing.com/profile/Patrick_Schoenbach
itemis AG
Schauenburgerstraße 116
24118 Kiel
Germany
Rechtlicher Hinweis:
Amtsgericht Dortmund, HRB 20621
Vorstand: Wolfgang Neuhaus, Jens Wagener, Dr. Georg Pietrek
Aufsichtsrat: Dr. Burkhard Igel(Vors.), Stephan Grollmann, Michael
Neuhaus
|
|
| |
Re: Obtaining *all* referenced projects (including plugins and external folders) [message #331512 is a reply to message #331501] |
Wed, 10 September 2008 19:58 |
Patrick Schoenbach Messages: 110 Registered: July 2009 |
Senior Member |
|
|
On Wed, 10 Sep 2008 11:35:34 -0400, Ed Merks wrote:
> Patrick,
>
> I wonder if you need to consider the dynamic references:
>
> project.getDescription().getDynamicReferences()
This method returns an empty array in my case.
--
Regards,
Patrick
--
Patrick Schönbach
Software Engineer
PGP public key available. Key ID: 0B7DDE39
Or email to pgp@robustsoft.de with subject 'pschoenb'.
Fingerprint: BE80 0E7E B68E CE99 623C 902D 62A6 806A 0B7D DE39
web: http://www.itemis.de
mail: schoenbach@itemis.de
xing: https://www.xing.com/profile/Patrick_Schoenbach
itemis AG
Schauenburgerstraße 116
24118 Kiel
Germany
Rechtlicher Hinweis:
Amtsgericht Dortmund, HRB 20621
Vorstand: Wolfgang Neuhaus, Jens Wagener, Dr. Georg Pietrek
Aufsichtsrat: Dr. Burkhard Igel(Vors.), Stephan Grollmann, Michael
Neuhaus
|
|
| |
Re: Obtaining *all* referenced projects (including plugins and external folders) [message #331515 is a reply to message #331513] |
Wed, 10 September 2008 22:05 |
Patrick Schoenbach Messages: 110 Registered: July 2009 |
Senior Member |
|
|
On Wed, 10 Sep 2008 17:20:08 -0400, Ed Merks wrote:
> Patrick,
>
> I have a feeling that this is just the way it works. The referenced
> IProjects, if they aren't actually in your workspace, are not going to
> be accessible via the IProject anyway, even if the methods did return
> them (and the methods do hint that they would). Maybe I should ask more
> generally what you're trying to do? For sure you won't be able to
> access these other projects via the Eclipse resource APIs...
Actually, my goal is to find and load a referenced Ecore. The current
code works, except for external folders, and we want to fix this. See:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=244516
--
Regards,
Patrick
--
Patrick Schönbach
Software Engineer
PGP public key available. Key ID: 0B7DDE39
Or email to pgp@robustsoft.de with subject 'pschoenb'.
Fingerprint: BE80 0E7E B68E CE99 623C 902D 62A6 806A 0B7D DE39
web: http://www.itemis.de
mail: schoenbach@itemis.de
xing: https://www.xing.com/profile/Patrick_Schoenbach
itemis AG
Schauenburgerstraße 116
24118 Kiel
Germany
Rechtlicher Hinweis:
Amtsgericht Dortmund, HRB 20621
Vorstand: Wolfgang Neuhaus, Jens Wagener, Dr. Georg Pietrek
Aufsichtsrat: Dr. Burkhard Igel(Vors.), Stephan Grollmann, Michael
Neuhaus
|
|
| |
Re: Obtaining *all* referenced projects (including plugins and external folders) [message #331522 is a reply to message #331519] |
Thu, 11 September 2008 11:23 |
Patrick Schoenbach Messages: 110 Registered: July 2009 |
Senior Member |
|
|
On Thu, 11 Sep 2008 06:15:49 -0400, Ed Merks wrote:
> What this does is ensure that references of the form
> platform:/resource/<project-name>/... are redirected to
> platform:/plugin/<plugin-id>/... (where project name and plugin-id are
> expected to match) if the project isn't in the workspace but there is a
> generated modeling in the runtime that has registered its model/*.ecore
> serialized version. And also references of the form
> platform:/plugin/<plugin-id>/... are redirected to
> platform:/resource/<project-name>/... so that even for registered
> models, the workspace version takes precedence... I'm not sure if this
> approach would help...
It might help or it might not. But I am not sure yet, that I fully
understand how this works. Could you please elaborate?
--
Regards,
Patrick
--
Patrick Schönbach
Software Engineer
PGP public key available. Key ID: 0B7DDE39
Or email to pgp@robustsoft.de with subject 'pschoenb'.
Fingerprint: BE80 0E7E B68E CE99 623C 902D 62A6 806A 0B7D DE39
web: http://www.itemis.de
mail: schoenbach@itemis.de
xing: https://www.xing.com/profile/Patrick_Schoenbach
itemis AG
Schauenburgerstraße 116
24118 Kiel
Germany
Rechtlicher Hinweis:
Amtsgericht Dortmund, HRB 20621
Vorstand: Wolfgang Neuhaus, Jens Wagener, Dr. Georg Pietrek
Aufsichtsrat: Dr. Burkhard Igel(Vors.), Stephan Grollmann, Michael
Neuhaus
|
|
| |
Re: Obtaining *all* referenced projects (including plugins and external folders) [message #331548 is a reply to message #331523] |
Thu, 11 September 2008 16:38 |
Patrick Schoenbach Messages: 110 Registered: July 2009 |
Senior Member |
|
|
On Thu, 11 Sep 2008 08:13:07 -0400, Ed Merks wrote:
> Maybe you could elaborate on the problem you are trying to solve?
Well, actually the problematic code location looks as follows:
private EPackage[] getMetamodelsForProjectInternal(IJavaProject
project, Set<String> visited) {
if (visited.contains(project.getProject().getName()))
return new EPackage[0];
visited.add(project.getProject().getName());
ProjectAnalyzer projectAnalyzer =
getProjectAnalyzer(project.getProject());
if (projectAnalyzer == null) {
return new EPackage[0];
}
// wait if analyzation is currently executed
while (projectAnalyzer.getState() == Job.RUNNING ||
projectAnalyzer.getState() == Job.WAITING) {
try {
Thread.sleep(500l);
if (EmfToolsPlugin.trace)
System.out.println("Waiting 500ms for ProjectAnalyzer of project "
+ project.getProject().getName() + " to finish.");
} catch (InterruptedException e) {
EmfToolsLog.logError(e);
}
}
Map<String, EPackage> packages = new HashMap<String,
EPackage>(projectAnalyzer.getNamedEPackageMap());
try {
for (IProject p : project.getProject().getReferencedProjects()) {
IJavaProject jp = JavaCore.create(p);
EPackage[] ps = getMetamodelsForProjectInternal(jp, visited);
for (EPackage package1 : ps) {
if (!packages.containsKey(package1.getNsURI())) {
packages.put(package1.getNsURI(), package1);
}
}
}
} catch (CoreException e) {
EmfToolsLog.logError(e);
}
return packages.values().toArray(new
EPackage[packages.values().size()]);
}
The ProjectAnalyzer mentioned in the code, tries to obtain an IResource
to the found Ecore file. The problem is that all this does not work, if
the Ecore model is located in an external folder.
--
Regards,
Patrick
--
Patrick Schönbach
Software Engineer
PGP public key available. Key ID: 0B7DDE39
Or email to pgp@robustsoft.de with subject 'pschoenb'.
Fingerprint: BE80 0E7E B68E CE99 623C 902D 62A6 806A 0B7D DE39
web: http://www.itemis.de
mail: schoenbach@itemis.de
xing: https://www.xing.com/profile/Patrick_Schoenbach
itemis AG
Schauenburgerstraße 116
24118 Kiel
Germany
Rechtlicher Hinweis:
Amtsgericht Dortmund, HRB 20621
Vorstand: Wolfgang Neuhaus, Jens Wagener, Dr. Georg Pietrek
Aufsichtsrat: Dr. Burkhard Igel(Vors.), Stephan Grollmann, Michael
Neuhaus
|
|
| |
Re: Obtaining *all* referenced projects (including plugins and external folders) [message #331554 is a reply to message #331552] |
Thu, 11 September 2008 17:42 |
Patrick Schoenbach Messages: 110 Registered: July 2009 |
Senior Member |
|
|
On Thu, 11 Sep 2008 13:17:39 -0400, Ed Merks wrote:
> Yes, and it's simply impossible to make this work. At some point I hope
> to find time to be able to build a package registry that's able to work
> with the target platform as in that EMF bugzilla I referenced. But
> unless you change your design not to rely on everything being in the
> workspace, there's really nothing you can do...
Ok. Is there currently a possible design that would be able to find
models in the workspace, inside deployed plugins, *and* external
folders?
--
Patrick Schönbach
Software Engineer
PGP public key available. Key ID: 0B7DDE39
Or email to pgp@robustsoft.de with subject 'pschoenb'.
Fingerprint: BE80 0E7E B68E CE99 623C 902D 62A6 806A 0B7D DE39
web: http://www.itemis.de
mail: schoenbach@itemis.de
xing: https://www.xing.com/profile/Patrick_Schoenbach
itemis AG
Schauenburgerstraße 116
24118 Kiel
Germany
Rechtlicher Hinweis:
Amtsgericht Dortmund, HRB 20621
Vorstand: Wolfgang Neuhaus, Jens Wagener, Dr. Georg Pietrek
Aufsichtsrat: Dr. Burkhard Igel(Vors.), Stephan Grollmann, Michael
Neuhaus
|
|
|
Re: Obtaining *all* referenced projects (including plugins and external folders) [message #331561 is a reply to message #331554] |
Thu, 11 September 2008 18:27 |
Ed Merks Messages: 33264 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------050008010306010104000906
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Patrick,
In the workspace you could do what you have now. In deployed plugins,
it's possible to force the plugin URL to be converted to a file URL, and
of course that turns it into the final case of pawing through the file
system directly. It's probably good to take a step back and look
consider very carefully how what's being done here is similar to the way
PDE manages and provides access to the target platform... You might
want to treat the problem you're trying to fix as a short term
limitation. Perhaps when I'm in Germany the week of Oct 13th we can
discuss the design choices...
Patrick Sch
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Goto Forum:
Current Time: Fri Dec 27 11:49:00 GMT 2024
Powered by FUDForum. Page generated in 0.05148 seconds
|