Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Display


  /**
   * {@inheritDoc}
   */
  public void run() {
    Display display= Display.getCurrent();
    if (display == null)
      return;
    Control focus= display.getFocusControl();
    if (focus == null || focus.isDisposed())
      return;
   
    MenuManager menu= new MenuManager();
    fillMenu(menu);
    final Menu widget= menu.createContextMenu(focus.getShell());
    Point location= computeMenuLocation(focus, widget);
    if (location == null)
      return;
    widget.setLocation(location);
    widget.setVisible(true);
    while (!widget.isDisposed() && widget.isVisible()) {
      if (!display.readAndDispatch())
        display.sleep();
    }
    if (!widget.isDisposed()) {
      widget.dispose();
    }
  }
View Full Code Here


      int /*long*/arg0, int /*long*/arg1)
      throws Throwable {
    if (DEBUG) {
      System.err.println("actionProc 4 " + id + "/" + sel);
    }
    Display display = Display.getCurrent();
    if (display == null)
      return 0;

    if (!alreadyHaveOpenDoc && sel == sel_application_openFile_) {
      Constructor<?> conNSString = nsstringCls.getConstructor(new Class[] {
View Full Code Here

   *            The action to run when the About menu is invoked.
   * @param preferencesAction
   *            The action to run when the Preferences menu is invoked.
   */
  public void hookApplicationMenu() {
    Display display = Display.getCurrent();
    try {
      // Initialize the menuItems.
      initialize();
    } catch (Exception e) {
      throw new IllegalStateException(e);
    }

    // Schedule disposal of callback object
    display.disposeExec(new Runnable() {
      public void run() {
        invoke(callBack3, "dispose");
        callBack3 = null;
        invoke(callBack4, "dispose");
        callBack4 = null;
View Full Code Here

 
  public
  TextViewerWindow(
     String sTitleID, String sMessageID, String sText, boolean modal )
  {
    final Display display = SWTThread.getInstance().getDisplay();
   
    if ( modal ){
   
      shell = org.gudy.azureus2.ui.swt.components.shell.ShellFactory.createShell(display, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE );
     
    }else{
     
      shell = ShellFactory.createMainShell(SWT.DIALOG_TRIM | SWT.RESIZE );
    }
   
    if (sTitleID != null) shell.setText(MessageText.keyExists(sTitleID)?MessageText.getString(sTitleID):sTitleID);
   
    Utils.setShellIcon(shell);
   
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    shell.setLayout(layout);

    Label label = new Label(shell, SWT.NONE);
    if (sMessageID != null) label.setText(MessageText.keyExists(sMessageID)?MessageText.getString(sMessageID):sMessageID);
    GridData gridData = new GridDataGridData.FILL_HORIZONTAL );
    gridData.widthHint = 200;
    gridData.horizontalSpan = 2;
    label.setLayoutData(gridData);

    txtInfo = new Text(shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
    gridData = new GridDataGridData.FILL_BOTH );
    gridData.widthHint = 500;
    gridData.heightHint = 400;
    gridData.horizontalSpan = 2;
    txtInfo.setLayoutData(gridData);
    txtInfo.setText(sText);

    label = new Label(shell, SWT.NONE);
    gridData = new GridData( GridData.FILL_HORIZONTAL );
    label.setLayoutData(gridData);
   
    Button ok = new Button(shell, SWT.PUSH);
    ok.setText(MessageText.getString("Button.ok"));
    gridData = new GridData();
    gridData.widthHint = 70;
    ok.setLayoutData(gridData);
    shell.setDefaultButton(ok);
    ok.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        try {
          shell.dispose();
        }
        catch (Exception e) {
          Debug.printStackTrace( e );
        }
      }
    });

  shell.addListener(SWT.Traverse, new Listener() { 
    public void handleEvent(Event e) {
      if ( e.character == SWT.ESC){
        shell.dispose();
      }
    }
  });
 
  shell.addDisposeListener(
    new DisposeListener()
    {
      public void
      widgetDisposed(
        DisposeEvent arg0)
      {
        for ( TextViewerWindowListener l: listeners ){
         
          l.closed();
        }
      }
    });
 
    shell.pack();
  Utils.centreWindow( shell );
    shell.open();
   
    if ( modal ){
      while (!shell.isDisposed())
        if (!display.readAndDispatch()) display.sleep();
    }
  }
View Full Code Here

   * @param alert
   *
   * @since 3.0.0.9
   */
  protected static void showAlert(LogAlert alert) {
    final Display display = SWTThread.getInstance().getDisplay();

    if (alert.err != null) {
      alert.details = Debug.getStackTrace(alert.err);
    }

    /*
    final String message2;
    if (alert.text != null
        && COConfigurationManager.getBooleanParameter("Show Timestamp For Alerts")) {
      message2 = "["
          + DisplayFormatters.formatDateShort(SystemTime.getCurrentTime())
          + "] " + alert.text;
    } else {
      message2 = (alert.text == null) ? "" : alert.text;
    }
    */

    for (Iterator<AlertListener> iter = listeners.iterator(); iter.hasNext();) {
      AlertListener l = (AlertListener) iter.next();
      if (!l.allowPopup(alert.relatedTo, alert.entryType)) {
        return;
      }
    }
   
 
    if (stopping || display.isDisposed()) {

      try {
        alert_queue_mon.enter();

        List close_alerts = COConfigurationManager.getListParameter(
            "Alerts.raised.at.close", new ArrayList());

        Map alert_map = new HashMap();

        alert_map.put("type", new Long(alert.entryType));
        alert_map.put("message", alert.text);
        alert_map.put("timeout", new Long( alert.getGivenTimeoutSecs()));
       
        if (alert.details != null) {
          alert_map.put("details", alert.details);
        }

        close_alerts.add(alert_map);

        COConfigurationManager.setParameter("Alerts.raised.at.close",
            close_alerts);

        return;
      } finally {
        alert_queue_mon.exit();
      }
    }

    if (display.isDisposed()) {
      return;
    }

   
    String key = (alert.err == null) ? alert.text : alert.text + ":"
View Full Code Here

  public SplashWindow(Display display) {
    this(display, null);
  }

  public static void main(String args[]) {
    Display display = new Display();

    final SplashWindow splash = new SplashWindow(display);

    Thread t = new Thread() {
      public void run() {
        try {
          int percent = 0;
          while (percent <= 100) {
            splash.reportPercent(percent++);
            splash.reportCurrentTask(percent
                + "% Loading dbnvsudn vjksfdh fgshdu fbhsduh bvsfd fbsd fbvsdb fsuid opnum supnum boopergood haha text doot subliminal.".substring(
                    0, (int) (1 + Math.random() * 110)));
            Thread.sleep(100);
          }
        } catch (Exception e) {
          // TODO: handle exception
        }
        splash.closeSplash();
      }
    };
    t.start();

    while (!splash.splash.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    display.dispose();
  }
View Full Code Here

          }
        });
    } catch (Exception e) {
      e.printStackTrace();
    }
    Display d = Display.getDefault();
    while (true) {
      if (!d.readAndDispatch()) {
        d.sleep();
      }
    }
  }
View Full Code Here

        // TODO: support composite, image, etc
        if (oToolTip == null || !(oToolTip instanceof String))
          return;
        String sToolTip = (String) oToolTip;

        Display d = table.getDisplay();
        if (d == null)
          return;

        // We don't get mouse down notifications on trim or borders..
        toolTipShell = new Shell(table.getShell(), SWT.ON_TOP);
        FillLayout f = new FillLayout();
        try {
          f.marginWidth = 3;
          f.marginHeight = 1;
        } catch (NoSuchFieldError e) {
          /* Ignore for Pre 3.0 SWT.. */
        }
        toolTipShell.setLayout(f);
        toolTipShell.setBackground(d.getSystemColor(SWT.COLOR_INFO_BACKGROUND));

        toolTipLabel = new Label(toolTipShell, SWT.WRAP);
        toolTipLabel.setForeground(d.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
        toolTipLabel.setBackground(d.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
        //toolTipShell.setData("TableCellSWT", item);
        toolTipLabel.setText(sToolTip.replaceAll("&", "&&"));
        // compute size on label instead of shell because label
        // calculates wrap, while shell doesn't
        Point size = toolTipLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
View Full Code Here

        }
      }
    }.start();
     
    try{
      final Display display = SWTThread.getInstance().getDisplay();
 
      while( !( task_complete || display.isDisposed())){
       
        if (!display.readAndDispatch()) display.sleep();
      }
    }finally{
     
        // bit of boiler plate in case something fails in the dispatch loop
     
View Full Code Here

    final String path,
    final String fileNames[] )
  {
    CoreWaiterSWT.waitForCoreRunning(new AzureusCoreRunningListener() {
      public void azureusCoreRunning(final AzureusCore core) {
        final Display display = SWTThread.getInstance().getDisplay();
        if (display == null || display.isDisposed() || core == null)
          return;
       
        new AEThread("TorrentOpener") {
          public void runSupport() {
View Full Code Here

TOP

Related Classes of org.eclipse.swt.widgets.Display

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.