@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); composite.setLayout(new FillLayout()); toolkit = new FormToolkit(composite.getDisplay()); form = toolkit.createScrolledForm(composite); FormColors colors = toolkit.getColors(); colors.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_HOVER); // // toolkit.getHyperlinkGroup().setActiveForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE)); // toolkit.getHyperlinkGroup().setForeground(colors.getColor("Categorytitle")); toolkit .getHyperlinkGroup() .setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); body = form.getBody(); GridLayout bodyLayout = new GridLayout(); bodyLayout.verticalSpacing = 3; body.setLayout(bodyLayout); // body.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); toolkit.paintBordersFor(body); return composite; }
public FormColors getFormColors(Display display) { if (formColors == null) { formColors = new FormColors(display); formColors.markShared(); } return formColors; }
/** * Blends two colors with the given ration. The colors are represented by int values as colors as * defined in the {@link SWT} class. * * @param color1 First color. * @param color2 Second color. * @param ratio Percentage of the first color in the blend (0-100). * @param display {@link Display} * @return New color. * @see FormColors#blend(RGB, RGB, int) */ private Color createColor(int color1, int color2, int ratio, Display display) { RGB rgb1 = display.getSystemColor(color1).getRGB(); RGB rgb2 = display.getSystemColor(color2).getRGB(); RGB blend = FormColors.blend(rgb2, rgb1, ratio); return new Color(display, blend); }
public static FormColors FORM_COLOR(final Display display) { if (formColors == null) { formColors = new FormColors(display); /* formColors.createColor( IFormColors.H_GRADIENT_START, ORANGE_COLOR.getRGB() ); formColors.createColor( IFormColors.H_GRADIENT_END, GREY_COLOR.getRGB() ); formColors.createColor( IFormColors.H_BOTTOM_KEYLINE1, GREY_COLOR.getRGB() ); formColors.createColor( IFormColors.H_BOTTOM_KEYLINE2,ORANGE_COLOR.getRGB()); formColors.createColor( IFormColors.TITLE, HEADING_COLOR.getRGB());*/ formColors.createColor( IFormColors.H_GRADIENT_START, new Color(Display.getDefault(), 170, 20, 30).getRGB()); formColors.createColor(IFormColors.H_GRADIENT_END, GREY_COLOR.getRGB()); formColors.createColor(IFormColors.H_BOTTOM_KEYLINE1, GREY_COLOR.getRGB()); formColors.createColor(IFormColors.H_BOTTOM_KEYLINE2, ORANGE_COLOR.getRGB()); formColors.createColor(IFormColors.TITLE, HEADING_COLOR.getRGB()); } return formColors; }
private void initColors() { if (colors == null) { colors = new Color[COLOR_STEPS]; for (int i = 0; i < COLOR_STEPS; i++) { RGB rgb = FormColors.blend(RED, GREEN, Math.min((int) Math.round(i * (100d / COLOR_STEPS)), 100)); colors[i] = colorRegistry.getColor(rgb); } } }
@Override public void stop(BundleContext context) throws Exception { try { if (formColors != null) { formColors.dispose(); formColors = null; } } finally { super.stop(context); } }
/* (non-Javadoc) * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) */ public void stop(BundleContext context) throws Exception { if (fFormColors != null) { fFormColors.dispose(); fFormColors = null; } if (fLabelProvider != null) { fLabelProvider.dispose(); fLabelProvider = null; } if (fLogFileProvider != null) { LogFilesManager.removeLogFileProvider(fLogFileProvider); fLogFileProvider = null; } Utilities.shutdown(); super.stop(context); }
public void createContents(Composite parent) { TableWrapLayout lo = new TableWrapLayout(); lo.leftMargin = 0; lo.rightMargin = 0; lo.topMargin = 0; lo.numColumns = 1; parent.setLayout(lo); FormToolkit toolkit = m_mform.getToolkit(); Section section = toolkit.createSection( parent, // // Section.DESCRIPTION | // Section.TITLE_BAR | // Section.EXPANDED); TableWrapData td = new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP); td.colspan = 1; section.setLayoutData(td); section.setText("Edit Provided Capability"); Composite sectionClient = toolkit.createComposite(section); GridLayout layout = new GridLayout(2, false); sectionClient.setLayout(layout); FormColors colors = toolkit.getColors(); Color headerColor = colors.getColor("org.eclipse.ui.forms.TITLE"); // $NON-NLS-1$ Label label = null; // -- NAMESPACE label = toolkit.createLabel(sectionClient, "Namespace:"); label.setForeground(headerColor); final Text nsText = toolkit.createText(sectionClient, ""); // $NON-NLS-1$ GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); gd.minimumWidth = 200; nsText.setLayoutData(gd); m_editAdapters.createEditAdapter( "nsText", nsText, //$NON-NLS-1$ new RequiredValidator(StructuredNameValidator.instance()), new Mutator() { @Override public String getValue() { return m_input != null && m_input.getNamespace() != null ? m_input.getNamespace() : ""; //$NON-NLS-1$ } @Override public void setValue(String input) throws Exception { m_input.setNamespace( input == null ? "" //$NON-NLS-1$ : input.trim()); } }); // -- NAME label = toolkit.createLabel(sectionClient, "Name:"); label.setForeground(headerColor); final Text nameText = toolkit.createText(sectionClient, ""); nameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); m_editAdapters.createEditAdapter( "name", nameText, //$NON-NLS-1$ new RequiredValidator( NullValidator.instance()), // TODO: A ProvidedCapability name validator new Mutator() { @Override public String getValue() { return m_input != null && m_input.getName() != null ? m_input.getName() : ""; //$NON-NLS-1$ } @Override public void setValue(String input) throws Exception { m_input.setName( input == null ? "" //$NON-NLS-1$ : input.trim()); } }); // -- VERSION label = toolkit.createLabel(sectionClient, "Version:"); label.setForeground(headerColor); final Text versionText = toolkit.createText(sectionClient, ""); versionText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); m_editAdapters.createEditAdapter( "version", versionText, //$NON-NLS-1$ new RequiredValidator(VersionValidator.instance()), new Mutator() { @Override public String getValue() { return m_input != null && m_input.getVersion() != null ? m_input.getVersion() : ""; //$NON-NLS-1$ } @Override public void setValue(String input) throws Exception { m_input.setVersion( input == null ? "" //$NON-NLS-1$ : input.trim()); } }); section.setClient(sectionClient); }