Example #1
0
  public BackBoard(Composite parent, int style) {
    super(parent, SWT.NONE);

    this.display = parent.getDisplay();

    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    super.setLayout(layout);

    Composite back = new Composite(this, SWT.NONE);
    back.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
    back.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));

    GridLayout backLayout = new GridLayout();
    backLayout.numColumns = 1;
    backLayout.verticalSpacing = 10;
    backLayout.marginWidth = 0;
    backLayout.marginHeight = 0;
    back.setLayout(backLayout);

    GridData titleBarGridData = new GridData(GridData.FILL, GridData.FILL, true, false);
    titleBarGridData.heightHint = 33;

    titleBar = new Canvas(back, SWT.NONE);
    titleBar.setLayoutData(titleBarGridData);
    titleBar.setBackgroundImage(
        Activator.getImageDescriptor("/icons/titleback.gif").createImage(display));

    backLayout = new GridLayout();
    backLayout.horizontalSpacing = 10;
    backLayout.marginWidth = 0;
    backLayout.marginHeight = 3;
    backLayout.marginRight = 10;
    titleBar.setLayout(backLayout);

    paintListener =
        new PaintListener() {
          public void paintControl(PaintEvent e) {
            if (e.widget == titleBar) {
              drawTitle(e);
            }
          }
        };

    titleBar.addPaintListener(paintListener);

    contents = new Composite(back, SWT.NONE);
    GridData contentsGridData = new GridData(GridData.FILL, GridData.FILL, true, true);
    contents.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
    contents.setLayoutData(contentsGridData);

    GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, true);
    gridData.horizontalAlignment = SWT.RIGHT;

    toolBar = new ToolBar(titleBar, SWT.FLAT);
    toolBar.setLayoutData(gridData);
    toolBar.setBackgroundImage(
        Activator.getImageDescriptor("/icons/titleback.gif").createImage(display));
  }
Example #2
0
  protected Composite createWarningComposite(final String text, final int imageType) {

    final Image image = getShell().getDisplay().getSystemImage(imageType);

    final Color backgroundColor = getShell().getBackground();
    final Color foregroundColor = getShell().getForeground();

    final Composite composite = new Composite(getShell(), SWT.NONE);
    final GridLayout gridLayout = new GridLayout(2, false);
    composite.setLayout(gridLayout);
    composite.setBackground(backgroundColor);
    composite.setForeground(foregroundColor);
    Composite imageCanvas = new SWTImageCanvas(composite, SWT.NONE, image);
    imageCanvas.setLayoutData(new GridData(ICONSIZE, ICONSIZE));
    imageCanvas.setBackground(backgroundColor);
    imageCanvas.setForeground(foregroundColor);

    final Label label = new Label(composite, SWT.NONE);
    label.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, true, true));
    label.setBackground(backgroundColor);
    label.setForeground(foregroundColor);
    label.setText(text);

    return composite;
  }
Example #3
0
 /**
  * Set the background for the widgets that support the filter text area.
  *
  * @param background background <code>Color</code> to set
  */
 public void setBackground(Color background) {
   super.setBackground(background);
   if (filterComposite != null) {
     filterComposite.setBackground(background);
   }
   if (filterToolBar != null && filterToolBar.getControl() != null) {
     filterToolBar.getControl().setBackground(background);
   }
 }
Example #4
0
  @Override
  protected Control createDialogArea(Composite parent) {
    updateTitle();
    final Composite composite = (Composite) super.createDialogArea(parent);
    composite.setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_WHITE));
    final ScrolledComposite scrolledComposite =
        new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL);
    scrolledComposite.setBackground(composite.getBackground());
    scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setExpandHorizontal(true);

    final Composite content = new Composite(scrolledComposite, SWT.NONE);
    content.setBackground(composite.getBackground());
    GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(content);
    GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).applyTo(content);

    try {
      if (view == null) {
        ECPSWTViewRenderer.INSTANCE.render(content, selection);
      } else {
        ECPSWTViewRenderer.INSTANCE.render(content, selection, view);
      }
    } catch (final ECPRendererException ex) {
      Activator.log(ex);
    }

    scrolledComposite.setContent(content);
    final Point point = content.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    content.setSize(point);
    scrolledComposite.setMinSize(point);

    objectChangeAdapter =
        new AdapterImpl() {

          /**
           * {@inheritDoc}
           *
           * @see
           *     org.eclipse.emf.common.notify.impl.AdapterImpl#notifyChanged(org.eclipse.emf.common.notify.Notification)
           */
          @Override
          public void notifyChanged(Notification msg) {
            super.notifyChanged(msg);
            updateTitle();
          }
        };
    selection.eAdapters().add(objectChangeAdapter);

    return composite;
  }
  /*
   * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
   */
  public void createControl(Composite parent) {

    WidgetFactory factory = getWidgetFactory();

    final int gridDataStyle = GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL;
    final GridData fieldGridData = new GridData(gridDataStyle);

    Composite container = new Composite(parent, SWT.NULL);
    container.setBackground(parent.getBackground());
    container.setForeground(parent.getForeground());
    container.setLayout(new GridLayout(2, false));
    container.setLayoutData(fieldGridData);

    Label label = null;

    // Format code
    label = new Label(container, SWT.NULL);
    label.setText(Messages.getString("aaa.mdf.metadict.entity.sqlname.label"));
    label.setBackground(container.getBackground());
    mdSQLName = factory.createText(container, null);
    mdSQLName.setLayoutData(fieldGridData);
    mdSQLName.setEditable(false);

    // Format Finantial Function
    label = new Label(container, SWT.NULL);
    label.setText(Messages.getString("aaa.mdf.metadict.entity.name.label"));
    label.setBackground(container.getBackground());
    mdName = factory.createText(container, null);
    mdName.setLayoutData(fieldGridData);
    mdName.setEditable(false);

    initialize();
    setControl(container);
  }
  private void createInfomation(Composite parent) {

    Font font = parent.getFont();
    Composite continer = createComposite(parent, font, 2, 2, GridData.FILL_BOTH, 0, 0);
    continer.setBackground(fBackgroundColor);
    IReportDocument document = null;
    try {
      document = engine.openReportDocument(getFileName());
      createScriptgLabel(continer, Messages.getString("ReportDocumentEditor.3")); // $NON-NLS-1$
      createScriptgLabel(continer, document.getName());

      createScriptgLabel(continer, Messages.getString("ReportDocumentEditor.4")); // $NON-NLS-1$
      createScriptgLabel(continer, document.getVersion());

      createScriptgLabel(continer, Messages.getString("ReportDocumentEditor.5")); // $NON-NLS-1$
      createScriptgLabel(continer, "" + document.getPageCount()); // $NON-NLS-1$

    } catch (EngineException e) {
      this.e = e;
      createErrorControl(continer);
    } finally {
      if (document != null) {
        document.close();
      }
    }
  }
Example #7
0
  private void createControls() {
    GridLayout gLayout = new GridLayout();
    gLayout.marginHeight = 0;
    gLayout.marginWidth = 0;
    gLayout.verticalSpacing = 0;
    shell.setLayout(gLayout);
    Utils.setShellIcon(shell);

    topPanel = new Composite(shell, SWT.NONE);
    topPanel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    GridLayout gLayout1 = new GridLayout();
    gLayout1.marginBottom = 10;
    topPanel.setLayout(gLayout1);
    topPanel.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    topPanel.setBackgroundMode(SWT.INHERIT_FORCE);

    Label separator1 = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
    separator1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    contentPanel = new Composite(shell, SWT.NONE);
    contentPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    contentStackLayout = new StackLayout();
    contentPanel.setLayout(contentStackLayout);

    titleLabel = new Label(topPanel, SWT.NONE);
    titleLabel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    Utils.setFontHeight(titleLabel, 16, SWT.NORMAL);

    descriptionLabel = new Label(topPanel, SWT.WRAP);
    GridData gData = new GridData(SWT.FILL, SWT.FILL, true, true);
    gData.horizontalIndent = 10;
    descriptionLabel.setLayoutData(gData);

    shell.layout(true, true);
  }
Example #8
0
  public ChatDisplay(Composite parent, int style, Color backgroundColor) {
    super(parent, style);

    this.contentComposite = new Composite(this, SWT.NONE);
    this.setContent(contentComposite);
    this.setExpandHorizontal(true);
    this.setExpandVertical(true);

    this.setBackgroundMode(SWT.INHERIT_DEFAULT);
    contentComposite.setBackground(backgroundColor);

    /*
     * NO LAYOUT needed, because ScrolledComposite sets it's own
     * automatically
     */
    GridLayout gridLayout = new GridLayout(1, false);
    contentComposite.setLayout(gridLayout);

    /*
     * Scroll to bottom if resized
     */
    this.addListener(
        SWT.Resize,
        new Listener() {
          public void handleEvent(Event event) {
            ChatDisplay.this.refresh();
          }
        });
  }
  private void createFeaturesToolbar(FormToolkit toolkit, Section section) {
    Composite headerComposite = toolkit.createComposite(section, SWT.NONE);
    RowLayout rowLayout = new RowLayout();
    rowLayout.marginTop = 0;
    rowLayout.marginBottom = 0;
    headerComposite.setLayout(rowLayout);
    headerComposite.setBackground(null);

    toolBarManager = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL);
    toolBarManager.createControl(headerComposite);

    installAction = new InstallAction();
    installAction.setEnabled(false);
    toolBarManager.add(installAction);

    toolBarManager.add(new CheckForUpdatesAction());

    CommandContributionItem item =
        JBossCentralActivator.createContributionItem(
            getSite(), "org.jboss.tools.central.refreshDiscovery");
    toolBarManager.add(item);

    toolBarManager.update(true);

    section.setTextClient(headerComposite);
  }
  @Override
  public void createPartControl(Composite parent) {
    Composite body = new Composite(parent, SWT.NONE);
    body.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
    body.setLayout(new GridLayout());

    Account account = getAccount();
    intervalReport =
        new TimeIntervalReport(
            account, TimeIntervalReport.Interval.DAY, PriceProviderFactory.getInstance());
    intervalReport.addPropertyChangeListener(changeListener);

    String chartType = StringUtils.defaultString(account.getConfigurationValue(CHART_TYPE), "all");
    JFreeChart chart = createChart(chartType);
    chartFrame = new ChartComposite(body, SWT.NONE, chart, true);
    chartFrame.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    displayType = new Combo(body, SWT.READ_ONLY);
    for (TimeChart.RANGE r : TimeChart.RANGE.values()) {
      displayType.add(r.getName());
    }
    displayType.setText(chartType);
    displayType.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            Combo c = (Combo) e.getSource();
            String type = c.getItem(c.getSelectionIndex());
            timeChart.setChartType(type);
            dirty = true;
            firePropertyChange(IEditorPart.PROP_DIRTY);
          }
        });
  }
  @Override
  protected Control createTreeAreaContents(Composite parent) {
    Composite leftArea = new Composite(parent, SWT.NONE);
    leftArea.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    leftArea.setFont(parent.getFont());
    GridLayout leftLayout = new GridLayout();
    leftLayout.numColumns = 1;
    leftLayout.marginHeight = 0;
    leftLayout.marginTop = IDialogConstants.VERTICAL_MARGIN;
    leftLayout.marginWidth = IDialogConstants.HORIZONTAL_MARGIN;
    leftLayout.horizontalSpacing = 0;
    leftLayout.verticalSpacing = 0;
    leftArea.setLayout(leftLayout);

    // Build the tree an put it into the composite.
    TreeViewer viewer = createTreeViewer(leftArea);
    setTreeViewer(viewer);

    updateTreeFont(JFaceResources.getDialogFont());
    GridData viewerData = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL);
    viewer.getControl().getParent().setLayoutData(viewerData);

    layoutTreeAreaControl(leftArea);

    return leftArea;
  }
 /** This method initializes diagramListcomposite. */
 private void createDiagramListcomposite() {
   GridLayout gridLayout2 = new GridLayout();
   diagramListcomposite = new Composite(cTabFolder, SWT.BORDER);
   diagramListcomposite.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
   createDiagramfilteredTree();
   diagramListcomposite.setLayout(gridLayout2);
 }
Example #13
0
  public void createControl(Composite parent, IActionBars actionbars) {

    this.content = new Composite(parent, SWT.NONE);
    content.setLayout(new GridLayout(1, false));
    GridUtils.removeMargins(content);
    content.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));

    // Make some sashes
    final SashForm horiz = new SashForm(content, SWT.VERTICAL);
    horiz.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    horiz.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    final SashForm top = new SashForm(horiz, SWT.HORIZONTAL);
    final SashForm bottom = new SashForm(horiz, SWT.HORIZONTAL);

    // Fill the sashes
    topSystem.createPlotPart(top, "Integration", null, PlotType.XY, getPart());
    Label label = new Label(top, SWT.NONE);
    label.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));

    super.createControl(bottom, actionbars);
    rightSystem.createPlotPart(bottom, "Integration", null, PlotType.XY, getPart());

    horiz.setWeights(new int[] {30, 70});
    top.setWeights(new int[] {70, 30});
    bottom.setWeights(new int[] {70, 30});

    topSystem.setShowLegend(false);
    rightSystem.setShowLegend(false);
    profilePlottingSystem.setShowIntensity(false);
  }
  /** @param form2 */
  private Composite getPageHeader(Composite parent) {
    final Composite header = new Composite(parent, SWT.FILL);
    final FormLayout layout = new FormLayout();
    layout.marginHeight = 5;
    layout.marginWidth = 5;
    header.setLayout(layout);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(header);

    header.setBackground(parent.getBackground());

    final Label titleImage = new Label(header, SWT.FILL);
    final ImageDescriptor imageDescriptor =
        ImageDescriptor.createFromURL(
            Activator.getDefault().getBundle().getResource("icons/view.png")); // $NON-NLS-1$
    titleImage.setImage(new Image(parent.getDisplay(), imageDescriptor.getImageData()));
    final FormData titleImageData = new FormData();
    final int imageOffset = -titleImage.computeSize(SWT.DEFAULT, SWT.DEFAULT).y / 2;
    titleImageData.top = new FormAttachment(50, imageOffset);
    titleImageData.left = new FormAttachment(0, 10);
    titleImage.setLayoutData(titleImageData);

    final Label title = new Label(header, SWT.WRAP);
    title.setText("View Editor"); // $NON-NLS-1$
    titleFont = new Font(title.getDisplay(), getDefaultFontName(title), 12, SWT.BOLD);
    title.setFont(titleFont);
    title.setForeground(getTitleColor(parent));
    final FormData titleData = new FormData();
    title.setLayoutData(titleData);
    titleData.left = new FormAttachment(titleImage, 5, SWT.DEFAULT);

    return header;
  }
  /**
   * @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
 protected void basicCreatePartControl(final Composite parent) {
   parent.setBackground(LnfManager.getLnf().getColor(LnfKeyConstants.SUB_MODULE_BACKGROUND));
   parent.setLayout(new GridLayout(1, true));
   final Group group = createUIProcessGroup(parent);
   GridDataFactory.fillDefaults().applyTo(group);
 }
  protected Control createListChangeControl(Composite parent) {
    GridData gd;
    Control control;
    if (composite == null) composite = new Composite(parent, SWT.NONE);
    composite.setBackground(parent.getBackground());
    GridLayout gridLayout = new GridLayout(3, false);
    gridLayout.marginHeight = 0;
    gridLayout.marginWidth = 0;
    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 0;
    composite.setLayout(gridLayout);

    Control listControl = createListControl(composite);
    gd = new GridData(GridData.FILL_BOTH);
    listControl.setLayoutData(gd);

    control = new Label(composite, SWT.NONE);
    control.setBackground(parent.getBackground());
    gd = new GridData();
    gd.widthHint = 5;
    control.setLayoutData(gd);

    control = getChangeControl(composite);

    return composite;
  }
  /**
   * Creates the composite holding the details.
   *
   * @param parent the parent
   * @return the right panel/detail composite
   */
  protected ScrolledComposite createRightPanelContent(Composite parent) {
    rightPanel = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
    rightPanel.setShowFocusedControl(true);
    rightPanel.setExpandVertical(true);
    rightPanel.setExpandHorizontal(true);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(rightPanel);
    rightPanel.setLayout(GridLayoutFactory.fillDefaults().create());
    rightPanel.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));

    container = new Composite(rightPanel, SWT.FILL);
    container.setLayout(GridLayoutFactory.fillDefaults().create());
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(container);
    container.setBackground(rightPanel.getBackground());

    /* The header */
    final Composite header = new Composite(container, SWT.FILL);
    final GridLayout headerLayout = GridLayoutFactory.fillDefaults().create();
    headerLayout.marginWidth = 5;
    header.setLayout(headerLayout);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(header);
    header.setBackground(rightPanel.getBackground());

    final Label label = new Label(header, SWT.WRAP);
    label.setText("Details"); // $NON-NLS-1$
    detailsFont = new Font(label.getDisplay(), getDefaultFontName(label), 10, SWT.BOLD);
    label.setFont(detailsFont);
    label.setForeground(getTitleColor(parent));
    label.setBackground(header.getBackground());

    rightPanelContainerComposite = new Composite(container, SWT.FILL);
    rightPanelContainerComposite.setLayout(GridLayoutFactory.fillDefaults().create());
    GridDataFactory.fillDefaults()
        .align(SWT.FILL, SWT.FILL)
        .grab(true, true)
        .applyTo(rightPanelContainerComposite);
    rightPanelContainerComposite.setBackground(rightPanel.getBackground());

    rightPanel.setContent(container);

    rightPanel.layout();
    container.layout();

    final Point point = container.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    rightPanel.setMinSize(point);

    return rightPanel;
  }
 /** Create the buttons that allow users to invoke actions on this section. */
 private void createButtons(Composite parent, int style) {
   Composite buttonComposite = new Composite(parent, SWT.NONE);
   GridLayout layout = new GridLayout(2, false);
   buttonComposite.setLayout(layout);
   buttonComposite.setBackground(getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
   new ActionButton(buttonComposite, style, newPolicyAction);
   new ActionButton(buttonComposite, style, deletePolicyAction);
 }
 protected void setInvalid(String message, Control... controls) {
   // restore the old color on all previous error composites
   for (Composite composite : currentErrorComposites.keySet()) {
     composite.setBackground(currentErrorComposites.get(composite));
   }
   currentErrorComposites.clear();
   // set the red error color on all new composites for each control
   for (Control control : controls) {
     if (errorBorderComposites.containsKey(control)) {
       Composite composite = errorBorderComposites.get(control);
       currentErrorComposites.put(composite, composite.getBackground());
       composite.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
     }
   }
   setErrorMessage(message);
   setValid(false);
 }
 @Override
 public void setBackgroundColor(Color background) {
   super.setBackgroundColor(background);
   if (fDetailPaneComposite != null) {
     fDetailPaneComposite.setBackground(background);
   }
   fTree.setBackground(background);
 }
Example #22
0
 public void setBackground(Color color) {
   super.setBackground(color);
   background = color;
   if (text != null) text.setBackground(color);
   if (list != null) list.setBackground(color);
   if (icon != null) icon.setBackground(color);
   if (arrow != null) arrow.setBackground(color);
 }
  /**
   * Creates the {@link #type} selection widget for changing the type of the current <code>
   * AdaptiveTreeComposite</code>. These widgets are
   *
   * @param client The client <code>Composite</code> that should contain the type selection widgets.
   * @return The <code>Composite</code> that contains the type selection widgets.
   */
  private Composite createTypeComposite(Composite client) {

    // Get the client's background color.
    Color backgroundColor = client.getBackground();

    // Create the type sub-section Composite that will contain the
    // type label and combo (dropdown).
    Composite typeComposite = new Composite(client, SWT.NONE);
    typeComposite.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, true));
    typeComposite.setBackground(backgroundColor);

    // Set the layout of the Composite to a vertical fill layout.
    // This ensures the type Label is above the Combo and that both
    // consume all available space.
    FillLayout typeCompositeLayout = new FillLayout(SWT.VERTICAL);
    typeCompositeLayout.marginHeight = 5;
    typeCompositeLayout.marginWidth = 3;
    typeCompositeLayout.spacing = 5;
    typeComposite.setLayout(typeCompositeLayout);

    // Add the type Label and an empty Combo.
    Label typeLabel = new Label(typeComposite, SWT.NONE);
    typeLabel.setText("Type:");
    typeLabel.setBackground(backgroundColor);

    // Create the ComboViewer for selecting the adaptive type.
    type = new ComboViewer(typeComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
    type.getCombo().setBackground(backgroundColor);
    // Use an ArrayContentProvider so we can set the List of type Strings as
    // input to the ComboViewer.
    type.setContentProvider(ArrayContentProvider.getInstance());
    // The labels for each value should just be their String value.
    type.setLabelProvider(
        new LabelProvider() {
          @Override
          public String getText(Object element) {
            return (element != null ? element.toString() : "");
          }
        });

    // Add a listener to set the type of the AdaptiveTreeComposite when the
    // Combo's selection changes.
    ISelectionChangedListener listener =
        new ISelectionChangedListener() {
          @Override
          public void selectionChanged(SelectionChangedEvent event) {
            ISelection selection = event.getSelection();
            if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
              IStructuredSelection s = (IStructuredSelection) selection;
              String type = (String) s.getFirstElement();
              ((AdaptiveTreeComposite) tree).setType(type);
            }
          }
        };
    type.addSelectionChangedListener(listener);

    return typeComposite;
  }
Example #24
0
 @Override
 protected void createButtonsForButtonBar(Composite parent) {
   GridData gd = new GridData(GridData.FILL_HORIZONTAL);
   gd.horizontalAlignment = GridData.CENTER;
   parent.setLayoutData(gd);
   parent.setBackground(JFaceColors.getBannerBackground(parent.getDisplay()));
   Button button = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
   button.setFocus();
 }
  /**
   * Set the major UI features of this basic view composite
   *
   * @param textEditor
   * @param parentComposite
   * @param styleBit
   */
  public Transition(final XMLEditor textEditor, final Composite parentComposite, int styleBit) {
    super(parentComposite, SWT.BORDER);
    setBackground(SWTResourceManager.getColor(SWT.COLOR_DARK_MAGENTA));
    this.textEditor = textEditor;
    addDisposeListener(
        new DisposeListener() {
          @Override
          public void widgetDisposed(DisposeEvent e) {
            toolkit.dispose();
          }
        });
    toolkit.adapt(this);
    toolkit.paintBordersFor(this);
    setLayout(new FormLayout());
    setLayoutData(new GridData(GridData.FILL_BOTH));

    final ScrolledComposite parentScrolledComposite =
        new ScrolledComposite(this, SWT.BORDER | SWT.V_SCROLL);
    parentScrolledComposite.setAlwaysShowScrollBars(true);
    parentScrolledComposite.setExpandHorizontal(true);
    parentScrolledComposite.setExpandVertical(true);
    FormData parentScrolledCompositeFormLayoutData = new FormData();
    parentScrolledCompositeFormLayoutData.right = new FormAttachment(100);
    parentScrolledCompositeFormLayoutData.bottom = new FormAttachment(100);
    parentScrolledCompositeFormLayoutData.top = new FormAttachment(0, 5);
    parentScrolledCompositeFormLayoutData.left = new FormAttachment(0, 5);
    parentScrolledComposite.setLayoutData(parentScrolledCompositeFormLayoutData);
    this.setData(parentScrolledComposite);

    baseContainer = new Composite(parentScrolledComposite, SWT.NONE);
    baseContainer.setBackground(SWTResourceManager.getColor(204, 153, 255));
    parentScrolledComposite.setContent(baseContainer);

    baseContainer.setLayout(new GridLayout(1, true));
    try {
      CentralUtils centralUtils = CentralUtils.getCentralUtils(textEditor);
      centralUtils.setBasicUI(parentScrolledComposite, baseContainer);
      centralUtils.unmarshal(textEditor);
    } catch (JAXBException e) {
      LOG.info(e.getMessage());
    }

    // create a THumanInteractions object if humanInteractions variable is
    // null
    if (textEditor.getRootElement() == null) {
      humanInteractions = new THumanInteractions();
      textEditor.setRootElement(humanInteractions);
    }
    try {
      // create the biggest xml element- UI section
      humanInteractionsUI =
          new THumanInteractionsUI(
              textEditor, baseContainer, this, SWT.NONE, textEditor.getRootElement(), 0, 0);
    } catch (JAXBException e1) {
      LOG.info(e1.getMessage());
    }
  }
Example #26
0
  @Override
  public void createPartControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    container.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));

    container.setLayout(new FormLayout());

    FormToolkit toolkit = new FormToolkit(container.getDisplay());
    Form form = toolkit.createForm(container);

    FormData data = new FormData();
    data.top = new FormAttachment(0, 20);
    data.left = new FormAttachment(50, -100);
    data.right = new FormAttachment(50, 100);
    data.bottom = new FormAttachment(100, -20);

    form.setLayoutData(data);

    // form.setText(Messages.IntroTitle);

    FillLayout layout = new FillLayout();
    layout.marginHeight = layout.marginWidth = 5;
    form.getBody().setLayout(layout);

    FormText text = toolkit.createFormText(form.getBody(), true);

    StringBuilder buf = new StringBuilder();
    buf.append("<form>"); // $NON-NLS-1$
    buf.append("<p><img href=\"logo\"/></p>"); // $NON-NLS-1$
    buf.append("<p><span color=\"header\" font=\"header\">") // $NON-NLS-1$
        .append(Messages.IntroTitle) //
        .append("</span></p>"); // $NON-NLS-1$
    addLink(buf, "action:open", Messages.IntroOpenFile, Messages.IntroOpenFileText); // $NON-NLS-1$
    addLink(buf, "action:new", Messages.IntroNewFile, Messages.IntroNewFileText); // $NON-NLS-1$
    addLink(
        buf,
        "action:sample",
        Messages.IntroOpenSample,
        Messages.IntroOpenSampleText); // $NON-NLS-1$
    addLink(
        buf,
        "action:daxsample",
        Messages.IntroOpenDaxSample,
        Messages.IntroOpenDaxSampleText); // $NON-NLS-1$
    addLink(
        buf,
        "http://buchen.github.com/portfolio/new_and_noteworthy.html", //$NON-NLS-1$
        Messages.IntroReadNews,
        Messages.IntroReadNewsText);
    buf.append("</form>"); // $NON-NLS-1$
    text.setText(buf.toString(), true, false);
    text.setImage("logo", PortfolioPlugin.image(PortfolioPlugin.IMG_LOGO)); // $NON-NLS-1$
    text.setColor("header", toolkit.getColors().getColor(IFormColors.TITLE)); // $NON-NLS-1$
    text.setFont("header", JFaceResources.getHeaderFont()); // $NON-NLS-1$
    text.addHyperlinkListener(this);
  }
 static void setColor(Composite composite, String indent, Color color, Color foreGorund) {
   if (composite == null) {
     return;
   }
   try {
     if (!composite.isDisposed()) {
       composite.setRedraw(false);
       if (composite instanceof ToolBar
           || composite instanceof Shell
           || composite instanceof CLabel
           || composite instanceof CTabFolder
           || composite instanceof CoolBar
           || composite instanceof CoolBar
           || composite instanceof CBanner
           || composite instanceof PageBook
           || composite instanceof ViewForm
           || composite instanceof Tree
           || composite instanceof StyledText
           || composite instanceof Table
           || composite.getClass().getName().startsWith("org.eclipse.jface")
           || composite.getClass().getName().startsWith("org.eclipse.ui.internal.layout")
           || composite.getClass().getName().startsWith("org.eclipse.ui.internal.FastViewBar")
           || composite
               .getClass()
               .getName()
               .startsWith("org.eclipse.ui.internal.progress.ProgressRegion")
           || composite.getClass().getName().startsWith("org.eclipse.swt.widgets.Canvas")
           || composite.getClass() == Composite.class) {
         composite.setBackground(color);
         composite.setForeground(foreGorund);
       } else {
         // System.out.println(indent +
         // composite.getClass().getName());
       }
       Control[] controls = composite.getChildren();
       for (Control control : controls) {
         if (!(control instanceof Composite)) {
           // System.out.println(indent + "Control " +
           // control.getClass().getName());
         }
         if (control instanceof Composite) {
           setColor((Composite) control, indent + " ", color, foreGorund);
         } else if (control instanceof Label
             || control instanceof CoolBar
             || control instanceof Sash
             || control instanceof ProgressBar
             || control instanceof Text) {
           control.setBackground(color);
           control.setForeground(foreGorund);
         }
       }
     }
   } finally {
     composite.setRedraw(true);
   }
 }
Example #28
0
 @Override
 public void setBackground(Color color) {
   super.setBackground(color);
   String hex = color != null ? new RGB(color.getRGB()).toDecString() : "transparent";
   try {
     this.injectCssImmediately("html, body { background-color: " + hex + "; }");
   } catch (Exception e) {
     LOGGER.error("Error setting background color to " + color, e);
   }
 }
 /**
  * Creates gradientLabel
  *
  * @see
  *     org.eclipse.jface.viewers.DialogCellEditor#createContents(org.eclipse.swt.widgets.Composite)
  */
 protected Control createContents(Composite cell) {
   Color bg = cell.getBackground();
   composite = new Composite(cell, getStyle());
   composite.setBackground(bg);
   composite.setLayout(new GradientCellLayout());
   gradientLabel = new Label(composite, SWT.LEFT);
   gradientLabel.setBackground(bg);
   gradientLabel.setFont(cell.getFont());
   return composite;
 }
Example #30
0
 void reset() {
   if (rootComposite != null) {
     rootComposite.dispose();
   }
   rootComposite = new Composite(this, SWT.NULL);
   rootComposite.setBackground(getBackground());
   rootComposite.setLayout(new GridLayout());
   addSeverityCells(getParent().getBackground());
   layout();
 }