private void createProgressMessageConfig(Composite parent) { fAddMessageButton = createButton(parent, fToolkit, PDEUIMessages.SplashSection_progressMessage); fAddMessageButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean enable = fAddMessageButton.getSelection(); getSplashInfo().addProgressMessage(enable, false); updateFieldEnablement(); } }); fAddMessageButton.setEnabled(false); Color foreground = fToolkit.getColors().getColor(IFormColors.TITLE); fMessageControls[0] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_messageX); fMessageControls[1] = fMessageSpinners[0] = createSpinner(parent, fToolkit); fMessageControls[2] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_messageY); fMessageControls[3] = fMessageSpinners[1] = createSpinner(parent, fToolkit); fMessageControls[4] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_messageWidth); fMessageControls[5] = fMessageSpinners[2] = createSpinner(parent, fToolkit); fMessageControls[6] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_messageHeight); fMessageControls[7] = fMessageSpinners[3] = createSpinner(parent, fToolkit); fMessageControls[8] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_messageColor); fColorSelector = new ColorSelector(parent); fColorSelector.addListener( new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (!event.getNewValue().equals(event.getOldValue())) applyColor(); } }); fToolkit.adapt(fColorSelector.getButton(), true, true); fMessageControls[9] = fColorSelector.getButton(); // Add tooltips to coordinate controls addOffsetTooltips(fMessageControls); for (Spinner spinner : fMessageSpinners) { spinner.setEnabled(isEditable()); spinner.addModifyListener( new ModifyListener() { @Override public void modifyText(ModifyEvent e) { applySpinners(false); } }); } }
/** * Creates the color selector. * * @param parent The parent composite * @return The color selector */ private ColorSelector createColorSelector(Composite parent) { final ColorSelector selector = new ColorSelector(parent); selector.addListener( new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { IStructuredSelection selection = (IStructuredSelection) attributesViewer.getSelection(); MBeanAttribute attribute = (MBeanAttribute) selection.getFirstElement(); if (attribute != null) { attribute.setRgb(selector.getColorValue()); } } }); selector.setEnabled(false); return selector; }
/** * Used internally * * @param parent * @param plottingSystem * @param style * @param xyGraph * @param defaultRegion * @param isImplicit Flag to tell whether the RegionComposite is used in a specific window with an * apply button or part of a view where the changes are implicit */ public RegionEditComposite( final Composite parent, final IPlottingSystem<?> plottingSystem, final int style, final XYRegionGraph xyGraph, final RegionType defaultRegion, final boolean isImplicit) { super(parent, SWT.NONE); this.setImplicit(isImplicit); this.xyGraph = xyGraph; this.plottingSystem = plottingSystem; setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); setLayout(new org.eclipse.swt.layout.GridLayout(2, false)); final Label nameLabel = new Label(this, SWT.NONE); nameLabel.setText("Name "); nameLabel.setLayoutData(new GridData()); nameText = new Text(this, SWT.BORDER | SWT.SINGLE); nameText.setToolTipText("Region name"); nameText.setLayoutData(new GridData(SWT.FILL, 0, true, false)); if (isImplicit()) { nameText.addSelectionListener( new SelectionAdapter() { @Override public void widgetDefaultSelected(SelectionEvent e) { AbstractSelectionRegion<?> region = getEditingRegion(); region.repaint(); } }); } final Label horiz = new Label(this, SWT.SEPARATOR | SWT.HORIZONTAL); horiz.setLayoutData(new GridData(SWT.FILL, 0, true, false, 2, 1)); final Label typeLabel = new Label(this, SWT.NONE); typeLabel.setText("Type"); typeLabel.setLayoutData(new GridData()); regionType = new CCombo(this, SWT.BORDER | SWT.NONE); regionType.setEditable(false); regionType.setToolTipText("Region type"); regionType.setLayoutData(new GridData(SWT.FILL, 0, true, false)); for (RegionType type : RegionType.ALL_TYPES) { regionType.add(type.getName()); } regionType.select(defaultRegion.getIndex()); xCombo = createAxisChooser(this, "X Axis", xyGraph.getXAxisList()); yCombo = createAxisChooser(this, "Y Axis", xyGraph.getYAxisList()); Label colorLabel = new Label(this, 0); colorLabel.setText("Selection Color"); colorLabel.setLayoutData(new GridData()); colorSelector = new ColorSelector(this); colorSelector.getButton().setLayoutData(new GridData()); colorSelector.setColorValue(defaultRegion.getDefaultColor().getRGB()); if (isImplicit()) { colorSelector.addListener( new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { AbstractSelectionRegion<?> region = getEditingRegion(); region.repaint(); } }); } final Label horiz2 = new Label(this, SWT.SEPARATOR | SWT.HORIZONTAL); horiz2.setLayoutData(new GridData(SWT.FILL, 0, true, false, 2, 1)); Label alphaLabel = new Label(this, 0); alphaLabel.setText("Alpha level"); alphaLabel.setLayoutData(new GridData()); alpha = new Spinner(this, SWT.NONE); alpha.setToolTipText("Alpha transparency level of the shaded shape"); alpha.setLayoutData(new GridData()); alpha.setMinimum(0); alpha.setMaximum(255); alpha.setSelection(80); if (isImplicit()) { alpha.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { AbstractSelectionRegion<?> region = getEditingRegion(); region.repaint(); } }); } this.mobile = new Button(this, SWT.CHECK); mobile.setText(" Mobile "); mobile.setToolTipText("When true, this selection can be resized and moved around the graph."); mobile.setLayoutData(new GridData(0, 0, false, false, 2, 1)); mobile.setSelection(true); if (isImplicit()) { mobile.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { AbstractSelectionRegion<?> region = getEditingRegion(); region.repaint(); } }); } this.showPoints = new Button(this, SWT.CHECK); showPoints.setText(" Show vertex values"); showPoints.setToolTipText( "When on this will show the actual value of the point in the axes it was added."); showPoints.setLayoutData(new GridData(0, 0, false, false, 2, 1)); if (isImplicit()) { showPoints.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { AbstractSelectionRegion<?> region = getEditingRegion(); region.repaint(); } }); } this.visible = new Button(this, SWT.CHECK); visible.setText(" Show region"); visible.setToolTipText("You may turn off the visibility of this region."); visible.setLayoutData(new GridData(0, 0, false, false, 2, 1)); visible.setSelection(true); if (isImplicit()) { visible.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { AbstractSelectionRegion<?> region = getEditingRegion(); region.repaint(); } }); } this.showLabel = new Button(this, SWT.CHECK); showLabel.setText(" Show name"); showLabel.setToolTipText("Turn on to show the name of a selection region."); showLabel.setLayoutData(new GridData(0, 0, false, false, 2, 1)); showLabel.setSelection(true); if (isImplicit()) { showLabel.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { AbstractSelectionRegion<?> region = getEditingRegion(); region.repaint(); } }); } this.fillRegion = new Button(this, SWT.CHECK); fillRegion.setText(" Fill region"); fillRegion.setToolTipText("Fill the body of an area region"); fillRegion.setLayoutData(new GridData(0, 0, false, false, 2, 1)); fillRegion.setSelection(true); if (isImplicit()) { fillRegion.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { AbstractSelectionRegion<?> region = getEditingRegion(); region.repaint(); } }); } final Label spacer = new Label(this, SWT.SEPARATOR | SWT.HORIZONTAL); spacer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); // We add a composite for setting the region location programmatically. final Label location = new Label(this, SWT.NONE); location.setText("Region Location"); location.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); this.roiViewer = new ROIEditTable(); roiViewer.createPartControl(this); // Should be last nameText.setText(getDefaultName(defaultRegion.getIndex())); }