+package org.argeo.slc.client.ui.commands;\r
+\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+import org.argeo.slc.client.ui.ClientUiPlugin;\r
+import org.eclipse.core.commands.AbstractHandler;\r
+import org.eclipse.core.commands.ExecutionEvent;\r
+import org.eclipse.core.commands.ExecutionException;\r
+import org.eclipse.jface.dialogs.TitleAreaDialog;\r
+import org.eclipse.swt.widgets.DirectoryDialog;\r
+import org.eclipse.swt.widgets.Shell;\r
+\r
+/**\r
+ * Command handler to manage existing bundles; add or remove specific ones.\r
+ * \r
+ * @author bsinou\r
+ * \r
+ */\r
+\r
+public class ManageBundlesHandler extends AbstractHandler {\r
+ private static final Log log = LogFactory\r
+ .getLog(ManageBundlesHandler.class);\r
+\r
+ // private static final String DEFAULT_BUNDLE_DIR = "tmp";\r
+\r
+ public Object execute(ExecutionEvent event) throws ExecutionException {\r
+\r
+ Shell shell = ClientUiPlugin.getDefault().getWorkbench()\r
+ .getActiveWorkbenchWindow().getShell();\r
+ // LaunchConfigurationsDialog lcd;\r
+ // see http://kickjava.com/src/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java.htm\r
+ // to have more ideas about what to do.\r
+ \r
+ TitleAreaDialog tad = new TitleAreaDialog(shell);\r
+ tad.setTitle("Manage Bundles");\r
+ tad.open();\r
+\r
+ DirectoryDialog dialog2 = new DirectoryDialog(shell);\r
+ String path = dialog2.open();\r
+\r
+ if (path == null)\r
+ // action canceled by user\r
+ return null;\r
+ log.debug("Path chosen by user : " + path);\r
+\r
+ \r
+ // the following does not work : it doesn't display anything.\r
+ // Label label = new Label(shell, SWT.WRAP);\r
+ // label.setText("This is a long text string that will wrap when the dialog is resized.");\r
+ // List list = new List(shell, SWT.BORDER | SWT.H_SCROLL |\r
+ // SWT.V_SCROLL);\r
+ // list.setItems(new String[] { "Item 1", "Item 2" });\r
+ // Button button1 = new Button(shell, SWT.PUSH);\r
+ // button1.setText("OK");\r
+ // Button button2 = new Button(shell, SWT.PUSH);\r
+ // button2.setText("Cancel");\r
+ //\r
+ // final int insetX = 4, insetY = 4;\r
+ // FormLayout formLayout = new FormLayout();\r
+ // formLayout.marginWidth = insetX;\r
+ // formLayout.marginHeight = insetY;\r
+ // shell.setLayout(formLayout);\r
+ //\r
+ // Point size = label.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
+ // final FormData labelData = new FormData(size.x, SWT.DEFAULT);\r
+ // labelData.left = new FormAttachment(0, 0);\r
+ // labelData.right = new FormAttachment(100, 0);\r
+ // label.setLayoutData(labelData);\r
+ //\r
+ // FormData button2Data = new FormData();\r
+ // button2Data.right = new FormAttachment(100, -insetX);\r
+ // button2Data.bottom = new FormAttachment(100, 0);\r
+ // button2.setLayoutData(button2Data);\r
+ //\r
+ // FormData button1Data = new FormData();\r
+ // button1Data.right = new FormAttachment(button2, -insetX);\r
+ // button1Data.bottom = new FormAttachment(100, 0);\r
+ // button1.setLayoutData(button1Data);\r
+ //\r
+ // FormData listData = new FormData();\r
+ // listData.left = new FormAttachment(0, 0);\r
+ // listData.right = new FormAttachment(100, 0);\r
+ // listData.top = new FormAttachment(label, insetY);\r
+ // listData.bottom = new FormAttachment(button2, -insetY);\r
+ // list.setLayoutData(listData);\r
+ //\r
+ // shell.pack();\r
+ // shell.open();\r
+ //\r
+ // Display display = shell.getDisplay();\r
+ // while (!shell.isDisposed()) {\r
+ // if (!display.readAndDispatch())\r
+ // display.sleep();\r
+ // }\r
+ // display.dispose();\r
+\r
+ return null;\r
+ }\r
+ \r
+}\r