]> git.argeo.org Git - gpl/argeo-slc.git/blob - eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ManageBundlesHandler.java
add some comments to help understanding the approach
[gpl/argeo-slc.git] / eclipse / plugins / org.argeo.slc.client.ui / src / main / java / org / argeo / slc / client / ui / commands / ManageBundlesHandler.java
1 package org.argeo.slc.client.ui.commands;
2
3 import org.apache.commons.logging.Log;
4 import org.apache.commons.logging.LogFactory;
5 import org.argeo.slc.client.ui.ClientUiPlugin;
6 import org.eclipse.core.commands.AbstractHandler;
7 import org.eclipse.core.commands.ExecutionEvent;
8 import org.eclipse.core.commands.ExecutionException;
9 import org.eclipse.jface.dialogs.TitleAreaDialog;
10 import org.eclipse.swt.widgets.DirectoryDialog;
11 import org.eclipse.swt.widgets.Shell;
12
13 /**
14 * Command handler to manage existing bundles; add or remove specific ones.
15 *
16 * @author bsinou
17 *
18 */
19
20 public class ManageBundlesHandler extends AbstractHandler {
21 private static final Log log = LogFactory
22 .getLog(ManageBundlesHandler.class);
23
24 // private static final String DEFAULT_BUNDLE_DIR = "tmp";
25
26 public Object execute(ExecutionEvent event) throws ExecutionException {
27
28 Shell shell = ClientUiPlugin.getDefault().getWorkbench()
29 .getActiveWorkbenchWindow().getShell();
30 // LaunchConfigurationsDialog lcd;
31 // see http://kickjava.com/src/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java.htm
32 // to have more ideas about what to do.
33
34 TitleAreaDialog tad = new TitleAreaDialog(shell);
35 tad.setTitle("Manage Bundles");
36 tad.open();
37
38 DirectoryDialog dialog2 = new DirectoryDialog(shell);
39 String path = dialog2.open();
40
41 if (path == null)
42 // action canceled by user
43 return null;
44 log.debug("Path chosen by user : " + path);
45
46
47 // the following does not work : it doesn't display anything.
48 // Label label = new Label(shell, SWT.WRAP);
49 // label.setText("This is a long text string that will wrap when the dialog is resized.");
50 // List list = new List(shell, SWT.BORDER | SWT.H_SCROLL |
51 // SWT.V_SCROLL);
52 // list.setItems(new String[] { "Item 1", "Item 2" });
53 // Button button1 = new Button(shell, SWT.PUSH);
54 // button1.setText("OK");
55 // Button button2 = new Button(shell, SWT.PUSH);
56 // button2.setText("Cancel");
57 //
58 // final int insetX = 4, insetY = 4;
59 // FormLayout formLayout = new FormLayout();
60 // formLayout.marginWidth = insetX;
61 // formLayout.marginHeight = insetY;
62 // shell.setLayout(formLayout);
63 //
64 // Point size = label.computeSize(SWT.DEFAULT, SWT.DEFAULT);
65 // final FormData labelData = new FormData(size.x, SWT.DEFAULT);
66 // labelData.left = new FormAttachment(0, 0);
67 // labelData.right = new FormAttachment(100, 0);
68 // label.setLayoutData(labelData);
69 //
70 // FormData button2Data = new FormData();
71 // button2Data.right = new FormAttachment(100, -insetX);
72 // button2Data.bottom = new FormAttachment(100, 0);
73 // button2.setLayoutData(button2Data);
74 //
75 // FormData button1Data = new FormData();
76 // button1Data.right = new FormAttachment(button2, -insetX);
77 // button1Data.bottom = new FormAttachment(100, 0);
78 // button1.setLayoutData(button1Data);
79 //
80 // FormData listData = new FormData();
81 // listData.left = new FormAttachment(0, 0);
82 // listData.right = new FormAttachment(100, 0);
83 // listData.top = new FormAttachment(label, insetY);
84 // listData.bottom = new FormAttachment(button2, -insetY);
85 // list.setLayoutData(listData);
86 //
87 // shell.pack();
88 // shell.open();
89 //
90 // Display display = shell.getDisplay();
91 // while (!shell.isDisposed()) {
92 // if (!display.readAndDispatch())
93 // display.sleep();
94 // }
95 // display.dispose();
96
97 return null;
98 }
99
100 }