public Section createControl(FormToolkit toolkit, Composite parent) {
    Section propSec = toolkit.createSection(parent, Section.TITLE_BAR | Section.EXPANDED);
    propSec.setText(_TITLE);

    // widgets
    Composite propSecCl = toolkit.createComposite(propSec, SWT.WRAP);
    Table propTable =
        toolkit.createTable(propSecCl, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    selectButton = toolkit.createButton(propSecCl, "Select All", SWT.CHECK);
    selectButton.setSelection(false);
    verifyButton = toolkit.createButton(propSecCl, "Perform Verification", SWT.PUSH);

    // layout
    propSec.setClient(propSecCl);
    propSecCl.setLayout(new GridLayout(2, false));
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
    gd.heightHint = propTable.getItemHeight() * 3;
    propTable.setLayoutData(gd);
    verifyButton.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));

    addListeners();
    makeViewer(propTable);
    makeVerifyAction();

    return propSec;
  }
  private void createSubSection(
      final ChangeDetail changeDetail,
      final PatchSetDetail patchSetDetail,
      final PatchSetPublishDetail publishDetail,
      Section section) {
    int style =
        ExpandableComposite.TWISTIE
            | ExpandableComposite.CLIENT_INDENT
            | ExpandableComposite.LEFT_TEXT_CLIENT_ALIGNMENT;
    if (changeDetail.isCurrentPatchSet(patchSetDetail)) {
      style |= ExpandableComposite.EXPANDED;
    }
    final Section subSection = toolkit.createSection(composite, style);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(subSection);
    subSection.setText(NLS.bind("Patch Set {0}", patchSetDetail.getPatchSet().getId().get()));
    subSection.setTitleBarForeground(toolkit.getColors().getColor(IFormColors.TITLE));

    addTextClient(toolkit, subSection, "", false); // $NON-NLS-1$
    updateTextClient(subSection, patchSetDetail, false);

    if (subSection.isExpanded()) {
      createSubSectionContents(changeDetail, patchSetDetail, publishDetail, subSection);
    }
    subSection.addExpansionListener(
        new ExpansionAdapter() {
          @Override
          public void expansionStateChanged(ExpansionEvent e) {
            if (subSection.getClient() == null) {
              createSubSectionContents(changeDetail, patchSetDetail, publishDetail, subSection);
            }
          }
        });
  }
  @Override
  protected void createMasterPart(IManagedForm managedForm, Composite parent) {
    // TODO Auto-generated method stub
    fManagedForm = managedForm;

    FormToolkit toolkit = managedForm.getToolkit();

    Composite composite = toolkit.createComposite(parent);
    composite.setLayout(new GridLayout(1, false));

    Section section = toolkit.createSection(composite, Section.TITLE_BAR);
    section.setText("overlay");

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

    final Tree tree = toolkit.createTree(viewercomposite, SWT.BORDER);
    fTreeViewer = new TreeViewer(tree);
    // fTreeViewer.setContentProvider(new XULTreeContentProvider());
    // fTreeViewer.setLabelProvider(new XULLabelProvider());

    MenuManager menu_manager = new MenuManager();

    // final Action addmenu = new AddAction("add");
    // menu_manager.add(addmenu);

  }
Exemple #4
0
  protected Section bindNestedComplexProperties(
      FormToolkit toolkit,
      Composite parent,
      final IMessageManager mmng,
      ComplexPropertyDescriptor complexProperty,
      final Object id,
      String labelText,
      String tooltip) {
    Class<?> complexType = complexProperty.getPropertyType();
    Section section =
        toolkit.createSection(
            parent, Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
    section.setText(labelText);
    section.setToolTipText(tooltip);
    Composite sectionClient = toolkit.createComposite(section);
    sectionClient.setLayout(new GridLayout(2, false));
    section.setClient(sectionClient);

    // now lets introspect the composite...
    Object value = node.getPropertyValue(id);
    if (value == null) {
      value = ObjectHelper.newInstance(complexType);
      node.setPropertyValue(id, value);
    }
    bindNestedComplexProperties(toolkit, mmng, complexProperty, complexType, sectionClient, value);
    sectionClient.layout(true, true);
    return section;
  }
  /**
   * @param parent
   * @return
   */
  public Control createContents(Composite parent) {
    final FormToolkit toolkit = new FormToolkit(parent.getDisplay());
    ScrolledForm sf = toolkit.createScrolledForm(parent);
    Composite comp = sf.getForm().getBody();
    comp.setLayout(new GridLayout(1, true));
    comp.setBackground(parent.getBackground());

    Section brandSection = toolkit.createSection(comp, Section.TITLE_BAR);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    brandSection.setLayoutData(gridData);
    brandSection.setText("Supported Interaction Types");

    Table table = new Table(comp, SWT.BORDER | SWT.FULL_SELECTION | SWT.CHECK | SWT.SINGLE);
    table.setHeaderVisible(true);
    TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(1));
    table.setLayout(layout);
    TableColumn column = new TableColumn(table, SWT.NONE);
    column.setText("Interaction Type");
    column.setWidth(100);
    column.setResizable(true);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.heightHint = 200;
    table.setLayoutData(gd);

    viewer = new CheckboxTableViewer(table);
    viewer.setContentProvider(new InteractionTypeContentProvider());
    InteractionTypeLabelProvider labelProvider = new InteractionTypeLabelProvider();
    viewer.setLabelProvider(labelProvider);
    viewer.setCheckStateProvider(labelProvider);
    viewer.addCheckStateListener(this);
    viewer.setInput(this);

    return comp;
  }
  @Override
  public void createPartControl(Composite parent) {
    // Creates toolkit and form
    toolkit = createFormBodySection(parent, "Senate Crawler");
    Section section = toolkit.createSection(form.getBody(), Section.TITLE_BAR | Section.EXPANDED);
    GridDataFactory.fillDefaults().grab(true, false).span(3, 1).applyTo(section);
    section.setExpanded(true);

    // Create a composite to hold the other widgets
    ScrolledComposite sc = new ScrolledComposite(section, SWT.H_SCROLL | SWT.V_SCROLL);
    sc.setExpandHorizontal(true);
    sc.setExpandVertical(true);
    GridLayoutFactory.fillDefaults().numColumns(3).equalWidth(false).applyTo(sc);

    // Creates an empty to create a empty space
    TacitFormComposite.createEmptyRow(toolkit, sc);

    // Create a composite that can hold the other widgets
    Composite client = toolkit.createComposite(form.getBody());
    GridLayoutFactory.fillDefaults()
        .equalWidth(true)
        .numColumns(1)
        .applyTo(client); // Align the composite section to one column
    GridDataFactory.fillDefaults().grab(true, false).span(1, 1).applyTo(client);
    GridLayout layout = new GridLayout(); // Layout creation
    layout.numColumns = 2;

    createSenateInputParameters(client);
    TacitFormComposite.createEmptyRow(toolkit, client);
    outputLayout =
        TacitFormComposite.createOutputSection(toolkit, client, form.getMessageManager());
    // Add run and help button on the toolbar
    addButtonsToToolBar();
  }
 private void createTimeScalingSection(Composite parent) {
   Section section = kit.createSection(parent, Section.TITLE_BAR);
   section.setText("time scaling");
   Composite client = kit.createComposite(section);
   client.setLayout(new GridLayout(3, false));
   section.setClient(client);
   createClocks(client);
   createScalingControls(client);
 }
  /**
   * Creates the SWT controls for this workbench part.
   *
   * @param parent the parent control
   */
  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("Ports");
    section.setDescription("Modify the server ports.");
    section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));

    // ports
    Composite composite = toolkit.createComposite(section);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 8;
    layout.marginWidth = 8;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.FILL_HORIZONTAL));
    // IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem();
    // whs.setHelp(composite, ContextIds.CONFIGURATION_EDITOR_PORTS);
    toolkit.paintBordersFor(composite);
    section.setClient(composite);

    ports = toolkit.createTable(composite, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION);
    ports.setHeaderVisible(true);
    ports.setLinesVisible(true);
    // whs.setHelp(ports, ContextIds.CONFIGURATION_EDITOR_PORTS_LIST);

    TableLayout tableLayout = new TableLayout();

    TableColumn col = new TableColumn(ports, SWT.NONE);
    col.setText("Port Name");
    ColumnWeightData colData = new ColumnWeightData(15, 150, true);
    tableLayout.addColumnData(colData);

    col = new TableColumn(ports, SWT.NONE);
    col.setText("Value");
    colData = new ColumnWeightData(8, 80, true);
    tableLayout.addColumnData(colData);

    GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
    data.widthHint = 230;
    data.heightHint = 100;
    ports.setLayoutData(data);
    ports.setLayout(tableLayout);

    viewer = new TableViewer(ports);
    viewer.setColumnProperties(new String[] {"name", "port"});

    initialize();
  }
Exemple #9
0
 private Section createSection(Composite parent, FormToolkit toolkit, int span) {
   Section section =
       toolkit.createSection(
           parent,
           ExpandableComposite.TITLE_BAR
               | ExpandableComposite.TWISTIE
               | ExpandableComposite.EXPANDED);
   GridDataFactory.fillDefaults().span(span, 1).grab(true, true).applyTo(section);
   return section;
 }
  /** {@inheritDoc} */
  @Override
  protected void createFormCreationSection(Composite pParent, FormToolkit pToolkit) {
    // create the section
    String lSectionTitle = getCreationSectionTitle();
    Section lSection = pToolkit.createSection(pParent, Section.EXPANDED | Section.TITLE_BAR);
    lSection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    if (lSectionTitle != null) {
      lSection.setText(lSectionTitle);
    }

    ScrolledForm lInsideScrolledForm = pToolkit.createScrolledForm(lSection);
    lInsideScrolledForm.setExpandHorizontal(true);
    lInsideScrolledForm.setExpandVertical(true);
    Composite lBody = lInsideScrolledForm.getBody();

    GridLayout lLayout = new GridLayout();
    lLayout.numColumns = 3;
    lBody.setLayout(lLayout);

    // content of the section
    creationRadio = pToolkit.createButton(lBody, getCreationSectionRadioLabel(), SWT.RADIO);
    creationRadio.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));

    pToolkit.createLabel(lBody, getNewTypeNameLabel(), SWT.NONE);
    newTypeNameText = pToolkit.createText(lBody, "", SWT.BORDER);
    newTypeNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    newTypeNameText.setFocus();

    // manage type selection
    pToolkit.createLabel(lBody, getNewTypeContainerNameLabel(), SWT.NONE);
    newTypeContainerNameText =
        pToolkit.createText(
            lBody, labelProvider.getText(newTypeContainer), SWT.BORDER | SWT.READ_ONLY);
    newTypeContainerNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    newTypeContainerButton = pToolkit.createButton(lBody, "...", SWT.FLAT);
    Image image = Activator.getInstance().getImage(containerType.getEClass());
    if (containerEClass != null) {
      image = Activator.getInstance().getImage(containerEClass);
    }
    newTypeContainerButton.setImage(image);
    newTypeContainerButton.setLayoutData(new GridData(SWT.NONE));

    pToolkit.createLabel(lBody, getNewTypeKindLabel(), SWT.NONE);
    newTypeKindCombo = new Combo(lBody, SWT.DROP_DOWN | SWT.READ_ONLY);
    newTypeKindComboViewer = new ComboViewer(newTypeKindCombo);
    pToolkit.adapt(newTypeKindCombo);
    newTypeKindCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    newTypeKindComboViewer.setLabelProvider(new ElementTypeLabelProvider());
    newTypeKindComboViewer.add(valueTypeKind);
    newTypeKindComboViewer.setSelection(new StructuredSelection(valueTypeKind[0]));

    lInsideScrolledForm.reflow(true);
    lSection.setClient(lInsideScrolledForm);
  }
 /**
  * Creates a section given the title and description.
  *
  * @param title
  * @param description
  * @return
  */
 private Section createSection(String title, String description) {
   ScrolledForm form = getManagedForm().getForm();
   FormToolkit tk = getManagedForm().getToolkit();
   Section sect = tk.createSection(form.getBody(), Section.TITLE_BAR | Section.DESCRIPTION);
   sect.setText(title);
   sect.setDescription(description);
   Composite comp = tk.createComposite(sect, SWT.BORDER);
   comp.setLayout(new GridLayout(2, false));
   sect.setClient(comp);
   return sect;
 }
  @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");
    usernameText = createText(toolkit, composite, SWT.SINGLE);

    createLabel(toolkit, composite, "Password");
    passwordText = createText(toolkit, composite, SWT.PASSWORD);

    initialize();
  }
  private void createSearchSection(Composite editorComposite, FormToolkit toolkit) {

    Section section =
        toolkit.createSection(
            editorComposite,
            ExpandableComposite.EXPANDED
                | ExpandableComposite.TITLE_BAR
                | ExpandableComposite.TWISTIE);
    section.setText("Search");
    section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    section.addExpansionListener(
        new IExpansionListener() {
          public void expansionStateChanging(ExpansionEvent e) {
            m_sform.reflow(true);
          }

          public void expansionStateChanged(ExpansionEvent e) {
            m_sform.reflow(true);
          }
        });

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

    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    sectionClient.setLayout(layout);
    sectionClient.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label label_freeSearch = toolkit.createLabel(sectionClient, "Query", SWT.NONE);
    label_freeSearch.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
    m_text_freeSearch = toolkit.createText(sectionClient, new String(), SWT.BORDER);
    m_text_freeSearch.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    m_text_freeSearch.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            firePropertyChange(IEditorPart.PROP_DIRTY);
          }
        });

    Label label_state = toolkit.createLabel(sectionClient, "State");
    label_state.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
    m_combo_news_state = new Combo(sectionClient, SWT.DROP_DOWN);
    m_combo_news_state.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    try {
      m_combo_news_state.setItems(FieldDataHelper.getStates());
    } catch (Exception e1) {
      m_combo_news_state.setEnabled(false);
      label_state.setEnabled(false);
    }
  }
 protected Composite createInheritanceGroup(FormToolkit widgetFactory, final Composite parent) {
   Section inheritanceSection =
       widgetFactory.createSection(parent, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
   inheritanceSection.setText(EcoreMessages.EClassPropertiesEditionPart_InheritanceGroupLabel);
   GridData inheritanceSectionData = new GridData(GridData.FILL_HORIZONTAL);
   inheritanceSectionData.horizontalSpan = 3;
   inheritanceSection.setLayoutData(inheritanceSectionData);
   Composite inheritanceGroup = widgetFactory.createComposite(inheritanceSection);
   GridLayout inheritanceGroupLayout = new GridLayout();
   inheritanceGroupLayout.numColumns = 3;
   inheritanceGroup.setLayout(inheritanceGroupLayout);
   inheritanceSection.setClient(inheritanceGroup);
   return inheritanceGroup;
 }
 protected Composite createPropertiesGroup(FormToolkit widgetFactory, final Composite parent) {
   Section propertiesSection =
       widgetFactory.createSection(parent, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
   propertiesSection.setText(FlowMessages.SubflowStatePropertiesEditionPart_PropertiesGroupLabel);
   GridData propertiesSectionData = new GridData(GridData.FILL_HORIZONTAL);
   propertiesSectionData.horizontalSpan = 3;
   propertiesSection.setLayoutData(propertiesSectionData);
   Composite propertiesGroup = widgetFactory.createComposite(propertiesSection);
   GridLayout propertiesGroupLayout = new GridLayout();
   propertiesGroupLayout.numColumns = 3;
   propertiesGroup.setLayout(propertiesGroupLayout);
   propertiesSection.setClient(propertiesGroup);
   return propertiesGroup;
 }
  private void createPlatformSpecificSection(FormToolkit toolkit, Composite parent) {
    fPlatformSectionControls = new ArrayList();
    // Create the section
    Section section = toolkit.createSection(parent, Section.EXPANDED | Section.TWISTIE);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.horizontalSpan = 3;
    section.setText(SOAMessages.PlatformSpecificPropLabel);
    section.setLayoutData(gd);

    Composite separator = toolkit.createCompositeSeparator(section);
    gd = new GridData(GridData.FILL_BOTH);
    gd.heightHint = 3;
    separator.setLayoutData(gd);

    Composite client = toolkit.createComposite(section, SWT.WRAP);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginWidth = 2;
    layout.marginHeight = 2;
    client.setLayout(layout);

    // Fill the section with components
    Composite fieldComposite = toolkit.createComposite(client);
    layout = new GridLayout(2, false);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    fieldComposite.setLayout(layout);
    fieldComposite.setLayoutData(gd);

    Label cicsUriLabel = toolkit.createLabel(fieldComposite, SOAMessages.CICSURILabel);
    fPlatformSectionControls.add(cicsUriLabel);
    fCICSURIText = toolkit.createText(fieldComposite, "", SWT.SINGLE); // $NON-NLS-1$
    gd = new GridData(GridData.FILL_HORIZONTAL);
    fCICSURIText.setLayoutData(gd);
    fCICSURIText.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            HandleCICSURIModified();
          }
        });
    fPlatformSectionControls.add(fCICSURIText);
    fSOAPServiceSectionControls.add(fCICSURIText);

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

    if (!EDTCoreIDEPlugin.SUPPORT_SOAP) {
      section.setExpanded(false);
      section.setVisible(false);
    }
  }
Exemple #17
0
  private void addOptions() {
    Map<String, Composite> sections = new HashMap<String, Composite>();

    for (IOption option : action.getConfiguration().getOptions()) {
      Composite parent = body;
      if (option instanceof Option) {
        if (((Option) option).isFixed()) continue;
        String sectionName = ((Option) option).getSection();
        if (sectionName != null) {
          parent = sections.get(sectionName);
          if (parent == null) {
            Section section =
                toolkit.createSection(body, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
            section.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
            section.setExpanded(false);
            section.addExpansionListener(
                new ExpansionAdapter() {
                  public void expansionStateChanged(ExpansionEvent e) {
                    form.reflow(true);
                  }
                });
            section.setText(sectionName);
            //						section.setDescription("This is the description that goes below the title");
            Composite sectionClient = toolkit.createComposite(section);
            sectionClient.setLayout(new GridLayout());
            section.setClient(sectionClient);
            sections.put(sectionName, sectionClient);
            parent = sectionClient;
          }
        }
      }
      addOption(parent, option);
    }

    runLink = toolkit.createImageHyperlink(body, SWT.NONE);
    //		runLink.setFont(JFaceResources.getHeaderFont());
    runLink.setImage(runImage);
    runLink.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, true));
    runLink.setText("Run");
    updateRunButton();

    runLink.addHyperlinkListener(
        new HyperlinkAdapter() {
          @Override
          public void linkActivated(HyperlinkEvent e) {
            safeRun();
          }
        });
  }
  @Override
  public final void createContents(Composite parent) {
    // This is a hacked fix to ensure that the label columns on every details
    // page have the same width. SchemaDetails_translatable plus 11 pixels
    // represents the longest label on any field on any details page. This
    // occurs on SchemaStringAttributeDetails and 11 is the size of the
    // horizontal indent that contributes to the label's width.
    GC gc = new GC(parent);
    minLabelWeight = gc.textExtent(PDEUIMessages.SchemaDetails_translatable).x + 11;
    gc.dispose();
    gc = null;

    parent.setLayout(FormLayoutFactory.createDetailsGridLayout(false, 1));
    FormToolkit toolkit = getManagedForm().getToolkit();
    fSection = toolkit.createSection(parent, Section.DESCRIPTION | ExpandableComposite.TITLE_BAR);
    fSection.clientVerticalSpacing = FormLayoutFactory.SECTION_HEADER_VERTICAL_SPACING;
    fSection.setLayout(FormLayoutFactory.createClearGridLayout(false, 1));

    GridData gd;
    if (fShowDescription) gd = new GridData(GridData.FILL_BOTH);
    else gd = new GridData(GridData.FILL_HORIZONTAL);
    fSection.setLayoutData(gd);

    // Align the master and details section headers (misalignment caused
    // by section toolbar icons)
    getPage().alignSectionHeaders(fElementSection.getSection(), fSection);

    Composite client = toolkit.createComposite(fSection);
    client.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, 3));

    createDetails(client);

    if (fShowDescription) createDescription(client, toolkit);

    // If the DTD Approximation section was requested, instantiate it and create it's contents
    // on the same parent Composite
    if (fShowDTD) {
      fDtdSection = new SchemaDtdDetailsSection();
      fDtdSection.initialize(getManagedForm());
      fDtdSection.createContents(parent);
    }

    toolkit.paintBordersFor(client);
    fSection.setClient(client);
    markDetailsPart(fSection);

    if (fShowDescription) fDescriptionViewer.createUIListeners();
    hookListeners();
  }
 public void createSection(Composite parent) {
   super.createSection(parent);
   FormToolkit toolkit2 = new FormToolkit(parent.getDisplay());
   Section publishTypeSection =
       toolkit2.createSection(
           parent,
           ExpandableComposite.TWISTIE
               | ExpandableComposite.EXPANDED
               | ExpandableComposite.TITLE_BAR);
   publishTypeSection.setText(Messages.ServerBehavior);
   Control c = createPublishMethodComposite(publishTypeSection);
   publishTypeSection.setClient(c);
   publishTypeSection.setLayoutData(
       new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
 }
  protected void createRESTServicePropertiesSection(FormToolkit toolkit, Composite parent) {
    fRESTServiceSectionControls = new ArrayList();
    // Create the section
    Section section = toolkit.createSection(parent, Section.EXPANDED | Section.TWISTIE);
    section.setText(SOAMessages.TitleSectionRestService);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.horizontalSpan = 3;
    section.setLayoutData(gd);

    Composite separator = toolkit.createCompositeSeparator(section);
    gd = new GridData(GridData.FILL_BOTH);
    gd.heightHint = 3;
    separator.setLayoutData(gd);

    Composite client = toolkit.createComposite(section, SWT.WRAP);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginWidth = 2;
    layout.marginHeight = 2;
    client.setLayout(layout);

    // Fill the section with components
    Composite fieldComposite = toolkit.createComposite(client);
    int layoutColumn = 3;
    layout = new GridLayout(layoutColumn, false);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    fieldComposite.setLayout(layout);
    fieldComposite.setLayoutData(gd);

    fRestUriLabel = toolkit.createLabel(fieldComposite, SOAMessages.LabelURI);
    fRESTServiceSectionControls.add(fRestUriLabel);
    fRestUri = toolkit.createText(fieldComposite, "", SWT.SINGLE); // $NON-NLS-1$
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = layoutColumn - 1;
    fRestUri.setLayoutData(gd);
    fRestUri.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            HandleRestURIModified();
          }
        });
    fRESTServiceSectionControls.add(fRestUri);

    createSpacer(toolkit, fieldComposite, layoutColumn);
    toolkit.paintBordersFor(fieldComposite);

    section.setClient(client);
  }
 protected Composite createFilterExpressionGroup(
     FormToolkit widgetFactory, final Composite parent) {
   Section filterExpressionSection =
       widgetFactory.createSection(parent, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
   filterExpressionSection.setText(
       FiltersMessages.OCLFilterPropertiesEditionPart_FilterExpressionGroupLabel);
   GridData filterExpressionSectionData = new GridData(GridData.FILL_HORIZONTAL);
   filterExpressionSectionData.horizontalSpan = 3;
   filterExpressionSection.setLayoutData(filterExpressionSectionData);
   Composite filterExpressionGroup = widgetFactory.createComposite(filterExpressionSection);
   GridLayout filterExpressionGroupLayout = new GridLayout();
   filterExpressionGroupLayout.numColumns = 3;
   filterExpressionGroup.setLayout(filterExpressionGroupLayout);
   filterExpressionSection.setClient(filterExpressionGroup);
   return filterExpressionGroup;
 }
Exemple #22
0
  public Section create(Composite parent, FormToolkit toolkit) {
    boolean twistie = (style & Section.TWISTIE) != 0;
    boolean expanded = !twistie || (style & Section.EXPANDED) != 0;
    final Section section = toolkit.createSection(parent, style | Section.NO_TITLE_FOCUS_BOX);
    section.setText(composite.getName());
    GridDataFactory.fillDefaults().grab(true, expanded).applyTo(section);

    Composite c = toolkit.createComposite(section);
    GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 5).applyTo(c);
    composite.createControl(c);

    Composite forToolbar = new Composite(section, SWT.NONE);
    FillLayout fl = new FillLayout();
    forToolbar.setLayout(fl);
    if (Platform.getOS().equals(Platform.OS_LINUX)) {
      fl.marginHeight = -2;
    }
    if (Platform.getOS().equals(Platform.OS_MACOSX)) {
      fl.marginHeight = -2;
    }
    composite.createToolBar(forToolbar);

    section.setClient(c);
    section.setTextClient(forToolbar);

    if (twistie) {
      composite.setVisible(expanded);
      composite
          .observeVisible()
          .addChangeListener(
              new IChangeListener() {
                public void handleChange(ChangeEvent event) {
                  GridDataFactory.fillDefaults()
                      .grab(true, composite.getVisible())
                      .applyTo(section);
                  section.setExpanded(composite.getVisible());
                }
              });
      section.addExpansionListener(
          new ExpansionAdapter() {
            public void expansionStateChanged(ExpansionEvent e) {
              composite.setVisible(section.isExpanded());
            }
          });
    }
    return section;
  }
 /**
  * Create the section to ask the user to create a parameter.
  *
  * @param pParent the section's parent widget
  * @param pToolkit the form toolkit
  */
 protected void createParameterSection(Composite pParent, FormToolkit pToolkit) {
   // create the section
   String lSectionTitle = getCreationTitle();
   Section lSection = pToolkit.createSection(pParent, Section.EXPANDED | Section.TITLE_BAR);
   lSection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   if (lSectionTitle != null) {
     lSection.setText(lSectionTitle);
   }
   ImageHyperlink componentHelp =
       HelpComponentFactory.createHelpComponent(
           lSection, pToolkit, CustomMessages.CreateParameterDialog_ParameterCreationHelp, true);
   lSection.setTextClient(componentHelp);
   ScrolledForm lInsideScrolledForm = pToolkit.createScrolledForm(lSection);
   lInsideScrolledForm.setExpandHorizontal(true);
   lInsideScrolledForm.setExpandVertical(true);
   Composite lBody = lInsideScrolledForm.getBody();
   GridLayout lLayout = new GridLayout();
   lLayout.numColumns = 3;
   lBody.setLayout(lLayout);
   // content of the section
   pToolkit.createLabel(lBody, getNameLabel(), SWT.NONE);
   creationNameText = pToolkit.createText(lBody, "", SWT.BORDER);
   creationNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
   creationNameText.setFocus();
   // manage type selection
   pToolkit.createLabel(lBody, getTypeLabel(), SWT.NONE);
   creationTypeText =
       pToolkit.createText(lBody, labelProvider.getText(selectedType), SWT.BORDER | SWT.READ_ONLY);
   creationTypeText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   creationTypeButton = pToolkit.createButton(lBody, "...", SWT.FLAT);
   Image image = getTypeImage();
   creationTypeButton.setImage(image);
   creationTypeButton.setLayoutData(new GridData(SWT.NONE));
   // manage direction selection
   pToolkit.createLabel(lBody, getDirectionLabel(), SWT.NONE);
   creationDirectionCombo = new Combo(lBody, SWT.DROP_DOWN | SWT.READ_ONLY);
   directionComboViewer = new ComboViewer(creationDirectionCombo);
   pToolkit.adapt(creationDirectionCombo);
   creationDirectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
   directionComboViewer.setLabelProvider(labelProvider);
   directionComboViewer.add(getPossibleDirections());
   // initialize selection
   directionComboViewer.setSelection(new StructuredSelection(getDefaultDirection()));
   selectedDirection = ParameterDirectionKind.getByName(getDefaultDirection());
   lInsideScrolledForm.reflow(true);
   lSection.setClient(lInsideScrolledForm);
 }
 protected void createGroupGroup(FormToolkit widgetFactory, final Composite view) {
   Section groupSection =
       widgetFactory.createSection(view, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
   groupSection.setText(NonregMessages.TestFilterPropertiesEditionPart_GroupGroupLabel);
   GridData groupSectionData = new GridData(GridData.FILL_HORIZONTAL);
   groupSectionData.horizontalSpan = 3;
   groupSection.setLayoutData(groupSectionData);
   Composite groupGroup = widgetFactory.createComposite(groupSection);
   GridLayout groupGroupLayout = new GridLayout();
   groupGroupLayout.numColumns = 3;
   groupGroup.setLayout(groupGroupLayout);
   createTestEOFCVFlatComboViewer(groupGroup, widgetFactory);
   createTestARTReferencesTable(widgetFactory, groupGroup);
   createTestAEOFCVFlatComboViewer(groupGroup, widgetFactory);
   createTestRTReferencesTable(widgetFactory, groupGroup);
   groupSection.setClient(groupGroup);
 }
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
   */
  protected Control createDialogArea(Composite parent) {

    getShell().setText("New Regex"); // $NON-NLS-1$

    // getShell().setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_WHITE));
    Composite composite = (Composite) super.createDialogArea(parent);
    composite.setLayout(new FillLayout());

    FormToolkit toolkit = new FormToolkit(Display.getDefault());
    form = toolkit.createForm(composite);
    form.getBody().setLayout(new GridLayout());
    toolkit.decorateFormHeading(form);

    sec = toolkit.createSection(form.getBody(), Section.TITLE_BAR);
    sec.setText("Regular Expression"); // $NON-NLS-1$
    sec.setLayoutData(new GridData(SWT.FILL, SWT.Expand, true, false, 1, 1));
    Composite compo = toolkit.createComposite(sec);
    GridLayout layout = new GridLayout(2, false);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    compo.setLayout(layout);
    sec.setClient(compo);
    createContent(toolkit, compo);

    // Create field for Regex
    toolkit.createLabel(compo, "Regex: "); // $NON-NLS-1$
    String helpText = Messages.PopupRegexDialog_REGEX;
    componentHelpTextField = new ComponentHelpTextField(this, compo, toolkit, SWT.NONE, helpText);
    GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    componentHelpTextField.setLayoutData(data);

    // Add regex viewer component to the dialog
    regex =
        new RegexViewerComposite(
            form.getBody(),
            SWT.NONE,
            RegexViewerComposite.EXPANDABLE
                | RegexViewerComposite.MATCH
                | RegexViewerComposite.DESCRIPTION
                | RegexViewerComposite.GROUP,
            Pattern.MULTILINE | patterns);
    regex.setDescription("Regex Test Area"); // $NON-NLS-1$
    regex.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));

    return composite;
  }
  private void createFilesAddedView(FormToolkit toolkit, Composite parent) {
    Section section = toolkit.createSection(parent, Section.TITLE_BAR | Section.DESCRIPTION);
    section.setText("Files selected");
    section.setDescription("Double click to remove from current project");

    Composite client = toolkit.createComposite(section, SWT.WRAP);

    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginWidth = 2;
    layout.marginHeight = 2;

    client.setLayout(layout);

    Table t = toolkit.createTable(client, SWT.NULL);

    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.heightHint = 20;
    gd.widthHint = 200;

    t.setLayoutData(gd);
    toolkit.paintBordersFor(client);

    section.setClient(client);

    table = new TableViewer(t);
    ArrayContentProvider tmp = new ArrayContentProvider();
    table.setContentProvider(tmp);

    TableViewerColumn viewerColumn = new TableViewerColumn(table, SWT.LEFT);
    viewerColumn.getColumn().setWidth(300);
    viewerColumn.setLabelProvider(
        new ColumnLabelProvider() {
          @Override
          public String getText(Object element) {
            return element.toString();
          };

          public Image getImage(Object element) {
            return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE);
          };
        });

    hookContextMenu2();
    hookDoubleClickAction2();
  }
  private void createBrowseLocalFilesView(FormToolkit toolkit, Composite parent) {
    Section localFilesSection =
        toolkit.createSection(parent, Section.TITLE_BAR | Section.DESCRIPTION);

    localFilesSection.setText("Local Files");
    localFilesSection.setDescription("Double click to add to current project");

    Composite composite = toolkit.createComposite(localFilesSection, SWT.WRAP);
    composite.setBounds(10, 94, 64, 64);

    FormData fd_composite = new FormData();
    fd_composite.bottom = new FormAttachment(100, -10);
    fd_composite.right = new FormAttachment(0, 751);
    fd_composite.left = new FormAttachment(0, 10);
    composite.setLayoutData(fd_composite);
    composite.setLayout(new TreeColumnLayout());

    treeViewer = new TreeViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    Tree localFilesTree = treeViewer.getTree();
    localFilesTree.setHeaderVisible(true);
    localFilesTree.setLinesVisible(true);

    treeViewer.setAutoExpandLevel(2);

    drillDownAdapter = new DrillDownAdapter(treeViewer);

    treeViewer.setContentProvider(new ViewContentProvider());

    treeViewer.setLabelProvider(new ViewLabelProvider());

    treeViewer.setSorter(new NameSorter());
    treeViewer.setInput(File.listRoots());

    // Create the help context id for the viewer's control
    PlatformUI.getWorkbench()
        .getHelpSystem()
        .setHelp(treeViewer.getControl(), "com.plugin.tryplugin.viewer");

    makeActions();
    hookContextMenu();
    hookDoubleClickAction();
    contributeToActionBars();
    localFilesSection.setClient(composite);
  }
  private Section createSection(SceneNodeComponent component) {
    FormToolkit toolkit = GurellaStudioPlugin.getToolkit();

    Section section =
        toolkit.createSection(componentsComposite, TWISTIE | SHORT_TITLE_BAR | NO_TITLE_FOCUS_BOX);
    section.setText(MetaTypes.getMetaType(component).getName());
    section.setLayoutData(new GridData(FILL, FILL, true, false, 1, 1));
    section.addExpansionListener(new ExpansionListener(component));

    BeanEditor<SceneNodeComponent> editor = createEditor(section, editorContext, component);
    Signal1<PropertyValueChangedEvent> signal = editor.getContext().propertiesSignal;
    signal.addListener(e -> notifySceneChanged());

    section.setClient(editor);
    section.setExpanded(getPreferences().getBoolean(component.ensureUuid(), true));
    editors.put(component, section);

    return section;
  }
  private void createButtonSection(Composite editorComposite, FormToolkit toolkit) {

    Section section = toolkit.createSection(editorComposite, ExpandableComposite.NO_TITLE);
    section.setLayoutData(new GridData(GridData.FILL_BOTH));

    Composite buttonSection = toolkit.createComposite(section);
    section.setClient(buttonSection);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    buttonSection.setLayout(layout);

    Button search_button = toolkit.createButton(buttonSection, "Search", SWT.PUSH | SWT.CENTER);
    search_button.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {

            m_sform.reflow(true);
            firePropertyChange(IEditorPart.PROP_DIRTY);

            String sparql_query = m_SparqlQueryHelper.constructQuery();
            String[] vars = {"?news"};
            QueryWrapper query = new QueryWrapper(sparql_query, vars);

            long selectiontime = System.currentTimeMillis();
            Object[] selection = {ExploreEnvironment.F_SEARCH, query, selectiontime, null};
            m_selectionProvider.setSelection(new StructuredSelection(selection));
          }
        });

    //		TODO combine NewsSearch with StoredQueryView. a 'save' option would be nice ...
    //		Button save_button = toolkit.createButton(buttonSection,"Save",SWT.PUSH | SWT.CENTER);
    //		save_button.addSelectionListener(new SelectionAdapter() {
    //			@Override
    //			public void widgetSelected(SelectionEvent e) {

    //				m_sform.reflow(true);
    //				markDirty(true);
    //				firePropertyChange(IEditorPart.PROP_DIRTY);
    //			}
    //		});
  }
  private void createFormMiscSection(final ScrolledForm form, FormToolkit toolkit) {
    /* Misc. Section */
    Section miscSection = toolkit.createSection(form.getBody(), Section.TWISTIE | Section.EXPANDED);
    miscSection.setActiveToggleColor(toolkit.getHyperlinkGroup().getActiveForeground());
    miscSection.setToggleColor(toolkit.getColors().getColor(FormColors.SEPARATOR));
    toolkit.createCompositeSeparator(miscSection);
    GridData miscSectionGridData = new GridData();
    miscSectionGridData.horizontalSpan = 3;
    miscSectionGridData.horizontalAlignment = GridData.FILL;
    miscSectionGridData.grabExcessHorizontalSpace = true;
    miscSection.setLayoutData(miscSectionGridData);
    miscSection.addExpansionListener(
        new ExpansionAdapter() {
          public void expansionStateChanged(ExpansionEvent e) {
            form.reflow(false);
          }
        });
    miscSection.setText(Messages.getString("ScheduledTaskPage.section.misc"));
    // miscSection.setLayoutData(new TableWrapData(TableWrapData.FILL));

    Composite miscSectionClient = toolkit.createComposite(miscSection);
    miscSectionClient.setLayout(new GridLayout());

    toolkit.createLabel(miscSectionClient, "Pinned Servers");
    GridData taskGroupGridData = new GridData();
    taskGroupGridData.horizontalSpan = 3;
    taskGroupGridData.horizontalAlignment = GridData.FILL;
    taskGroupGridData.grabExcessHorizontalSpace = true;
    pinnedServers = toolkit.createText(miscSectionClient, "");
    pinnedServers.setBackground(new Color(null, 229, 236, 253));
    pinnedServers.setLayoutData(taskGroupGridData);
    pinnedServers.addModifyListener(
        new ModifyListener() {
          @Override
          public void modifyText(ModifyEvent e) {
            setSave(true);
            updateDirtyState();
          }
        });

    miscSection.setClient(miscSectionClient);
  }