[jbosstools-dev] [Fwd: [jbosstools-commits] JBoss Tools SVN: r3757 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view: src/org/jboss/tools/hibernate/ui/view/views and 1 other directory.]
Max Rydahl Andersen
max.andersen at redhat.com
Mon Sep 24 11:43:52 EDT 2007
dma at exadel.com wrote:
> Hi Michael,
>
> Great that you are trying to fix JBIDE-611.
>
> Got some comments on that:
>
> 1) Any way that this could be done in the hibernate tools plugin instead
> of the unrelated diagram plugin ? (I don't see you are using any
> new plugins for this so should be in the core of hibernate tools imo)
>
> +++
> Yes, hibernate tools core is better place for that code but I thougth I
> can't change this plugin. If I can't use the original code of core how I
> can do it? Should I ask you to make some changes or can I do it myself?
> +++
For this thing where you are only adding an entry to plugin.xml and add
a new class you can just do it your self and i'll look at it when you
commit it.
> 3) This code looks like it is assuming everything are done in mapping
> files and with a cfg.xml file; is that correct ? What about annotated
> classes?
>
> +++
> I remember comment in jira about it. I work with this point now.
> +++
Basically it probably should just try and see if it can find the mapped
class mentioned in hibernate.cfg.xml (if that exists) and if no listing
is found there load the java file.
> 4) you have copied a large chunk of code from hibernate tools plugin to
> locate the default project; why don't you use the existing code for that ?
>
> +++
> You speak about code
>
> ILaunchManager launchManager =
> DebugPlugin.getDefault().getLaunchManager();
> ILaunchConfigurationType launchConfigurationType =
> launchManager.getLaunchConfigurationType(
> "org.hibernate.eclipse.launch.ConsoleConfigurationLaunchConfigurationType" );
> ILaunchConfiguration[] launchConfigurations;
> try {
> launchConfigurations = launchManager.getLaunchConfigurations(
> launchConfigurationType );
> for (int i = 0; i < launchConfigurations.length; i++) { // can't
> believe there is no look up by name API
> ILaunchConfiguration launchConfiguration = launchConfigurations[i];
> if(launchConfiguration.getName().equals(consoleConfiguration.getName()))
> {
> proj =
> ProjectUtils.findJavaProject(launchConfiguration.getAttribute(IConsoleConfigurationLaunchConstants.PROJECT_NAME,
> ""));
> }
> }
> } catch (CoreException e1) {
> ViewPlugin.getDefault().logError("Can't find java project.", e1);
> }
>
> in OpenMappingActionDelegate class. Is that correct?
> +++
Yes.
And now that I read it more thoroughly I can see your code is a bit
different since it scan's all hibernate console configurations to find
the config and possible matching project name.
It's not pretty but the following should work:
((EclipseConsoleConfigurationPreferences)consoleConfiguration.getPreferences()).getProjectName();
Isn't that what you want ? The java project associated with the console
configuration ? (remember that this can be null so remember check for null ;
/max
More information about the jbosstools-dev
mailing list