KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > dolphin > actions > ChangeWorkspaceAction


1 /*
2 * Copyright (C) 2005 Bourgeon Jérôme, Macherel Bruno
3 *
4 * This file is part of Dolphin
5 *
6 * Dolphin : An open source J2EE Deployment Tool JSR-88 compliant
7 * Contact: ishmael-dev@objectweb.org
8 *
9 * Dolphin is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or any later version.
13 *
14 * Dolphin is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with Dolphin; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 * USA
23 */

24 package org.objectweb.dolphin.actions;
25
26 import org.eclipse.jface.action.Action;
27 import org.eclipse.jface.action.IAction;
28 import org.eclipse.swt.widgets.Shell;
29 import org.eclipse.ui.IWorkbenchWindow;
30 import org.objectweb.dolphin.dialogs.DialogWorkspace;
31
32
33 /**
34  * Class who implements the action for changing the Dolphin workspace
35  * @author Bourgeon Jérôme, Macherel Bruno
36  */

37 public class ChangeWorkspaceAction extends Action {
38
39     /**
40      * private decalarion of the element window
41      */

42     private IWorkbenchWindow fWindow;
43
44
45     /**
46      * Constructor
47      * @param window
48      */

49     public ChangeWorkspaceAction(IWorkbenchWindow window) {
50         init(window);
51         setEnabled(true);
52     }
53
54     /**
55      * Initialize the class
56      * @param window
57      */

58     public void init(IWorkbenchWindow window) {
59         fWindow= window;
60         setId("org.objectweb.dolphin.actions.ChangeWorkspaceAction");
61         setText("Switch Workspace");
62         setToolTipText("Change the current workspace to another one");
63     }
64
65     /**
66      * Dispose the window
67      */

68     public void dispose() {
69         fWindow = null;
70
71     }
72
73     /**
74      * run the the action for cchanging the workspace
75      * @param action
76      */

77     public void run(IAction action) {
78         run();
79
80     }
81
82
83
84     /* (non-Javadoc)
85      * @see org.eclipse.jface.action.IAction#run()
86      */

87     public void run(){
88         Shell parentshell = new Shell();//fWindow.getShell();
89
// FormLayout form = new FormLayout();
90
// parentshell.setLayout(form);
91
// parentshell.setSize(300,200);
92
// parentshell.setText("Choose workspace");
93
// parentshell.setToolTipText("Choose a new workspace");
94
// parentshell.setImage(DolphinPlugin.getImageDescriptor("images/icons/dolphin.gif").createImage());
95
DialogWorkspace dialog = new DialogWorkspace(parentshell);
96         parentshell.pack();
97         dialog.open();
98     }
99
100 }
101
Popular Tags