Author: mdryakhlenkov
Date: 2007-07-30 11:40:23 -0400 (Mon, 30 Jul 2007)
New Revision: 2718
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java
Log:
EXIN-369: Saving positions and states (visible/hidden) of diagram elements
Creating file for save.
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java 2007-07-30
15:33:42 UTC (rev 2717)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java 2007-07-30
15:40:23 UTC (rev 2718)
@@ -12,6 +12,12 @@
import java.util.HashMap;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.TreeSelection;
@@ -21,6 +27,9 @@
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.internal.ObjectPluginAction;
import org.hibernate.cfg.Configuration;
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.eclipse.console.utils.ProjectUtils;
+import org.hibernate.eclipse.launch.IConsoleConfigurationLaunchConstants;
import org.jboss.tools.hibernate.ui.view.ViewPlugin;
public class OpenDiagramActionDelegate implements IObjectActionDelegate {
@@ -33,9 +42,29 @@
ObjectPluginAction objectPluginAction = (ObjectPluginAction)action;
Object rootClass =
((TreeSelection)objectPluginAction.getSelection()).getFirstElement();
ObjectEditorInput input = (ObjectEditorInput)hashMap.get(rootClass);
- Configuration configuration =
(Configuration)(((TreeSelection)objectPluginAction.getSelection()).getPaths()[0]).getSegment(1);
+// Configuration configuration =
(Configuration)(((TreeSelection)objectPluginAction.getSelection()).getPaths()[0]).getSegment(1);
+ ConsoleConfiguration consoleConfiguration =
(ConsoleConfiguration)(((TreeSelection)objectPluginAction.getSelection()).getPaths()[0]).getSegment(0);
+
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+
+ ILaunchConfigurationType launchConfigurationType =
launchManager.getLaunchConfigurationType(
"org.hibernate.eclipse.launch.ConsoleConfigurationLaunchConfigurationType" );
+ ILaunchConfiguration[] launchConfigurations;
+ IJavaProject proj = null;
+ 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);
+ }
+
+
if(input == null) {
- input = new ObjectEditorInput(configuration, rootClass);
+ input = new ObjectEditorInput(consoleConfiguration, rootClass, proj);
hashMap.put(rootClass, input);
}
try {
Show replies by date