Examples of Display


Examples of org.eclipse.swt.widgets.Display

     
        skin = (SWTSkin)JMuleUIManager.getJMuleUI().getSkin();
   
    }catch(Throwable t) {}
   
    Display display = SWTThread.getDisplay();
   
    final Shell shell1=new Shell(display,SWT.ON_TOP);
    shell=new Shell(shell1,SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
   
    shell.setImage(SWTImageRepository.getImage("server_add.png"));
View Full Code Here

Examples of org.eclipse.swt.widgets.Display

  /**
   * Paint the Label's border.
   */
  private void paintBorder(GC gc, Rectangle r) {
    Display disp = getDisplay();

    Color c1 = null;
    Color c2 = null;

    int style = getStyle();
    if ((style & SWT.SHADOW_IN) != 0) {
      c1 = disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
      c2 = disp.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW);
    }
    if ((style & SWT.SHADOW_OUT) != 0) {
      c1 = disp.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW);
      c2 = disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
    }

    if (c1 != null && c2 != null) {
      gc.setLineWidth(1);
      drawBevelRect(gc, r.x, r.y, r.width - 1, r.height - 1, c1, c2);
View Full Code Here

Examples of org.eclipse.swt.widgets.Display

  /**
   * @param runnable
   */
  public static void runInBackgroundWithBusyIndicator(final Runnable runnable) {
    final Display display = Display.getCurrent();
    final Integer busyId = Integer.valueOf(nextBusyId++);

    /* Guard against Illegal-Thread-Access */
    if (display == null)
      throw new IllegalStateException("Method was not called from the UI-Thread!");

    /* Set the Cursor */
    Cursor cursor = display.getSystemCursor(SWT.CURSOR_APPSTARTING);
    Shell[] shells = display.getShells();
    for (Shell shell : shells) {
      Integer id = (Integer) shell.getData(BUSYID_NAME);
      if (id == null) {
        shell.setCursor(cursor);
        shell.setData(BUSYID_NAME, busyId);
      }
    }

    /* Run the Runnable and update cursor afterwards */
    runUIUpdater(new UIBackgroundJob(null) {

      @Override
      protected void runInBackground(IProgressMonitor monitor) {
        runnable.run();
      }

      @Override
      protected void runInUI(IProgressMonitor monitor) {
        if (!display.isDisposed()) {
          Shell[] shells = display.getShells();
          for (Shell shell : shells) {
            Integer id = (Integer) shell.getData(BUSYID_NAME);
            if (busyId.equals(id)) {
              shell.setCursor(null);
              shell.setData(BUSYID_NAME, null);
View Full Code Here

Examples of org.eclipse.swt.widgets.Display

  /**
   * @return the Size of the {@link Monitor} if only a single monitor is used or
   * <code>null</code> if none.
   */
  public static Point getFirstMonitorSize() {
    Display display = Display.getDefault();
    if (display != null) {
      Monitor[] monitors = display.getMonitors();
      if (monitors.length == 1) {
        Rectangle clientArea = monitors[0].getClientArea();
        return new Point(clientArea.width, clientArea.height);
      }
    }
View Full Code Here

Examples of org.eclipse.swt.widgets.Display

        }
      }
    });

    /* Proceed normally */
    Display display = PlatformUI.createDisplay();
    try {

      /* Handle possible Link supplied after startup */
      Runnable runAfterUIStartup = new Runnable() {
        public void run() {
          String link = parseLink(Platform.getCommandLineArgs());
          if (StringUtils.isSet(link))
            handleLinkSupplied(link);
        }
      };

      /* Check Startup Status */
      IStatus startupStatus = Activator.getDefault().getStartupStatus();
      if (startupStatus.getSeverity() == IStatus.ERROR)
        return handleStartupError(startupStatus);

      /* Create the Workbench */
      fWorkbenchAdvisor = new ApplicationWorkbenchAdvisor(runAfterUIStartup);
      int returnCode = PlatformUI.createAndRunWorkbench(display, fWorkbenchAdvisor);
      if (returnCode == PlatformUI.RETURN_RESTART)
        return IApplication.EXIT_RESTART;

      return IApplication.EXIT_OK;
    } finally {
      display.dispose();
    }
  }
View Full Code Here

Examples of org.eclipse.swt.widgets.Display

  public void stop() {
    final IWorkbench workbench = PlatformUI.getWorkbench();
    if (workbench == null)
      return;

    final Display display = workbench.getDisplay();
    display.syncExec(new Runnable() {
      public void run() {
        if (!display.isDisposed())
          workbench.close();
      }
    });
  }
View Full Code Here

Examples of org.eclipse.swt.widgets.Display

  * MAIN: Start the application viewer with an initial splash screen
  */
public static void main(final String[] args)
{
  //*-- generate the splash screen
  final Display display = new Display();
  final int[] numProgIncr = {3};
  //final Image image = new Image(display, 300, 300);
  final Image image = new Image(display, Constants.MUSTRU_HOME + File.separator + "icons" + File.separator + "mustruSplash.png");
  final Shell splash = new Shell(SWT.ON_TOP);
  final ProgressBar bar = new ProgressBar(splash, SWT.NONE);
  bar.setMaximum(numProgIncr[0]);
  Label label = new Label(splash, SWT.NONE);
  label.setImage(image);
 
  FormLayout layout = new FormLayout();
  splash.setLayout(layout);
 
  FormData labelData = new FormData();
  labelData.right = new FormAttachment(100, 0);
  labelData.bottom = new FormAttachment(100, 0);
  label.setLayoutData(labelData);
 
  FormData progressData = new FormData();
  progressData.left = new FormAttachment(0, 5);
  progressData.right = new FormAttachment(100, -5);
  progressData.bottom = new FormAttachment(100, -5);
  bar.setLayoutData(progressData);
 
  splash.pack();
  Rectangle splashRect = splash.getBounds();
  Rectangle displayRect = display.getBounds();
  int x = (displayRect.width - splashRect.width) / 2;
  int y = (displayRect.height - splashRect.height) / 2;
  splash.setLocation(x, y);
  splash.open();
 
  //*-- start the Online Index application
  display.asyncExec(
    new Runnable()
    {
      public void run()
      {
       int i = 0;
       PropertyConfigurator.configure (Constants.LOG4J_FILE); bar.setSelection(i + 1); numProgIncr[0]--;
       OnlineIndex oi = new OnlineIndex(null); oi.copyArgs(args); bar.setSelection(i + 1); numProgIncr[0]--;
       ApplicationWindow viewer = oi; bar.setSelection(i + 1); numProgIncr[0]--;
       splash.close(); image.dispose();
       viewer.setBlockOnOpen(true);
       viewer.open();    
      }
    }
   
  ); //*-- end of display asynexec
  
  //*-- wait till the app starts
  while (numProgIncr[0] != 0)
   if (!display.readAndDispatch()) display.sleep();
  display.dispose();
 
}
View Full Code Here

Examples of org.eclipse.swt.widgets.Display

  /**
   * @param runnable
   */
  public static void runInBackgroundWithBusyIndicator(final Runnable runnable) {
    final Display display = Display.getCurrent();
    final Integer busyId = Integer.valueOf(nextBusyId++);

    /* Guard against Illegal-Thread-Access */
    if (display == null)
      throw new IllegalStateException("Method was not called from the UI-Thread!");

    /* Set the Cursor */
    Cursor cursor = display.getSystemCursor(SWT.CURSOR_APPSTARTING);
    Shell[] shells = display.getShells();
    for (Shell shell : shells) {
      Integer id = (Integer) shell.getData(BUSYID_NAME);
      if (id == null) {
        shell.setCursor(cursor);
        shell.setData(BUSYID_NAME, busyId);
      }
    }

    /* Run the Runnable and update cursor afterwards */
    runUIUpdater(new UIBackgroundJob(null) {

      @Override
      protected void runInBackground(IProgressMonitor monitor) {
        runnable.run();
      }

      @Override
      protected void runInUI(IProgressMonitor monitor) {
        if (!display.isDisposed()) {
          Shell[] shells = display.getShells();
          for (Shell shell : shells) {
            Integer id = (Integer) shell.getData(BUSYID_NAME);
            if (busyId.equals(id)) {
              shell.setCursor(null);
              shell.setData(BUSYID_NAME, null);
View Full Code Here

Examples of org.eclipse.swt.widgets.Display

        }
      }
    });

    /* Proceed normally */
    Display display = PlatformUI.createDisplay();
    try {

      /* Handle possible Link supplied after startup */
      Runnable runAfterUIStartup = new Runnable() {
        public void run() {
          String link = parseLink(Platform.getCommandLineArgs());
          if (StringUtils.isSet(link))
            handleLinkSupplied(link);
        }
      };

      /* Create the Workbench */
      fWorkbenchAdvisor = new ApplicationWorkbenchAdvisor(runAfterUIStartup);
      int returnCode = PlatformUI.createAndRunWorkbench(display, fWorkbenchAdvisor);
      if (returnCode == PlatformUI.RETURN_RESTART)
        return IApplication.EXIT_RESTART;

      return IApplication.EXIT_OK;
    } finally {
      display.dispose();
    }
  }
View Full Code Here

Examples of org.eclipse.swt.widgets.Display

  public void stop() {
    final IWorkbench workbench = PlatformUI.getWorkbench();
    if (workbench == null)
      return;

    final Display display = workbench.getDisplay();
    display.syncExec(new Runnable() {
      public void run() {
        if (!display.isDisposed())
          workbench.close();
      }
    });
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.