コード例 #1
0
  public void createClient(Section section, FormToolkit toolkit) {

    section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1));
    Composite container = toolkit.createComposite(section);
    container.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, 2));
    container.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    GridData data = new GridData(GridData.FILL_BOTH);
    section.setLayoutData(data);

    fNameText = new FormEntry(container, toolkit, MDEUIMessages.CategoryDetails_name, null, false);
    fNameText.setFormEntryListener(
        new FormEntryAdapter(this) {
          public void textValueChanged(FormEntry text) {
            try {
              if (text.getValue().length() <= 0 || alreadyExists(text.getValue())) {
                setValue(PROPERTY_NAME);
                String message = MDEUIMessages.CategoryDetails_alreadyExists;
                MessageDialog.openError(
                    MDEPlugin.getActiveWorkbenchShell(),
                    MDEUIMessages.CategoryDetails_alreadyExists_title,
                    message);
              } else {
                applyValue(PROPERTY_NAME, text.getValue());
              }
            } catch (CoreException e) {
              MDEPlugin.logException(e);
            }
          }
        });
    limitTextWidth(fNameText);
    fNameText.setEditable(isEditable());

    fLabelText =
        new FormEntry(container, toolkit, MDEUIMessages.CategoryDetails_label, null, false);
    fLabelText.setFormEntryListener(
        new FormEntryAdapter(this) {
          public void textValueChanged(FormEntry text) {
            try {
              applyValue(PROPERTY_TYPE, text.getValue());
            } catch (CoreException e) {
              MDEPlugin.logException(e);
            }
          }
        });
    limitTextWidth(fLabelText);
    fLabelText.setEditable(isEditable());

    fDescriptionText =
        new FormEntry(container, toolkit, MDEUIMessages.CategoryDetails_desc, SWT.WRAP | SWT.MULTI);
    fDescriptionText.getText().setLayoutData(new GridData(GridData.FILL_BOTH));

    fDescriptionText.getLabel().setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));

    fDescriptionText.setFormEntryListener(
        new FormEntryAdapter(this) {
          public void textValueChanged(FormEntry text) {
            try {
              applyValue(PROPERTY_DESC, text.getValue());
            } catch (CoreException e) {
              MDEPlugin.logException(e);
            }
          }
        });
    limitTextWidth(fDescriptionText);
    fDescriptionText.setEditable(isEditable());
    toolkit.paintBordersFor(container);
    section.setClient(container);

    ISiteModel model = (ISiteModel) getPage().getModel();
    if (model != null) model.addModelChangedListener(this);
  }
コード例 #2
0
  @Override
  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.createSectionClientGridLayout(false, 3));
    container.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    String editLabel = PDEUIMessages.SiteEditor_PortabilitySection_edit;

    fOsText =
        new FormEntry(
            container, toolkit, PDEUIMessages.SiteEditor_PortabilitySection_os, editLabel, false);
    fOsText.setFormEntryListener(
        new FormEntryAdapter(this) {

          @Override
          public void browseButtonSelected(FormEntry entry) {
            BusyIndicator.showWhile(
                fOsText.getText().getDisplay(),
                new Runnable() {
                  @Override
                  public void run() {
                    Choice[] choices = getOSChoices();
                    openPortabilityChoiceDialog(IEnvironment.P_OS, fOsText, choices);
                  }
                });
          }

          @Override
          public void textValueChanged(FormEntry text) {
            try {
              applyValue(IEnvironment.P_OS, text.getValue());
            } catch (CoreException e) {
              PDEPlugin.logException(e);
            }
          }
        });
    limitTextWidth(fOsText);
    fOsText.setEditable(fCurrentInput != null && isEditable());

    fWsText =
        new FormEntry(
            container, toolkit, PDEUIMessages.SiteEditor_PortabilitySection_ws, editLabel, false);
    fWsText.setFormEntryListener(
        new FormEntryAdapter(this) {

          @Override
          public void browseButtonSelected(FormEntry entry) {
            BusyIndicator.showWhile(
                fWsText.getText().getDisplay(),
                new Runnable() {
                  @Override
                  public void run() {
                    Choice[] choices = getWSChoices();
                    openPortabilityChoiceDialog(IEnvironment.P_WS, fWsText, choices);
                  }
                });
          }

          @Override
          public void textValueChanged(FormEntry text) {
            try {
              applyValue(IEnvironment.P_WS, text.getValue());
            } catch (CoreException e) {
              PDEPlugin.logException(e);
            }
          }
        });
    limitTextWidth(fWsText);
    fWsText.setEditable(fCurrentInput != null && isEditable());

    fNlText =
        new FormEntry(
            container, toolkit, PDEUIMessages.SiteEditor_PortabilitySection_nl, editLabel, false);

    fNlText.setFormEntryListener(
        new FormEntryAdapter(this) {

          @Override
          public void browseButtonSelected(FormEntry entry) {
            BusyIndicator.showWhile(
                fNlText.getText().getDisplay(),
                new Runnable() {
                  @Override
                  public void run() {
                    Choice[] choices = getNLChoices();
                    openPortabilityChoiceDialog(IEnvironment.P_NL, fNlText, choices);
                  }
                });
          }

          @Override
          public void textValueChanged(FormEntry text) {
            try {
              applyValue(IEnvironment.P_NL, text.getValue());
            } catch (CoreException e) {
              PDEPlugin.logException(e);
            }
          }
        });
    limitTextWidth(fNlText);
    fNlText.setEditable(fCurrentInput != null && isEditable());

    fArchText =
        new FormEntry(
            container, toolkit, PDEUIMessages.SiteEditor_PortabilitySection_arch, editLabel, false);
    fArchText.setFormEntryListener(
        new FormEntryAdapter(this) {

          @Override
          public void browseButtonSelected(FormEntry entry) {
            BusyIndicator.showWhile(
                fArchText.getText().getDisplay(),
                new Runnable() {
                  @Override
                  public void run() {
                    Choice[] choices = getArchChoices();
                    openPortabilityChoiceDialog(IEnvironment.P_ARCH, fArchText, choices);
                  }
                });
          }

          @Override
          public void textValueChanged(FormEntry text) {
            try {
              applyValue(IEnvironment.P_ARCH, text.getValue());
            } catch (CoreException e) {
              PDEPlugin.logException(e);
            }
          }
        });
    limitTextWidth(fArchText);
    fArchText.setEditable(fCurrentInput != null && isEditable());

    toolkit.paintBordersFor(container);
    section.setClient(container);
  }