1 5 package org.hibernate.eclipse.console.actions; 6 7 import java.util.Iterator ; 8 9 import org.eclipse.jface.viewers.StructuredSelection; 10 import org.eclipse.jface.wizard.WizardDialog; 11 import org.eclipse.ui.IWorkbenchWindow; 12 import org.eclipse.ui.PlatformUI; 13 import org.hibernate.HibernateException; 14 import org.hibernate.console.ConsoleConfiguration; 15 import org.hibernate.console.node.BaseNode; 16 import org.hibernate.eclipse.console.HibernateConsolePlugin; 17 import org.hibernate.eclipse.console.wizards.ConsoleConfigurationCreationWizard; 18 19 23 public class EditConsoleConfiguration extends ConsoleConfigurationBasedAction { 24 25 28 public EditConsoleConfiguration() { 29 super("Edit Configuration"); 30 } 31 32 protected void doRun() { 33 for (Iterator i = getSelectedNonResources().iterator(); i.hasNext();) { 34 try { 35 BaseNode node = ((BaseNode) i.next()); 36 final ConsoleConfiguration config = node.getConsoleConfiguration(); 37 ConsoleConfigurationCreationWizard wizard = new ConsoleConfigurationCreationWizard(); 38 wizard.init(PlatformUI.getWorkbench(), new StructuredSelection(config)); 39 IWorkbenchWindow win = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); 40 41 WizardDialog dialog = new WizardDialog(win.getShell(), wizard); 42 dialog.open(); } catch(HibernateException he) { 44 HibernateConsolePlugin.getDefault().showError(null, "Exception while trying to edit configuration", he); 45 } 46 } 47 } 48 49 protected boolean updateState(ConsoleConfiguration consoleConfiguration) { 50 return true; 51 } 52 } 53 | Popular Tags |