Package org.gudy.azureus2.ui.swt.welcome

Examples of org.gudy.azureus2.ui.swt.welcome.WelcomeWindow


  }

  public static MenuItem addNatTestMenuItem(Menu menu) {
    return addMenuItem(menu, MENU_ID_NAT_TEST, new Listener() {
      public void handleEvent(Event e) {
        new NatTestWindow();
      }
    });
  }
View Full Code Here


          }
          case kHICommandWizard:
            new ConfigureWizard(false,ConfigureWizard.WIZARD_MODE_FULL);
            return noErr;
          case kHICommandNatTest:
            new NatTestWindow();
            return noErr;
          case kHICommandSpeedTest:
            new SpeedTestWizard();
            return noErr;
View Full Code Here

        uiFunctions.dispose(true, false);
      }
    } else if (sel == sel_wizardMenuSelected_) {
      new ConfigureWizard(false,ConfigureWizard.WIZARD_MODE_FULL);
    } else if (sel == sel_natMenuSelected_) {
      new NatTestWindow();
    } else if (sel == sel_speedMenuSelected_) {
      new SpeedTestWizard();
    } else if (sel == sel_toolbarButtonClicked_) {
      try {
        Field fldsel_window = osCls.getField("sel_window");
View Full Code Here

 
  public static MenuItem addPluginInstallMenuItem(Menu menuParent) {
    return addMenuItem(menuParent, MENU_ID_PLUGINS_INSTALL,
        new Listener() {
          public void handleEvent(Event e) {
            new InstallPluginWizard();
      }
    });
  }
View Full Code Here

      /*
       * Add a listener to the reporter for a cancel event and cancel the update
       * check instance if the event is detected
       */
      updateReporter.addListener(new IProgressReporterListener() {

        public int report(IProgressReport progressReport) {
          if (progressReport.getReportType() == REPORT_TYPE_DONE
              || progressReport.getReportType() == REPORT_TYPE_ERROR) {
            return RETVAL_OK_TO_DISPOSE;
View Full Code Here

      }
    });

    Rectangle printArea = new Rectangle(BORDER_X, 0, WIDTH - (BORDER_X * 2),
        5000);
    spText = new GCStringPrinter(gc, text, printArea, true, false, SWT.WRAP);
    spText.setUrlColor(Colors.blues[Colors.FADED_DARKEST]);
    spText.calculateMetrics();

    gc.setFont(fontCount);
    String sCount = MessageText.getString("OpenTorrentWindow.xOfTotal",
        new String[] {
          "" + historyPosition + 1,
          "" + getWarningCount()
        });
    spCount = new GCStringPrinter(gc, sCount, printArea, true, false, SWT.WRAP);
    spCount.calculateMetrics();

    gc.setFont(fontTitle);
    spTitle = new GCStringPrinter(gc, title, printArea, true, false, SWT.WRAP);
    spTitle.calculateMetrics();

    gc.dispose();
    sizeText = spText.getCalculatedSize();
    sizeTitle = spTitle.getCalculatedSize();
    sizeCount = spCount.getCalculatedSize();

    FormData fd;

    Button btnDismiss = new Button(shell, SWT.PUSH);
    Messages.setLanguageText(btnDismiss, "Button.dismiss");
    final int btnHeight = btnDismiss.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;

    Button btnPrev = new Button(shell, SWT.PUSH);
    btnPrev.setText("<");

    Button btnNext = new Button(shell, SWT.PUSH);
    btnNext.setText(">");

    fd = new FormData();
    fd.bottom = new FormAttachment(100, -BORDER_Y1);
    fd.right = new FormAttachment(100, -BORDER_X);
    btnNext.setLayoutData(fd);

    fd = new FormData();
    fd.bottom = new FormAttachment(100, -BORDER_Y1);
    fd.right = new FormAttachment(btnNext, -BORDER_X);
    btnPrev.setLayoutData(fd);

    fd = new FormData();
    fd.bottom = new FormAttachment(100, -BORDER_Y1);
    fd.right = new FormAttachment(btnPrev, -BORDER_X);
    btnDismiss.setLayoutData(fd);

    height = BORDER_Y0 + sizeTitle.y + GAP_Y + sizeText.y + GAP_Y_TITLE_COUNT
        + sizeCount.y + GAP_BUTTON_Y + btnHeight + BORDER_Y1;

    Rectangle area = shell.computeTrim(ptBottomRight.x - WIDTH, ptBottomRight.y
        - height, WIDTH, height);
    shell.setBounds(area);
    shell.setLocation(ptBottomRight.x - area.width, ptBottomRight.y
        - area.height - 2);

    rectX = new Rectangle(area.width - BORDER_X - boundsClose.width, BORDER_Y0,
        boundsClose.width, boundsClose.height);

    shell.addMouseMoveListener(new MouseMoveListener() {
      int lastCursor = SWT.CURSOR_ARROW;

      public void mouseMove(MouseEvent e) {
        if (shell == null || shell.isDisposed()) {
          return;
        }
        URLInfo hitUrl = spText.getHitUrl(e.x, e.y);

        int cursor = (rectX.contains(e.x, e.y)) || hitUrl != null
            ? SWT.CURSOR_HAND : SWT.CURSOR_ARROW;
        if (cursor != lastCursor) {
          lastCursor = cursor;
          shell.setCursor(e.display.getSystemCursor(cursor));
        }
      }
    });

    shell.addMouseListener(new MouseListener() {
      public void mouseUp(MouseEvent e) {
        if (shell == null || shell.isDisposed()) {
          return;
        }
        if (rectX.contains(e.x, e.y)) {
          shell.dispose();
        }
        URLInfo hitUrl = spText.getHitUrl(e.x, e.y);
        if (hitUrl != null) {
          if (hitUrl.url.equals("details")) {
            MessageBoxShell mb = new MessageBoxShell(Constants.APP_NAME,
                logAlert.details, new String[] {
                  MessageText.getString("Button.ok")
                }, 0);
            mb.setUseTextBox(true);
            mb.setParent(Utils.findAnyShell());
            mb.open(null);
          } else {
            Utils.launch(hitUrl.url);
          }
        }
      }

      public void mouseDown(MouseEvent e) {
      }

      public void mouseDoubleClick(MouseEvent e) {
      }
    });

    shell.addPaintListener(new PaintListener() {
      public void paintControl(PaintEvent e) {
        e.gc.drawImage(imgClose, WIDTH - BORDER_X - boundsClose.width,
            BORDER_Y0);

        Rectangle printArea;
        printArea = new Rectangle(BORDER_X, BORDER_Y0 + sizeTitle.y + GAP_Y_TITLE_COUNT,
            WIDTH, 100);
        String sCount = MessageText.getString("OpenTorrentWindow.xOfTotal",
            new String[] {
              "" + (historyPosition + 1),
              "" + getWarningCount()
            });
        e.gc.setAlpha(180);
        Font lastFont = e.gc.getFont();
        e.gc.setFont(fontCount);
        spCount = new GCStringPrinter(e.gc, sCount, printArea, true, false,
            SWT.WRAP | SWT.TOP);
        spCount.printString();
        e.gc.setAlpha(255);
        sizeCount = spCount.getCalculatedSize();

View Full Code Here

      Image image = getImage();
      Rectangle imageBounds = null;
      if (image != null && !image.isDisposed()) {
        imageBounds = image.getBounds();
      }
      GCStringPrinter sp = new GCStringPrinter(e.gc, getText(), clientArea,
          true, true, SWT.CENTER);
      sp.calculateMetrics();
      Point textSize = sp.getCalculatedSize();

      if (imageBounds != null) {
        int pad = 2;
        int ofs = imageBounds.width + imageBounds.x;
        int xStartImage = (clientArea.width - textSize.x - ofs - pad) / 2;
        e.gc.drawImage(image, xStartImage,
            (clientArea.height / 2) - (imageBounds.height / 2));
        clientArea.x += xStartImage + ofs + pad;
        clientArea.width -= xStartImage + ofs + pad;
      } else {
        int ofs = (clientArea.width / 2) - (textSize.x / 2);
        clientArea.x += ofs;
        clientArea.width -= ofs;
      }
      sp.printString(e.gc, clientArea, SWT.LEFT);

      int x = clientArea.x + clientArea.width - 1;
      e.gc.setAlpha(20);
      e.gc.drawLine(x, 3, x, clientArea.height - 3);
    }
View Full Code Here

        lastSize.x += ofs;
        lastSize.y = bounds.height;
      }

      GC gc = new GC(this);
      GCStringPrinter sp = new GCStringPrinter(gc, getText(), new Rectangle(0,
          0, 10000, 20), true, true, SWT.LEFT);
      sp.calculateMetrics();
      Point lastTextSize = sp.getCalculatedSize();
      gc.dispose();

      lastSize.x += lastTextSize.x + 10;
      lastSize.y = Math.max(lastSize.y, lastTextSize.y);
View Full Code Here

      public void mouseMove(MouseEvent e) {
        if (shell == null || shell.isDisposed()) {
          return;
        }
        URLInfo hitUrl = spText.getHitUrl(e.x, e.y);

        int cursor = (rectX.contains(e.x, e.y)) || hitUrl != null
            ? SWT.CURSOR_HAND : SWT.CURSOR_ARROW;
        if (cursor != lastCursor) {
          lastCursor = cursor;
          shell.setCursor(e.display.getSystemCursor(cursor));
        }
      }
    });

    shell.addMouseListener(new MouseListener() {
      public void mouseUp(MouseEvent e) {
        if (shell == null || shell.isDisposed()) {
          return;
        }
        if (rectX.contains(e.x, e.y)) {
          shell.dispose();
        }
        URLInfo hitUrl = spText.getHitUrl(e.x, e.y);
        if (hitUrl != null) {
          if (hitUrl.url.equals("details")) {
            MessageBoxShell mb = new MessageBoxShell(Constants.APP_NAME,
                logAlert.details, new String[] {
                  MessageText.getString("Button.ok")
View Full Code Here

              if ( pos != -1 ){
               
                param_name = param_name.substring( 0, pos ).trim();
              }
             
              MessageBoxShell mb =
                new MessageBoxShell(
                  SWT.ICON_ERROR | SWT.OK,
                  MessageText.getString( "ConfigView.section.invalid.value.title"),
                  MessageText.getString(
                    "ConfigView.section.invalid.value",
                    new String[]{ val, param_name, Debug.getNestedExceptionMessage(e)}));
             
                  mb.setParent( parent.getShell());
                  mb.open(null);
            }
          }
        });
     
      label = new Label(area, SWT.NULL);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      label.setLayoutData(gridData);
     
      Long max_heap_mb = AEMemoryMonitor.getMaxHeapMB();
     
      if ( max_heap_mb > 0 ){
       
        Messages.setLanguageText(label,  "jvm.max.mem.current", new String[]{ DisplayFormatters.formatByteCountToKiBEtc( max_heap_mb*1024*1024, true )});
      }
    }
   
    {
        // min mem
     
      final int MIN_MIN_JVM = 8*1024*1024;
 
      long  min_mem = AEMemoryMonitor.getJVMLongOption( options, "-Xms" );
 
      GridData gridData = new GridData();
      Label label = new Label(area, SWT.NULL);
      label.setLayoutData(gridData);
      Messages.setLanguageText(label,  "jvm.min.mem", new String[]{encodeDisplayLong(MIN_MIN_JVM)});
 
      gridData = new GridData();
      gridData.widthHint = 125;
      final StringParameter min_vm = new StringParameter(area, "jvm.min.mem", "", false );
      min_vm.setLayoutData(gridData);
       
      min_vm.setValue( min_mem == -1?"":encodeDisplayLong( min_mem ));
     
      min_vm.addChangeListener(
        new ParameterChangeAdapter()
        {
          private String  last_value;
         
          public void
          parameterChanged(
            Parameter  p,
            boolean    caused_internally )
          {
            if ( min_vm.isDisposed()){
             
              min_vm.removeChangeListener( this );
             
              return;
            }
           
            String val = min_vm.getValue();
           
            if ( last_value != null && last_value.equals( val )){
             
              return;
            }
           
            last_value = val;
                     
            try{
              long min_mem = decodeDisplayLong( val );
             
              if ( min_mem < MIN_MIN_JVM ){
               
                throw( new Exception( "Min=" + encodeDisplayLong( MIN_MIN_JVM )));
              }
                         
              String[] options = platform.getExplicitVMOptions();
             
              options = AEMemoryMonitor.setJVMLongOption( options, "-Xms", min_mem );
 
              long  max_mem = AEMemoryMonitor.getJVMLongOption( options, "-Xmx" );
 
              if ( max_mem == -1 || max_mem < min_mem ){
               
                options = AEMemoryMonitor.setJVMLongOption( options, "-Xmx", min_mem );
              }
             
              platform.setExplicitVMOptions( options );
             
              buildOptions( parent, platform, area, true );
             
            }catch( Throwable e ){
             
              String param_name = MessageText.getString( "jvm.min.mem" );
             
              int  pos = param_name.indexOf( '[' );
             
              if ( pos != -1 ){
               
                param_name = param_name.substring( 0, pos ).trim();
              }
             
              MessageBoxShell mb =
                new MessageBoxShell(
                  SWT.ICON_ERROR | SWT.OK,
                  MessageText.getString( "ConfigView.section.invalid.value.title"),
                  MessageText.getString(
                    "ConfigView.section.invalid.value",
                    new String[]{ val, param_name, Debug.getNestedExceptionMessage(e)}));
             
                  mb.setParent( parent.getShell());
                  mb.open(null);
            }
          }
        });
     
      label = new Label(area, SWT.NULL);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      label.setLayoutData(gridData);
    }
   
    {
        // max DIRECT mem
     
      final int MIN_DIRECT_JVM = 32*1024*1024;
     
      final String OPTION_KEY = "-XX:MaxDirectMemorySize=";
     
      long  max_direct = AEMemoryMonitor.getJVMLongOption( options, OPTION_KEY );
 
      GridData gridData = new GridData();
      Label label = new Label(area, SWT.NULL);
      label.setLayoutData(gridData);
      Messages.setLanguageText(label,  "jvm.max.direct.mem", new String[]{encodeDisplayLong(MIN_DIRECT_JVM)});
 
      gridData = new GridData();
      gridData.widthHint = 125;
      final StringParameter max_direct_vm = new StringParameter(area, "jvm.max.direct.mem", "", false );
      max_direct_vm.setLayoutData(gridData);
       
      max_direct_vm.setValue( max_direct == -1?"":encodeDisplayLong( max_direct ));
     
      max_direct_vm.addChangeListener(
        new ParameterChangeAdapter()
        {
          private String  last_value;
         
          public void
          parameterChanged(
            Parameter  p,
            boolean    caused_internally )
          {
            if ( max_direct_vm.isDisposed()){
             
              max_direct_vm.removeChangeListener( this );
             
              return;
            }
           
            String val = max_direct_vm.getValue();
           
            if ( last_value != null && last_value.equals( val )){
             
              return;
            }
           
            last_value = val;
                     
            try{
              long max_direct = decodeDisplayLong( val );
             
              if ( max_direct < MIN_DIRECT_JVM ){
               
                throw( new Exception( "Min=" + encodeDisplayLong( MIN_DIRECT_JVM )));
              }
                         
              String[] options = platform.getExplicitVMOptions();
             
              options = AEMemoryMonitor.setJVMLongOption( options, OPTION_KEY, max_direct );
               
              platform.setExplicitVMOptions( options );
             
              buildOptions( parent, platform, area, true );
             
            }catch( Throwable e ){
             
              String param_name = MessageText.getString( "jvm.max.direct.mem" );
             
              int  pos = param_name.indexOf( '[' );
             
              if ( pos != -1 ){
               
                param_name = param_name.substring( 0, pos ).trim();
              }
             
              MessageBoxShell mb =
                new MessageBoxShell(
                  SWT.ICON_ERROR | SWT.OK,
                  MessageText.getString( "ConfigView.section.invalid.value.title"),
                  MessageText.getString(
                    "ConfigView.section.invalid.value",
                    new String[]{ val, param_name, Debug.getNestedExceptionMessage(e)}));
             
                  mb.setParent( parent.getShell());
                  mb.open(null);
            }
          }
        });
     
      label = new Label(area, SWT.NULL);
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.ui.swt.welcome.WelcomeWindow

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.