コード例 #1
0
 protected void setTheme(ITheme theme) {
   positiveForeground = theme.getColorRegistry().get(POSITIVE_FOREGROUND);
   negativeForeground = theme.getColorRegistry().get(NEGATIVE_FOREGROUND);
   foreground = theme.getColorRegistry().get(FOREGROUND);
   background = theme.getColorRegistry().get(BACKGROUND);
   theme.addPropertyChangeListener(themeChangeListener);
 }
コード例 #2
0
  /* (non-Javadoc)
   * @see org.eclipse.ui.IPresentationPreview#createControl(org.eclipse.swt.widgets.Composite, org.eclipse.ui.themes.ITheme)
   */
  public void createControl(Composite parent, ITheme currentTheme) {
    this.theme = currentTheme;
    folder = new CTabFolder(parent, SWT.BORDER);
    folder.setUnselectedCloseVisible(false);
    folder.setEnabled(false);
    folder.setMaximizeVisible(true);
    folder.setMinimizeVisible(true);

    viewForm = new ViewForm(folder, SWT.NONE);
    viewForm.marginHeight = 0;
    viewForm.marginWidth = 0;
    viewForm.verticalSpacing = 0;
    viewForm.setBorderVisible(false);
    toolBar = new ToolBar(viewForm, SWT.FLAT | SWT.WRAP);
    ToolItem toolItem = new ToolItem(toolBar, SWT.PUSH);

    Image hoverImage = WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_LCL_VIEW_MENU);
    toolItem.setImage(hoverImage);

    viewForm.setTopRight(toolBar);

    viewMessage = new CLabel(viewForm, SWT.NONE);
    viewMessage.setText("Etu?"); // $NON-NLS-1$
    viewForm.setTopLeft(viewMessage);

    CTabItem item = new CTabItem(folder, SWT.CLOSE);
    item.setText("Lorem"); // $NON-NLS-1$
    Label text = new Label(viewForm, SWT.NONE);
    viewForm.setContent(text);
    text.setText("Lorem ipsum dolor sit amet"); // $NON-NLS-1$
    text.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
    item = new CTabItem(folder, SWT.CLOSE);
    item.setText("Ipsum"); // $NON-NLS-1$
    item.setControl(viewForm);
    item.setImage(WorkbenchImages.getImage(ISharedImages.IMG_TOOL_COPY));

    folder.setSelection(item);

    item = new CTabItem(folder, SWT.CLOSE);
    item.setText("Dolor"); // $NON-NLS-1$
    item = new CTabItem(folder, SWT.CLOSE);
    item.setText("Sit"); // $NON-NLS-1$

    currentTheme.addPropertyChangeListener(fontAndColorListener);
    setColorsAndFonts();
    setTabPosition();
    setTabStyle();
  }