Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Display


   * Creates the job that performs garbage collection
   */
  private void createGarbageCollectionJob() {
    gcJob = new Job(IDEWorkbenchMessages.IDEIdleHelper_backgroundGC) {
      protected IStatus run(IProgressMonitor monitor) {
        final Display display = configurer.getWorkbench().getDisplay();
        if (display != null && !display.isDisposed()) {
          final long start = System.currentTimeMillis();
          System.gc();
          System.runFinalization();
          lastGC = start;
          final int duration = (int) (System.currentTimeMillis() - start);
View Full Code Here


   */
  void shutdown() {
    if (idleListener == null) {
      return;
    }
    final Display display = configurer.getWorkbench().getDisplay();
    if (display != null && !display.isDisposed()) {
      try {
        display.asyncExec(new Runnable() {
          public void run() {
            display.timerExec(-1, handler);
            display.removeFilter(SWT.KeyUp, idleListener);
            display.removeFilter(SWT.MouseUp, idleListener);
          }
        });
      } catch (SWTException ex) {
        // ignore (display might be disposed)
      }     
View Full Code Here

            return;

        final AnalyseBundleResolutionJob job = new AnalyseBundleResolutionJob(Messages.BundleCalculatedImportsPart_jobAnalyse, new File[] {
            location.toFile()
        });
        final Display display = tree.getDisplay();
        job.addJobChangeListener(new JobChangeAdapter() {
            @Override
            public void done(IJobChangeEvent event) {
                if (job.getResult().isOK()) {
                    final List<ImportPackage> imports = job.getImportResults();
                    display.asyncExec(new Runnable() {
                        public void run() {
                            if (tree != null && !tree.isDisposed())
                                viewer.setInput(imports);
                        }
                    });
View Full Code Here

            if ((delta.getFlags() & IResourceDelta.MOVED_TO) != 0) {
                IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(delta.getMovedToPath());
                final FileEditorInput newInput = new FileEditorInput(file);

                setInput(newInput);
                Display display = getEditorSite().getShell().getDisplay();
                if (display != null) {
                    SWTConcurrencyUtil.execForDisplay(display, true, new Runnable() {
                        public void run() {
                            setPartNameForInput(newInput);
                            sourcePage.setInput(newInput);
View Full Code Here

                result.set(response == Window.OK);
            }
        };

        Display display = PlatformUI.getWorkbench().getDisplay();
        if (display.getThread() == Thread.currentThread())
            uitask.run();
        else
            display.syncExec(uitask);

        return result.get();
    }
View Full Code Here

                } catch (PartInitException e) {
                    logger.logError("Error showing JUnit Results view", e);
                }
            }
        };
        Display display = PlatformUI.getWorkbench().getDisplay();
        if (display.getThread() == Thread.currentThread())
            runnable.run();
        else
            display.syncExec(runnable);

        return null;
    }
View Full Code Here

  }

  private void setupListeners() {
    eventsource.addControlListener(this);
   
    Display display = Display.getCurrent();
    addMouseUpListener(display);
    addMouseDownListener(display);     
  }
View Full Code Here

    public Viz open() {
        new Thread(new Runnable() {
            @Override
            public void run() {
                final int ms = 1000 / 50;
                final Display display = new Display();
                final Shell shell = new Shell(display, SWT.SHELL_TRIM & ~SWT.RESIZE);
                final Canvas canvas = new Canvas(shell, SWT.DOUBLE_BUFFERED);
                canvas.addPaintListener(Viz.this);
                canvas.setSize(512, 512);
                shell.setText("MDS");
                shell.pack();
                shell.open();
                display.timerExec(ms , new Runnable() {
                    @Override
                    public void run() {
                        if (shell.isDisposed()) return;
                        canvas.redraw();
                        display.timerExec(ms, this);
                    }
                });
                while (!shell.isDisposed()) {
                    if (!display.readAndDispatch())
                        display.sleep();
                }
                display.dispose();
                System.exit(-1);
            }
        }).start();
        return this;
    }
View Full Code Here

    public void processCandidates(final Requirement requirement, Set<Capability> wired, final List<Capability> candidates) {
        if (wired.size() > 0 || candidates.size() < 2)
            return;

        final Display display = PlatformUI.getWorkbench().getDisplay();
        final AtomicInteger resultRef = new AtomicInteger();

        Runnable runnable = new Runnable() {
            public void run() {
                Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
                if (!shell.isDisposed()) {
                    ResolutionChoiceSelectionDialog dialog = new ResolutionChoiceSelectionDialog(shell, requirement, candidates);
                    resultRef.set(dialog.open());
                } else {
                    resultRef.set(IDialogConstants.CANCEL_ID);
                }
            }
        };

        display.syncExec(runnable);
        int result = resultRef.get();

        if (result == IDialogConstants.CANCEL_ID)
            throw new ResolveCancelledException();
    }
View Full Code Here

    static final int mapSize = 1000;
    private static Image background;
    private static Labeling labeling;

    public static void main(String[] args) {
        final Display display = new Display();
        final Shell shell = new Shell(display);
       
        shell.addPaintListener(new PaintListener() {

            public void paintControl(PaintEvent event) {
                event.gc.drawImage(background, 0, 0);
                new LabelOverlay().paintLabels(labeling, event.gc);
            }
        });
       
        // needed for debugging
        shell.addMouseMoveListener(new MouseMoveListener() {
            @Override
            public void mouseMove(MouseEvent e) {
//                System.out.println(e.x + " " + e.y);
            }
        });
       
        prepare();
       
        shell.setBounds(10, 10, mapSize, mapSize);
        shell.open();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch())
                display.sleep();
        }
        display.dispose();
        System.exit(1);
    }
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.