Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Display


   return this.foreGround;
  }
 
  public void show(Display display) {
   
      final Display d = display;
      final Shell s1 = new Shell(d);
    final Shell s = new Shell(MainWindow.getSShell(), SWT.CLOSE | SWT.TITLE | SWT.APPLICATION_MODAL | SWT.BORDER);
      final RGB aktForeGround = this.foreGround;

      s.setSize(302, 160);
      s.setText("Font Dialog");
      s.setLayout(new GridLayout(11, false));

      new Label(s, SWT.NONE);
      final Text t = new Text(s, SWT.BORDER | SWT.WRAP | SWT.MULTI);
     
      t.setText("Sample Text");
        t.setFont(SWTResourceManager.getFont("Courier New", 8, SWT.NORMAL));
        t.setForeground(new Color(d, this.foreGround));
       
        t.setFont(new Font(d, this.fontData));
        t.setForeground(new Color(d, this.foreGround));
       
      GridData gd_t = new GridData(SWT.FILL, SWT.FILL, false, false, 10, 1);
      gd_t.heightHint = 74;
      t.setLayoutData(gd_t);
      new Label(s, SWT.NONE);
      final Button btnChange = new Button(s, SWT.PUSH | SWT.BORDER);
      btnChange.setText("Change Font");
      btnChange.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
          FontDialog fd = new FontDialog(s, SWT.NONE);
          fd.setText("Select Font");
          fd.setRGB(t.getForeground().getRGB());
          fd.setFontList(t.getFont().getFontData());

           FontData newFont = fd.open();
          if(newFont==null)
              return;
          t.setFont(new Font(d, newFont));
          t.setForeground(new Color(d, fd.getRGB()));
         
        }
      });
     
      Button btnSave = new Button(s, SWT.NONE);
      btnSave.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
           saveFontData(t.getFont().getFontData()[0],t.getForeground().getRGB());
           s.dispose();
        }
      });
      btnSave.setText("Save");
     
      Button btnReset = new Button(s, SWT.NONE);
      btnReset.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            t.setFont(new Font(d, fontData));
            t.setForeground(new Color(d, aktForeGround));
        }
      });
      btnReset.setText("Reset");
     
      Button btnCancel = new Button(s, SWT.NONE);
      btnCancel.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
           s.dispose();
        }
      });
      btnCancel.setText("Cancel");
  
      new Label(s, SWT.NONE);
      s.open();


      while (!s.isDisposed()) {
        if (!d.readAndDispatch())
          d.sleep();
      }
      //d.dispose();
        
  }
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

                }
            }

            Central.setProjectPackageModel(project, allExports, allContained, modelSourcePathsResources);

            Display display = PlatformUI.getWorkbench().getDisplay();
            SWTConcurrencyUtil.execForDisplay(display, true, new Runnable() {
                public void run() {
                    PlatformUI.getWorkbench().getDecoratorManager().update("bndtools.packageDecorator");
                }
            });
View Full Code Here

        if (displayJob != null && displayJob.getState() != Job.NONE)
            displayJob.cancel();

        if (zipEntry != null && !zipEntry.isDirectory()) {
            IEditorInput input = editor.getEditorInput();
            final Display display = text.getDisplay();
            final URI uri = URIHelper.retrieveFileURI(input);

            if (uri != null) {
                displayJob = new Job("Load zip content") {
                    @Override
                    protected IStatus run(IProgressMonitor monitor) {
                        File ioFile = new File(uri);
                        ZipFile zipFile = null;
                        try {
                            zipFile = new ZipFile(ioFile);
                            final StringWriter writer = new StringWriter();
                            if (showAsText)
                                readAsText(zipFile, zipEntry, charsets[selectedCharset], writer, 1024 * 20, monitor);
                            else
                                readAsHex(zipFile, zipEntry, writer, 1024 * 20, 2, monitor);

                            display.asyncExec(new Runnable() {
                                public void run() {
                                    setContent(writer.toString());
                                }
                            });

View Full Code Here

    /* (non-Javadoc)
     * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext context)
     */
    public Object start(IApplicationContext appContext) throws Exception {
        Display display = createDisplay();
        // processor must be created before we start event loop
        DelayedEventsProcessor processor = new DelayedEventsProcessor(display);

        try {

          // look and see if there's a splash shell we can parent off of
          Shell shell = WorkbenchPlugin.getSplashShell(display);
          if (shell != null) {
            // should should set the icon and message for this shell to be the
            // same as the chooser dialog - this will be the guy that lives in
            // the task bar and without these calls you'd have the default icon
            // with no message.
            shell.setText(ChooseWorkspaceDialog.getWindowTitle());
            shell.setImages(Dialog.getDefaultImages());
          }
          
            Object instanceLocationCheck = checkInstanceLocation(shell, appContext.getArguments());
      if (instanceLocationCheck != null) {
              WorkbenchPlugin.unsetSplashShell(display);
                Platform.endSplash();
                return instanceLocationCheck;
            }

            // create the workbench with this advisor and run it until it exits
            // N.B. createWorkbench remembers the advisor, and also registers
            // the workbench globally so that all UI plug-ins can find it using
            // PlatformUI.getWorkbench() or AbstractUIPlugin.getWorkbench()
            int returnCode = PlatformUI.createAndRunWorkbench(display,
                new IDEWorkbenchAdvisor(processor));

            // the workbench doesn't support relaunch yet (bug 61809) so
            // for now restart is used, and exit data properties are checked
            // here to substitute in the relaunch return code if needed
            if (returnCode != PlatformUI.RETURN_RESTART) {
        return EXIT_OK;
      }

            // if the exit code property has been set to the relaunch code, then
            // return that code now, otherwise this is a normal restart
            return EXIT_RELAUNCH.equals(Integer.getInteger(PROP_EXIT_CODE)) ? EXIT_RELAUNCH
                    : EXIT_RESTART;
        } finally {
            if (display != null) {
        display.dispose();
      }
            Location instanceLoc = Platform.getInstanceLocation();
            if (instanceLoc != null)
              instanceLoc.release();
        }
View Full Code Here

     */
  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

            allContained.add(entry.getKey().getFQN());
        }

        Central.setProjectPackageModel(getProject(), allExports, allContained, modelSourcePathsResources);

        Display display = PlatformUI.getWorkbench().getDisplay();
        SWTConcurrencyUtil.execForDisplay(display, true, new Runnable() {
            @Override
            public void run() {
                PlatformUI.getWorkbench().getDecoratorManager().update("bndtools.packageDecorator");
            }
View Full Code Here

   */
  public Control createEmptyWindowContents(Composite parent) {
    final IWorkbenchWindow window = getWindowConfigurer().getWindow();
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(2, false));
    Display display = composite.getDisplay();
    Color bgCol = display
        .getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND);
    composite.setBackground(bgCol);
    Label label = new Label(composite, SWT.WRAP);
    label.setForeground(display
        .getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND));
    label.setBackground(bgCol);
    label.setFont(JFaceResources.getFontRegistry().getBold(
        JFaceResources.DEFAULT_FONT));
    String msg = IDEWorkbenchMessages.IDEWorkbenchAdvisor_noPerspective;
View Full Code Here

        if (displayJob != null && displayJob.getState() != Job.NONE)
            displayJob.cancel();

        if (zipEntry != null && !zipEntry.isDirectory()) {
            IEditorInput input = editor.getEditorInput();
            final Display display = text.getDisplay();
            final URI uri;

            if (input instanceof IFileEditorInput) {
                uri = ((IFileEditorInput) input).getFile().getLocationURI();
            } else if (input instanceof IURIEditorInput) {
                uri = ((IURIEditorInput) input).getURI();
            } else {
                uri = null;
            }

            if (uri != null) {
                displayJob = new Job("Load zip content") {
                    @Override
                    protected IStatus run(IProgressMonitor monitor) {
                        File ioFile = new File(uri);
                        ZipFile zipFile = null;
                        try {
                            zipFile = new ZipFile(ioFile);
                            final StringWriter writer = new StringWriter();
                            if (showAsText)
                                readAsText(zipFile, zipEntry, charsets[selectedCharset], writer, 1024 * 20, monitor);
                            else
                                readAsHex(zipFile, zipEntry, writer, 1024 * 20, 2, monitor);

                            display.asyncExec(new Runnable() {
                                public void run() {
                                    setContent(writer.toString());
                                }
                            });

View Full Code Here

    }
   
    createGarbageCollectionJob();

    //hook idle handler
    final Display display = configurer.getWorkbench().getDisplay();
    handler = new Runnable() {
          public void run() {
            if (!display.isDisposed() && !configurer.getWorkbench().isClosing()) {
              int nextInterval;
              final long start = System.currentTimeMillis();
              //don't garbage collect if background jobs are running
              if (!Job.getJobManager().isIdle()) {
                nextInterval = IDLE_INTERVAL;
              } else if ((start - lastGC) < nextGCInterval) {
                //don't garbage collect if we have collected within the specific interval
                nextInterval = nextGCInterval - (int) (start - lastGC);
              } else {
                gcJob.schedule();
                nextInterval = minGCInterval;
              }
              display.timerExec(nextInterval, this);
            }
          }
        };
    idleListener = new Listener() {
      public void handleEvent(Event event) {
        display.timerExec(IDLE_INTERVAL, handler);
      }
    };
    display.addFilter(SWT.KeyUp, idleListener);
    display.addFilter(SWT.MouseUp, idleListener);
  }
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.