[jboss-cvs] jbosside/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions ...
Max Rydahl Andersen
mandersen at jboss.com
Tue Feb 20 08:21:50 EST 2007
User: mandersen
Date: 07/02/20 08:21:50
Modified: hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions
AddConfigurationAction.java
EditConsoleConfiguration.java
Log:
HBX-889 sort console configuration lists in ui
HBX-637 Provide ability to import/export console configs
HBX-863 Hibernate Code Generation toolbar group is appearing in all Eclipse perspectives.
Revision Changes Path
1.6 +25 -5 jbosside/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/AddConfigurationAction.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AddConfigurationAction.java
===================================================================
RCS file: /cvsroot/jboss/jbosside/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/AddConfigurationAction.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- AddConfigurationAction.java 7 Jul 2006 13:51:09 -0000 1.5
+++ AddConfigurationAction.java 20 Feb 2007 13:21:50 -0000 1.6
@@ -21,13 +21,19 @@
*/
package org.hibernate.eclipse.console.actions;
+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.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jface.action.Action;
-import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.PlatformUI;
import org.hibernate.console.ImageConstants;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.utils.EclipseImages;
-import org.hibernate.eclipse.console.wizards.ConsoleConfigurationCreationWizard;
/**
*
@@ -50,10 +56,24 @@
}
protected void doAddConfiguration() {
- ConsoleConfigurationCreationWizard wizard = new ConsoleConfigurationCreationWizard();
+ /*ConsoleConfigurationCreationWizard wizard = new ConsoleConfigurationCreationWizard();
wizard.init(PlatformUI.getWorkbench(), null); // initializes the wizard
WizardDialog dialog = new WizardDialog(part.getSite().getShell(), wizard);
- dialog.open(); // This opens a dialog
+ dialog.open(); // This opens a dialog*/
+
+ try {
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+
+ ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType( "org.hibernate.eclipse.launch.ConsoleConfigurationLaunchConfigurationType" );
+ String launchName = launchManager.generateUniqueLaunchConfigurationNameFrom("hibernate");
+ ILaunchConfiguration[] launchConfigurations = launchManager.getLaunchConfigurations( launchConfigurationType );
+ ILaunchConfigurationWorkingCopy wc = launchConfigurationType.newInstance(null, launchName);
+ int i = DebugUITools.openLaunchConfigurationPropertiesDialog( part.getSite().getShell(), wc, "org.eclipse.debug.ui.launchGroup.run" );
+
+ } catch (CoreException ce) {
+ HibernateConsolePlugin.getDefault().showError( part.getSite().getShell(), "Problem adding a console configuration", ce);
+ }
+
}
}
1.7 +31 -5 jbosside/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/EditConsoleConfiguration.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: EditConsoleConfiguration.java
===================================================================
RCS file: /cvsroot/jboss/jbosside/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/EditConsoleConfiguration.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- EditConsoleConfiguration.java 7 Jul 2006 13:51:09 -0000 1.6
+++ EditConsoleConfiguration.java 20 Feb 2007 13:21:50 -0000 1.7
@@ -23,6 +23,14 @@
import java.util.Iterator;
+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.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.IWorkbenchWindow;
@@ -75,12 +83,30 @@
}
private void edit(final ConsoleConfiguration config) {
+ IWorkbenchWindow win = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ /*if(MessageDialog.openQuestion( null, "Use old dialog ?", "Use old dialog" )) {
ConsoleConfigurationCreationWizard wizard = new ConsoleConfigurationCreationWizard();
wizard.init(PlatformUI.getWorkbench(), new StructuredSelection(config) );
- IWorkbenchWindow win = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+
WizardDialog dialog = new WizardDialog(win.getShell(), wizard);
dialog.open(); // This opens a dialog
+ } else {*/
+ try {
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+
+ ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType( "org.hibernate.eclipse.launch.ConsoleConfigurationLaunchConfigurationType" );
+ ILaunchConfiguration[] 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(config.getName())) {
+ DebugUITools.openLaunchConfigurationPropertiesDialog( win.getShell(), launchConfiguration, "org.eclipse.debug.ui.launchGroup.run" );
+ }
+ }
+ } catch (CoreException ce) {
+ HibernateConsolePlugin.getDefault().showError( win.getShell(), "Problem adding a console configuration", ce);
+ }
+ //}
}
protected boolean updateState(ConsoleConfiguration consoleConfiguration) {
More information about the jboss-cvs-commits
mailing list