private void setLoggingInfo(LoggingInfo loggingInfo) { logCategoryCombo.select(loggingInfo.getCategorySelection()); logLevelScale.setMaximum(LoggingInfo.getLoggingLevelRange(loggingInfo.getCategoryExt()) - 1); logLevelScale.setSelection(loggingInfo.getLevelScaleSelection()); logLevelDesc.setText(PLUS_PREFIX + loggingInfo.getLevelLabelText()); layout(true, true); }
public Setting(Composite comp, String title) { final Composite settingComp = new Composite(comp, SWT.BORDER); settingComp.setLayout(new FillLayout(SWT.VERTICAL)); final RowLayout infoLayout = new RowLayout(); infoLayout.center = true; final Composite infoComp = new Composite(settingComp, SWT.NONE); infoComp.setLayout(infoLayout); final Label settingLabel = new Label(infoComp, SWT.CENTER); settingLabel.setText(title); settingValue = new Text(infoComp, SWT.BORDER | SWT.SINGLE); settingValue.setText("000"); settingScale = new Scale(settingComp, SWT.BORDER); settingScale.setSize(200, 64); settingScale.setMaximum(50); settingScale.addListener( SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { settingValue.setText("" + settingScale.getSelection()); } }); }
@Override protected Control createControl(Composite parent) { // TODO Auto-generated method stub Composite composite = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(1, false); layout.marginHeight = layout.marginWidth = layout.horizontalSpacing = 0; composite.setLayout(layout); scale = new Scale(composite, SWT.HORIZONTAL); scale.setSize(200, 30); scale.setMinimum(0); scale.setMaximum(10); scale.addSelectionListener( new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { // TODO Auto-generated method stub System.out.println("scale: " + scale.getSelection()); LevelHighlightingEvent event = new LevelHighlightingEvent(); event.setHierarchyLevel(scale.getSelection()); EventPublisher.trigger(event); } @Override public void widgetDefaultSelected(SelectionEvent e) { // TODO Auto-generated method stub } }); return composite; }
/* * (non-Javadoc) * * @see net.refractions.udig.style.sld.SLDEditorPart#createPartControl(org.eclipse.swt.widgets.Composite) */ protected Control createPartControl(Composite parent) { myparent = parent; RowLayout layout = new RowLayout(); myparent.setLayout(layout); layout.pack = false; layout.wrap = true; layout.type = SWT.HORIZONTAL; /* Border Opacity */ Group borderOpacityArea = new Group(myparent, SWT.NONE); borderOpacityArea.setLayout(new GridLayout(2, false)); borderOpacityArea.setText("Raster Opacity"); // $NON-NLS-1$ opacityScale = new Scale(borderOpacityArea, SWT.HORIZONTAL); opacityScale.setMinimum(0); opacityScale.setMaximum(100); opacityScale.setPageIncrement(10); opacityScale.setBounds(0, 0, 10, SWT.DEFAULT); opacityScale.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { opacityText.setText(String.valueOf(opacityScale.getSelection()) + "%"); // $NON-NLS-1$ opacityText.pack(true); } }); opacityScale.addSelectionListener(this); opacityText = new Text(borderOpacityArea, SWT.BORDER | SWT.READ_ONLY); opacityText.pack(true); return parent; }
public void testRenderMaxmum() throws IOException { Scale scale = new Scale(shell, SWT.NONE); scale.setMaximum(10); lca.renderChanges(scale); Message message = Fixture.getProtocolMessage(); assertEquals(new Integer(10), message.findSetProperty(scale, "maximum")); }
public void testRenderMaxmumUnchanged() throws IOException { Scale scale = new Scale(shell, SWT.NONE); Fixture.markInitialized(display); Fixture.markInitialized(scale); scale.setMaximum(10); Fixture.preserveWidgets(); lca.renderChanges(scale); Message message = Fixture.getProtocolMessage(); assertNull(message.findSetOperation(scale, "maximum")); }
protected void configureControl(Control control) { if (control instanceof Scale) { Scale scale = (Scale) control; scale.setMinimum(0); scale.setMaximum(10000); scale.setSelection(0); return; } else if (control instanceof FigureCanvas) { FigureCanvas fc = (FigureCanvas) control; fc.setScrollBarVisibility(FigureCanvas.NEVER); fc.getLightweightSystem().setEventDispatcher(new SliderEventDispatcher()); fc.setViewport(createViewport(fc)); IFigure contents = createContents(fc); fc.setContents(contents); createSlotFigure(contents); createBlockFigure(contents); } }
private void createScalingControls(Composite client) { final Scale scale = new Scale(client, SWT.NONE); scale.setMinimum(1); scale.setMaximum(100); scale.setSelection(50); scale.setPageIncrement(5); scale.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { int selection = scale.getSelection(); if (selection > 50) { selection = selection - 50; scaleFactor.setText(String.valueOf(1.0d * selection)); } else if (selection == 50) { scaleFactor.setText(String.valueOf(1.0d)); } else { selection = 50 - selection; scaleFactor.setText(String.valueOf(1.0d / selection)); } applyScaleFactor(); } }); GridDataFactory.fillDefaults().span(3, 0).applyTo(scale); Label label = kit.createLabel(client, "scale factor: "); GridDataFactory.fillDefaults().grab(true, false).applyTo(label); scaleFactor = kit.createText(client, "1.0"); GridDataFactory.fillDefaults().grab(true, false).applyTo(scaleFactor); final Button setScale = kit.createButton(client, "apply", SWT.PUSH); setScale.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { applyScaleFactor(); } }); GridDataFactory.fillDefaults().applyTo(setScale); }
/** Creates the GUI. */ public void createGUI(Composite parent) { GridLayout gridLayout; GridData gridData; /** * Create principal GUI layout elements ** */ Composite displayArea = new Composite(parent, SWT.NONE); gridLayout = new GridLayout(); gridLayout.numColumns = 1; displayArea.setLayout(gridLayout); // Creating these elements here avoids the need to instantiate the GUI elements // in strict layout order. The natural layout ordering is an artifact of using // SWT layouts, but unfortunately it is not the same order as that required to // instantiate all of the non-GUI application elements to satisfy referential // dependencies. It is possible to reorder the initialization to some extent, but // this can be very tedious. // paint canvas final Canvas paintCanvas = new Canvas( displayArea, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.NO_REDRAW_RESIZE | SWT.NO_BACKGROUND); gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); paintCanvas.setLayoutData(gridData); paintCanvas.setBackground(paintColorWhite); // color selector frame final Composite colorFrame = new Composite(displayArea, SWT.NONE); gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL); colorFrame.setLayoutData(gridData); // tool settings frame final Composite toolSettingsFrame = new Composite(displayArea, SWT.NONE); gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL); toolSettingsFrame.setLayoutData(gridData); // status text final Text statusText = new Text(displayArea, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY); gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL); statusText.setLayoutData(gridData); /** * Create the remaining application elements inside the principal GUI layout elements ** */ // paintSurface paintSurface = new PaintSurface(paintCanvas, statusText, paintColorWhite); // finish initializing the tool data PaintExample.tools[PaintExample.Pencil_tool].data = new PencilTool(toolSettings, paintSurface); PaintExample.tools[PaintExample.Airbrush_tool].data = new AirbrushTool(toolSettings, paintSurface); PaintExample.tools[PaintExample.Line_tool].data = new LineTool(toolSettings, paintSurface); PaintExample.tools[PaintExample.PolyLine_tool].data = new PolyLineTool(toolSettings, paintSurface); PaintExample.tools[PaintExample.Rectangle_tool].data = new RectangleTool(toolSettings, paintSurface); PaintExample.tools[PaintExample.RoundedRectangle_tool].data = new RoundedRectangleTool(toolSettings, paintSurface); PaintExample.tools[PaintExample.Ellipse_tool].data = new EllipseTool(toolSettings, paintSurface); PaintExample.tools[PaintExample.Text_tool].data = new TextTool(toolSettings, paintSurface); // colorFrame gridLayout = new GridLayout(); gridLayout.numColumns = 3; gridLayout.marginHeight = 0; gridLayout.marginWidth = 0; colorFrame.setLayout(gridLayout); // activeForegroundColorCanvas, activeBackgroundColorCanvas activeForegroundColorCanvas = new Canvas(colorFrame, SWT.BORDER); gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gridData.heightHint = 24; gridData.widthHint = 24; activeForegroundColorCanvas.setLayoutData(gridData); activeBackgroundColorCanvas = new Canvas(colorFrame, SWT.BORDER); gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gridData.heightHint = 24; gridData.widthHint = 24; activeBackgroundColorCanvas.setLayoutData(gridData); // paletteCanvas final Canvas paletteCanvas = new Canvas(colorFrame, SWT.BORDER | SWT.NO_BACKGROUND); gridData = new GridData(GridData.FILL_HORIZONTAL); gridData.heightHint = 24; paletteCanvas.setLayoutData(gridData); paletteCanvas.addListener( SWT.MouseDown, new Listener() { public void handleEvent(Event e) { Rectangle bounds = paletteCanvas.getClientArea(); Color color = getColorAt(bounds, e.x, e.y); if (e.button == 1) setForegroundColor(color); else setBackgroundColor(color); } private Color getColorAt(Rectangle bounds, int x, int y) { if (bounds.height <= 1 && bounds.width <= 1) return paintColorWhite; final int row = (y - bounds.y) * PaintExample.numPaletteRows / bounds.height; final int col = (x - bounds.x) * PaintExample.numPaletteCols / bounds.width; return paintColors[ Math.min( Math.max(row * PaintExample.numPaletteCols + col, 0), paintColors.length - 1)]; } }); Listener refreshListener = new Listener() { public void handleEvent(Event e) { if (e.gc == null) return; Rectangle bounds = paletteCanvas.getClientArea(); for (int row = 0; row < PaintExample.numPaletteRows; ++row) for (int col = 0; col < PaintExample.numPaletteCols; ++col) { final int x = bounds.width * col / PaintExample.numPaletteCols; final int y = bounds.height * row / PaintExample.numPaletteRows; final int width = Math.max(bounds.width * (col + 1) / PaintExample.numPaletteCols - x, 1); final int height = Math.max(bounds.height * (row + 1) / PaintExample.numPaletteRows - y, 1); e.gc.setBackground(paintColors[row * PaintExample.numPaletteCols + col]); e.gc.fillRectangle(bounds.x + x, bounds.y + y, width, height); } } }; paletteCanvas.addListener(SWT.Resize, refreshListener); paletteCanvas.addListener(SWT.Paint, refreshListener); // paletteCanvas.redraw(); // toolSettingsFrame gridLayout = new GridLayout(); gridLayout.numColumns = 4; gridLayout.marginHeight = 0; gridLayout.marginWidth = 0; toolSettingsFrame.setLayout(gridLayout); Label label = new Label(toolSettingsFrame, SWT.NONE); label.setText(PaintExample.getResourceString("settings.AirbrushRadius.text")); final Scale airbrushRadiusScale = new Scale(toolSettingsFrame, SWT.HORIZONTAL); airbrushRadiusScale.setMinimum(5); airbrushRadiusScale.setMaximum(50); airbrushRadiusScale.setSelection(toolSettings.airbrushRadius); airbrushRadiusScale.setLayoutData( new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL)); airbrushRadiusScale.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { toolSettings.airbrushRadius = airbrushRadiusScale.getSelection(); updateToolSettings(); } }); label = new Label(toolSettingsFrame, SWT.NONE); label.setText(PaintExample.getResourceString("settings.AirbrushIntensity.text")); final Scale airbrushIntensityScale = new Scale(toolSettingsFrame, SWT.HORIZONTAL); airbrushIntensityScale.setMinimum(1); airbrushIntensityScale.setMaximum(100); airbrushIntensityScale.setSelection(toolSettings.airbrushIntensity); airbrushIntensityScale.setLayoutData( new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL)); airbrushIntensityScale.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { toolSettings.airbrushIntensity = airbrushIntensityScale.getSelection(); updateToolSettings(); } }); }
/** {@inheritDoc} */ public Composite createControls(Composite parent, FormToolkit toolkit) { Section section = toolkit.createSection(parent, Section.TITLE_BAR); section.setText("Sampling Rate"); section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); Composite composite = toolkit.createComposite(section); section.setClient(composite); GridLayout layout = new GridLayout(4, false); layout.marginLeft = 10; layout.horizontalSpacing = 10; composite.setLayout(layout); GridData gridData = new GridData(SWT.MAX, SWT.DEFAULT); gridData.grabExcessHorizontalSpace = true; composite.setLayoutData(gridData); final Label sliderLabel = toolkit.createLabel(composite, "no sensitivity selected", SWT.LEFT); GridData data = new GridData(SWT.FILL, SWT.FILL, false, false); data.widthHint = sliderLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT).x; sliderLabel.setLayoutData(data); slider = new Scale(composite, SWT.HORIZONTAL); toolkit.adapt(slider, true, true); slider.setMinimum(0); slider.setMaximum(Sensitivity.values().length - 1); slider.setIncrement(1); slider.setSize(200, 10); slider.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); slider.addSelectionListener( new SelectionAdapter() { /** {@inheritDoc} */ @Override public void widgetSelected(SelectionEvent event) { Sensitivity sensitivity = Sensitivity.fromOrd(slider.getSelection()); switch (sensitivity) { case NO_SENSITIVITY: sliderLabel.setText("no sensitivity selected"); break; case VERY_FINE: sliderLabel.setText("very fine"); break; case FINE: sliderLabel.setText("fine"); break; case MEDIUM: sliderLabel.setText("medium"); break; case COARSE: sliderLabel.setText("coarse"); break; case VERY_COARSE: sliderLabel.setText("very coarse"); break; default: break; } } }); slider.setSelection(DEFAULT_SENSITIVITY.ordinal()); slider.notifyListeners(SWT.Selection, null); Label modeLabel = toolkit.createLabel(composite, "Sampling Rate Mode: ", SWT.LEFT); modeLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); timeframeModeButton = toolkit.createButton(composite, "Timeframe dividing", SWT.RADIO); timeframeModeButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); timeframeModeButton.setSelection(true); return composite; }
/** Create contents of the window. */ protected void createContents() { splitImageShell = new Shell(); splitImageShell.setSize(500, 500); splitImageShell.setText("Image Mosaic"); Log.print("Opening the split image GUI."); Group splitImageGroup = new Group(splitImageShell, SWT.NONE); splitImageGroup.setText("Split Main Image"); splitImageGroup.setBounds(10, 10, 464, 400); numYCompSpinner = new Spinner(splitImageGroup, SWT.BORDER); numYCompScale = new Scale(splitImageGroup, SWT.VERTICAL); numXCompScale = new Scale(splitImageGroup, SWT.NONE); numXCompSpinner = new Spinner(splitImageGroup, SWT.BORDER); mainImageLabel = new Label(splitImageGroup, SWT.NONE); numYCompSpinner.setBounds(10, 20, 47, 22); numYCompSpinner.setMaximum(150); numYCompSpinner.setMinimum(1); numYCompSpinner.setSelection(1); numYCompSpinner.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { numYCompScale.setSelection(numYCompSpinner.getSelection()); dispImage = outlineSplitImage( image, numXCompSpinner.getSelection(), numYCompScale.getSelection()); final Image swtMainImage = new Image(Display.getDefault(), ImageManipulator.convertAWTImageToSWT(dispImage)); mainImageLabel.setImage(swtMainImage); } }); numYCompScale.setBounds(10, 48, 42, 300); numYCompScale.setMaximum(150); numYCompScale.setMinimum(1); numYCompScale.setSelection(1); numYCompScale.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { numYCompSpinner.setSelection(numYCompScale.getSelection()); dispImage = outlineSplitImage( image, numXCompSpinner.getSelection(), numYCompSpinner.getSelection()); final Image swtMainImage = new Image(Display.getDefault(), ImageManipulator.convertAWTImageToSWT(dispImage)); mainImageLabel.setImage(swtMainImage); } }); numXCompScale.setMaximum(150); numXCompScale.setMinimum(1); numXCompScale.setSelection(1); numXCompScale.setBounds(41, 348, 360, 42); numXCompScale.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { numXCompSpinner.setSelection(numXCompScale.getSelection()); dispImage = outlineSplitImage( image, numXCompSpinner.getSelection(), numYCompSpinner.getSelection()); final Image swtMainImage = new Image(Display.getDefault(), ImageManipulator.convertAWTImageToSWT(dispImage)); mainImageLabel.setImage(swtMainImage); } }); numXCompSpinner.setMaximum(150); numXCompSpinner.setMinimum(1); numXCompSpinner.setSelection(1); numXCompSpinner.setBounds(407, 357, 47, 22); numXCompSpinner.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { numXCompScale.setSelection(numXCompSpinner.getSelection()); dispImage = outlineSplitImage( image, numXCompScale.getSelection(), numYCompSpinner.getSelection()); final Image swtMainImage = new Image(Display.getDefault(), ImageManipulator.convertAWTImageToSWT(dispImage)); mainImageLabel.setImage(swtMainImage); } }); int mainImageLabelWidth = 391; int mainImageLabelHeight = 328; mainImageLabel.setBounds(63, 20, mainImageLabelWidth, mainImageLabelHeight); this.image = ImageManipulator.fitImage(this.image, mainImageLabelWidth, mainImageLabelHeight); dispImage = outlineSplitImage( this.image, numXCompSpinner.getSelection(), numYCompSpinner.getSelection()); final Image swtMainImage = new Image(Display.getDefault(), ImageManipulator.convertAWTImageToSWT(dispImage)); mainImageLabel.setImage(swtMainImage); Button cancelButton = new Button(splitImageShell, SWT.NONE); cancelButton.setBounds(399, 427, 75, 25); cancelButton.setText("Cancel"); cancelButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { Log.print("Cancelled splitting image. Closing split image GUI."); splitImageShell.dispose(); } }); Button okayButton = new Button(splitImageShell, SWT.NONE); okayButton.setBounds(318, 427, 75, 25); okayButton.setText("Okay"); okayButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { numXSubcomponents = numXCompSpinner.getSelection(); numYSubcomponents = numYCompSpinner.getSelection(); Log.print("Image split has been confirmed."); splitImageShell.dispose(); } }); }
public RoomDataComposite(Composite parent, RoomController control) { super(parent, SWT.NONE); setLayout(new GridLayout(3, false)); this.roomC = control; container = Manager.getCurrentShip(); final ShipController shipC = container.getShipController(); label = new Label(this, SWT.NONE); label.setAlignment(SWT.CENTER); label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); label.setText("Room"); Label separator = new Label(this, SWT.SEPARATOR | SWT.HORIZONTAL); separator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); Label lblSystem = new Label(this, SWT.NONE); lblSystem.setText("System: "); btnSystem = new Button(this, SWT.NONE); GridData gd_btnSystem = new GridData(SWT.RIGHT, SWT.CENTER, true, false, 2, 1); gd_btnSystem.widthHint = 100; btnSystem.setLayoutData(gd_btnSystem); btnSystem.setText(""); btnAvailable = new Button(this, SWT.CHECK); btnAvailable.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 3, 1)); btnAvailable.setText("Available At Start"); lblSysLevel = new Label(this, SWT.NONE); lblSysLevel.setText("Starting Level:"); scaleSysLevel = new Scale(this, SWT.NONE); scaleSysLevel.setMaximum(2); scaleSysLevel.setMinimum(1); scaleSysLevel.setPageIncrement(1); scaleSysLevel.setIncrement(1); scaleSysLevel.setSelection(1); scaleSysLevel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1)); txtSysLevel = new Text(this, SWT.BORDER | SWT.READ_ONLY); txtSysLevel.setText(""); txtSysLevel.setTextLimit(3); GridData gd_txtSysLevel = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1); gd_txtSysLevel.widthHint = 20; txtSysLevel.setLayoutData(gd_txtSysLevel); scaleSysLevel.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Systems sys = container.getActiveSystem(roomC.getGameObject()); SystemController system = container.getSystemController(sys); system.setLevel(scaleSysLevel.getSelection()); txtSysLevel.setText("" + scaleSysLevel.getSelection()); } }); if (!Manager.getCurrentShip().getShipController().isPlayerShip()) { lblMaxLevel = new Label(this, SWT.NONE); lblMaxLevel.setText("Max Level:"); scaleMaxLevel = new Scale(this, SWT.NONE); scaleMaxLevel.setMaximum(2); scaleMaxLevel.setMinimum(1); scaleMaxLevel.setPageIncrement(1); scaleMaxLevel.setIncrement(1); scaleMaxLevel.setSelection(1); scaleMaxLevel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1)); txtMaxLevel = new Text(this, SWT.BORDER | SWT.READ_ONLY); txtMaxLevel.setText(""); txtMaxLevel.setTextLimit(3); GridData gd_txtMaxLevel = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1); gd_txtMaxLevel.widthHint = 20; txtMaxLevel.setLayoutData(gd_txtMaxLevel); scaleMaxLevel.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Systems sys = container.getActiveSystem(roomC.getGameObject()); SystemController system = container.getSystemController(sys); system.setLevelMax(scaleMaxLevel.getSelection()); txtMaxLevel.setText("" + scaleMaxLevel.getSelection()); if (!shipC.isPlayerShip()) { scaleSysLevel.setMaximum(scaleMaxLevel.getSelection()); scaleSysLevel.notifyListeners(SWT.Selection, null); scaleSysLevel.setEnabled(scaleMaxLevel.getSelection() > 1); scaleSysLevel.setSelection( Math.min(scaleSysLevel.getSelection(), scaleSysLevel.getMaximum())); } } }); } else { imagesComposite = new Composite(this, SWT.NONE); GridLayout gl_imagesComposite = new GridLayout(4, false); gl_imagesComposite.marginHeight = 0; gl_imagesComposite.marginWidth = 0; imagesComposite.setLayout(gl_imagesComposite); imagesComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1)); // Interior widgets Label lblInterior = new Label(imagesComposite, SWT.NONE); lblInterior.setText("Interior image:"); btnInteriorView = new Button(imagesComposite, SWT.NONE); btnInteriorView.setEnabled(false); btnInteriorView.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1)); btnInteriorView.setText("View"); btnInteriorBrowse = new Button(imagesComposite, SWT.NONE); btnInteriorBrowse.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); btnInteriorBrowse.setText("Browse"); btnInteriorClear = new Button(imagesComposite, SWT.NONE); btnInteriorClear.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); btnInteriorClear.setText("Reset"); txtInterior = new Text(imagesComposite, SWT.BORDER | SWT.READ_ONLY); txtInterior.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 4, 1)); // Glow widgets lblGlow = new Label(imagesComposite, SWT.NONE); lblGlow.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblGlow.setText("Manning glow:"); btnGlow = new Button(imagesComposite, SWT.NONE); GridData gd_btnGlow = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 3, 1); gd_btnGlow.widthHint = 120; btnGlow.setLayoutData(gd_btnGlow); btnGlow.setText("None"); SelectionAdapter imageViewListener = new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Systems sys = container.getActiveSystem(roomC.getGameObject()); SystemController system = container.getSystemController(sys); File file = new File(system.getInteriorPath()); if (file != null && file.exists()) { if (Desktop.isDesktopSupported()) { Desktop desktop = Desktop.getDesktop(); if (desktop != null) { try { desktop.open(file.getParentFile()); } catch (IOException ex) { } } } else { Superluminal.log.error( "Unable to open file location - AWT Desktop not supported."); } } } }; btnInteriorView.addSelectionListener(imageViewListener); SelectionAdapter imageBrowseListener = new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Systems sys = container.getActiveSystem(roomC.getGameObject()); SystemController system = container.getSystemController(sys); FileDialog dialog = new FileDialog(EditorWindow.getInstance().getShell()); dialog.setFilterExtensions(new String[] {"*.png"}); String path = dialog.open(); // path == null only when user cancels if (path != null) { system.setInteriorPath("file:" + path); updateData(); } } }; btnInteriorBrowse.addSelectionListener(imageBrowseListener); SelectionAdapter imageClearListener = new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Systems sys = container.getActiveSystem(roomC.getGameObject()); SystemController system = container.getSystemController(sys); system.setInteriorPath(null); updateData(); } }; btnInteriorClear.addSelectionListener(imageClearListener); btnGlow.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Systems sys = container.getActiveSystem(roomC.getGameObject()); SystemObject systemObject = container.getSystemController(sys).getGameObject(); GlowSelectionDialog dialog = new GlowSelectionDialog(EditorWindow.getInstance().getShell()); GlowSet glowSet = dialog.open(systemObject); if (glowSet != null) { btnGlow.setText(glowSet.getIdentifier()); systemObject.setGlowSet(glowSet); } } }); } btnSystem.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Point p = btnSystem.getLocation(); SystemsMenu sysMenu = SystemsMenu.getInstance(); sysMenu.setLocation(toDisplay(p.x, p.y + btnSystem.getSize().y)); sysMenu.open(); } }); btnAvailable.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Systems sys = container.getActiveSystem(roomC.getGameObject()); SystemController system = container.getSystemController(sys); system.setAvailableAtStart(btnAvailable.getSelection()); roomC.redraw(); } }); updateData(); pack(); }
public void updateData() { if (roomC == null) return; SystemsMenu sysMenu = SystemsMenu.getInstance(); sysMenu.setController(roomC); sysMenu.disposeSystemSubmenus(); sysMenu.createSystemSubmenus(); Systems sys = container.getActiveSystem(roomC.getGameObject()); SystemController system = container.getSystemController(sys); ShipController shipController = container.getShipController(); boolean playerShip = shipController.isPlayerShip(); String alias = roomC.getAlias(); label.setText( "Room " + roomC.getId() + (alias == null || alias.equals("") ? "" : " (" + alias + ")")); btnSystem.setText(system.toString()); btnAvailable.setEnabled(system.getSystemId() != Systems.EMPTY); scaleSysLevel.setEnabled(system.getSystemId() != Systems.EMPTY); if (!playerShip) scaleMaxLevel.setEnabled(system.getSystemId() != Systems.EMPTY); if (system.getSystemId() != Systems.EMPTY) { // Update widgets with the system's data btnAvailable.setSelection(system.isAvailableAtStart()); scaleSysLevel.setMaximum(playerShip ? system.getLevelCap() : scaleMaxLevel.getSelection()); scaleSysLevel.setSelection(system.getLevel()); scaleSysLevel.notifyListeners(SWT.Selection, null); if (!playerShip) { scaleMaxLevel.setMaximum(system.getLevelCap()); scaleMaxLevel.setSelection(system.getLevelMax()); scaleMaxLevel.notifyListeners(SWT.Selection, null); scaleSysLevel.setEnabled(scaleMaxLevel.getSelection() > 1); } else { btnInteriorBrowse.setEnabled(system.canContainInterior()); btnInteriorClear.setEnabled(system.canContainInterior()); btnInteriorView.setEnabled(system.getInteriorPath() != null); String temp = system.getInteriorPath(); txtInterior.setText(temp == null ? "" : IOUtils.trimProtocol(temp)); txtInterior.selectAll(); txtInterior.clearSelection(); btnGlow.setEnabled(system.canContainGlow()); if (system.canContainGlow() && playerShip) { btnGlow.setText(system.getGameObject().getGlowSet().getIdentifier()); } else { btnGlow.setText("None"); } } } else { // No system - reset to default scaleSysLevel.setMaximum(2); scaleSysLevel.setSelection(1); txtSysLevel.setText(""); if (!playerShip) { scaleMaxLevel.setMaximum(2); scaleMaxLevel.setSelection(1); txtMaxLevel.setText(""); } else { txtInterior.setText(""); btnGlow.setText("None"); } } OverviewWindow.staticUpdate(roomC); }
private void initialize(Composite parentComposite) { // Create logging composite under parent composite Composite loggingComposite = new Composite(parentComposite, SWT.NONE); loggingComposite.setLayout(new GridLayout(5, false)); loggingComposite.setLayoutData(new GridData(SWT.BEGINNING)); // 1. Log category label CLabel logCategoryLabel = new CLabel(loggingComposite, SWT.NONE); logCategoryLabel.setText("Log category:"); logCategoryLabel.setLayoutData(new GridData(SWT.BEGINNING)); // 2. Log categories list logCategoryCombo = new Combo(loggingComposite, SWT.DROP_DOWN | SWT.READ_ONLY); logCategoryCombo.setEnabled(false); populateLogCategory(); logCategoryCombo.addSelectionListener( new org.eclipse.swt.events.SelectionListener() { @Override public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { String logCategoryText = ((Combo) e.widget).getText(); handleLogCategoryChange(LogCategoryExt.fromExternalValue(logCategoryText)); } private void handleLogCategoryChange(LogCategoryExt logCategoryExt) { // fchang: hook for display diff log category w/o requesting server again. - per bill: // not possible // w/o refactoring server-side code. logLevelScale.setEnabled(true); // enable scale only after logCategory is set. LoggingInfo loggingInfo = loggingService.getLoggingInfoByCategory( project, logCategoryExt, supportedFeatureEnum); setLoggingInfo(loggingInfo); } @Override public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {} }); // 3. Log level label CLabel logLevel = new CLabel(loggingComposite, SWT.NONE); logLevel.setText("Log level: --"); logLevel.setLayoutData(new GridData(SWT.BEGINNING)); // 4. Log levels scale logLevelScale = new Scale(loggingComposite, SWT.NULL); logLevelScale.setIncrement(1); logLevelScale.setMaximum(7); logLevelScale.setEnabled(false); logLevelScale.setPageIncrement(1); logLevelScale.setLayoutData(new GridData(SWT.BEGINNING)); logLevelScale.addListener( SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { LoggingInfo loggingInfo = LoggingInfo.getLoggingInfo( logLevelScale.getSelection(), logCategoryCombo.getText()); loggingService.setLoggingInfo(project, loggingInfo, supportedFeatureEnum); logLevelDesc.setText(PLUS_PREFIX + loggingInfo.getLevelLabelText()); layout(true, true); } }); // 5. Log level description label logLevelDesc = new CLabel(loggingComposite, SWT.NONE); logLevelDesc.setText(INIT_PLUS_PREFIX); GridData logLevelDescGd = new GridData(); logLevelDesc.setLayoutData(logLevelDescGd); }
public void createPartControl(final Composite parent) { parent.setLayout(new GridLayout(3, false)); final Composite comp = new Composite(parent, SWT.BORDER); comp.setLayout(new FillLayout()); comp.setLayoutData(new GridData(GridData.FILL_BOTH)); final Scale scale = new Scale(parent, SWT.BORDER | SWT.VERTICAL); scale.setLayoutData(new GridData(GridData.FILL_VERTICAL)); scale.setMaximum(100); scale.setMinimum(0); scale.setPageIncrement(1); scale.setSelection(100); scale.setToolTipText("Throttle Command."); scale.addListener( SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { int value = 100 - scale.getSelection(); // Inverted! from 100 to 0. if (throttleText != null) throttleText.setText(String.valueOf(value) + " %"); commandThread.getData().setM2(value); commandThread.getData().setM3(value); commandThread.getData().setM1(value); commandThread.getData().setM0(value); } }); canvas = new Canvas(comp, SWT.DOUBLE_BUFFERED); final Composite data = new Composite(parent, SWT.NONE); data.setLayout(new GridLayout(1, true)); data.setLayoutData(new GridData(GridData.FILL_VERTICAL)); Group groupThrottle = new Group(data, SWT.NONE); groupThrottle.setText("Throttle Command"); groupThrottle.setLayout(new GridLayout(2, true)); groupThrottle.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label label = new Label(groupThrottle, SWT.NONE); label.setText("Throttle:"); throttleText = new Text(groupThrottle, SWT.BORDER); throttleText.setEditable(false); throttleText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); throttleText.setText("0 %"); Group groupRoll = new Group(data, SWT.NONE); groupRoll.setText("Roll Command"); groupRoll.setLayout(new GridLayout(2, true)); groupRoll.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Group groupPitch = new Group(data, SWT.NONE); groupPitch.setText("Pitch Command"); groupPitch.setLayout(new GridLayout(2, true)); groupPitch.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); label = new Label(groupRoll, SWT.NONE); label.setText("Lock Roll:"); lockRoll = new Button(groupRoll, SWT.CHECK); label = new Label(groupRoll, SWT.NONE); label.setText("Roll (°):"); rollText = new Text(groupRoll, SWT.BORDER); rollText.setEditable(false); rollText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); label = new Label(groupPitch, SWT.NONE); label.setText("Lock Pitch:"); lockPitch = new Button(groupPitch, SWT.CHECK); label = new Label(groupPitch, SWT.NONE); label.setText("Pitch (°):"); pitchText = new Text(groupPitch, SWT.BORDER); pitchText.setEditable(false); pitchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); label = new Label(groupRoll, SWT.NONE); label.setText("Max Roll (°):"); rollMax = new Text(groupRoll, SWT.BORDER); rollMax.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); rollMax.addFocusListener( new FocusListener() { @Override public void focusLost(FocusEvent e) { String value = ((Text) e.widget).getText(); IPreferenceStore store = Activator.getDefault().getPreferenceStore(); int intVal = 0; try { intVal = Integer.valueOf(value); } catch (NumberFormatException e1) { ((Text) e.widget).setText(store.getString(PreferenceConstants.P_CMD_ROLL)); } if (intVal > 90 || intVal < 0) ((Text) e.widget).setText(store.getString(PreferenceConstants.P_CMD_ROLL)); } @Override public void focusGained(FocusEvent arg0) {} }); label = new Label(groupPitch, SWT.NONE); label.setText("Max Pitch (°):"); pitchMax = new Text(groupPitch, SWT.BORDER); pitchMax.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); pitchMax.addFocusListener( new FocusListener() { @Override public void focusLost(FocusEvent e) { String value = ((Text) e.widget).getText(); IPreferenceStore store = Activator.getDefault().getPreferenceStore(); int intVal = 0; try { intVal = Integer.valueOf(value); } catch (NumberFormatException e1) { ((Text) e.widget).setText(store.getString(PreferenceConstants.P_CMD_PITCH)); } if (intVal > 90 || intVal < 0) ((Text) e.widget).setText(store.getString(PreferenceConstants.P_CMD_PITCH)); } @Override public void focusGained(FocusEvent arg0) {} }); final Composite buttons = new Composite(data, SWT.NONE); buttons.setLayout(new GridLayout(2, true)); buttons.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); final Button recordBtn = new Button(buttons, SWT.TOGGLE); recordBtn.addListener( SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { if (recordBtn.getSelection()) TelemetryDataSingleton.getInstance().setLogEnabled(true); else TelemetryDataSingleton.getInstance().setLogEnabled(false); recordBtn.setSelection(TelemetryDataSingleton.getInstance().getLogEnabled()); logger.logInfo( "Data recording " + (recordBtn.getSelection() ? "enabled." : "disabled."), this.getClass()); } }); recordBtn.setImage( PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_ELCL_STOP)); recordBtn.setLayoutData(new GridData(GridData.FILL_BOTH)); recordBtn.setToolTipText("Record telemetry to file."); final Button enableBtn = new Button(buttons, SWT.TOGGLE); enableBtn.addListener( SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { if (enableBtn.getSelection()) commandThread.setPause(true); else commandThread.setPause(false); recordBtn.setSelection(TelemetryDataSingleton.getInstance().getLogEnabled()); if (enableBtn.getSelection()) logger.logInfo("Command data sent enabled.", this.getClass()); else logger.logWarning("Command data sent disabled.", this.getClass()); } }); enableBtn.setImage( PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_ELCL_COLLAPSEALL)); enableBtn.setLayoutData(new GridData(GridData.FILL_BOTH)); enableBtn.setToolTipText("Enable command data sent."); canvas.setToolTipText("Pitch [left] & Roll [right] Commands."); canvas.addPaintListener( new PaintListener() { @Override public void paintControl(PaintEvent e) { // Get the canvas for drawing and its width and height Canvas canvas = (Canvas) e.widget; int width = canvas.getSize().x; int height = canvas.getSize().y - comp.getBorderWidth(); drawAttitudeControls(e.gc, width, height); } }); canvas.addMouseListener( new MouseListener() { @Override public void mouseUp(MouseEvent e) { enable = false; roll = 0; pitch = 0; update(); } @Override public void mouseDown(MouseEvent e) { enable = true; prevX = e.x; prevY = e.y; } @Override public void mouseDoubleClick(MouseEvent e) { if (enableDoubleClick) { enableDoubleClick = false; roll = 0; pitch = 0; update(); } else enableDoubleClick = true; } }); canvas.addMouseMoveListener( new MouseMoveListener() { private float pitchAngleStep; private float rollAngleStep; @Override public void mouseMove(MouseEvent e) { if (enable || enableDoubleClick) { int maxRoll = Integer.valueOf(rollMax.getText()); int maxPitch = Integer.valueOf(pitchMax.getText()); // Calculate deltas and scale value rollAngleStep = Math.abs(e.x - prevX) * 0.5f; pitchAngleStep = Math.abs(e.y - prevY) * 1.5f; if (roll >= maxRoll) { roll = maxRoll; } else if (roll <= -maxRoll) { roll = -maxRoll; } if (pitch >= maxPitch) { pitch = maxPitch; } else if (pitch <= -maxPitch) { pitch = -maxPitch; } if (e.x < prevX && !lockRoll.getSelection()) roll -= rollAngleStep; else if (e.x > prevX && !lockRoll.getSelection()) roll += rollAngleStep; else if (e.y < prevY && !lockPitch.getSelection()) pitch -= pitchAngleStep; else if (e.y > prevY && !lockPitch.getSelection()) pitch += pitchAngleStep; prevX = e.x; prevY = e.y; update(); } } }); updateFromPreferences(); }
public void createGUI(org.eclipse.swt.widgets.Composite parent) { org.eclipse.swt.layout.GridLayout gridLayout; org.eclipse.swt.layout.GridData gridData; org.eclipse.swt.widgets.Composite displayArea = new org.eclipse.swt.widgets.Composite(parent, SWT.NONE); gridLayout = new org.eclipse.swt.layout.GridLayout(); gridLayout.numColumns = 1; displayArea.setLayout(gridLayout); final org.eclipse.swt.widgets.Canvas paintCanvas = new org.eclipse.swt.widgets.Canvas( displayArea, (-(SWT.BORDER | SWT.V_SCROLL)) | SWT.H_SCROLL | SWT.NO_REDRAW_RESIZE | SWT.NO_BACKGROUND); gridData = new org.eclipse.swt.layout.GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); paintCanvas.setLayoutData(gridData); paintCanvas.setBackground(paintColorWhite); final org.eclipse.swt.widgets.Composite colorFrame = new org.eclipse.swt.widgets.Composite(displayArea, SWT.NONE); gridData = new org.eclipse.swt.layout.GridData( GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL); colorFrame.setLayoutData(gridData); final org.eclipse.swt.widgets.Composite toolSettingsFrame = new org.eclipse.swt.widgets.Composite(displayArea, SWT.NONE); gridData = new org.eclipse.swt.layout.GridData( GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL); toolSettingsFrame.setLayoutData(gridData); final org.eclipse.swt.widgets.Text statusText = new org.eclipse.swt.widgets.Text(displayArea, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY); gridData = new org.eclipse.swt.layout.GridData( GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL); statusText.setLayoutData(gridData); paintSurface = new org.eclipse.swt.examples.paint.PaintSurface(paintCanvas, statusText, paintColorWhite); tools[Pencil_tool].data = new org.eclipse.swt.examples.paint.PencilTool(toolSettings, paintSurface); tools[Airbrush_tool].data = new org.eclipse.swt.examples.paint.AirbrushTool(toolSettings, paintSurface); tools[Line_tool].data = new org.eclipse.swt.examples.paint.LineTool(toolSettings, paintSurface); tools[PolyLine_tool].data = new org.eclipse.swt.examples.paint.PolyLineTool(toolSettings, paintSurface); tools[Rectangle_tool].data = new org.eclipse.swt.examples.paint.RectangleTool(toolSettings, paintSurface); tools[RoundedRectangle_tool].data = new org.eclipse.swt.examples.paint.RoundedRectangleTool(toolSettings, paintSurface); tools[Ellipse_tool].data = new org.eclipse.swt.examples.paint.EllipseTool(toolSettings, paintSurface); tools[Text_tool].data = new org.eclipse.swt.examples.paint.TextTool(toolSettings, paintSurface); gridLayout = new org.eclipse.swt.layout.GridLayout(); gridLayout.numColumns = 3; gridLayout.marginHeight = 0; gridLayout.marginWidth = 0; colorFrame.setLayout(gridLayout); activeForegroundColorCanvas = new org.eclipse.swt.widgets.Canvas(colorFrame, SWT.BORDER); gridData = new org.eclipse.swt.layout.GridData(GridData.HORIZONTAL_ALIGN_FILL); gridData.heightHint = 24; gridData.widthHint = 24; activeForegroundColorCanvas.setLayoutData(gridData); activeBackgroundColorCanvas = new org.eclipse.swt.widgets.Canvas(colorFrame, SWT.BORDER); gridData = new org.eclipse.swt.layout.GridData(GridData.HORIZONTAL_ALIGN_FILL); gridData.heightHint = 24; gridData.widthHint = 24; activeBackgroundColorCanvas.setLayoutData(gridData); final org.eclipse.swt.widgets.Canvas paletteCanvas = new org.eclipse.swt.widgets.Canvas(colorFrame, SWT.BORDER | SWT.NO_BACKGROUND); gridData = new org.eclipse.swt.layout.GridData(GridData.FILL_HORIZONTAL); gridData.heightHint = 24; paletteCanvas.setLayoutData(gridData); paletteCanvas.addListener( SWT.MouseDown, new org.eclipse.swt.widgets.Listener() { public void handleEvent(org.eclipse.swt.widgets.Event e) { org.eclipse.swt.graphics.Rectangle bounds = paletteCanvas.getClientArea(); org.eclipse.swt.graphics.Color color = getColorAt(bounds, e.x, e.y); if (e.button == 1) { setForegroundColor(color); } else { setBackgroundColor(color); } } private org.eclipse.swt.graphics.Color getColorAt( org.eclipse.swt.graphics.Rectangle bounds, int x, int y) { if (bounds.height <= 1 && bounds.width <= 1) { return paintColorWhite; } final int row = (y - bounds.y) * numPaletteRows / bounds.height; final int col = (x - bounds.x) * numPaletteCols / bounds.width; return paintColors[ Math.min(Math.max(row * numPaletteCols + col, 0), paintColors.length - 1)]; } }); org.eclipse.swt.widgets.Listener refreshListener = new org.eclipse.swt.widgets.Listener() { public void handleEvent(org.eclipse.swt.widgets.Event e) { if (e.gc == null) { return; } org.eclipse.swt.graphics.Rectangle bounds = paletteCanvas.getClientArea(); for (int row = 0; row < numPaletteRows; ++row) { for (int col = 0; col < numPaletteCols; ++col) { final int x = bounds.width * col / numPaletteCols; final int y = bounds.height * row / numPaletteRows; final int width = Math.max(bounds.width * (col + 1) / numPaletteCols - x, 1); final int height = Math.max(bounds.height * (row + 1) / numPaletteRows - y, 1); e.gc.setBackground(paintColors[row * numPaletteCols + col]); e.gc.fillRectangle(bounds.x + x, bounds.y + y, width, height); } } } }; paletteCanvas.addListener(SWT.Resize, refreshListener); paletteCanvas.addListener(SWT.Paint, refreshListener); gridLayout = new org.eclipse.swt.layout.GridLayout(); gridLayout.numColumns = 4; gridLayout.marginHeight = 0; gridLayout.marginWidth = 0; toolSettingsFrame.setLayout(gridLayout); org.eclipse.swt.widgets.Label label = new org.eclipse.swt.widgets.Label(toolSettingsFrame, SWT.NONE); label.setText(getResourceString("settings.AirbrushRadius.text")); final org.eclipse.swt.widgets.Scale airbrushRadiusScale = new org.eclipse.swt.widgets.Scale(toolSettingsFrame, SWT.HORIZONTAL); airbrushRadiusScale.setMinimum(5); airbrushRadiusScale.setMaximum(50); airbrushRadiusScale.setSelection(toolSettings.airbrushRadius); airbrushRadiusScale.setLayoutData( new org.eclipse.swt.layout.GridData( GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL)); airbrushRadiusScale.addSelectionListener( new org.eclipse.swt.events.SelectionAdapter() { public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { toolSettings.airbrushRadius = airbrushRadiusScale.getSelection(); updateToolSettings(); } }); label = new org.eclipse.swt.widgets.Label(toolSettingsFrame, SWT.NONE); label.setText(getResourceString("settings.AirbrushIntensity.text")); final org.eclipse.swt.widgets.Scale airbrushIntensityScale = new org.eclipse.swt.widgets.Scale(toolSettingsFrame, SWT.HORIZONTAL); airbrushIntensityScale.setMinimum(1); airbrushIntensityScale.setMaximum(100); airbrushIntensityScale.setSelection(toolSettings.airbrushIntensity); airbrushIntensityScale.setLayoutData( new org.eclipse.swt.layout.GridData( GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL)); airbrushIntensityScale.addSelectionListener( new org.eclipse.swt.events.SelectionAdapter() { public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { toolSettings.airbrushIntensity = airbrushIntensityScale.getSelection(); updateToolSettings(); } }); }