1 package net.sf.panoptes.module.jmx.wizard;
2
3 import java.util.Properties;
4
5 import net.sf.panoptes.controller.MBeanConnectionController;
6 import net.sf.panoptes.module.jmx.MBeanServerComponent;
7
8 import org.eclipse.jface.viewers.IStructuredSelection;
9 import org.eclipse.jface.wizard.Wizard;
10 import org.eclipse.ui.INewWizard;
11 import org.eclipse.ui.IWorkbench;
12
13 /***
14 * Wizard class
15 */
16 public class NewNodeWizard extends Wizard implements INewWizard {
17
18 private MBeanConnectionController controller;
19
20 NodeConnectionPage nodeConnectionPage;
21 MBeanServerComponent connection = null;
22 boolean connectImmediately = false;
23
24 protected IStructuredSelection selection;
25
26 protected IWorkbench workbench;
27
28 public NewNodeWizard(MBeanConnectionController controller) {
29 super();
30 this.controller = controller;
31 setNeedsProgressMonitor(true);
32
33 }
34
35 public void addPages() {
36 nodeConnectionPage = new NodeConnectionPage(null, null);
37 addPage(nodeConnectionPage);
38
39 }
40
41 public boolean canFinish() {
42 if (this.getContainer().getCurrentPage() == nodeConnectionPage
43 && this.getContainer().getCurrentPage().isPageComplete())
44 return true;
45 else
46 return false;
47 }
48
49 /***
50 * @see org.eclipse.jface.wizard.IWizard#performFinish()
51 */
52 public boolean performFinish() {
53 Properties props = new Properties();
54 props.put("hostname", nodeConnectionPage.getHostName());
55 props.put("port", String.valueOf(nodeConnectionPage.getPort()));
56
57 controller.addMBeanServerConnection(
58 nodeConnectionPage.getName(),
59 props,
60 nodeConnectionPage.getConnectorClass(),
61 nodeConnectionPage.connectImmediately());
62 return true;
63 }
64
65 public MBeanServerComponent getConnection() {
66 return connection;
67 }
68
69 public boolean connectImmediately() {
70 return connectImmediately;
71 }
72
73 /***
74 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
75 */
76 public void init(IWorkbench workbench, IStructuredSelection selection) {
77 }
78
79 }
This page was automatically generated by Maven