Example #1
0
 public void createControl(Composite parent) {
   toolkit = new FormToolkit(parent.getDisplay());
   int borderStyle = toolkit.getBorderStyle() == SWT.BORDER ? SWT.NULL : SWT.BORDER;
   container = new Composite(parent, borderStyle);
   FillLayout flayout = new FillLayout();
   flayout.marginWidth = 1;
   flayout.marginHeight = 1;
   container.setLayout(flayout);
   formText = new ScrolledFormText(container, SWT.V_SCROLL | SWT.H_SCROLL, false);
   if (borderStyle == SWT.NULL) {
     formText.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER);
     toolkit.paintBordersFor(container);
   }
   FormText ftext = toolkit.createFormText(formText, false);
   formText.setFormText(ftext);
   formText.setExpandHorizontal(true);
   formText.setExpandVertical(true);
   formText.setBackground(toolkit.getColors().getBackground());
   formText.setForeground(toolkit.getColors().getForeground());
   ftext.marginWidth = 2;
   ftext.marginHeight = 2;
   ftext.setHyperlinkSettings(toolkit.getHyperlinkGroup());
   formText.addDisposeListener(
       new DisposeListener() {
         public void widgetDisposed(DisposeEvent e) {
           if (toolkit != null) {
             toolkit.dispose();
             toolkit = null;
           }
         }
       });
   if (text != null) formText.setText(text);
 }
Example #2
0
  protected void createClient(Section section, FormToolkit toolkit) {

    section.setText("Process Under Test");

    section.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    section.setDescription(
        "Enter a name, deployer, and WSDL file for the process under test (PUT).");

    Composite content = toolkit.createComposite(section);
    TableWrapLayout layout = new TableWrapLayout();
    layout.leftMargin = layout.rightMargin = toolkit.getBorderStyle() != SWT.NULL ? 0 : 2;
    layout.numColumns = 3;
    content.setLayout(layout);

    createNameEntry(content, toolkit);
    createTypeEntry(content, toolkit);
    createWSDLEntry(content, toolkit);

    createText(
        content,
        "<form><p><a href=\"deploymentOptions\">Configure Deployment Options...</a></p></form>",
        toolkit,
        this);

    section.setClient(content);
    toolkit.paintBordersFor(content);
  }
Example #3
0
  private void createMessageArea(Composite parent, FormToolkit toolkit, int span) {
    Section messageSection = createSection(parent, toolkit, span);
    Composite messageArea = createSectionClient(messageSection, toolkit);

    messageSection.setText(UIText.CommitEditorPage_SectionMessage);

    RevCommit commit = getCommit().getRevCommit();
    String message = commit.getFullMessage();

    PersonIdent author = commit.getAuthorIdent();
    if (author != null) message = replaceSignedOffByLine(message, author);
    PersonIdent committer = commit.getCommitterIdent();
    if (committer != null) message = replaceSignedOffByLine(message, committer);

    SpellcheckableMessageArea textContent =
        new SpellcheckableMessageArea(messageArea, message, true, toolkit.getBorderStyle()) {

          @Override
          protected IAdaptable getDefaultTarget() {
            return new PlatformObject() {
              public Object getAdapter(Class adapter) {
                return Platform.getAdapterManager().getAdapter(getEditorInput(), adapter);
              }
            };
          }

          protected void createMarginPainter() {
            // Disabled intentionally
          }
        };
    if ((toolkit.getBorderStyle() & SWT.BORDER) == 0)
      textContent.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
    GridDataFactory.fillDefaults().hint(SWT.DEFAULT, 80).grab(true, true).applyTo(textContent);

    updateSectionClient(messageSection, messageArea, toolkit);
  }
Example #4
0
  private void createFilesArea(Composite parent, FormToolkit toolkit, int span) {
    Section files = createSection(parent, toolkit, span);
    Composite filesArea = createSectionClient(files, toolkit);
    GridLayout filesAreaLayout = (GridLayout) filesArea.getLayout();
    filesAreaLayout.marginLeft = 0;
    filesAreaLayout.marginRight = 0;
    filesAreaLayout.marginTop = 0;
    filesAreaLayout.marginBottom = 0;

    CommitFileDiffViewer viewer =
        new CommitFileDiffViewer(
            filesArea,
            getSite(),
            SWT.MULTI
                | SWT.H_SCROLL
                | SWT.V_SCROLL
                | SWT.FULL_SELECTION
                | toolkit.getBorderStyle());
    // commit file diff viewer uses a nested composite with a stack layout
    // and so margins need to be applied to have form toolkit style borders
    toolkit.paintBordersFor(viewer.getTable().getParent());
    viewer.getTable().setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER);
    StackLayout viewerLayout = (StackLayout) viewer.getControl().getParent().getLayout();
    viewerLayout.marginHeight = 2;
    viewerLayout.marginWidth = 2;
    GridDataFactory.fillDefaults()
        .grab(true, true)
        .hint(SWT.DEFAULT, 80)
        .applyTo(viewer.getTable().getParent());
    viewer.setContentProvider(ArrayContentProvider.getInstance());
    viewer.setTreeWalk(getCommit().getRepository(), null);

    FileDiff[] diffs = getCommit().getDiffs();
    viewer.setInput(diffs);
    files.setText(
        MessageFormat.format(UIText.CommitEditorPage_SectionFiles, Integer.valueOf(diffs.length)));

    updateSectionClient(files, filesArea, toolkit);
  }
  protected void createClient(FormToolkit toolkit) {
    Composite container = toolkit.createComposite(getSection());

    GridLayout layout = new GridLayout();
    layout.numColumns = 4;
    container.setLayout(layout);

    fFilterCombo = new Combo(container, toolkit.getBorderStyle() | SWT.READ_ONLY);
    toolkit.adapt(fFilterCombo, true, true);
    String[] fFilterComboItems = {
      Messages.EntriesFilterSection_ComboItemFilter, Messages.EntriesFilterSection_ComboItemClear
    };
    fFilterCombo.setItems(fFilterComboItems);
    fFilterCombo.select(0);
    fFilterCombo.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            if (fFilterCombo.getSelectionIndex() == 1) {
              fFilterText.setText(""); // $NON-NLS-1$
              filter.setPattern(""); // $NON-NLS-1$
              // always leave selection at 'filter' (this combo is acting as a push button)
              fFilterCombo.select(0);
            }
          }
        });

    // Build an array of the localized names of the properties
    // on which a filter may be based.
    String[] filterTypes = new String[allEntryDataObjects.size() + 1];
    int i = 0;
    filterTypes[i++] = Messages.EntriesFilterSection_Entry;
    for (IndividualBlock entriesSectionProperty : allEntryDataObjects) {
      filterTypes[i++] = entriesSectionProperty.getText();
    }

    fFilterTypeCombo = new Combo(container, toolkit.getBorderStyle() | SWT.READ_ONLY);
    toolkit.adapt(fFilterTypeCombo, true, true);
    fFilterTypeCombo.setItems(filterTypes);
    fFilterTypeCombo.select(0);
    fFilterTypeCombo.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            filter.setType(fFilterTypeCombo.getSelectionIndex());
          }
        });

    fOperationCombo = new Combo(container, toolkit.getBorderStyle() | SWT.READ_ONLY);
    toolkit.adapt(fOperationCombo, true, true);
    String[] fOperationComboItems = {
      Messages.EntriesFilterSection_ComboItemContains,
    };
    fOperationCombo.setItems(fOperationComboItems);
    fOperationCombo.select(0);

    fFilterText = toolkit.createText(container, ""); // $NON-NLS-1$
    fFilterText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    fFilterText.addFocusListener(
        new FocusAdapter() {
          @Override
          public void focusLost(FocusEvent e) {
            filter.setPattern(fFilterText.getText());
          }
        });

    getSection().setClient(container);
    toolkit.paintBordersFor(container);
    refresh();
  }
  /** {@inheritDoc} */
  @Override
  public void createPartControl(Composite parent) {
    createViewToolbar();

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

    mainComposite = new SashForm(parent, SWT.VERTICAL);
    GridLayout mainLayout = new GridLayout(1, true);
    mainLayout.marginWidth = 0;
    mainLayout.marginHeight = 0;
    mainComposite.setLayout(mainLayout);

    mainForm = toolkit.createForm(mainComposite);
    mainForm.getBody().setLayout(new GridLayout(1, true));
    mainForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    createHeadClient();
    toolkit.decorateFormHeading(mainForm);

    int borderStyle = toolkit.getBorderStyle();
    toolkit.setBorderStyle(SWT.NULL);
    Table table = toolkit.createTable(mainForm.getBody(), SWT.V_SCROLL | SWT.H_SCROLL);
    toolkit.setBorderStyle(borderStyle);
    tableViewer = new TableViewer(table);

    // create tree content provider
    tableViewer.setContentProvider(getContentProvider());
    tableViewer.setLabelProvider(getLabelProvider());

    ViewerComparator comparator = getViewerComparator();
    if (null != comparator) {
      tableViewer.setComparator(comparator);
    }
    ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.NO_RECREATE);

    // double-click listener
    IDoubleClickListener doubleClickListener = getTreeDoubleClickListener();
    if (null != doubleClickListener) {
      tableViewer.addDoubleClickListener(doubleClickListener);
    }

    // menu
    String menuId = getMenuId();
    if (null != menuId) {
      MenuManager menuManager = new MenuManager();
      menuManager.setRemoveAllWhenShown(true);
      getSite().registerContextMenu(menuId, menuManager, tableViewer);
      Control control = tableViewer.getControl();
      Menu menu = menuManager.createContextMenu(control);
      control.setMenu(menu);
    }

    // resizing listener
    mainComposite.addControlListener(
        new ControlAdapter() {
          private boolean verticaLayout;

          @Override
          public void controlResized(ControlEvent e) {
            int width = mainComposite.getBounds().width;
            int height = mainComposite.getBounds().height;

            if (width > height && verticaLayout) {
              verticaLayout = false;
              mainComposite.setOrientation(SWT.HORIZONTAL);
            } else if (width < height && !verticaLayout) {
              verticaLayout = true;
              mainComposite.setOrientation(SWT.VERTICAL);
            }

            mainComposite.layout();
          }
        });

    // update all
    updateFormTitle();
    updateFormMenuManager();
    updateFormBody();

    tableViewer.addSelectionChangedListener(
        new ISelectionChangedListener() {
          @Override
          public void selectionChanged(SelectionChangedEvent event) {
            StructuredSelection ss = (StructuredSelection) tableViewer.getSelection();
            if (ss.getFirstElement() instanceof IProfileProvider
                || ss.getFirstElement() instanceof IEnvironmentProvider) {
              selectionProviderAdapter.setSelection(ss);
            } else {
              // setting selection to the CMR so that we can perform all the necessary
              // operations
              selectionProviderAdapter.setSelection(
                  new StructuredSelection(displayedCmrRepositoryDefinition));
            }
          }
        });
    getSite().setSelectionProvider(selectionProviderAdapter);
    selectionProviderAdapter.setSelection(
        new StructuredSelection(displayedCmrRepositoryDefinition));

    // TODO: This needs to be removed as soon as the configuration interface is fully
    // functional.
    UnfinishedWarningUtils.inform(
        "The configuration interface is not yet connected with the agent instrumentation. You can play around with this preview, but the instrumentations will not be effective.",
        "UNFINISHED_WARNING_CONFIGURATION_INTERFACE");
  }