Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Shell


      _lstTomcatLibraries.setItems(_model.getTomcatLibraryNames());
    }
  }
 
  private void handleRemoveTomcatLibrary() {
    Shell shell = getManagedForm().getForm().getShell();
    if (_lstTomcatLibraries.getSelectionCount() > 0) {
      boolean delete = MessageDialog.openConfirm(shell, "Remove selected libraries?", "Are you sure you want to remove the selected libraries? This will also delete the selected files from filesystem.");
      if (delete) {
        String[] fileNames = _lstTomcatLibraries.getSelection();
        for (int i=0; i < fileNames.length; i++) {
View Full Code Here


public class ChangeDirlinkTarget implements IViewActionDelegate {

  private IFolder _selectedFodler;

  public void run(IAction action) {
    Shell shell = new Shell(Display.getCurrent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);

    if (_selectedFodler != null) {
      ChangeDirlinkTargetDialog dialog = new ChangeDirlinkTargetDialog(shell, _selectedFodler);
      dialog.open();
    } else {
View Full Code Here

  private static final int MAX_ITERATIONS = 10000;
  private static final int NB_CONTACTS = 5;
 
  public VivaldiVisualTest() {
    final Display display = new Display();
    Shell shell = new Shell(display);
    final VivaldiPanel panel = new VivaldiPanel(shell);
    shell.setLayout(new FillLayout());
    shell.setSize(800,800);
    shell.setText("Vivaldi Simulator");
    shell.open();
   
    Thread runner = new Thread("Viviladi Simulator") {
      public void run() {
        VivaldiPosition positions[][] = new VivaldiPosition[ELEMENTS_X][ELEMENTS_Y];
        final List lPos = new ArrayList(ELEMENTS_X*ELEMENTS_Y);       
        HeightCoordinatesImpl realCoordinates[][] = new HeightCoordinatesImpl[ELEMENTS_X][ELEMENTS_Y];
        //Init all
        for(int i = 0 ; i < ELEMENTS_X ; i++) {
          for(int j = 0 ; j < ELEMENTS_Y ; j++) {
            realCoordinates[i][j] = new HeightCoordinatesImpl(i*DISTANCE-ELEMENTS_X * DISTANCE/2,j*DISTANCE-ELEMENTS_Y*DISTANCE/2,MAX_HEIGHT);
            if(i >= ELEMENTS_X / 2 && 1 == 0) {
              positions[i][j] = new VivaldiPositionImpl(realCoordinates[i][j]);
              positions[i][j].setErrorEstimate(0.01f);
            } else {
              positions[i][j] = new VivaldiPositionImpl(new HeightCoordinatesImpl(1000+DISTANCE*i,1000+DISTANCE*j,20));
            }
           
            lPos.add(positions[i][j]);
          }
        }
       
        //Main loop
        for(int iter = 0 ; iter < MAX_ITERATIONS ; iter++) {
          if(iter%100 == 0) System.out.println(iter);
          if(display.isDisposed()) return;
          display.syncExec( new Runnable() {
            public void run() {
              panel.refresh(lPos);
            }
          });
          try {
            //Thread.sleep(100);
          } catch (Exception e) {
            // TODO: handle exception
          }
         
          //For each node :
          for(int i = 0 ; i < ELEMENTS_X ; i++) {
            for(int j = 0 ; j < ELEMENTS_Y ; j++) {
              VivaldiPosition position = positions[i][j];
              //Pick N random nodes
              for(int k = 0 ; k < NB_CONTACTS ; k++) {
                int i1 = (int) (Math.random() * ELEMENTS_X);
                int j1 = (int) (Math.random() * ELEMENTS_Y);
                if(i1 == i && j1 ==j) continue;
                VivaldiPosition position1 = positions[i1][j1];
                float rtt = realCoordinates[i1][j1].distance(realCoordinates[i][j]);
                //rtt *= (Math.random() - 0.5)/20 + 1; 
                position.update(rtt,position1.getCoordinates(),position1.getErrorEstimate());
              }
             
            }
          }
         
        }
      }
    };
    runner.setDaemon(true);
    runner.start();
   
    while (!shell.isDisposed ()) {
      if (!display.readAndDispatch ()) display.sleep ();
    }
    display.dispose ();
  }
View Full Code Here

          public void runSupport() {
            SWTThread instance = SWTThread.getInstance();
            if (instance == null || instance.isTerminated()) {
              return;
            }
            Shell anyShell = Utils.findAnyShell();
            Point location = null;
            if (anyShell != null) {
              Rectangle bounds = anyShell.getBounds();
              location = new Point(bounds.x, bounds.y);
            }
            Shell[] shells = instance.getDisplay().getShells();
            for (Shell shell : shells) {
              if (!shell.isDisposed()) {
                shell.dispose();
              }
            }
            Shell shell = new Shell(instance.getDisplay(), SWT.BORDER | SWT.TITLE);
            Utils.setShellIcon(shell);
            shell.setText("Shutting Down Vuze..");
            shell.setSize(200, 0);
            if (location != null) {
              shell.setLocation(location);
            }
            shell.open();
          }
        });
      }

    } finally {
View Full Code Here

  public static void _open(final boolean showNoLoad, final String sourceRef) {
    if (shell != null && !shell.isDisposed()) {
      return;
    }
    final Shell parentShell = Utils.findAnyShell();
    shell = ShellFactory.createShell(parentShell, SWT.BORDER
        | SWT.APPLICATION_MODAL | SWT.TITLE);
    shell.setLayout(new FillLayout());
    if (parentShell != null) {
      parentShell.setCursor(shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
    }

    shell.addTraverseListener(new TraverseListener() {
      public void keyTraversed(TraverseEvent e) {
        if (e.detail == SWT.TRAVERSE_ESCAPE) {
          e.doit = false;
        }
      }
    });
   
    shell.addShellListener(new ShellAdapter() {
      public void shellClosed(ShellEvent e) {
        e.doit = false;
      }
    });
   
    shell.addDisposeListener(new DisposeListener() {
      public void widgetDisposed(DisposeEvent e) {
        if (parentShell != null) {
          parentShell.setCursor(e.display.getSystemCursor(SWT.CURSOR_ARROW));
        }
        if (browserFunction != null && !browserFunction.isDisposed()) {
          browserFunction.dispose();
        }
        shell = null;
      }
    });

    browser = Utils.createSafeBrowser(shell, SWT.NONE);
    if (browser == null) {
      shell.dispose();
      return;
    }

    browser.addTitleListener(new TitleListener() {
      public void changed(TitleEvent event) {
        if (shell == null || shell.isDisposed()) {
          return;
        }
        shell.setText(event.title);
      }
    });
   
    browserFunction = new BrowserFunction(browser, "sendDonationEvent") {
      public Object function(Object[] arguments) {

        if (shell == null || shell.isDisposed()) {
          return null;
        }
       
        if (arguments == null) {
          Debug.out("Invalid sendDonationEvent null ");
          return null;
        }
        if (arguments.length < 1) {
          Debug.out("Invalid sendDonationEvent length " + arguments.length + " not 1");
          return null;
        }
        if (!(arguments[0] instanceof String)) {
          Debug.out("Invalid sendDonationEvent "
              + (arguments[0] == null ? "NULL"
                  : arguments.getClass().getSimpleName()) + " not String");
          return null;
        }

        String text = (String) arguments[0];
        if (text.contains("page-loaded")) {
          pageLoadedOk = true;
          COConfigurationManager.setParameter("donations.count",
              COConfigurationManager.getLongParameter("donations.count", 1) + 1);
          Utils.centreWindow(shell);
          if (parentShell != null) {
            parentShell.setCursor(shell.getDisplay().getSystemCursor(SWT.CURSOR_ARROW));
          }
          shell.open();
        } else if (text.contains("reset-ask-time")) {
          int time = reAskEveryHours;
          String[] strings = text.split(" ");
View Full Code Here

        params.put( "error", "template '" + id + "' not found" );

        sendBrowserMessage("metasearch", "exportTemplateFailed",params);
       
      }else{
        final Shell shell = Utils.findAnyShell();
       
        shell.getDisplay().asyncExec(
          new AERunnable()
          {
            public void
            runSupport()
            {
              FileDialog dialog =
                new FileDialog( shell, SWT.SYSTEM_MODAL | SWT.SAVE );
             
              dialog.setFilterPath( TorrentOpener.getFilterPathData() );
                         
              dialog.setText(MessageText.getString("metasearch.export.select.template.file"));
             
              dialog.setFilterExtensions(new String[] {
                  "*.vuze",
                  "*.vuz",
                  Constants.FILE_WILDCARD
                });
              dialog.setFilterNames(new String[] {
                  "*.vuze",
                  "*.vuz",
                  Constants.FILE_WILDCARD
                });
             
              String path = TorrentOpener.setFilterPathData( dialog.open());
   
              if ( path != null ){
               
                String lc = path.toLowerCase();
               
                if ( !lc.endsWith( ".vuze" ) && !lc.endsWith( ".vuz" )){
                 
                  path += ".vuze";
                }
               
                try{
                  engine.exportToVuzeFile( new File( path ));
                 
                  Map params = new HashMap();
                  params.put( "id", new Long( id ));
                  sendBrowserMessage( "metasearch", "exportTemplateCompleted", params );

                }catch( Throwable e ){
                 
                  Map params = new HashMap();
                  params.put( "id", new Long( id ));
                  params.put( "error", "save failed: " + Debug.getNestedExceptionMessage(e));

                  sendBrowserMessage("metasearch", "exportTemplateFailed",params);
                }
              }else{
               
                Map params = new HashMap();
                params.put( "id", new Long( id ));
                params.put( "error", "operation cancelled" );

                sendBrowserMessage("metasearch", "exportTemplateFailed",params);
              }
            }
          });
      }
    }else if ( OP_IMPORT_TEMPLATE.equals(opid)){
           
      final Shell shell = Utils.findAnyShell();
     
      shell.getDisplay().asyncExec(
        new AERunnable()
        {
          public void
          runSupport()
          {
View Full Code Here

          if (bringToFront) {
            uiFunctions.bringToFront();
          }
        }

        Shell shell = uiFunctions.getMainShell();
        if (shell != null) {
          new FileDownloadWindow(shell, url, dlInfo.getReferer(),
              dlInfo.getRequestProperties(),
              new TorrentDownloaderCallBackInterface() {
View Full Code Here

    }
  }

  public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display, SWT.DIALOG_TRIM);
    shell.setSize(800, 600);

    new SimpleBrowserWindow(shell, "http://google.com", 0.8, 0.5, true, false);

    shell.open();

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

   
    if ( display.isDisposed()){         
      return;
    }
   
    shell = new Shell(display,type);           
   
    shell.setSize(250,150);
    Utils.setShellIcon(shell);
   
    FormLayout layout = new FormLayout();
View Full Code Here

    GCStringPrinter.printString(gc, "" + sortVal, printArea, true, true,
        SWT.RIGHT);
  }

  private void openFilesMiniView(DownloadManager dm, TableCell cell) {
    Shell shell = ShellFactory.createShell(Utils.findAnyShell(), SWT.SHELL_TRIM);

    shell.setLayout(new FillLayout());

    Rectangle bounds = ((TableCellSWT) cell).getBoundsOnDisplay();
    bounds.y += bounds.height;
    bounds.width = 630;
    bounds.height = (16 * dm.getNumFileInfos()) + 60;
    Rectangle realBounds = shell.computeTrim(0, 0, bounds.width, bounds.height);
    realBounds.width -= realBounds.x;
    realBounds.height -= realBounds.y;
    realBounds.x = bounds.x;
    realBounds.y = bounds.y;
    if (bounds.height > 500) {
      bounds.height = 500;
    }
    shell.setBounds(realBounds);
    shell.setAlpha(230);

    Utils.verifyShellRect(shell, true);

   
    final FilesView view = new FilesView(false);
    view.dataSourceChanged(dm);

    view.initialize(shell);

    Composite composite = view.getComposite();
    //composite.setLayoutData(null);
    shell.setLayout(new FillLayout());

    view.viewActivated();
    view.refresh();

    final UIUpdatable viewUpdater = new UIUpdatable() {
      public void updateUI() {
        view.refresh();
      }

      public String getUpdateUIName() {
        return view.getFullTitle();
      }
    };
    UIUpdaterSWT.getInstance().addUpdater(viewUpdater);

    shell.addDisposeListener(new DisposeListener() {
      public void widgetDisposed(DisposeEvent e) {
        UIUpdaterSWT.getInstance().removeUpdater(viewUpdater);
      }
    });

    shell.layout(true, true);


    shell.setText(dm.getDisplayName());

    shell.open();
  }
View Full Code Here

TOP

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

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.