Package org.eclipse.ui.forms.widgets

Examples of org.eclipse.ui.forms.widgets.FormToolkit


  @Override
  public void createSection(Composite parent) {
    super.createSection(parent);

    FormToolkit toolkit = getFormToolkit(parent.getDisplay());

    Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
    section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    section.setText(Messages.CloudFoundryServerStatusSection_TEXT_SERV_STAT);
    section.setExpanded(true);

    composite = toolkit.createComposite(section);
    section.setClient(composite);

    GridLayoutFactory.fillDefaults().numColumns(4).margins(10, 5).applyTo(composite);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(composite);

    nameLabel = toolkit.createLabel(composite, ""); //$NON-NLS-1$
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(nameLabel);
    nameLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
   
    statusLabel = toolkit.createLabel(composite, ""); //$NON-NLS-1$
    GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.CENTER).applyTo(statusLabel);
   
    connectButton = toolkit.createButton(composite, Messages.CloudFoundryServerStatusSection_TEXT_CONN_BUTTON, SWT.PUSH);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(connectButton);
   
    connectButton.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        Job job = new Job(Messages.CloudFoundryServerStatusSection_JOB_CONN_SERVER) {
         
          @Override
          protected IStatus run(IProgressMonitor monitor) {
            try {
              cfServer.getBehaviour().connect(monitor);
            }
            catch (CoreException e) {
              StatusManager.getManager().handle(new Status(Status.ERROR, CloudFoundryServerUiPlugin.PLUGIN_ID, "", e), StatusManager.LOG); //$NON-NLS-1$
              return Status.CANCEL_STATUS;
            }
           
            return Status.OK_STATUS;
          }
        };
        job.schedule();
      }
    });
   
    disconnectButton = toolkit.createButton(composite, Messages.CloudFoundryServerStatusSection_TEXT_DISCONN_BUTTON, SWT.PUSH);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(disconnectButton);
   
    disconnectButton.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
View Full Code Here


    if (!CloudFoundryURLNavigation.canEnableCloudFoundryNavigation(getCloudFoundryServer())) {
      return;
    }
    super.createSection(parent);

    FormToolkit toolkit = getFormToolkit(parent.getDisplay());

    Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
    section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    section.setText(Messages.SpringInsightSection_TEXT_SPRING_INSIGHT);
    section.setExpanded(false);

    Composite composite = toolkit.createComposite(section);
    section.setClient(composite);

    GridLayoutFactory.fillDefaults().numColumns(1).margins(10, 5).applyTo(composite);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(composite);
View Full Code Here

  private final int MAX_ERROR_MESSAGE = 100;

  @Override
  public void createPartControl(Composite parent) {
    mform = new ManagedForm(parent);
    FormToolkit toolkit = getFormToolkit(parent.getDisplay());

    sform = mform.getForm();
    sform.getForm().setText(Messages.COMMONTXT_APPLICATIONS);
    toolkit.decorateFormHeading(sform.getForm());

    cloudServer = (CloudFoundryServer) getServer().getOriginal().loadAdapter(CloudFoundryServer.class, null);

    masterDetailsBlock = new ApplicationMasterDetailsBlock(this, cloudServer);
    masterDetailsBlock.createContent(mform);
View Full Code Here

    }
  }

  @Override
  protected void createMasterPart(IManagedForm managedForm, Composite parent) {
    FormToolkit toolkit = managedForm.getToolkit();
    Composite container = toolkit.createComposite(parent);
    container.setLayout(new GridLayout());
    container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));

    masterPart = new ApplicationMasterPart(editorPage, managedForm, container, cloudServer);
    managedForm.addPart(masterPart);
View Full Code Here

  @Override
  public void createSection(Composite parent) {
    super.createSection(parent);

    FormToolkit toolkit = getFormToolkit(parent.getDisplay());

    Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
    section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    section.setText(sectionTitle);

    Composite composite = toolkit.createComposite(section);
    section.setClient(composite);

    GridLayout layout = new GridLayout();
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    Composite topComposite = new Composite(composite, SWT.NONE);
    topComposite.setLayout(new GridLayout(2, false));
    topComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

    Label emailLabel = toolkit.createLabel(topComposite, Messages.COMMONTXT_EMAIL_WITH_COLON, SWT.NONE);
    emailLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
    emailLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));

    emailText = toolkit.createText(topComposite, ""); //$NON-NLS-1$
    emailText.setEditable(false);
    emailText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    emailText.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
    if (cfServer.getUsername() != null) {
      emailText.setText(cfServer.getUsername());
    }
    emailText.addModifyListener(new DataChangeListener(DataType.EMAIL));

    Label passwordLabel = toolkit.createLabel(topComposite, Messages.COMMONTXT_PW, SWT.NONE);
    passwordLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
    passwordLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));

    passwordText = toolkit.createText(topComposite, "", SWT.PASSWORD); //$NON-NLS-1$
    passwordText.setEditable(false);
    passwordText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    passwordText.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
    if (cfServer.getPassword() != null) {
      passwordText.setText(cfServer.getPassword());
    }
    passwordText.addModifyListener(new DataChangeListener(DataType.PASSWORD));

    Label label = toolkit.createLabel(topComposite, Messages.COMMONTXT_URL);
    label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
    label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));

    urlText = toolkit.createText(topComposite, "", SWT.NONE); //$NON-NLS-1$
    urlText.setEditable(false);
    urlText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    urlText.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.FALSE);
    if (cfServer.getUrl() != null) {
      urlText.setText(CloudUiUtil.getDisplayTextFromUrl(cfServer.getUrl(), cfServer.getServer().getServerType()
          .getId()));
    }

    Label orgLabel = toolkit.createLabel(topComposite, Messages.CloudFoundryAccountSection_LABEL_ORG, SWT.NONE);
    orgLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
    orgLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));

    orgText = toolkit.createText(topComposite, "", SWT.NONE); //$NON-NLS-1$
    orgText.setEditable(false);
    orgText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    orgText.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.FALSE);
    if (cfServer.getCloudFoundrySpace() != null && cfServer.getCloudFoundrySpace().getOrgName() != null) {
      orgText.setText(cfServer.getCloudFoundrySpace().getOrgName());
    }

    Label spaceLabel = toolkit.createLabel(topComposite, Messages.CloudFoundryAccountSection_LABEL_SPACE, SWT.NONE);
    spaceLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
    spaceLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));

    spaceText = toolkit.createText(topComposite, "", SWT.NONE); //$NON-NLS-1$
    spaceText.setEditable(false);
    spaceText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    spaceText.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.FALSE);
    if (cfServer.getCloudFoundrySpace() != null && cfServer.getCloudFoundrySpace().getSpaceName() != null) {
      spaceText.setText(cfServer.getCloudFoundrySpace().getSpaceName());
    }

    // urlWidget = new CloudUrlWidget(cfServer);
    // urlWidget.createControls(topComposite);
    // urlWidget.getUrlCombo().addModifyListener(new
    // DataChangeListener(DataType.URL));
    //
    final Composite buttonComposite = toolkit.createComposite(composite);

    buttonComposite.setLayout(new GridLayout(4, false));
    GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).grab(true, false).applyTo(buttonComposite);

    final Composite validateComposite = toolkit.createComposite(composite);
    validateComposite.setLayout(new GridLayout(1, false));
    validateComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

    validateLabel = toolkit.createLabel(validateComposite, "", SWT.NONE); //$NON-NLS-1$
    validateLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    createCloneServerArea(buttonComposite, toolkit);

    final Button changePasswordButton = toolkit.createButton(buttonComposite,
        Messages.CloudFoundryAccountSection_BUTTON_CHANGE_PW, SWT.PUSH);

    // Pivotal Tracker: 54644658 - Disable for CF 1.5.0 until fixed.
    changePasswordButton.setEnabled(false);

    changePasswordButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
    changePasswordButton.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        if (server.isDirty()) {
          boolean confirm = MessageDialog.openQuestion(getShell(),
              Messages.CloudFoundryAccountSection_DIALOG_UNSAVE_TITLE,
              Messages.CloudFoundryAccountSection_DIALOG_UNSAVE_BODY);
          if (!confirm) {
            return;
          }
        }

        UpdatePasswordDialog dialog = new UpdatePasswordDialog(getShell(), cfServer.getUsername());

        if (dialog.open() == IDialogConstants.OK_ID) {
          final String newPassword = dialog.getPassword();
          String errorMsg = CloudUiUtil.updatePassword(newPassword, cfServer, server);

          if (errorMsg != null) {
            validateLabel.setText(errorMsg);
            validateLabel.setForeground(validateLabel.getDisplay().getSystemColor(SWT.COLOR_RED));
          }
          else {
            validateLabel.setText(Messages.CloudFoundryAccountSection_LABEL_PW_CHANGED);
            passwordText.setText(newPassword);
          }
        }
      }
    });

    final Button validateButton = toolkit.createButton(buttonComposite,
        Messages.CloudFoundryAccountSection_BUTTON_VALIDATE_ACCOUNT, SWT.PUSH);
    validateButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
    validateButton.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent event) {
        final String url = cfServer.getUrl();
        final String userName = emailText.getText();
        final String password = passwordText.getText();
        final String org = orgText.getText();
        final String space = spaceText.getText();
        try {
          CloudUiUtil.validateCredentials(userName, password, url, false,
              cfServer.getSelfSignedCertificate(), null);

          if (org != null && space != null) {
            validateLabel.setText(Messages.VALID_ACCOUNT);
            validateLabel.setForeground(validateLabel.getDisplay().getSystemColor(SWT.COLOR_BLACK));
          }
          else {
            String errorMsg = null;
            if (org == null) {
              errorMsg = Messages.ERROR_INVALID_ORG;
            }
            else if (space == null) {
              errorMsg = Messages.ERROR_INVALID_SPACE;
            }
            validateLabel.setText(errorMsg);
            validateLabel.setForeground(validateLabel.getDisplay().getSystemColor(SWT.COLOR_RED));
          }

        }
        catch (CoreException e) {
          validateLabel.setText(e.getMessage());
        }
        buttonComposite.layout(new Control[] { validateButton });
        validateComposite.layout(new Control[] { validateLabel });
      }
    });

    // Create signup button only if the server is not local or micro
    if (CloudFoundryURLNavigation.canEnableCloudFoundryNavigation(cfServer)) {
      Button cfSignup = toolkit.createButton(buttonComposite,
          CloudFoundryConstants.PUBLIC_CF_SERVER_SIGNUP_LABEL, SWT.PUSH);
      cfSignup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
      cfSignup.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
          IServer iServer = cfServer.getServer();
          if (iServer != null) {
            String signupURL = CloudFoundryBrandingExtensionPoint.getSignupURL(cfServer.getServerId(),
                cfServer.getUrl());
            if (signupURL != null) {
              CloudFoundryURLNavigation nav = new CloudFoundryURLNavigation(signupURL);
              nav.navigate();
            }
          }
        }
      });
    }

    toolkit.paintBordersFor(topComposite);
    section.setExpanded(true);

    ServerEventHandler.getDefault().addServerListener(this);
  }
View Full Code Here

    }

    @Override
    protected void createFormContent(IManagedForm managedForm)
    {
        FormToolkit toolkit = managedForm.getToolkit();

        ScrolledForm form = managedForm.getForm();
        form.setText("Contents");

        Composite body = form.getBody();
        TableWrapLayout layout = new TableWrapLayout();
        layout.bottomMargin = 10;
        layout.topMargin = 5;
        layout.leftMargin = 10;
        layout.rightMargin = 10;
        layout.numColumns = 1;
        layout.horizontalSpacing = 10;
        body.setLayout(layout);
        body.setLayoutData(new TableWrapData(TableWrapData.FILL));

        Composite top = toolkit.createComposite(body);
        layout = new TableWrapLayout();
        layout.verticalSpacing = 20;
        top.setLayout(layout);
        TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
        //data.colspan = 2;
        top.setLayoutData(data);

        Composite bottom = toolkit.createComposite(body);
        layout = new TableWrapLayout();
        layout.verticalSpacing = 20;
        bottom.setLayout(layout);
        bottom.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
View Full Code Here

    }

    @Override
    protected void createFormContent(IManagedForm managedForm)
    {
        FormToolkit toolkit = managedForm.getToolkit();

        ScrolledForm form = managedForm.getForm();
        form.setText("Overview");

        Composite body = form.getBody();
        TableWrapLayout layout = new TableWrapLayout();
        layout.bottomMargin = 10;
        layout.topMargin = 5;
        layout.leftMargin = 10;
        layout.rightMargin = 10;
        layout.numColumns = 2;
        layout.horizontalSpacing = 10;
        body.setLayout(layout);
        body.setLayoutData(new TableWrapData(TableWrapData.FILL));

        Composite left = toolkit.createComposite(body);
        layout = new TableWrapLayout();
        layout.verticalSpacing = 20;
        left.setLayout(layout);
        left.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));

        Composite right = toolkit.createComposite(body);
        layout = new TableWrapLayout();
        layout.verticalSpacing = 20;
        right.setLayout(layout);
        right.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
View Full Code Here

    }

    @Override
    protected void createFormContent(IManagedForm managedForm)
    {
        FormToolkit toolkit = managedForm.getToolkit();

        ScrolledForm form = managedForm.getForm();
        form.setText("Dependencies");

        Composite body = form.getBody();
        TableWrapLayout layout = new TableWrapLayout();
        layout.bottomMargin = 10;
        layout.topMargin = 5;
        layout.leftMargin = 10;
        layout.rightMargin = 10;
        layout.numColumns = 2;
        layout.horizontalSpacing = 10;
        body.setLayout(layout);
        body.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));

        Composite left = toolkit.createComposite(body);
        layout = new TableWrapLayout();
        layout.verticalSpacing = 20;
        left.setLayout(layout);
        TableWrapData layoutData = new TableWrapData(TableWrapData.FILL_GRAB);
        layoutData.rowspan = 2;
        left.setLayoutData(layoutData);

        Composite right = toolkit.createComposite(body);
        layout = new TableWrapLayout();
        layout.verticalSpacing = 20;
        right.setLayout(layout);
        right.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));

        Composite bottom = toolkit.createComposite(body);
        layout = new TableWrapLayout();
        layout.verticalSpacing = 20;
        bottom.setLayout(layout);
        bottom.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
View Full Code Here

    private boolean updating = false;

    @Override
    public void createSection(Composite parent) {
        super.createSection(parent);
        FormToolkit toolkit = getFormToolkit(parent.getDisplay());

        Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED
                | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE);
        section.setText("Connection");
        section.setDescription("Connection details for this server");
        section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));

        // ports
        Composite composite = toolkit.createComposite(section);

        GridLayout layout = new GridLayout();
        layout.numColumns = 2;
        layout.marginHeight = 8;
        layout.marginWidth = 8;
        composite.setLayout(layout);
        GridData gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.FILL_HORIZONTAL);
        composite.setLayoutData(gridData);
        toolkit.paintBordersFor(composite);
        section.setClient(composite);

        createLabel(toolkit, composite, "Port");
        portText = createText(toolkit, composite, SWT.SINGLE);

        createLabel(toolkit, composite, "Debug Port");
        debugPortText = createText(toolkit, composite, SWT.SINGLE);

        createLabel(toolkit, composite, "Context path");
        contextPathText = createText(toolkit, composite, SWT.SINGLE);

        // TODO wrong parent
        Label separator = toolkit.createSeparator(parent, SWT.HORIZONTAL);
        GridData data = new GridData(GridData.FILL_HORIZONTAL);
        data.horizontalSpan = 2;
        separator.setLayoutData(data);

        createLabel(toolkit, composite, "Username");
View Full Code Here

    private OsgiClientFactory osgiClientFactory;

    @Override
    public void createSection(Composite parent) {
        super.createSection(parent);
        FormToolkit toolkit = getFormToolkit(parent.getDisplay());

        Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED
                | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE);
        section.setText("Install");
        section.setDescription("Specify how to install bundles on the server");
        section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));

        // ports
        Composite composite = toolkit.createComposite(section);

        GridLayout layout = new GridLayout();
        layout.numColumns = 2;
        layout.marginHeight = 8;
        layout.marginWidth = 8;
        composite.setLayout(layout);
        GridData gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.FILL_HORIZONTAL);
        composite.setLayoutData(gridData);
        toolkit.paintBordersFor(composite);
        section.setClient(composite);

       
        bundleLocalInstallButton = toolkit.createButton(composite, "Install bundles via bundle upload", SWT.RADIO);
        GridData data = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
        bundleLocalInstallButton.setLayoutData(data);
       
        quickLocalInstallButton = toolkit.createButton(composite, "Install bundles directly from the filesystem",
                SWT.RADIO);
        data = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
        quickLocalInstallButton.setLayoutData(data);

        actionArea = toolkit.createComposite(composite);
        RowLayout actionAreaLayout = new RowLayout();
        actionAreaLayout.center = true;
        actionArea.setLayout(actionAreaLayout);

        supportBundleVersionLabel = toolkit.createLabel(actionArea, "");
        installOrUpdateSupportBundleLink = toolkit.createHyperlink(actionArea, "(Install)", SWT.NONE);

        initialize();
    }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.forms.widgets.FormToolkit

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.