import org.argeo.security.ui.rcp.SecureWorkbenchWindowAdvisor;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DropTargetAdapter;
+import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Tray;
import org.eclipse.swt.widgets.TrayItem;
import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.application.ActionBarAdvisor;
-import org.eclipse.ui.application.IActionBarConfigurer;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
+import org.eclipse.ui.part.EditorInputTransfer;
-/**
- * Set here initial default size of the UI
- *
- * @author bsinou
- *
- */
+/** Set here initial default size of the UI */
public class SlcSecureWorkbenchWindowAdvisor extends
SecureWorkbenchWindowAdvisor {
+ public final static String IN_TRAY_PROPERTY = "org.argeo.slc.ui.inTray";
private TrayItem trayItem;
- public SlcSecureWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
- super(configurer);
+ public SlcSecureWorkbenchWindowAdvisor(
+ IWorkbenchWindowConfigurer configurer, String username) {
+ super(configurer, username);
}
-// public ActionBarAdvisor createActionBarAdvisor(
-// IActionBarConfigurer configurer) {
-// return new ApplicationActionBarAdvisor(configurer);
-// }
+ public void postWindowOpen() {
+ String inTray = System.getProperty(IN_TRAY_PROPERTY);
+ if (inTray != null && inTray.equals("true")) {
+ initTray();
+ }
+ }
+ @Override
+ public void preWindowOpen() {
+ getWindowConfigurer().addEditorAreaTransfer(
+ EditorInputTransfer.getInstance());
+ getWindowConfigurer().configureEditorAreaDropListener(
+ new DropTargetAdapter() {
- public void postWindowOpen() {
- initTray();
+ @Override
+ public void dragEnter(DropTargetEvent event) {
+ System.out.println("DROP enter!!! " + event);
+ }
+
+ @Override
+ public void dragLeave(DropTargetEvent event) {
+ System.out.println("DROP leave!!! " + event);
+ }
+
+ public void drop(DropTargetEvent event) {
+ System.out.println("DROP drop!!! " + event);
+
+ }
+
+ @Override
+ public void dropAccept(DropTargetEvent event) {
+ System.out.println("DROP accept!!! " + event);
+ super.dropAccept(event);
+ }
+
+ });
+ super.preWindowOpen();
}
@Override
/** Init tray support */
protected void initTray() {
IWorkbenchWindow window = getWindowConfigurer().getWindow();
- final Tray tray = window.getShell().getDisplay().getSystemTray();
+ Shell shell = window.getShell();
+ final Tray tray = shell.getDisplay().getSystemTray();
trayItem = new TrayItem(tray, SWT.NONE);
if (trayItem == null)
return;
}
}
});
+
+ // start hidden
+ // shell.setVisible(false);
}
@Override