Package org.eclipse.swt.layout

Examples of org.eclipse.swt.layout.GridData


  }

 
  protected Control createDialogArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.None);
    GridData data = new GridData(GridData.FILL, GridData.FILL, true, true);
    composite.setLayoutData(data);
    GridLayout layout = new GridLayout(1, false);
    composite.setLayout(layout);   
   
    Label label = new Label(composite,SWT.NONE);
View Full Code Here


        GridLayout layout = new GridLayout(1, false);
        layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
        layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
        viewerComposite.setLayout(layout);

        GridData data = new GridData(GridData.FILL_BOTH);
        data.heightHint = 200;
        data.widthHint = 350;

        viewerComposite.setLayoutData(data);

        viewer = CheckboxTableViewer.newCheckList(viewerComposite, SWT.BORDER);
        viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));

        class WorkingSetLabelProvider extends LabelProvider {
            private ResourceManager images;

            public WorkingSetLabelProvider() {
                images = new LocalResourceManager(JFaceResources.getResources());
            }

            public void dispose() {
                images.dispose();

                super.dispose();
            }

            public Image getImage(Object object) {
                Assert.isTrue(object instanceof IWorkingSet);
                IWorkingSet workingSet = (IWorkingSet) object;
                ImageDescriptor imageDescriptor = workingSet.getImageDescriptor();

                if (imageDescriptor == null) {
                    return null;
                }

                Image icon = (Image) images.get(imageDescriptor);
                return icon;
            }

            public String getText(Object object) {
                Assert.isTrue(object instanceof IWorkingSet);
                IWorkingSet workingSet = (IWorkingSet) object;
                return workingSet.getLabel();
            }
        }
        viewer.setLabelProvider(new WorkingSetLabelProvider());

        viewer.setContentProvider(new ArrayContentProvider());
        viewer.setInput(PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets());
        viewer.addSelectionChangedListener(new ISelectionChangedListener() {
            public void selectionChanged(SelectionChangedEvent event) {
                // handleSelectionChanged();
            }
        });

        data = new GridData(GridData.FILL_BOTH);
        data.heightHint = 200;
        data.widthHint = 50;
        viewer.getControl().setLayoutData(data);
        Dialog.applyDialogFont(composite);
       
View Full Code Here

    setHelpAvailable(false);
  }

  protected Control createDialogArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.None);
    composite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
    GridLayout layout = new GridLayout(2, false);
    composite.setLayout(layout);

    GridData txtStyle = new GridData(GridData.FILL_HORIZONTAL);
    txtStyle.minimumWidth = convertWidthInCharsToPixels(60);

    Label lblTemplateName = new Label(composite, SWT.None);
    lblTemplateName.setText("Server name:");
    _srvName = new Text(composite, SWT.BORDER);
    _srvName.setLayoutData(txtStyle);
    _srvName.addModifyListener(this);

    //Label filler = new Label(composite, SWT.None);
    //filler.setText("");

    Label lblUrl = new Label(composite, SWT.None);
    lblUrl.setText("URL:");
    _srvURL = new Text(composite, SWT.BORDER);
    _srvURL.setLayoutData(txtStyle);
    _srvURL.addModifyListener(this);

    //filler = new Label(composite, SWT.None);
    //filler.setText("");

    Label lblUser = new Label(composite, SWT.None);
    lblUser.setText("User:");
    _srvUser = new Text(composite, SWT.BORDER);
    _srvUser.setLayoutData(txtStyle);
    _srvUser.addModifyListener(this);

    //filler = new Label(composite, SWT.None);
    //filler.setText("");

    Label lblPW = new Label(composite, SWT.None);
    lblPW.setText("Password:");
    _srvPW = new Text(composite, SWT.PASSWORD | SWT.BORDER);
    _srvPW.setLayoutData(txtStyle);
    _srvPW.addModifyListener(this);

    _btnTestConnection = new Button(composite, SWT.PUSH);
    _btnTestConnection.addSelectionListener(new SelectionListener() {

      public void widgetDefaultSelected(SelectionEvent e) {
      }

      public void widgetSelected(SelectionEvent e) {
        handleTestConnection();
      }

    });
    _btnTestConnection.setText("Test connection");
    _btnTestConnection.setEnabled(false);
   
    GridData g = new GridData();
    g.horizontalAlignment = GridData.END;
    g.horizontalSpan = 2;
    _btnTestConnection.setLayoutData(g);

    if (_server != null) {
View Full Code Here

      label.setText("Metadata headers are present in this tml file. Editing metadata with this editor is not possible. Please remove metadata headers first.");
      noDefaultAndApplyButton();
    } else {
      Label label = new Label(composite, SWT.None);
      label.setText("Description:");
      label.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
      _txtDescription = new Text(composite, SWT.MULTI|SWT.BORDER);
      _txtDescription.setData("description");
      GridData descriptionLayout = new GridData(SWT.FILL, SWT.FILL, true, false);
      descriptionLayout.heightHint = WidgetFactory.computeFontHeight(_txtDescription) * 5;
        _txtDescription.setLayoutData(descriptionLayout);
     
     
      label = new Label(composite, SWT.None);
      label.setText("DirectAccess:");
      _chkDirectAccess = new Button(composite, SWT.CHECK);
      _chkDirectAccess.setText("enabled");
      _chkDirectAccess.setData("directAccess");
     
      label = new Label(composite, SWT.None);
      label.setText("Caching:");
      _chkCachable = new Button(composite, SWT.CHECK);
      _chkCachable.setText("enabled");
      _chkCachable.setData("cachable");
     
     
      Label filler = new Label(composite, SWT.None);
      GridData fillerLayout = new GridData(SWT.FILL, SWT.FILL, true, true);
      fillerLayout.horizontalSpan = 2;
      filler.setLayoutData(fillerLayout);
       
      bind(composite);           
    }
View Full Code Here

  public Composite configSectionCreate(final Composite parent) {
    ImageLoader imageLoader = ImageLoader.getInstance();
    Image imgOpenFolder = imageLoader.getImage("openFolderButton");     

    GridData gridData;
    GridLayout layout;

    Composite gLogging = new Composite(parent, SWT.NULL);
    gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
    gLogging.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 2;
    gLogging.setLayout(layout);
   
    int userMode = COConfigurationManager.getIntParameter("User Mode");

   
    BooleanParameter enable_logger = new BooleanParameter(gLogging, "Logger.Enabled", CFG_PREFIX + "loggerenable");
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    enable_logger.setLayoutData(gridData);

    // row

    final BooleanParameter enableLogging =
      new BooleanParameter(gLogging,
                           "Logging Enable",
                           CFG_PREFIX + "enable");
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    enableLogging.setLayoutData(gridData);

    Composite cArea = new Composite(gLogging, SWT.NULL);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 3;
    cArea.setLayout(layout);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 2;
    cArea.setLayoutData(gridData);


    // row

    Label lStatsPath = new Label(cArea, SWT.NULL);
    Messages.setLanguageText(lStatsPath, CFG_PREFIX + "logdir"); //$NON-NLS-1$

    gridData = new GridData();
    gridData.widthHint = 150;
    final StringParameter pathParameter = new StringParameter(cArea, "Logging Dir"); //$NON-NLS-1$ //$NON-NLS-2$
    pathParameter.setLayoutData(gridData);
    Button browse = new Button(cArea, SWT.PUSH);
    browse.setImage(imgOpenFolder);
    imgOpenFolder.setBackground(browse.getBackground());
    browse.setToolTipText(MessageText.getString("ConfigView.button.browse"));
    browse.addListener(SWT.Selection, new Listener() {
      /* (non-Javadoc)
       * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
       */
      public void handleEvent(Event event) {
      DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.APPLICATION_MODAL);
        dialog.setFilterPath(pathParameter.getValue());
        dialog.setText(MessageText.getString(CFG_PREFIX + "choosedefaultsavepath")); //$NON-NLS-1$
        String path = dialog.open();
        if (path != null) {
        pathParameter.setValue(path);
        }
      }
    });

    Label lMaxLog = new Label(cArea, SWT.NULL);

    Messages.setLanguageText(lMaxLog, CFG_PREFIX + "maxsize");
    final String lmLabels[] = new String[logFileSizes.length];
    final int lmValues[] = new int[logFileSizes.length];
    for (int i = 0; i < logFileSizes.length; i++) {
      int  num = logFileSizes[i];
      lmLabels[i] = " " + num + " MB";
      lmValues[i] = num;
    }

    IntListParameter paramMaxSize = new IntListParameter(cArea, "Logging Max Size", lmLabels, lmValues);
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    paramMaxSize.setLayoutData(gridData);
   
    if(userMode > 1)
    {
      Label timeStampLbl = new Label(cArea, SWT.NULL);
      Messages.setLanguageText(timeStampLbl, CFG_PREFIX+"timestamp");
      timeStampLbl.setLayoutData(new GridData());
      StringParameter timeStamp = new StringParameter(cArea,"Logging Timestamp");
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      gridData.widthHint = 150;
      timeStamp.setLayoutData(gridData);
    }
   
   
   
    /** FileLogging filter, consisting of a List of types (info, warning, error)
     * and a checkbox Table of component IDs.
     */
    final String sFilterPrefix = CFG_PREFIX + "filter";
    Group gLogIDs = new Group(gLogging, SWT.NULL);
    Messages.setLanguageText(gLogIDs, sFilterPrefix);
    layout = new GridLayout();
    layout.numColumns = 2;
    gLogIDs.setLayout(layout);
    gridData = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, true);
    gridData.horizontalSpan = 2;
    gLogIDs.setLayoutData(gridData);

    final List listLogTypes = new List(gLogIDs, SWT.BORDER | SWT.SINGLE
        | SWT.V_SCROLL);
    gridData = new GridData(SWT.NULL, SWT.BEGINNING, false, false);
    listLogTypes.setLayoutData(gridData);

    final int[] logTypes = { LogEvent.LT_INFORMATION, LogEvent.LT_WARNING,
        LogEvent.LT_ERROR };
    for (int i = 0; i < logTypes.length; i++)
      listLogTypes.add(MessageText.getString(CFG_PREFIX + "log" + i + "type"));
    listLogTypes.select(0);

    final LogIDs[] logIDs = FileLogging.configurableLOGIDs;
    //Arrays.sort(logIDs);
    final Table tableLogIDs = new Table(gLogIDs, SWT.CHECK | SWT.BORDER
        | SWT.SINGLE | SWT.FULL_SELECTION);
    gridData = new GridData(GridData.FILL_BOTH);
    tableLogIDs.setLayoutData(gridData);
    tableLogIDs.setLinesVisible (false);   
    tableLogIDs.setHeaderVisible(false);
    TableColumn column = new TableColumn(tableLogIDs, SWT.NONE);

View Full Code Here

  GridLayout layout = new GridLayout();
  layout.numColumns = 1;
  rootPanel.setLayout(layout);

  Composite panel = new Composite(rootPanel, SWT.NULL);
  GridData gridData = new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.FILL_HORIZONTAL);
  panel.setLayoutData(gridData);
  layout = new GridLayout();
  layout.numColumns = 3;
  panel.setLayout(layout);

  Label label = new Label(panel, SWT.WRAP);
  gridData = new GridData();
  gridData.horizontalSpan = 3;
  gridData.widthHint = 380;
  label.setLayoutData(gridData);
  Messages.setLanguageText(label, "exportTorrentWizard.finish.message");
  }
View Full Code Here

      GridLayout layout = new GridLayout();
      layout.numColumns = 3;
     
      shell.setLayout (layout);
     
      GridData gridData;
     
      // info
     
      Label info_label = new Label(shell,SWT.NULL);
      Messages.setLanguageText(info_label, "security.certtruster.intro");
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 3;
      info_label.setLayoutData(gridData);
     
      // resource
     
      Label resource_label = new Label(shell,SWT.NULL);
      Messages.setLanguageText(resource_label, "security.certtruster.resource");
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 1;
      resource_label.setLayoutData(gridData);
     
      Label resource_value = new Label(shell,SWT.NULL);
      resource_value.setText(resource.replaceAll("&", "&&"));
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 2;
      resource_value.setLayoutData(gridData);
     
      // issued by
     
      Label issued_by_label = new Label(shell,SWT.NULL);
      Messages.setLanguageText(issued_by_label, "security.certtruster.issuedby");
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 1;
      issued_by_label.setLayoutData(gridData);
     
      Label issued_by_value = new Label(shell,SWT.NULL);
      issued_by_value.setText(extractCN(cert.getIssuerDN().getName()).replaceAll("&", "&&"));
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 2;
      issued_by_value.setLayoutData(gridData);
     
      // issued to
     
      Label issued_to_label = new Label(shell,SWT.NULL);
      Messages.setLanguageText(issued_to_label, "security.certtruster.issuedto");
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 1;
      issued_to_label.setLayoutData(gridData);
     
      Label issued_to_value = new Label(shell,SWT.NULL);
      issued_to_value.setText(extractCN(cert.getSubjectDN().getName()).replaceAll("&", "&&"));
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 2;
      issued_to_value.setLayoutData(gridData);
     
      // prompt
     
      Label prompt_label = new Label(shell,SWT.NULL);
      Messages.setLanguageText(prompt_label, "security.certtruster.prompt");
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 3;
      prompt_label.setLayoutData(gridData);
     
        // line
     
      Label labelSeparator = new Label(shell,SWT.SEPARATOR | SWT.HORIZONTAL);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      gridData.horizontalSpan = 3;
      labelSeparator.setLayoutData(gridData);
     
        // buttons
     
      new Label(shell,SWT.NULL);
     
      Composite comp = new Composite(shell,SWT.NULL);
      gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END | GridData.HORIZONTAL_ALIGN_FILL);
      gridData.grabExcessHorizontalSpace = true;
      gridData.horizontalSpan = 2;
      comp.setLayoutData(gridData);
      GridLayout layoutButtons = new GridLayout();
      layoutButtons.numColumns = 2;
      comp.setLayout(layoutButtons);
     
     
     
      Button bYes = new Button(comp,SWT.PUSH);
      bYes.setText(MessageText.getString("security.certtruster.yes"));
      gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END | GridData.HORIZONTAL_ALIGN_FILL);
      gridData.grabExcessHorizontalSpace = true;
      gridData.widthHint = 70;
      bYes.setLayoutData(gridData);
      bYes.addListener(SWT.Selection,new Listener() {
        public void handleEvent(Event e) {
          close(true);
        }
      });
     
      Button bNo = new Button(comp,SWT.PUSH);
      bNo.setText(MessageText.getString("security.certtruster.no"));
      gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
      gridData.grabExcessHorizontalSpace = false;
      gridData.widthHint = 70;
      bNo.setLayoutData(gridData);   
      bNo.addListener(SWT.Selection,new Listener() {
        public void handleEvent(Event e) {
View Full Code Here

    return 1;
  }


  public Composite configSectionCreate(final Composite parent) {
    GridData gridData;
    GridLayout layout;
    Label label;

    final Composite cDisplay = new Composite(parent, SWT.NULL);

    gridData = new GridData(GridData.VERTICAL_ALIGN_FILL
        | GridData.HORIZONTAL_ALIGN_FILL);
    cDisplay.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    cDisplay.setLayout(layout);

    final PlatformManager platform = PlatformManagerFactory.getPlatformManager();
   
    int userMode = COConfigurationManager.getIntParameter("User Mode");
   
      // ***** start group
   
    boolean can_ral = platform.hasCapability(PlatformManagerCapabilities.RunAtLogin );
       
    if ( can_ral ){
     
      Group gStartStop = new Group(cDisplay, SWT.NULL);
      Messages.setLanguageText(gStartStop, LBLKEY_PREFIX + "start");
      layout = new GridLayout(2, false);
      gStartStop.setLayout(layout);
      gStartStop.setLayoutData(new GridData( GridData.FILL_HORIZONTAL ));
 
      if ( can_ral ){
 
        gridData = new GridData();
        gridData.horizontalSpan = 2;
        BooleanParameter start_on_login = new BooleanParameter(gStartStop, "Start On Login", LBLKEY_PREFIX + "start.onlogin");
       
        try{
          start_on_login.setSelected( platform.getRunAtLogin());
         
          start_on_login.addChangeListener(
            new ParameterChangeAdapter()
            {
              public void
              booleanParameterChanging(
                Parameter p,
                boolean toValue)
              {
                try{
                  platform.setRunAtLogin( toValue );
                 
                }catch( Throwable e ){
                 
                  Debug.out( e );
                }
              }
            });
         
        }catch( Throwable e ){
         
          start_on_login.setEnabled( false );
         
          Debug.out( e );
        }
       
        start_on_login.setLayoutData(gridData);
      }
     
    }
       
    if ( userMode > 0 ){
       
      Group gPR = new Group(cDisplay, SWT.NULL);
      Messages.setLanguageText(gPR, LBLKEY_PREFIX + "pauseresume");
      layout = new GridLayout(2, false);
      gPR.setLayout(layout);
      gPR.setLayoutData(new GridData( GridData.FILL_HORIZONTAL ));

      gridData = new GridData();
      gridData.horizontalSpan = 2;
      BooleanParameter pauseOnExit = new BooleanParameter(gPR,
          "Pause Downloads On Exit", "ConfigView.label.pause.downloads.on.exit");
      pauseOnExit.setLayoutData(gridData);
 
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      BooleanParameter resumeOnStart = new BooleanParameter(gPR,
          "Resume Downloads On Start", "ConfigView.label.resume.downloads.on.start");
      resumeOnStart.setLayoutData(gridData);
    }
   
    if ( userMode >= 0 ){
     
      Group gStop = new Group(cDisplay, SWT.NULL);
      Messages.setLanguageText(gStop, LBLKEY_PREFIX + "stop");
      layout = new GridLayout(2, false);
      gStop.setLayout(layout);
      gStop.setLayoutData(new GridData( GridData.FILL_HORIZONTAL ));

        // done downloading
     
      gridData = new GridData();
      label = new Label(gStop, SWT.NULL);
        Messages.setLanguageText(label, "ConfigView.label.stop.downcomp");
        label.setLayoutData( gridData );
     
        int  shutdown_types = platform.getShutdownTypes();
       
      List<String>  l_action_values = new ArrayList<String>();
      List<String>  l_action_descs   = new ArrayList<String>();

      l_action_values.add( "Nothing" );
      l_action_values.add( "QuitVuze" );
     
      if (( shutdown_types & PlatformManager.SD_SLEEP ) != 0 ){
       
        l_action_values.add( "Sleep" );
      }
      if (( shutdown_types & PlatformManager.SD_HIBERNATE ) != 0 ){
       
        l_action_values.add( "Hibernate" );
      }
      if (( shutdown_types & PlatformManager.SD_SHUTDOWN ) != 0 ){
       
        l_action_values.add( "Shutdown" );
      }
     
      String[] action_values = l_action_values.toArray( new String[ l_action_values.size()]);
         
      for ( String s: action_values ){
       
        l_action_descs.add( MessageText.getString( "ConfigView.label.stop." + s ));
      }
     
      String[] action_descs = l_action_descs.toArray( new String[ l_action_descs.size()]);

      new StringListParameter(gStop, "On Downloading Complete Do", "Nothing", action_descs, action_values );

        // done seeding
     
      gridData = new GridData();
        label = new Label(gStop, SWT.NULL);
        Messages.setLanguageText(label, "ConfigView.label.stop.seedcomp");
        label.setLayoutData( gridData );
             
      new StringListParameter(gStop, "On Seeding Complete Do", "Nothing", action_descs, action_values );
     
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      BooleanParameter resetOnTrigger =
        new BooleanParameter(
          gStop, "Stop Triggers Auto Reset",
          "!" + MessageText.getString(
            "ConfigView.label.stop.autoreset",
            new String[]{ MessageText.getString( "ConfigView.label.stop.Nothing" )})+ "!");
       
      resetOnTrigger.setLayoutData(gridData);
    }
   
    if ( userMode > 0 && platform.hasCapability( PlatformManagerCapabilities.AccessExplicitVMOptions )){
     
      Group gJVM = new Group(cDisplay, SWT.NULL);
      Messages.setLanguageText(gJVM, LBLKEY_PREFIX + "jvm");
      layout = new GridLayout(2, false);
      gJVM.setLayout(layout);
      gJVM.setLayoutData(new GridData( GridData.FILL_HORIZONTAL ));
     
        // wiki link
     
      gridData = new GridData();
      gridData.horizontalSpan = 2;

      LinkLabel link = new LinkLabelgJVM, gridData, "ConfigView.label.please.visit.here",
                      "http://wiki.vuze.com/w/Java_VM_memory_usage");
     
        // info
     
      label = new Label(gJVM, SWT.NULL);
      Messages.setLanguageText(label, "jvm.info");
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      label.setLayoutData( gridData );
     
      try{
        final File option_file = platform.getVMOptionFile();
        
        final Group gJVMOptions = new Group(gJVM, SWT.NULL);
        layout = new GridLayout(3, false);
        gJVMOptions.setLayout(layout);
        gridData = new GridData( GridData.FILL_HORIZONTAL );
        gridData.horizontalSpan = 2;
        gJVMOptions.setLayoutData( gridData );
       
        buildOptions( cDisplay, platform, gJVMOptions, false );
       
          // show option file
       
        label = new Label(gJVM, SWT.NULL);
        Messages.setLanguageText(label, "jvm.show.file", new String[]{ option_file.getAbsolutePath() });

        Button show_folder_button = new Button( gJVM, SWT.PUSH );
       
         Messages.setLanguageText( show_folder_button, "MyTorrentsView.menu.explore");
        
         show_folder_button.addSelectionListener(
           new SelectionAdapter()
           {
             public void
             widgetSelected(
               SelectionEvent e )
             {
               ManagerUtils.open( option_file );
             }
           });

         label = new Label(gJVM, SWT.NULL);     
        Messages.setLanguageText(label, "jvm.reset");

        Button reset_button = new Button( gJVM, SWT.PUSH );
       
         Messages.setLanguageText( reset_button, "Button.reset");
        
         reset_button.addSelectionListener(
           new SelectionAdapter()
           {
             public void
             widgetSelected(
               SelectionEvent event )
             {
               try{
                 platform.setExplicitVMOptions( new String[0] );
                
                 buildOptions( cDisplay, platform, gJVMOptions, true );
                
               }catch( Throwable e ){
                
                 Debug.out( e );
               }
             }
           });
        
      }catch( Throwable e ){
       
        Debug.out( e );
       
        label = new Label(gJVM, SWT.NULL);
        Messages.setLanguageText(label, "jvm.error", new String[]{ Debug.getNestedExceptionMessage(e) });
        gridData = new GridData();
        gridData.horizontalSpan = 2;
        label.setLayoutData( gridData );
      }
    }

View Full Code Here

     
      long  max_mem = AEMemoryMonitor.getJVMLongOption( options, "-Xmx" );
     
      final int MIN_MAX_JVM = 32*1024*1024;
 
      GridData gridData = new GridData();
      Label label = new Label(area, SWT.NULL);
      label.setLayoutData(gridData);
      Messages.setLanguageText(label,  "jvm.max.mem", new String[]{encodeDisplayLong(MIN_MAX_JVM)});
 
      gridData = new GridData();
      gridData.widthHint = 125;
      final StringParameter max_vm = new StringParameter(area, "jvm.max.mem", "", false );
      max_vm.setLayoutData(gridData);
       
      max_vm.setValue( max_mem == -1?"":encodeDisplayLong( max_mem ));
     
      max_vm.addChangeListener(
        new ParameterChangeAdapter()
        {
          private String  last_value;
         
          public void
          parameterChanged(
            Parameter  p,
            boolean    caused_internally )
          {
            if ( max_vm.isDisposed()){
             
              max_vm.removeChangeListener( this );
             
              return;
            }
           
            String val = max_vm.getValue();
           
            if ( last_value != null && last_value.equals( val )){
             
              return;
            }
           
            last_value = val;
                     
            try{
              long max_mem = decodeDisplayLong( val );
             
              if ( max_mem < MIN_MAX_JVM ){
               
                throw( new Exception( "Min=" + encodeDisplayLong( MIN_MAX_JVM )));
              }
                         
              String[] options = platform.getExplicitVMOptions();
             
              options = AEMemoryMonitor.setJVMLongOption( options, "-Xmx", max_mem );
 
              long  min_mem = AEMemoryMonitor.getJVMLongOption( options, "-Xms" );
 
              if ( min_mem == -1 || min_mem > max_mem ){
               
                options = AEMemoryMonitor.setJVMLongOption( options, "-Xms", max_mem );
              }
             
              platform.setExplicitVMOptions( options );
             
              buildOptions( parent, platform, area, true );
             
            }catch( Throwable e ){
             
              String param_name = MessageText.getString( "jvm.max.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);
     
      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);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      label.setLayoutData(gridData);
      Messages.setLanguageText(label,  "jvm.max.direct.mem.info" );
    }   
   
      // all options

    Label label = new Label(area, SWT.NULL);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    label.setLayoutData(gridData);
    Messages.setLanguageText(label,  "jvm.options.summary" );

    for ( String option: options ){
     
      label = new Label(area, SWT.NULL);
      label.setText( option );
      gridData = new GridData( );
      gridData.horizontalSpan = 3;
      gridData.horizontalIndent = 20;
      label.setLayoutData( gridData );
    }
   
View Full Code Here

      GridLayout layout = new GridLayout();
      layout.numColumns = 3;
     
      shell.setLayout (layout);
     
      GridData gridData;
     
      // info
     
      Label info_label = new Label(shell,SWT.NULL);
      Messages.setLanguageText(info_label, "security.certcreate.intro");
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 3;
      info_label.setLayoutData(gridData);
     
      // alias
     
      Label alias_label = new Label(shell,SWT.NULL);
      Messages.setLanguageText(alias_label, "security.certcreate.alias");
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 1;
      alias_label.setLayoutData(gridData);
     
      final Text alias_field =new Text(shell,SWT.BORDER);
     
      alias_field.setText( SESecurityManager.DEFAULT_ALIAS );
     
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 2;
      alias_field.setLayoutData(gridData);
     
      // strength
     
      Label strength_label = new Label(shell,SWT.NULL);
      Messages.setLanguageText(strength_label, "security.certcreate.strength");
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 1;
      strength_label.setLayoutData(gridData);
     
      final Combo strength_combo = new Combo(shell, SWT.SINGLE | SWT.READ_ONLY);
        
      final int[] strengths = { 512, 1024, 1536, 2048 };
                    
      for (int i=0;i<strengths.length;i++){
       
        strength_combo.add(""+strengths[i]);
      }
           
      strength_combo.select(1);
     
      new Label(shell,SWT.NULL);
           
      // first + last name
     
      String[]  field_names = {
                  "security.certcreate.firstlastname",
                  "security.certcreate.orgunit",
                  "security.certcreate.org",
                  "security.certcreate.city",
                  "security.certcreate.state",
                  "security.certcreate.country"
                };
     
      final String[]    field_rns = {"CN", "OU", "O", "L", "ST", "C" };
     
      final Text[]    fields = new Text[field_names.length];
     
      for (int i=0;i<fields.length;i++){
       
        Label resource_label = new Label(shell,SWT.NULL);
        Messages.setLanguageText(resource_label, field_names[i]);
        gridData = new GridData(GridData.FILL_BOTH);
        gridData.horizontalSpan = 1;
        resource_label.setLayoutData(gridData);
       
        Text field = fields[i] = new Text(shell,SWT.BORDER);
        gridData = new GridData(GridData.FILL_BOTH);
        gridData.horizontalSpan = 2;
        field.setLayoutData(gridData);
      }

        // line
     
      Label labelSeparator = new Label(shell,SWT.SEPARATOR | SWT.HORIZONTAL);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      gridData.horizontalSpan = 3;
      labelSeparator.setLayoutData(gridData);
     
        // buttons
     
      new Label(shell,SWT.NULL);
     
      Composite comp = new Composite(shell,SWT.NULL);
      gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END | GridData.HORIZONTAL_ALIGN_FILL);
      gridData.grabExcessHorizontalSpace = true;
      gridData.horizontalSpan = 2;
      comp.setLayoutData(gridData);
      GridLayout layoutButtons = new GridLayout();
      layoutButtons.numColumns = 2;
      comp.setLayout(layoutButtons);
     
     
     
      Button bYes = new Button(comp,SWT.PUSH);
      Messages.setLanguageText(bYes, "security.certcreate.ok");
      gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END | GridData.HORIZONTAL_ALIGN_FILL);
      gridData.grabExcessHorizontalSpace = true;
      gridData.widthHint = 70;
      bYes.setLayoutData(gridData);
      bYes.addListener(SWT.Selection,new Listener() {
        public void handleEvent(Event e) {
         
          String  alias  = alias_field.getText().trim();
         
          int    strength  = strengths[strength_combo.getSelectionIndex()];
         
          String  dn = "";
         
          for (int i=0;i<fields.length;i++){
           
            String  rn = fields[i].getText().trim();
           
            if ( rn.length() == 0 ){
             
              rn = "Unknown";
            }
           
            dn += (dn.length()==0?"":",") + field_rns[i] + "=" + rn;
          }
                   
          try{
            SESecurityManager.createSelfSignedCertificate( alias, dn, strength );
           
            close(true );
           
            Logger.log(new LogAlert(LogAlert.UNREPEATABLE,
                LogAlert.AT_INFORMATION, MessageText
                    .getString("security.certcreate.createok")
                    + "\n" + alias + ":" + strength + "\n"
                    + dn + "\n" + SystemTime.getCurrentTime()));
           
          }catch( Throwable f ){
           
            Logger.log(new LogAlert(LogAlert.UNREPEATABLE, MessageText
                .getString("security.certcreate.createfail")
                + "\n" + SystemTime.getCurrentTime(), f));
          }
        }
      });
     
      Button bNo = new Button(comp,SWT.PUSH);
      Messages.setLanguageText(bNo, "security.certcreate.cancel");
      gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
      gridData.grabExcessHorizontalSpace = false;
      gridData.widthHint = 70;
      bNo.setLayoutData(gridData);   
      bNo.addListener(SWT.Selection,new Listener() {
        public void handleEvent(Event e) {
View Full Code Here

TOP

Related Classes of org.eclipse.swt.layout.GridData

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.