Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Shell


        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) {
View Full Code Here


* @author Olivier
*
*/
public class TrackerChangerWindow {
  public TrackerChangerWindow(final Display display, final DownloadManager[] dms ) {
    final Shell shell = ShellFactory.createShell(display);
    shell.setText(MessageText.getString("TrackerChangerWindow.title"));
    Utils.setShellIcon(shell);
    GridLayout layout = new GridLayout();
    shell.setLayout(layout);

    Label label = new Label(shell, SWT.NONE);
    Messages.setLanguageText(label, "TrackerChangerWindow.newtracker");   
    GridData gridData = new GridData();
    gridData.widthHint = 200;
    label.setLayoutData(gridData);

    final Text url = new Text(shell, SWT.BORDER);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.widthHint = 300;
    url.setLayoutData(gridData);
    Utils.setTextLinkFromClipboard(shell, url, false);

    Composite panel = new Composite(shell, SWT.NULL);
    layout = new GridLayout();
    layout.numColumns = 3;
    panel.setLayout(layout);       
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    panel.setLayoutData(gridData);
    Button ok = new Button(panel, 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() {
      /* (non-Javadoc)
       * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
       */
      public void handleEvent(Event event) {
        try {
          for ( DownloadManager dm: dms ){
            TOTorrent  torrent = dm.getTorrent();
           
            if ( torrent != null ){
           
              TorrentUtils.announceGroupsInsertFirst( torrent, url.getText());
           
              TorrentUtils.writeToFile( torrent );
           
              TRTrackerAnnouncer announcer = dm.getTrackerClient();
             
              if ( announcer != null ){
           
                announcer.resetTrackerUrl(false);
              }
            }
          }
         
          shell.dispose();
        }
        catch (Exception e) {
          Debug.printStackTrace( e );
        }
      }
    });

    Button cancel = new Button(panel, SWT.PUSH);
    cancel.setText(MessageText.getString("Button.cancel"));
    gridData = new GridData();
    gridData.widthHint = 70;
    cancel.setLayoutData(gridData);
    cancel.addListener(SWT.Selection, new Listener() {
      /* (non-Javadoc)
       * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
       */
      public void handleEvent(Event event) {
        shell.dispose();
      }
    });

    shell.pack();
    Utils.createURLDropTarget(shell, url);
    shell.open();
  }
View Full Code Here

              stop(dm, shell, stateAfterStopped);
            }
          });
          return;
        }
        Shell aShell = shell == null ? Utils.findAnyShell() : shell;
        MessageBox mb = new MessageBox(aShell, SWT.ICON_WARNING
            | SWT.YES | SWT.NO);
        mb.setText(MessageText.getString("seedmore.title"));
        mb.setMessage(MessageText.getString("seedmore.shareratio")
            + (dm.getStats().getShareRatio() / 10) + "%.\n"
View Full Code Here

    }
    else {
        styles = SWT.DIALOG_TRIM | SWT.MAX | SWT.RESIZE | SWT.APPLICATION_MODAL;
    }

    final Shell window = org.gudy.azureus2.ui.swt.components.shell.ShellFactory.createShell(display,styles);
    Messages.setLanguageText(window,"ConfigView.section.ipfilter.list.title");
    Utils.setShellIcon(window);
    FormLayout layout = new FormLayout();
    try {
      layout.spacing = 5;
    } catch (NoSuchFieldError e) {
      /* Ignore for Pre 3.0 SWT.. */
    }
    layout.marginHeight = 5;
    layout.marginWidth = 5;
    window.setLayout(layout);
    FormData formData;
   
      // text blocked area
   
    final StyledText textBlocked = new StyledText(window,SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    Button btnClear = new Button(window,SWT.PUSH);
    textBlocked.setEditable(false);
   
    final StyledText textBanned = new StyledText(window,SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    Button btnOk = new Button(window,SWT.PUSH);
    Button btnReset = new Button(window,SWT.PUSH);
    textBanned.setEditable(false);
   
           
    formData = new FormData();
    formData.left = new FormAttachment(0,0);
    formData.right = new FormAttachment(100,0);
    formData.top = new FormAttachment(0,0);  
    formData.bottom = new FormAttachment(40,0);  
    textBlocked.setLayoutData(formData);
    textBlocked.setText(ipsBlocked);
   
   
    // label blocked area
   
    Label  blockedInfo = new Label(window, SWT.NULL);
    Messages.setLanguageText(blockedInfo,"ConfigView.section.ipfilter.blockedinfo");
    formData = new FormData();
    formData.top = new FormAttachment(textBlocked);   
    formData.right = new FormAttachment(btnClear);   
    formData.left = new FormAttachment(0,0);   
    blockedInfo.setLayoutData( formData );
      // clear button
   
   
    Messages.setLanguageText(btnClear,"Button.clear");
    formData = new FormData();
    formData.top = new FormAttachment(textBlocked);   
    formData.right = new FormAttachment(95,0 );   
    //formData.bottom = new FormAttachment(textBanned);
    formData.width = 70;
    btnClear.setLayoutData(formData);
    btnClear.addListener(SWT.Selection,new Listener() {

    public void handleEvent(Event e) {
    
      azureus_core.getIpFilterManager().getIPFilter().clearBlockedIPs();
     
      textBlocked.setText( "" );
    }
    });
   
   
      // text banned area
    formData = new FormData();
    formData.left = new FormAttachment(0,0);
    formData.right = new FormAttachment(100,0);
    formData.top = new FormAttachment(btnClear);  
    formData.bottom = new FormAttachment(btnOk);  
    textBanned.setLayoutData(formData);
    textBanned.setText(ipsBanned);
   
      // label banned area
   
    Label  bannedInfo = new Label(window, SWT.NULL);
    Messages.setLanguageText(bannedInfo,"ConfigView.section.ipfilter.bannedinfo");
    formData = new FormData();
    formData.right = new FormAttachment(btnReset);   
    formData.left = new FormAttachment(0,0);   
    formData.bottom = new FormAttachment(100,0)
    bannedInfo.setLayoutData( formData );
   
      // reset button
   
    Messages.setLanguageText(btnReset,"Button.reset");
    formData = new FormData();
    formData.right = new FormAttachment(btnOk);   
    formData.bottom = new FormAttachment(100,0);   
    formData.width = 70;
    btnReset.setLayoutData(formData);
    btnReset.addListener(SWT.Selection,new Listener() {

    public void handleEvent(Event e) {
      azureus_core.getIpFilterManager().getIPFilter().clearBannedIps();
      azureus_core.getIpFilterManager().getBadIps().clearBadIps();
   
      textBanned.setText( "" );   
      }
    });
      // ok button
   
    Messages.setLanguageText(btnOk,"Button.ok");
    formData = new FormData();
    formData.right = new FormAttachment(95,0);   
    formData.bottom = new FormAttachment(100,0);   
    formData.width = 70;
    btnOk.setLayoutData(formData);
    btnOk.addListener(SWT.Selection,new Listener() {

    public void handleEvent(Event e) {
      window.dispose();
    }
    });
       
    window.setDefaultButton( btnOk );
   
    window.addListener(SWT.Traverse, new Listener() { 
    public void handleEvent(Event e) {
      if ( e.character == SWT.ESC){
           window.dispose();
       }
    }
    });
   
    if (!Utils.linkShellMetricsToConfig(window, "BlockedIpsWindow")) {
      window.setSize(620, 450);
      if (!Constants.isOSX)
        Utils.centreWindow(window);
    }
    window.layout();
    window.open();
    return window;
  }
View Full Code Here

                  {
                    synchronized( ProgressWindow.this ){
                     
                      if ( !task_complete ){
                   
                        Shell shell = org.gudy.azureus2.ui.swt.components.shell.ShellFactory.createMainShell(
                            ( SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL ));


                        showDialog( shell );
                      }
                    }
                  }
                },
                false );
            }
          }
        });
   
    new AEThread2( "ProgressWindow", true )
    {
      public void
      run()
      {
        try
          // Thread.sleep(10000);
         
          operation.getTask().run( operation );
         
        }catch( RuntimeException e ){
         
          error[0] = e;
         
        }catch( Throwable e ){
   
          error[0] = new RuntimeException( e );
         
        }finally{
         
          Utils.execSWTThread(
              new Runnable()
              {
                public void
                run()
                {
                  destroy();
                }
              });
        }
      }
    }.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
     
      synchronized( ProgressWindow.this ){
       
        task_complete = true;
      }
     
      try{
        if ( shell != null && !shell.isDisposed()){
       
          shell.dispose();
        }
      }catch( Throwable e ){
       
        Debug.printStackTrace(e);
      }
View Full Code Here

    int      _style,
    int      _delay_millis )
  {
    resource = _resource;
     
    final Shell shell = new Shell( _parent, _style );

    if ( _delay_millis <= 0 ){
   
      showDialog( shell );
     
View Full Code Here

*/
public final class ShellFactory
{

  public static Shell createMainShell(int styles) {
    Shell parent = null;

    UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();

    if (uiFunctions != null) {

View Full Code Here

    }

    public void open() {
      UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
      if (uiFunctions != null) {
        Shell mainShell = uiFunctions.getMainShell();
        if (mainShell != null && mainShell.getMinimized()) {
          uiFunctions.bringToFront();
        }
      }
     
      Shell firstShellWithStyle = Utils.findFirstShellWithStyle(SWT.APPLICATION_MODAL);
      if (firstShellWithStyle != null && firstShellWithStyle != this) {
        // ok, there's a window with application_modal set, which on OSX will mean
        // that if we open our window, it will be on top, but users won't be able
        // to interact with it.  So, wait until the modal window goes away..
        firstShellWithStyle.addDisposeListener(new DisposeListener() {
          public void widgetDisposed(DisposeEvent e) {
            // wait for dispose to complete, then run open again to check for
            // any new application modal shells to wait for
            Utils.execSWTThreadLater(0, new AERunnable() {
              public void runSupport() {
                AEShell.this.open();
              }
            });
          }
        });
        firstShellWithStyle.setVisible(true);
        firstShellWithStyle.forceActive();
      } else {
        if (!isDisposed()) {
          super.open();
        }
      }
View Full Code Here

    public final void performForShells(final Listener command)
    {
        Iterator iter = shells.iterator();
        for(int i = 0; i < shells.size(); i++)
        {
            Shell aShell = (Shell)iter.next();
            Event evt = new Event();
            evt.widget = aShell;
            evt.data = this;
            command.handleEvent(evt);
        }
View Full Code Here

  public static void
  openTorrentTrackingOnly()
  {
    Utils.execSWTThread(new AERunnable() {
      public void runSupport() {
        final Shell shell = Utils.findAnyShell();
        if (shell == null)
          return;

        FileDialog fDialog = new FileDialog(shell, SWT.OPEN | SWT.MULTI);
        fDialog.setFilterPath(getFilterPathTorrent());
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.