You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2011/09/07 20:20:12 UTC

svn commit: r1166297 - in /uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui: Utility.java dialogs/AbstractDialogMultiColTable.java

Author: schor
Date: Wed Sep  7 18:20:12 2011
New Revision: 1166297

URL: http://svn.apache.org/viewvc?rev=1166297&view=rev
Log:
[UIMA-2114] make pop-up msg for some errors have a parent, so the pop-up doesn't get hidden (only happening on a Apple Mac).

Modified:
    uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/Utility.java
    uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/dialogs/AbstractDialogMultiColTable.java

Modified: uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/Utility.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/Utility.java?rev=1166297&r1=1166296&r2=1166297&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/Utility.java (original)
+++ uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/Utility.java Wed Sep  7 18:20:12 2011
@@ -28,6 +28,7 @@ import org.eclipse.jface.window.Window;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Widget;
 
 // MessageDialog extended only to enable resize
 public class Utility extends MessageDialog {
@@ -85,16 +86,35 @@ public class Utility extends MessageDial
   public static void popMessage(String title, String message, int type) {
     popMessage(title, message, type, OKstring);
   }
+  
+  public static void popMessage(Widget w, String title, String message, int type) {
+    popMessage(w, title, message, type, OKstring);
+  }
 
   public static int popMessage(String title, String message, int type, String[] buttons) {
-    Utility dialog = new Utility(new Shell(), title, null, message, type, buttons, 0);
-    dialog.setShellStyle(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE);
+    return popMessage(new Shell(), title,message, type, buttons);
+//    Utility dialog = new Utility(new Shell(), title, null, message, type, buttons, 0);
+//    dialog.setShellStyle(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE);
+//    dialog.getShell().forceActive();  
+//    int returnCode = dialog.open();
+//    if (returnCode == -1)
+//      returnCode = Window.CANCEL; // Cancel code
+//    return returnCode;
+  }
+
+  public static int popMessage(Shell parent, String title, String message, int type, String[] buttons) {
+    Utility dialog = new Utility(parent, title, null, message, type, buttons, 0);
+    dialog.setShellStyle(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE); 
     int returnCode = dialog.open();
     if (returnCode == -1)
       returnCode = Window.CANCEL; // Cancel code
     return returnCode;
   }
 
+  // https://issues.apache.org/jira/browse/UIMA-2114
+  public static int popMessage(Widget w, String title, String message, int type, String[] buttons) {
+    return popMessage(w.getDisplay().getActiveShell(), title, message, type, buttons);
+  }
   /**
    * remove 1 element (must be present) use == test
    * 

Modified: uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/dialogs/AbstractDialogMultiColTable.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/dialogs/AbstractDialogMultiColTable.java?rev=1166297&r1=1166296&r2=1166297&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/dialogs/AbstractDialogMultiColTable.java (original)
+++ uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/dialogs/AbstractDialogMultiColTable.java Wed Sep  7 18:20:12 2011
@@ -25,6 +25,7 @@ import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Widget;
 
 import org.apache.uima.taeconfigurator.editors.ui.AbstractSection;
 import org.apache.uima.taeconfigurator.editors.ui.Utility;
@@ -57,13 +58,13 @@ public abstract class AbstractDialogMult
       Point mousePosition = new Point(event.x, event.y);
       TableItem item = table.getItem(mousePosition);
       if (null == item) {
-        jitHowTo();
+        jitHowTo(event.widget);
         return;
       }
 
       int col = getHitColumn(item, mousePosition);
       if (col != 1 && col != 2) {
-        jitHowTo();
+        jitHowTo(event.widget);
         return;
       }
       if (col == 1 && !enableCol1) {
@@ -80,8 +81,8 @@ public abstract class AbstractDialogMult
     super.handleEvent(event);
   }
 
-  private void jitHowTo() {
-    Utility.popMessage("Where to mouse click",
+  private void jitHowTo(Widget w) {
+    Utility.popMessage(w, "Where to mouse click",
             "Please click the mouse in the input or output columns to toggle the selection.",
             MessageDialog.INFORMATION);
   }