コード例 #1
0
  /* (non-Javadoc)
   * @see org.eclipse.pde.internal.ui.editor.PDESection#createClient(org.eclipse.ui.forms.widgets.Section, org.eclipse.ui.forms.widgets.FormToolkit)
   */
  protected void createClient(Section section, FormToolkit toolkit) {
    section.setText(PDEUIMessages.GeneralInfoSection_title);
    section.setDescription(PDEUIMessages.GeneralInfoSection_desc);
    section.setLayout(FormLayoutFactory.createClearTableWrapLayout(false, 1));
    TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
    data.colspan = 2;
    section.setLayoutData(data);

    Composite client = toolkit.createComposite(section);
    client.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, NUM_COLUMNS));

    IActionBars actionBars = getPage().getPDEEditor().getEditorSite().getActionBars();

    // general section
    createIdEntry(client, toolkit, actionBars);
    createVersionEntry(client, toolkit, actionBars);
    createNameEntry(client, toolkit, actionBars);
    createLaunchersOption(client, toolkit);

    toolkit.paintBordersFor(client);
    section.setClient(client);

    getModel().addModelChangedListener(this);
  }
コード例 #2
0
ファイル: StyleFontPage.java プロジェクト: CareWB/WeX5
  public void initLayout() {
    final TableWrapLayout tableWrapLayout = new TableWrapLayout();
    tableWrapLayout.numColumns = 5;

    setLayout(tableWrapLayout);

    fontLabel = new Label(this, SWT.NONE);
    fontLabel.setLayoutData(new TableWrapData(TableWrapData.RIGHT));
    fontLabel.setText("font-family:");

    TableWrapData twd_combo_font_family = new TableWrapData(TableWrapData.FILL);
    twd_combo_font_family.colspan = 4;
    combo_font_family = new Combo(this, SWT.NONE);
    combo_font_family.setVisibleItemCount(15);
    combo_font_family.setLayoutData(twd_combo_font_family);

    fontsizeLabel = new Label(this, SWT.NONE);
    fontsizeLabel.setLayoutData(new TableWrapData(TableWrapData.RIGHT));
    fontsizeLabel.setText("font-size:");

    combo_font_size = new Combo(this, SWT.NONE);
    combo_font_size.setVisibleItemCount(StyleCommonPropertyValue.COMBO_VISIBLEITEM_COUNT);
    combo_font_size.setLayoutData(new TableWrapData(TableWrapData.FILL));

    slider_font_size = new Slider(this, SWT.VERTICAL);
    final TableWrapData twd_slider_font_size =
        new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP);
    twd_slider_font_size.heightHint = 20;
    slider_font_size.setLayoutData(twd_slider_font_size);

    StyleCommonPropertyValue.initSlide(slider_font_size);

    combo_font_sizeUnit = new Combo(this, SWT.NONE);
    combo_font_sizeUnit.setVisibleItemCount(StyleCommonPropertyValue.COMBO_VISIBLEITEM_COUNT);

    textdesLabel = new Label(this, SWT.NONE);
    textdesLabel.setText("text-decoration:");

    fontweightLabel = new Label(this, SWT.NONE);
    fontweightLabel.setLayoutData(new TableWrapData(TableWrapData.RIGHT));
    fontweightLabel.setText("font-weight:");

    combo_font_weight = new Combo(this, SWT.NONE);
    combo_font_weight.setVisibleItemCount(StyleCommonPropertyValue.COMBO_VISIBLEITEM_COUNT);
    combo_font_weight.setLayoutData(new TableWrapData(TableWrapData.FILL));
    new Label(this, SWT.NONE);
    new Label(this, SWT.NONE);

    check_underline = new Button(this, SWT.CHECK);
    check_underline.setText("underline");

    fontstyleLabel = new Label(this, SWT.NONE);
    fontstyleLabel.setLayoutData(new TableWrapData(TableWrapData.RIGHT));
    fontstyleLabel.setText("font-style:");

    combo_font_style = new Combo(this, SWT.NONE);
    combo_font_style.setVisibleItemCount(StyleCommonPropertyValue.COMBO_VISIBLEITEM_COUNT);
    combo_font_style.setLayoutData(new TableWrapData(TableWrapData.FILL));

    new Label(this, SWT.NONE);
    new Label(this, SWT.NONE);

    check_overline = new Button(this, SWT.CHECK);
    check_overline.setText("overline");

    fontLabel_1 = new Label(this, SWT.NONE);
    fontLabel_1.setLayoutData(new TableWrapData(TableWrapData.RIGHT));
    fontLabel_1.setText("font-variant:");

    combo_font_variant = new Combo(this, SWT.NONE);
    combo_font_variant.setVisibleItemCount(StyleCommonPropertyValue.COMBO_VISIBLEITEM_COUNT);
    combo_font_variant.setLayoutData(new TableWrapData(TableWrapData.FILL));
    new Label(this, SWT.NONE);
    new Label(this, SWT.NONE);

    check_line = new Button(this, SWT.CHECK);
    check_line.setText("line-through");

    textLabel = new Label(this, SWT.NONE);
    textLabel.setLayoutData(new TableWrapData(TableWrapData.RIGHT));
    textLabel.setText("text-transform:");

    combo_text_transform = new Combo(this, SWT.NONE);
    combo_text_transform.setVisibleItemCount(StyleCommonPropertyValue.COMBO_VISIBLEITEM_COUNT);
    combo_text_transform.setLayoutData(new TableWrapData(TableWrapData.FILL));
    new Label(this, SWT.NONE);
    new Label(this, SWT.NONE);

    check_blink = new Button(this, SWT.CHECK);
    check_blink.setText("blink");

    colorLabel = new Label(this, SWT.NONE);
    colorLabel.setLayoutData(new TableWrapData(TableWrapData.RIGHT));
    colorLabel.setText("color:");

    text_color = new Combo(this, SWT.NONE);
    text_color.setLayoutData(new TableWrapData(TableWrapData.FILL));

    composite_color = new Composite(this, SWT.BORDER);
    composite_color.setBackground(StyleCommonPropertyValue.DEFAULT_COLOR);
    final TableWrapData twd_composite_color =
        new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP);
    twd_composite_color.heightHint = 20;
    twd_composite_color.maxWidth = 20;
    composite_color.setLayoutData(twd_composite_color);

    new Label(this, SWT.NONE);

    check_none = new Button(this, SWT.CHECK);
    check_none.setText("none");
  }
コード例 #3
0
  protected void createFormContent(IManagedForm managedForm) {
    final ScrolledForm form = managedForm.getForm();
    FormToolkit toolkit = managedForm.getToolkit();
    TableWrapLayout tw = new TableWrapLayout();
    tw.leftMargin = 10;
    tw.rightMargin = 10;
    tw.verticalSpacing = 25;
    form.getBody().setLayout(tw);
    form.setText(Messages.EvaluationGeneralPage_2);

    Section generalSection =
        toolkit.createSection(
            form.getBody(),
            Section.TWISTIE | Section.TITLE_BAR | Section.DESCRIPTION | Section.EXPANDED);
    generalSection.setText(Messages.EvaluationGeneralPage_3);
    generalSection.setDescription(Messages.EvaluationGeneralPage_4);
    TableWrapData td = new TableWrapData();
    td.align = TableWrapData.LEFT;
    td.grabHorizontal = true;
    generalSection.setLayoutData(td);

    final Composite generalComposite = toolkit.createComposite(generalSection);
    generalSection.setClient(generalComposite);
    GridLayout layout = new GridLayout();
    layout.numColumns = 4;
    layout.marginHeight = layout.marginWidth = 0;
    layout.verticalSpacing = 8;
    layout.horizontalSpacing = 20;
    generalComposite.setLayout(layout);

    generalSection.setClient(generalComposite);
    toolkit.createLabel(generalComposite, Messages.EvaluationGeneralPage_5);
    schemeName = toolkit.createText(generalComposite, "", SWT.SINGLE);
    schemeName.setEnabled(false);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
    gd.widthHint = 150;
    schemeName.setLayoutData(gd);
    toolkit.createLabel(generalComposite, "");
    toolkit.createLabel(generalComposite, "");
    toolkit.createLabel(generalComposite, Messages.EvaluationGeneralPage_9);
    evalSerial = toolkit.createText(generalComposite, "", SWT.SINGLE);
    evalSerial.setLayoutData(gd);
    evalSerial.setEnabled(false);
    toolkit.createLabel(generalComposite, Messages.EvaluationGeneralPage_11);
    author = toolkit.createText(generalComposite, "", SWT.SINGLE);
    author.setLayoutData(gd);
    author.setEnabled(false);
    toolkit.createLabel(generalComposite, Messages.EvaluationGeneralPage_13);
    backgroud = toolkit.createText(generalComposite, "", SWT.MULTI);
    gd = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
    gd.widthHint = 153;
    gd.heightHint = 50;
    backgroud.setLayoutData(gd);
    backgroud.setEnabled(((EvaluationEditor) this.getEditor()).isAllowed());
    toolkit.createLabel(generalComposite, Messages.EvaluationGeneralPage_15);
    remark = toolkit.createText(generalComposite, "", SWT.MULTI);
    remark.setLayoutData(gd);
    remark.setEnabled(((EvaluationEditor) this.getEditor()).isAllowed());

    update();
  }
コード例 #4
0
  void addOverviewSection(final Composite body, final FormToolkit toolkit) {
    final Section overviewSection = toolkit.createSection(body, FormToolkitSupport.SECTION_STYLE);
    overviewSection.setExpanded(true);
    final TableWrapData td = new TableWrapData(TableWrapData.FILL_GRAB);
    td.colspan = 1;
    overviewSection.setLayoutData(td);
    overviewSection.setText(Messages.SingleActivityViewPart1);
    overviewSection.setDescription(Messages.SingleActivityViewPart2);

    final Composite overViewComposite = toolkit.createComposite(overviewSection);
    final GridLayout layoutClient = new GridLayout(3, false);
    overViewComposite.setLayout(layoutClient);
    final FormToolkitSupport support = new FormToolkitSupport(toolkit);
    final String readableTime = TimeHelper.convertSecondsToHumanReadableZeit(training.getDauer());
    support.addLabelAndValue(
        overViewComposite, Messages.SingleActivityViewPart3, readableTime, Units.HOUR_MINUTE_SEC);
    final String laengeInKm =
        DistanceHelper.roundDistanceFromMeterToKm(training.getLaengeInMeter());
    support.addLabelAndValue(
        overViewComposite, Messages.SingleActivityViewPart4, laengeInKm, Units.KM);
    final int avgHeartRate = training.getAverageHeartBeat();
    if (avgHeartRate > 0) {
      support.addLabelAndValue(
          overViewComposite,
          Messages.SingleActivityViewPart5,
          String.valueOf(avgHeartRate),
          Units.BEATS_PER_MINUTE);
    } else {
      support.addLabelAndValue(
          overViewComposite,
          Messages.SingleActivityViewPart5,
          "-",
          Units.BEATS_PER_MINUTE); // $NON-NLS-1$
    }
    support.addLabelAndValue(
        overViewComposite,
        Messages.SingleActivityViewPart6,
        String.valueOf(training.getMaxHeartBeat()),
        Units.BEATS_PER_MINUTE);

    final String labelAverage;
    final String labelMax;
    if (Sport.RUNNING.equals(training.getSport())) {
      // running
      labelAverage = Messages.SingleActivityViewPart7;
      labelMax = Messages.SingleActivityViewPart8;
    } else {
      labelAverage = Messages.SingleActivityViewPart19;
      labelMax = Messages.SingleActivityViewPart20;
    }
    final Units unit = getUnitFuerGeschwindigkeit(training.getSport());
    final String average =
        DistanceHelper.calculatePace(
            training.getLaengeInMeter(), training.getDauer(), training.getSport());
    final String max = DistanceHelper.calculatePace(training.getMaxSpeed(), training.getSport());

    support.addLabelAndValue(overViewComposite, labelAverage, average, unit);
    support.addLabelAndValue(overViewComposite, labelMax, max, unit);
    support.addLabelAndValue(
        overViewComposite,
        Messages.SingleActivityViewPart_4,
        training.getUpMeter().toString(),
        Units.METER);
    support.addLabelAndValue(
        overViewComposite,
        Messages.SingleActivityViewPart_8,
        training.getDownMeter().toString(),
        Units.METER);
    if (training.getTrainingEffect() != null) {
      support.addLabelAndValue(
          overViewComposite,
          Messages.Common_TrainingEffect,
          String.valueOf(training.getTrainingEffect().doubleValue() / 10),
          Units.NONE);
    }
    overviewSection.setClient(overViewComposite);
  }
コード例 #5
0
  public void createContents(Composite parent) {
    TableWrapLayout lo = new TableWrapLayout();
    lo.leftMargin = 0;
    lo.rightMargin = 0;
    lo.topMargin = 0;
    lo.numColumns = 1;
    parent.setLayout(lo);

    FormToolkit toolkit = m_mform.getToolkit();

    Section section =
        toolkit.createSection(
            parent, //
            // Section.DESCRIPTION | //
            Section.TITLE_BAR
                | //
                Section.EXPANDED);

    TableWrapData td = new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP);
    td.colspan = 1;
    section.setLayoutData(td);
    section.setText("Edit Provided Capability");

    Composite sectionClient = toolkit.createComposite(section);

    GridLayout layout = new GridLayout(2, false);
    sectionClient.setLayout(layout);

    FormColors colors = toolkit.getColors();
    Color headerColor = colors.getColor("org.eclipse.ui.forms.TITLE"); // $NON-NLS-1$
    Label label = null;

    // -- NAMESPACE
    label = toolkit.createLabel(sectionClient, "Namespace:");
    label.setForeground(headerColor);
    final Text nsText = toolkit.createText(sectionClient, ""); // $NON-NLS-1$
    GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gd.minimumWidth = 200;
    nsText.setLayoutData(gd);
    m_editAdapters.createEditAdapter(
        "nsText",
        nsText, //$NON-NLS-1$
        new RequiredValidator(StructuredNameValidator.instance()),
        new Mutator() {
          @Override
          public String getValue() {
            return m_input != null && m_input.getNamespace() != null
                ? m_input.getNamespace()
                : ""; //$NON-NLS-1$
          }

          @Override
          public void setValue(String input) throws Exception {
            m_input.setNamespace(
                input == null
                    ? "" //$NON-NLS-1$
                    : input.trim());
          }
        });

    // -- NAME
    label = toolkit.createLabel(sectionClient, "Name:");
    label.setForeground(headerColor);
    final Text nameText = toolkit.createText(sectionClient, "");
    nameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    m_editAdapters.createEditAdapter(
        "name",
        nameText, //$NON-NLS-1$
        new RequiredValidator(
            NullValidator.instance()), // TODO: A ProvidedCapability name validator			
        new Mutator() {

          @Override
          public String getValue() {
            return m_input != null && m_input.getName() != null
                ? m_input.getName()
                : ""; //$NON-NLS-1$
          }

          @Override
          public void setValue(String input) throws Exception {
            m_input.setName(
                input == null
                    ? "" //$NON-NLS-1$
                    : input.trim());
          }
        });

    // -- VERSION
    label = toolkit.createLabel(sectionClient, "Version:");
    label.setForeground(headerColor);
    final Text versionText = toolkit.createText(sectionClient, "");
    versionText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    m_editAdapters.createEditAdapter(
        "version",
        versionText, //$NON-NLS-1$
        new RequiredValidator(VersionValidator.instance()),
        new Mutator() {

          @Override
          public String getValue() {
            return m_input != null && m_input.getVersion() != null
                ? m_input.getVersion()
                : ""; //$NON-NLS-1$
          }

          @Override
          public void setValue(String input) throws Exception {
            m_input.setVersion(
                input == null
                    ? "" //$NON-NLS-1$
                    : input.trim());
          }
        });

    section.setClient(sectionClient);
  }
コード例 #6
0
  public void createClient(Section section, FormToolkit toolkit) {

    section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1));
    GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
    section.setLayoutData(data);

    Composite container = toolkit.createComposite(section);
    container.setLayout(FormLayoutFactory.createSectionClientTableWrapLayout(false, 2));

    fNameText =
        new FormEntry(
            container,
            toolkit,
            MDEUIMessages.SiteEditor_IncludedFeaturesDetailsSection_featureLabel,
            null,
            false);
    fNameText.setFormEntryListener(
        new FormEntryAdapter(this) {
          public void textValueChanged(FormEntry text) {
            if (fInput != null)
              try {
                fInput.setName(text.getValue());
              } catch (CoreException e) {
                MDEPlugin.logException(e);
              }
          }
        });
    fNameText.setEditable(isEditable());

    fVersionText =
        new FormEntry(
            container, toolkit, MDEUIMessages.FeatureEditor_SpecSection_version, null, false);
    fVersionText.setFormEntryListener(
        new FormEntryAdapter(this) {
          public void textValueChanged(FormEntry text) {
            if (fInput != null)
              try {
                fInput.setVersion(text.getValue());
              } catch (CoreException e) {
                MDEPlugin.logException(e);
              }
          }
        });
    fVersionText.setEditable(isEditable());

    fOptionalButton =
        toolkit.createButton(
            container, MDEUIMessages.SiteEditor_IncludedFeaturesDetailsSection_optional, SWT.CHECK);

    TableWrapData gd = new TableWrapData(TableWrapData.FILL);
    gd.colspan = 2;
    fOptionalButton.setLayoutData(gd);
    fOptionalButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            if (!fBlockNotification) {
              try {
                fInput.setOptional(fOptionalButton.getSelection());
              } catch (CoreException ce) {
              }
            }
          }
        });
    Label fSearchLocationDescLabel =
        toolkit.createLabel(
            container,
            MDEUIMessages.SiteEditor_IncludedFeaturesDetailsSection_searchLocation,
            SWT.WRAP);
    gd = new TableWrapData(TableWrapData.FILL);
    gd.colspan = 2;
    fSearchLocationDescLabel.setLayoutData(gd);

    fSearchRootButton =
        toolkit.createButton(
            container, MDEUIMessages.SiteEditor_IncludedFeaturesDetailsSection_root, SWT.RADIO);
    fSearchRootButton.setSelection(true);
    gd = new TableWrapData(TableWrapData.FILL);
    gd.colspan = 2;
    gd.indent = 5;
    fSearchRootButton.setLayoutData(gd);
    fSearchRootButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            if (!fBlockNotification) {
              try {
                if (fSearchRootButton.getSelection()) fInput.setSearchLocation(IFeatureChild.ROOT);
              } catch (CoreException ce) {
              }
            }
          }
        });

    fSearchSelfButton =
        toolkit.createButton(
            container, MDEUIMessages.SiteEditor_IncludedFeaturesDetailsSection_self, SWT.RADIO);
    fSearchSelfButton.setSelection(true);
    gd = new TableWrapData(TableWrapData.FILL);
    gd.colspan = 2;
    gd.indent = 5;
    fSearchSelfButton.setLayoutData(gd);
    fSearchSelfButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            if (!fBlockNotification) {
              try {
                if (fSearchSelfButton.getSelection()) fInput.setSearchLocation(IFeatureChild.SELF);
              } catch (CoreException ce) {
              }
            }
          }
        });

    fSearchBothButton =
        toolkit.createButton(
            container, MDEUIMessages.SiteEditor_IncludedFeaturesDetailsSection_both, SWT.RADIO);
    fSearchBothButton.setSelection(true);
    gd = new TableWrapData(TableWrapData.FILL);
    gd.colspan = 2;
    gd.indent = 5;
    fSearchBothButton.setLayoutData(gd);
    fSearchBothButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            if (!fBlockNotification) {
              try {
                if (fSearchBothButton.getSelection()) fInput.setSearchLocation(IFeatureChild.BOTH);
              } catch (CoreException ce) {
              }
            }
          }
        });

    toolkit.paintBordersFor(container);
    section.setClient(container);
  }
コード例 #7
0
  public void build(ScrolledForm form, SpyFormToolkit toolkit, ExecutionEvent event) {
    IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
    if (window
        == null) // if we don't have an active workbench, we don't have a valid selection to analyze
    return;

    // analyze the selection
    ISelection selection = HandlerUtil.getCurrentSelection(event);
    if (selection != null) {
      Section section = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR);
      section.clientVerticalSpacing = 9;
      section.setText(MDERuntimeMessages.SpyDialog_activeSelection_title);
      FormText text = toolkit.createFormText(section, true);
      section.setClient(text);

      TableWrapData td = new TableWrapData();
      td.align = TableWrapData.FILL;
      td.grabHorizontal = true;
      section.setLayoutData(td);

      // time to analyze the selection
      Class clazz = selection.getClass();
      StringBuffer buffer = new StringBuffer();
      buffer.append("<form>"); // $NON-NLS-1$
      buffer.append(
          toolkit.createClassSection(
              text, MDERuntimeMessages.SpyDialog_activeSelection_desc, new Class[] {clazz}));

      Class[] interfaces = clazz.getInterfaces();
      buffer.append(
          toolkit.createInterfaceSection(
              text, MDERuntimeMessages.SpyDialog_activeSelectionInterfaces_desc, interfaces));

      if (selection instanceof IStructuredSelection) {
        IStructuredSelection ss = (IStructuredSelection) selection;
        int size = ss.size();
        if (size == 1) {
          clazz = ss.getFirstElement().getClass();
          buffer.append(
              toolkit.createClassSection(
                  text,
                  MDERuntimeMessages.SpyDialog_activeSelectedElement_desc,
                  new Class[] {clazz}));

          interfaces = clazz.getInterfaces();
          buffer.append(
              toolkit.createInterfaceSection(
                  text,
                  MDERuntimeMessages.SpyDialog_activeSelectedElementInterfaces_desc,
                  interfaces));
        } else if (size > 1) {
          buffer.append(
              NLS.bind(
                  MDERuntimeMessages.SpyDialog_activeSelectedElementsCount_desc,
                  new Integer(size)));
        }
      }

      buffer.append("</form>"); // $NON-NLS-1$
      text.setText(buffer.toString(), true, false);
    }
  }