javadude2 / javadude

Automatically exported from code.google.com/p/javadude
0 stars 0 forks source link

working set based on Maven groupId #45

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I think automatic working sets is an interesting idea. It would be neat to
have an extension for m2eclipse http://m2eclipse.codehaus.org/ that would
use an artifact/project groupId as a base for the working set.

Original issue reported on code.google.com by ekules...@gmail.com on 20 Feb 2009 at 7:23

GoogleCodeExporter commented 9 years ago
hmmm... I'll have to take a peek. I'm not that familiar with m2eclipse yet, but 
I 
doubt it would be hard to do.

thanks for the idea!

Original comment by scott%ja...@gtempaccount.com on 20 Feb 2009 at 7:42

GoogleCodeExporter commented 9 years ago

Original comment by scott%ja...@gtempaccount.com on 20 Feb 2009 at 7:43

GoogleCodeExporter commented 9 years ago
You can use the following code from m2eclipse API to get the groupId:

MavenProjectManager projectManager = 
MavenPlugin.getDefault().getMavenProjectManager();
IMavenProjectFacade facade = projectManager.create(project, null);
if(facade!=null) {
  ArtifactKey artifactKey = facade.getArtifactKey();
  String groupId = artifactKey.getGroupId()
  ...
}

Original comment by ekules...@gmail.com on 20 Feb 2009 at 7:53

GoogleCodeExporter commented 9 years ago
cool...

I'll see if I can set up an extension point for the plugin to allow new dynamic 
working sets to be easily defined. Should be doable. Really only need to have 
the 
extensions code the set-inclusion test and property sheet to edit it... I 
really 
should have done that to start (though I did make some common base classes -- 
I'll 
just move the deets to an interface that extensions can implement)

This would definitely have to be in a separate plugin so I don't have the base 
working sets requiring m2eclipse. (Well, I could make the dep optional, but I 
think 
extensions would be cleaner)

Original comment by scott%ja...@gtempaccount.com on 20 Feb 2009 at 8:01

GoogleCodeExporter commented 9 years ago
Right, I think separate plugin that would depend on m2eclipse API makes sense.

Original comment by ekules...@gmail.com on 20 Feb 2009 at 8:04

GoogleCodeExporter commented 9 years ago
I've added in the m2eclipse support -- please give it a try.

It seems to sometimes not update properly; I haven't found the pattern to it 
yet. If 
a project that should appear in a m2eclipse working set doesn't, try 
right-clicking 
the working set, choosing properties and re-save it.

Original comment by scott%ja...@gtempaccount.com on 28 Feb 2009 at 3:30

GoogleCodeExporter commented 9 years ago
You may want to register a listener to get notified about project changes and if
possible, force refresh of the working set.

Original comment by ekules...@gmail.com on 28 Feb 2009 at 3:43

GoogleCodeExporter commented 9 years ago
actually I did set up listeners to the maven project manager

its seems that there are sometimes times when it can't properly set up the 
listener

I think there's a timing issue between when the working set updater is created 
and 
the maven project manager is created. The bundle deps will make it wait to 
activate 
the maven working set bundle until the maven bundle is created, but I think the 
maven project manager might not be created during its bundle's activation.

I put the listener setup in the working set updater constructor and sometimes I 
see 
an error in the log that I couldn't instantiate the updater.

I originally tried a standard resource updater and watched the pom.xml. This 
didn't 
work properly, as it seemed I was getting notified about the change before the 
maven 
project manager, so when I asked for the artifact and group ids I always got 
the 
*last* ids.

I'm getting the feeling the only safe solution would be to go back to listening 
to 
the pom and parse it myself... sigh...

Original comment by scott%ja...@gtempaccount.com on 28 Feb 2009 at 4:09