Examples of Shell


Examples of org.eclipse.swt.widgets.Shell

    }
    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

Examples of org.eclipse.swt.widgets.Shell

                  {
                    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

Examples of org.eclipse.swt.widgets.Shell

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

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

Examples of org.eclipse.swt.widgets.Shell

*/
public final class ShellFactory
{

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

    UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();

    if (uiFunctions != null) {

View Full Code Here

Examples of org.eclipse.swt.widgets.Shell

    }

    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

Examples of org.eclipse.swt.widgets.Shell

    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

Examples of org.eclipse.swt.widgets.Shell

  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

Examples of org.eclipse.swt.widgets.Shell

  }

  public static void openTorrentSimple() {
    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

Examples of org.eclipse.swt.widgets.Shell

   
      final String[] f_torrents = torrents;
     
    Utils.execSWTThread(new AERunnable() {
      public void runSupport() {
        Shell shell = Utils.findAnyShell();
        if (!AzureusCoreFactory.isCoreRunning()) {
          // not running, wait until running, then either
          // wait for UIFunctionsManager to be initialized,
          // or open immediately
          AzureusCoreFactory.addCoreRunningListener(new AzureusCoreRunningListener() {
View Full Code Here

Examples of org.eclipse.swt.widgets.Shell

   */
  public OpenUrlWindow(final Shell parent,
      String linkURL, final String referrer,
      final TorrentDownloaderCallBackInterface listener) {

    final Shell shell = ShellFactory.createShell(parent, SWT.DIALOG_TRIM
        | SWT.APPLICATION_MODAL | SWT.RESIZE);
    shell.setText(MessageText.getString("openUrl.title"));
    Utils.setShellIcon(shell);
   
    GridData gridData;
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    shell.setLayout(layout);
   
      // URL field
   
    Label label = new Label(shell, SWT.NULL);
    label.setText(MessageText.getString("openUrl.url"));
    gridData = new GridData();
    label.setLayoutData(gridData);
   
    final Text url = new Text(shell, SWT.BORDER);

    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.widthHint=400;
    gridData.horizontalSpan  = 2;
    url.setLayoutData(gridData);
    if(linkURL == null)
      Utils.setTextLinkFromClipboard(shell, url, true);
    else
      url.setText(linkURL);
    url.setSelection(url.getText().length());
   
   
   
    // help field
    Label help_label = new Label(shell, SWT.NULL);
    help_label.setText(MessageText.getString("openUrl.url.info"));
    gridData = new GridData();
    gridData.horizontalSpan  = 3;
    help_label.setLayoutData(gridData);
      
    Label space = new Label(shell, SWT.NULL);
    gridData = new GridData();
    gridData.horizontalSpan  = 3;
    space.setLayoutData(gridData);
   
      // referrer field
   
    Label referrer_label = new Label(shell, SWT.NULL);
    referrer_label.setText(MessageText.getString("openUrl.referrer"));
    gridData = new GridData();
    referrer_label.setLayoutData(gridData);
   
    final Combo referrer_combo = new Combo(shell, SWT.BORDER);

    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.widthHint=150;
  gridData.grabExcessHorizontalSpace = true;
  referrer_combo.setLayoutData(gridData);
   
    final StringList referrers = COConfigurationManager.getStringListParameter("url_open_referrers");
    StringIterator iter = referrers.iterator();
    while(iter.hasNext()) {
      referrer_combo.add(iter.next());
    }
   
    if ( referrer != null && referrer.length() > 0 ){
     
      referrer_combo.setText( referrer );
     
    }else if ( last_referrer != null ){
     
      referrer_combo.setText( last_referrer );
    }
   
    Label referrer_info = new Label(shell, SWT.NULL);
    referrer_info.setText(MessageText.getString("openUrl.referrer.info"));
   
  // line
 
  Label labelSeparator = new Label(shell,SWT.SEPARATOR | SWT.HORIZONTAL);
  gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END);
  gridData.horizontalSpan = 3;
  labelSeparator.setLayoutData(gridData);

      // buttons
   
    Composite panel = new Composite(shell, SWT.NULL);
    layout = new GridLayout();
    layout.numColumns = 3;
    panel.setLayout(layout);       
    gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_END);
    gridData.horizontalSpan = 3;
  gridData.grabExcessHorizontalSpace = true;
    panel.setLayoutData(gridData);
  
    new Label(panel, SWT.NULL);
   
    Button ok = new Button(panel,SWT.PUSH);
    gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_END);
    gridData.widthHint = 70;   
  gridData.grabExcessHorizontalSpace = true;
    ok.setLayoutData(gridData);
    ok.setText(MessageText.getString("Button.ok"));
    ok.addListener(SWT.Selection,new Listener() {
      public void handleEvent(Event e) {    
        last_referrer  = referrer_combo.getText().trim();
       
        if(! referrers.contains(last_referrer)) {
          referrers.add(last_referrer);
          COConfigurationManager.setParameter("url_open_referrers",referrers);
          COConfigurationManager.save();
        }
       
        COConfigurationManager.setParameter( CONFIG_REFERRER_DEFAULT, last_referrer );
        COConfigurationManager.save();
       
        String  url_str = url.getText();
       
        url_str = UrlUtils.parseTextForURL( url_str, true );
       
        if (url_str == null) {
          url_str = UrlUtils.parseTextForMagnets(url.getText());
        }
       
        if ( url_str == null ){
         
          url_str = url.getText();
        }
       
        new FileDownloadWindow(parent,url_str, last_referrer, null, listener );
        shell.dispose();
      }
    });
   
    shell.setDefaultButton (ok);
   
    Button cancel = new Button(panel,SWT.PUSH);
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
  gridData.grabExcessHorizontalSpace = false;
    gridData.widthHint = 70;
    cancel.setLayoutData(gridData);
    cancel.setText(MessageText.getString("Button.cancel"));
    cancel.addListener(SWT.Selection,new Listener() {
      public void handleEvent(Event e) {
        shell.dispose();
      }
    });       
   
  shell.addListener(SWT.Traverse, new Listener() {
    
    public void handleEvent(Event e) {
     
      if ( e.character == SWT.ESC){
        shell.dispose();
      }
    }
  });
 
 
  Point p = shell.computeSize( SWT.DEFAULT, SWT.DEFAULT );
 
  if ( p.x > 800 ){
   
    p.x = 800;
  }
 
    shell.setSize( p );   
   
    Utils.createURLDropTarget(shell, url);
   
    Utils.centreWindow( shell );
   
    shell.open();
  }
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.