KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > eclipse > console > actions > AddConfigurationAction


1 /*
2  * Created on 2004-10-29 by max
3  *
4  */

5 package org.hibernate.eclipse.console.actions;
6
7 import org.eclipse.core.resources.ResourcesPlugin;
8 import org.eclipse.jface.action.Action;
9 import org.eclipse.jface.wizard.WizardDialog;
10 import org.eclipse.ui.IViewPart;
11 import org.eclipse.ui.PlatformUI;
12 import org.hibernate.console.ImageConstants;
13 import org.hibernate.eclipse.console.utils.EclipseImages;
14 import org.hibernate.eclipse.console.wizards.ConsoleConfigurationCreationWizard;
15
16 /**
17  *
18  * Action that creates a ConsoleConfiguration
19  * @author max
20  *
21  */

22 public class AddConfigurationAction extends Action {
23
24     private final IViewPart part;
25
26     public AddConfigurationAction(IViewPart part) {
27         this.part = part;
28         setText("Add Configuration");
29         setImageDescriptor(EclipseImages.getImageDescriptor(ImageConstants.ADD));
30     }
31
32     public void run() {
33         doAddConfiguration();
34     }
35     
36     protected void doAddConfiguration() {
37         ConsoleConfigurationCreationWizard wizard = new ConsoleConfigurationCreationWizard();
38         wizard.init(PlatformUI.getWorkbench(), null); // initializes the wizard
39
WizardDialog dialog = new WizardDialog(part.getSite().getShell(), wizard);
40         dialog.open(); // This opens a dialog
41

42     }
43 }
44
Popular Tags