Java Examples for org.eclipse.swt.layout.RowLayout

The following java examples will help you to understand the usage of org.eclipse.swt.layout.RowLayout. These source code samples are taken from different open source projects.

Example 1
Project: extFM-Tooling-master  File: ViewmodelMultiPageEditor.java View source code
/**
    * Creates page 1 of the multi-page editor, which allows you to change the font used in page 2.
    */
void createViewPointView() {
    Composite composite = new Composite(getContainer(), SWT.NONE);
    GridLayout bodyGridLayout = new GridLayout(1, false);
    composite.setLayout(bodyGridLayout);
    Composite topComposite = new Composite(composite, SWT.NONE);
    RowLayout rowLayout = new RowLayout(SWT.HORIZONTAL);
    rowLayout.wrap = true;
    rowLayout.fill = false;
    rowLayout.pack = true;
    rowLayout.justify = false;
    topComposite.setLayout(rowLayout);
    Combo viewPointCombo = new Combo(topComposite, SWT.READ_ONLY);
    viewPointCombo.setItems(getViewPoints());
    viewPointCombo.addSelectionListener(new ViewPointComboSelectionListener(this));
    mainComposite = new Composite(composite, SWT.NONE);
    mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    FillLayout layout = new FillLayout();
    mainComposite.setLayout(layout);
    ViewerPane viewerPane = new ViewerPane(getSite().getPage(), ViewmodelMultiPageEditor.this) {

        @Override
        public Viewer createViewer(Composite composite) {
            Tree tree = new Tree(composite, SWT.MULTI);
            TreeViewer newTreeViewer = new TreeViewer(tree);
            return newTreeViewer;
        }

        @Override
        public void requestActivation() {
            super.requestActivation();
            setCurrentViewerPane(this);
        }
    };
    viewerPane.createControl(mainComposite);
    viewPointViewer = (TreeViewer) viewerPane.getViewer();
    ViewPointContentProvider = new ViewPointContentProvider();
    viewPointViewer.setContentProvider(ViewPointContentProvider);
    viewPointViewer.setLabelProvider(new AdapterFactoryLabelProvider.FontProvider(adapterFactory, viewPointViewer));
    new AdapterFactoryTreeEditor(viewPointViewer.getTree(), adapterFactory);
    createContextMenuFor(viewPointViewer);
    int index = addPage(composite);
    setPageText(index, "ViewPoint View");
}
Example 2
Project: cdt-tests-runner-master  File: VisibilitySelectionPanel.java View source code
private void createAccessModifierComposite(Composite control) {
    accessModifierGroup = new Group(this, SWT.SHADOW_NONE);
    RowLayout groupLayout = new RowLayout(SWT.HORIZONTAL);
    groupLayout.fill = true;
    accessModifierGroup.setLayout(groupLayout);
    accessModifierGroup.setText(Messages.VisibilitySelectionPanel_AccessModifier);
    publicAccessRadioButton = new Button(accessModifierGroup, SWT.RADIO | SWT.LEFT);
    publicAccessRadioButton.setText(VisibilityEnum.v_public.toString());
    protectedAccessRadioButton = new Button(accessModifierGroup, SWT.RADIO | SWT.LEFT);
    protectedAccessRadioButton.setText(VisibilityEnum.v_protected.toString());
    privateAccessRadioButton = new Button(accessModifierGroup, SWT.RADIO | SWT.LEFT);
    privateAccessRadioButton.setText(VisibilityEnum.v_private.toString());
}
Example 3
Project: erlide-master  File: ControlPanelView.java View source code
private Composite createProcessCheckBoxes(final Composite parent) {
    final Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(new RowLayout());
    TraceBackend.getInstance().removeAllProcessFlag();
    for (final ProcessFlag flag : ProcessFlag.values()) {
        final Button button = new Button(container, SWT.CHECK);
        button.setText(flag.getName());
        button.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(final SelectionEvent e) {
                if (button.getSelection()) {
                    TraceBackend.getInstance().addProcessFlag(flag);
                } else {
                    TraceBackend.getInstance().removeProcessFlag(flag);
                }
            }
        });
    }
    return container;
}
Example 4
Project: tdq-studio-se-master  File: HideSeriesChartDialog.java View source code
private Composite createUtilityControl(Composite parent) {
    Composite comp = new Composite(parent, SWT.BORDER);
    comp.setLayout(new RowLayout());
    comp.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY));
    if (isCountAvgNull) {
        XYDataset dataset = chart.getXYPlot().getDataset();
        int count = dataset.getSeriesCount();
        for (int i = 0; i < count; i++) {
            Button checkBtn = new Button(comp, SWT.CHECK);
            checkBtn.setText(dataset.getSeriesKey(i).toString());
            checkBtn.setSelection(true);
            checkBtn.addSelectionListener(listener);
            checkBtn.setData(SERIES_KEY_ID, i);
        }
    }
    if (isMinMaxDate) {
        CategoryPlot plot = (CategoryPlot) chart.getPlot();
        CategoryDataset dataset = plot.getDataset();
        int count = dataset.getRowCount();
        for (int i = 0; i < count; i++) {
            Button checkBtn = new Button(comp, SWT.CHECK);
            checkBtn.setText(dataset.getRowKey(i).toString());
            checkBtn.setSelection(true);
            checkBtn.addSelectionListener(listener);
            checkBtn.setData(SERIES_KEY_ID, i);
        }
    }
    return comp;
}
Example 5
Project: LanguageBuddy-master  File: TagFilterComposite.java View source code
protected void init() {
    tree = new Tree(this, SWT.MULTI | SWT.CHECK);
    tree.setHeaderVisible(false);
    tree.setEnabled(true);
    tree.setLinesVisible(true);
    TreeColumn nameColumn = new TreeColumn(tree, SWT.NONE);
    nameColumn.setWidth(400);
    nameColumn.setResizable(true);
    nameColumn.setText(MessageUtil.getString("FilterColumn"));
    tree.showColumn(nameColumn);
    viewer = new CheckboxTreeViewer(tree);
    viewer.setCellEditors(new CellEditor[] { new CheckboxCellEditor() });
    contentProvider = new MetaDataContentProvider();
    labelProvider = new MetaDataLabelProvider(this.getDisplay());
    viewer.setContentProvider(contentProvider);
    viewer.setLabelProvider(labelProvider);
    viewer.addCheckStateListener(this);
    refresh();
    setContent(tree);
    setExpandHorizontal(true);
    setExpandVertical(true);
    if (getParent().getLayout() instanceof RowLayout) {
        RowData treeRowData = new RowData(SWT.DEFAULT, 200);
        setLayoutData(treeRowData);
    } else if (getParent().getLayout() instanceof GridLayout) {
        GridData treeGridData = new GridData(GridData.FILL);
        treeGridData.minimumHeight = 200;
        treeGridData.heightHint = 200;
        setLayoutData(treeGridData);
    }
    tree.setToolTipText(getTagPathDescription());
}
Example 6
Project: earthsci-master  File: BookmarkEditorDialog.java View source code
/**
	 * Create the property edit area (right side) used to contain the
	 * [email protected] IBookmarkProperty} editors.
	 * <p/>
	 * Expects the [email protected] parent} to have a [email protected] GridLayout}.
	 */
protected Control createPropertyEditArea(Composite parent) {
    final Composite container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.horizontalSpacing = 0;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    container.setLayout(layout);
    final Label leftSeparator = new Label(container, SWT.VERTICAL | SWT.SEPARATOR);
    leftSeparator.setLayoutData(new GridData(GridData.FILL_VERTICAL | GridData.GRAB_VERTICAL));
    editorScroller = new ScrolledComposite(container, SWT.V_SCROLL | SWT.H_SCROLL);
    editorScroller.setShowFocusedControl(true);
    editorScroller.setExpandHorizontal(true);
    editorScroller.setExpandVertical(true);
    editorScroller.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
    editorScroller.setMinSize(DEFAULT_MIN_PAGE_SIZE);
    final Composite inner = new Composite(editorScroller, SWT.NONE);
    inner.setLayoutData(new GridData(GridData.FILL_BOTH));
    inner.setLayout(new GridLayout());
    editorScroller.setContent(inner);
    editorScroller.addControlListener(new ControlAdapter() {

        @Override
        public void controlResized(ControlEvent e) {
            updateScrollerMinSize();
        }
    });
    messageArea = new DialogMessageArea();
    messageArea.createContents(inner);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    messageArea.setTitleLayoutData(gd);
    messageArea.setMessageLayoutData(gd);
    Label separator = new Label(inner, SWT.HORIZONTAL | SWT.SEPARATOR);
    separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    editorInclusionArea = new Composite(inner, SWT.NONE);
    editorInclusionArea.setLayout(new GridLayout());
    editorInclusionArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    editorInclusionCheck = new Button(editorInclusionArea, SWT.CHECK);
    editorInclusionCheck.setText(Messages.BookmarkEditorDialog_IncludeInBookmarkLabel);
    editorInclusionCheck.setSelection(true);
    editorInclusionCheck.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            updateEditorIncluded(editorInclusionCheck.getSelection());
        }
    });
    editorContainer = new Composite(inner, SWT.NONE);
    editorContainer.setLayoutData(new GridData(GridData.FILL_BOTH));
    editorContainer.setLayout(new GridLayout());
    editorButtonBar = new Composite(inner, SWT.RIGHT_TO_LEFT);
    editorButtonBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    editorButtonBar.setLayout(new RowLayout());
    resetButton = new Button(editorButtonBar, SWT.NONE);
    resetButton.setText(Messages.BookmarkEditorDialog_ResetValuesLabel);
    resetButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (currentEditor == null) {
                return;
            }
            currentEditor.restoreOriginalValues();
        }
    });
    fillFromCurrentButton = new Button(editorButtonBar, SWT.NONE);
    fillFromCurrentButton.setText(Messages.BookmarkEditorDialog_FillFromCurrentLabel);
    fillFromCurrentButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (currentEditor == null || !(currentEditor instanceof IBookmarkPropertyEditor)) {
                return;
            }
            ((IBookmarkPropertyEditor) currentEditor).fillFromCurrent();
        }
    });
    return container;
}
Example 7
Project: tmdm-studio-se-master  File: RepositoryCheckTreeViewer.java View source code
/**
     * DOC hcw Comment method "createSelectionButton".
     * 
     * @param itemComposite
     */
private void createSelectionButton(Composite itemComposite) {
    Composite buttonComposite = new Composite(itemComposite, SWT.NONE);
    GridLayoutFactory.swtDefaults().margins(0, 25).applyTo(buttonComposite);
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.BEGINNING).applyTo(buttonComposite);
    buttonComposite.setLayout(new RowLayout(SWT.VERTICAL));
    Button hide = new Button(buttonComposite, SWT.PUSH);
    hide.setVisible(false);
    Button selectAll = new Button(buttonComposite, SWT.PUSH);
    selectAll.setText(Messages.RepositoryCheckTreeViewer_SelectAll);
    selectAll.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            ((CheckboxTreeViewer) viewer).setAllChecked(true);
        }
    });
    Button deselectAll = new Button(buttonComposite, SWT.PUSH);
    deselectAll.setText(Messages.RepositoryCheckTreeViewer_DeselectAll);
    deselectAll.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            ((CheckboxTreeViewer) viewer).setAllChecked(false);
        }
    });
    if (bunListener != null) {
        selectAll.addSelectionListener(bunListener);
        deselectAll.addSelectionListener(bunListener);
    }
    // setButtonLayoutData(deselectAll);
    Button expandBtn = new Button(buttonComposite, SWT.PUSH);
    //$NON-NLS-1$
    expandBtn.setText("Expand All");
    expandBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            viewer.expandAll();
        }
    });
    // setButtonLayoutData(expandBtn);
    Button collapseBtn = new Button(buttonComposite, SWT.PUSH);
    //$NON-NLS-1$
    collapseBtn.setText("Collapse All");
    collapseBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            viewer.collapseAll();
        }
    });
// setButtonLayoutData(collapseBtn);
}
Example 8
Project: platform_tools_motodev-master  File: MOTODEVVideosView.java View source code
@Override
protected Control createControl(Composite parent) {
    Composite toolbarComposite = new Composite(parent, SWT.NONE);
    toolbarComposite.setLayout(new RowLayout(SWT.HORIZONTAL));
    final Text searchText = new Text(toolbarComposite, SWT.SEARCH);
    searchText.setLayoutData(new RowData(150, SWT.DEFAULT));
    searchText.setMessage(VideosNLS.UI_Search);
    searchText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            searchAndFilter(searchText.getText());
        }
    });
    if (canPlayEmbeddedVideo()) {
        // recover the state, if there is flash player
        // if there is NO flash player, the checkbox is always selected
        boolean enablement = hasFlashPlayer();
        boolean selection = !enablement ? true : openExternalBrowser != null ? openExternalBrowser : false;
        final Button openExternal = new Button(toolbarComposite, SWT.CHECK);
        openExternal.setText(VideosNLS.UI_Open_External_Browser);
        openExternal.setToolTipText(VideosNLS.UI_Open_External_Browser);
        openExternal.setEnabled(enablement);
        openExternal.setSelection(selection);
        openExternalBrowser = selection;
        if (!enablement) {
            Label warningImg = new Label(toolbarComposite, SWT.NONE);
            warningImg.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK));
            warningImg.setToolTipText(getNoFlashMessage());
        }
        openExternal.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                openExternalBrowser = openExternal.getSelection();
            }
        });
    }
    return toolbarComposite;
}
Example 9
Project: liferay-ide-master  File: NewLayoutTplLayoutWizardPage.java View source code
protected void createSelectLayoutGroup(Composite parent) {
    SWTUtil.createLabel(parent, Msgs.selectInitialLayout, 1);
    // Composite group = SWTUtil.createTopComposite(parent, 4);
    // group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    Composite group = new Composite(parent, SWT.NONE);
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.widthHint = 575;
    group.setLayoutData(gd);
    RowLayout rowLayout = new RowLayout();
    rowLayout.wrap = true;
    rowLayout.pack = false;
    group.setLayout(rowLayout);
    if (LAYOUT_PROPERTIES.length == layoutOptionsText.length && LAYOUT_PROPERTIES.length == layoutOptionsImages.length) {
        imagesToDispose = new ArrayList<Image>();
        for (int i = 0; i < LAYOUT_PROPERTIES.length; i++) {
            Image img = layoutOptionsImages[i].createImage();
            createLayoutOption(group, LAYOUT_PROPERTIES[i], layoutOptionsText[i], img);
            imagesToDispose.add(img);
        }
    }
}
Example 10
Project: streamline-master  File: EditView.java View source code
private void createMenu(Composite inComp) {
    Composite menuComp = new Composite(inComp, SWT.NONE);
    menuComp.setLayout(new RowLayout());
    Button syncButt = new Button(parent, SWT.PUSH);
    syncButt.setText("Synch");
    syncButt.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent sev) {
            uploadRecord();
        }
    });
    Button newButt = new Button(parent, SWT.PUSH);
    newButt.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent sev) {
            TabItem[] items = tabFolder.getSelection();
            if (items != null && items.length != 0) {
                DataViewer viewer = (DataViewer) items[0].getControl();
                viewer.addEntry();
            }
        //				
        }
    });
    newButt.setText("New Entry");
}
Example 11
Project: swtbot-master  File: ImageAnalyzer.java View source code
void createWidgets() {
    // Add the widgets to the shell in a grid layout.
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.numColumns = 2;
    shell.setLayout(layout);
    // Add a composite to contain some control widgets across the top.
    Composite controls = new Composite(shell, SWT.NONE);
    RowLayout rowLayout = new RowLayout();
    rowLayout.marginTop = 5;
    rowLayout.marginBottom = 5;
    rowLayout.spacing = 8;
    controls.setLayout(rowLayout);
    GridData gridData = new GridData();
    gridData.horizontalSpan = 2;
    controls.setLayoutData(gridData);
    // Combo to change the background.
    Group group = new Group(controls, SWT.NONE);
    group.setLayout(new RowLayout());
    group.setText(ImageAnalyzer.bundle.getString("Background"));
    backgroundCombo = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY);
    backgroundCombo.setItems(new String[] { ImageAnalyzer.bundle.getString("None"), ImageAnalyzer.bundle.getString("White"), ImageAnalyzer.bundle.getString("Black"), ImageAnalyzer.bundle.getString("Red"), ImageAnalyzer.bundle.getString("Green"), ImageAnalyzer.bundle.getString("Blue") });
    backgroundCombo.select(backgroundCombo.indexOf(ImageAnalyzer.bundle.getString("White")));
    backgroundCombo.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            changeBackground();
        }
    });
    // Combo to change the x scale.
    String[] values = { "0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "2", "3", "4", "5", "6", "7", "8", "9", "10" };
    group = new Group(controls, SWT.NONE);
    group.setLayout(new RowLayout());
    group.setText(ImageAnalyzer.bundle.getString("X_scale"));
    scaleXCombo = new Combo(group, SWT.DROP_DOWN);
    for (int i = 0; i < values.length; i++) scaleXCombo.add(values[i]);
    scaleXCombo.select(scaleXCombo.indexOf("1"));
    scaleXCombo.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            scaleX();
        }
    });
    // Combo to change the y scale.
    group = new Group(controls, SWT.NONE);
    group.setLayout(new RowLayout());
    group.setText(ImageAnalyzer.bundle.getString("Y_scale"));
    scaleYCombo = new Combo(group, SWT.DROP_DOWN);
    for (int i = 0; i < values.length; i++) scaleYCombo.add(values[i]);
    scaleYCombo.select(scaleYCombo.indexOf("1"));
    scaleYCombo.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            scaleY();
        }
    });
    // Combo to change the alpha value.
    group = new Group(controls, SWT.NONE);
    group.setLayout(new RowLayout());
    group.setText(ImageAnalyzer.bundle.getString("Alpha_K"));
    alphaCombo = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY);
    for (int i = 0; i <= 255; i += 5) alphaCombo.add(String.valueOf(i));
    alphaCombo.select(alphaCombo.indexOf("255"));
    alphaCombo.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            alpha();
        }
    });
    // Check box to request incremental display.
    group = new Group(controls, SWT.NONE);
    group.setLayout(new RowLayout());
    group.setText(ImageAnalyzer.bundle.getString("Display"));
    incrementalCheck = new Button(group, SWT.CHECK);
    incrementalCheck.setText(ImageAnalyzer.bundle.getString("Incremental"));
    incrementalCheck.setSelection(incremental);
    incrementalCheck.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            incremental = ((Button) event.widget).getSelection();
        }
    });
    // Check box to request transparent display.
    transparentCheck = new Button(group, SWT.CHECK);
    transparentCheck.setText(ImageAnalyzer.bundle.getString("Transparent"));
    transparentCheck.setSelection(transparent);
    transparentCheck.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            transparent = ((Button) event.widget).getSelection();
            if (image != null)
                imageCanvas.redraw();
        }
    });
    // Check box to request mask display.
    maskCheck = new Button(group, SWT.CHECK);
    maskCheck.setText(ImageAnalyzer.bundle.getString("Mask"));
    maskCheck.setSelection(showMask);
    maskCheck.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            showMask = ((Button) event.widget).getSelection();
            if (image != null)
                imageCanvas.redraw();
        }
    });
    // Check box to request background display.
    backgroundCheck = new Button(group, SWT.CHECK);
    backgroundCheck.setText(ImageAnalyzer.bundle.getString("Background"));
    backgroundCheck.setSelection(showBackground);
    backgroundCheck.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            showBackground = ((Button) event.widget).getSelection();
        }
    });
    // Group the animation buttons.
    group = new Group(controls, SWT.NONE);
    group.setLayout(new RowLayout());
    group.setText(ImageAnalyzer.bundle.getString("Animation"));
    // Push button to display the previous image in a multi-image file.
    previousButton = new Button(group, SWT.PUSH);
    previousButton.setText(ImageAnalyzer.bundle.getString("Previous"));
    previousButton.setEnabled(false);
    previousButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            previous();
        }
    });
    // Push button to display the next image in a multi-image file.
    nextButton = new Button(group, SWT.PUSH);
    nextButton.setText(ImageAnalyzer.bundle.getString("Next"));
    nextButton.setEnabled(false);
    nextButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            next();
        }
    });
    // Push button to toggle animation of a multi-image file.
    animateButton = new Button(group, SWT.PUSH);
    animateButton.setText(ImageAnalyzer.bundle.getString("Animate"));
    animateButton.setEnabled(false);
    animateButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            animate();
        }
    });
    // Label to show the image file type.
    typeLabel = new Label(shell, SWT.NONE);
    typeLabel.setText(ImageAnalyzer.bundle.getString("Type_initial"));
    typeLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    // Canvas to show the image.
    imageCanvas = new Canvas(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.NO_REDRAW_RESIZE | SWT.NO_BACKGROUND);
    imageCanvas.setBackground(whiteColor);
    imageCanvas.setCursor(crossCursor);
    gridData = new GridData();
    gridData.verticalSpan = 15;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.verticalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    gridData.grabExcessVerticalSpace = true;
    imageCanvas.setLayoutData(gridData);
    imageCanvas.addPaintListener(new PaintListener() {

        public void paintControl(PaintEvent event) {
            if (image == null) {
                Rectangle bounds = imageCanvas.getBounds();
                event.gc.fillRectangle(0, 0, bounds.width, bounds.height);
            } else
                paintImage(event);
        }
    });
    imageCanvas.addMouseMoveListener(new MouseMoveListener() {

        public void mouseMove(MouseEvent event) {
            if (image != null)
                showColorAt(event.x, event.y);
        }
    });
    // Set up the image canvas scroll bars.
    ScrollBar horizontal = imageCanvas.getHorizontalBar();
    horizontal.setVisible(true);
    horizontal.setMinimum(0);
    horizontal.setEnabled(false);
    horizontal.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            scrollHorizontally((ScrollBar) event.widget);
        }
    });
    ScrollBar vertical = imageCanvas.getVerticalBar();
    vertical.setVisible(true);
    vertical.setMinimum(0);
    vertical.setEnabled(false);
    vertical.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            scrollVertically((ScrollBar) event.widget);
        }
    });
    // Label to show the image size.
    sizeLabel = new Label(shell, SWT.NONE);
    sizeLabel.setText(ImageAnalyzer.bundle.getString("Size_initial"));
    sizeLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    // Label to show the image depth.
    depthLabel = new Label(shell, SWT.NONE);
    depthLabel.setText(ImageAnalyzer.bundle.getString("Depth_initial"));
    depthLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    // Label to show the transparent pixel.
    transparentPixelLabel = new Label(shell, SWT.NONE);
    transparentPixelLabel.setText(ImageAnalyzer.bundle.getString("Transparent_pixel_initial"));
    transparentPixelLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    // Label to show the time to load.
    timeToLoadLabel = new Label(shell, SWT.NONE);
    timeToLoadLabel.setText(ImageAnalyzer.bundle.getString("Time_to_load_initial"));
    timeToLoadLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    // Separate the animation fields from the rest of the fields.
    Label separator = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
    separator.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    // Label to show the logical screen size for animation.
    screenSizeLabel = new Label(shell, SWT.NONE);
    screenSizeLabel.setText(ImageAnalyzer.bundle.getString("Animation_size_initial"));
    screenSizeLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    // Label to show the background pixel.
    backgroundPixelLabel = new Label(shell, SWT.NONE);
    backgroundPixelLabel.setText(ImageAnalyzer.bundle.getString("Background_pixel_initial"));
    backgroundPixelLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    // Label to show the image location (x, y).
    locationLabel = new Label(shell, SWT.NONE);
    locationLabel.setText(ImageAnalyzer.bundle.getString("Image_location_initial"));
    locationLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    // Label to show the image disposal method.
    disposalMethodLabel = new Label(shell, SWT.NONE);
    disposalMethodLabel.setText(ImageAnalyzer.bundle.getString("Disposal_initial"));
    disposalMethodLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    // Label to show the image delay time.
    delayTimeLabel = new Label(shell, SWT.NONE);
    delayTimeLabel.setText(ImageAnalyzer.bundle.getString("Delay_initial"));
    delayTimeLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    // Label to show the background pixel.
    repeatCountLabel = new Label(shell, SWT.NONE);
    repeatCountLabel.setText(ImageAnalyzer.bundle.getString("Repeats_initial"));
    repeatCountLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    // Separate the animation fields from the palette.
    separator = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
    separator.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    // Label to show if the image has a direct or indexed palette.
    paletteLabel = new Label(shell, SWT.NONE);
    paletteLabel.setText(ImageAnalyzer.bundle.getString("Palette_initial"));
    paletteLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    // Canvas to show the image's palette.
    paletteCanvas = new Canvas(shell, SWT.BORDER | SWT.V_SCROLL | SWT.NO_REDRAW_RESIZE);
    paletteCanvas.setFont(fixedWidthFont);
    paletteCanvas.getVerticalBar().setVisible(true);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.verticalAlignment = GridData.FILL;
    GC gc = new GC(paletteLabel);
    paletteWidth = gc.stringExtent(ImageAnalyzer.bundle.getString("Max_length_string")).x;
    gc.dispose();
    gridData.widthHint = paletteWidth;
    // show at least 16 colors
    gridData.heightHint = 16 * 11;
    paletteCanvas.setLayoutData(gridData);
    paletteCanvas.addPaintListener(new PaintListener() {

        public void paintControl(PaintEvent event) {
            if (image != null)
                paintPalette(event);
        }
    });
    // Set up the palette canvas scroll bar.
    vertical = paletteCanvas.getVerticalBar();
    vertical.setVisible(true);
    vertical.setMinimum(0);
    vertical.setIncrement(10);
    vertical.setEnabled(false);
    vertical.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            scrollPalette((ScrollBar) event.widget);
        }
    });
    // Sash to see more of image or image data.
    sash = new Sash(shell, SWT.HORIZONTAL);
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    gridData.horizontalAlignment = GridData.FILL;
    sash.setLayoutData(gridData);
    sash.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            if (event.detail != SWT.DRAG) {
                ((GridData) paletteCanvas.getLayoutData()).heightHint = SWT.DEFAULT;
                Rectangle paletteCanvasBounds = paletteCanvas.getBounds();
                int minY = paletteCanvasBounds.y + 20;
                Rectangle dataLabelBounds = dataLabel.getBounds();
                int maxY = statusLabel.getBounds().y - dataLabelBounds.height - 20;
                if (event.y > minY && event.y < maxY) {
                    Rectangle oldSash = sash.getBounds();
                    sash.setBounds(event.x, event.y, event.width, event.height);
                    int diff = event.y - oldSash.y;
                    Rectangle bounds = imageCanvas.getBounds();
                    imageCanvas.setBounds(bounds.x, bounds.y, bounds.width, bounds.height + diff);
                    bounds = paletteCanvasBounds;
                    paletteCanvas.setBounds(bounds.x, bounds.y, bounds.width, bounds.height + diff);
                    bounds = dataLabelBounds;
                    dataLabel.setBounds(bounds.x, bounds.y + diff, bounds.width, bounds.height);
                    bounds = dataText.getBounds();
                    dataText.setBounds(bounds.x, bounds.y + diff, bounds.width, bounds.height - diff);
                // shell.layout(true);
                }
            }
        }
    });
    // Label to show data-specific fields.
    dataLabel = new Label(shell, SWT.NONE);
    dataLabel.setText(ImageAnalyzer.bundle.getString("Pixel_data_initial"));
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    gridData.horizontalAlignment = GridData.FILL;
    dataLabel.setLayoutData(gridData);
    // Text to show a dump of the data.
    dataText = new StyledText(shell, SWT.BORDER | SWT.MULTI | SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL);
    dataText.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    dataText.setFont(fixedWidthFont);
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.verticalAlignment = GridData.FILL;
    gridData.heightHint = 128;
    gridData.grabExcessVerticalSpace = true;
    dataText.setLayoutData(gridData);
    dataText.addMouseListener(new MouseAdapter() {

        public void mouseDown(MouseEvent event) {
            if (image != null && event.button == 1)
                showColorForData();
        }
    });
    dataText.addKeyListener(new KeyAdapter() {

        public void keyPressed(KeyEvent event) {
            if (image != null)
                showColorForData();
        }
    });
    // Label to show status and cursor location in image.
    statusLabel = new Label(shell, SWT.NONE);
    statusLabel.setText("");
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    gridData.horizontalAlignment = GridData.FILL;
    statusLabel.setLayoutData(gridData);
}
Example 12
Project: geotools-old-master  File: SimpleStyleConfigurator.java View source code
@Override
protected Control createDialogArea(Composite parent) {
    Composite parentPanel = (Composite) super.createDialogArea(parent);
    setLayout(parentPanel);
    // ensure vertical layout
    ((RowLayout) parentPanel.getLayout()).type = SWT.VERTICAL;
    ((RowLayout) parentPanel.getLayout()).spacing = 3;
    KeyAdapter adp = new KeyAdapter() {

        @Override
        public void keyReleased(KeyEvent e) {
            /*
                 * I don't like having different ways of checking for keypad enter and the normal
                 * one. Using the keyCode would be better, but I couldn't readily find the value for
                 * CR.
                 */
            if (e.keyCode == SWT.KEYPAD_CR || e.character == SWT.CR) {
                // makeActionDoStuff();
                refresh();
            }
        }
    };
    Composite part = AbstractSimpleConfigurator.subpart(parentPanel, Messages.getString("SimpleStyleConfigurator_GeometryLabel"));
    geometryName = new ComboViewer(part);
    geometryName.setContentProvider(new IStructuredContentProvider() {

        FeatureType schema;

        public Object[] getElements(Object inputElement) {
            // note use of descriptors; so we can make use of associations if available
            ArrayList<String> names = new ArrayList<String>();
            names.add(DEFAULT_GEOMETRY);
            if (schema != null) {
                for (PropertyDescriptor descriptor : schema.getDescriptors()) {
                    if (descriptor instanceof GeometryDescriptor) {
                        names.add(((GeometryDescriptor) descriptor).getLocalName());
                    }
                }
            }
            return names.toArray();
        }

        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
            // we don't really care since we are not listening to the change in schema
            schema = (FeatureType) newInput;
        }

        public void dispose() {
        }
    });
    geometryName.getCombo().setText(DEFAULT_GEOMETRY);
    geometryName.getCombo().addSelectionListener(synchronize);
    part = AbstractSimpleConfigurator.subpart(parentPanel, Messages.getString("SimpleStyleConfigurator_ModeLabel"));
    this.pointMode = new Button(part, SWT.RADIO);
    pointMode.setText(Messages.getString("SimpleStyleConfigurator_PointMode"));
    this.lineMode = new Button(part, SWT.RADIO);
    lineMode.setText(Messages.getString("SimpleStyleConfigurator_LineMode"));
    this.polyMode = new Button(part, SWT.RADIO);
    polyMode.setText(Messages.getString("SimpleStyleConfigurator_PolygonMode"));
    this.line.createControl(parentPanel, adp);
    this.fill.createControl(parentPanel, adp);
    this.point.createControl(parentPanel, adp, this.build);
    this.label.createControl(parentPanel, adp);
    this.minScale.createControl(parentPanel, adp);
    this.maxScale.createControl(parentPanel, adp);
    Composite replaceComp = AbstractSimpleConfigurator.subpart(parentPanel, Messages.getString("SimpleStyleConfigurator_replaceButton"));
    this.replace = new Button(replaceComp, SWT.CHECK);
    replace.addSelectionListener(synchronize);
    replace.setSelection(true);
    refresh();
    return parentPanel;
}
Example 13
Project: pentaho-kettle-master  File: DatabaseDialogHarness.java View source code
private void showDialog() {
    XulDomContainer container = null;
    try {
        DatabaseConnectionDialog dcDialog = new DatabaseConnectionDialog();
        container = dcDialog.getSwtInstance(new Shell(SWT.NONE));
        if (database != null) {
            container.getEventHandler("dataHandler").setData(database);
        }
    } catch (XulException e) {
        e.printStackTrace();
    }
    XulRoot root = (XulRoot) container.getDocumentRoot().getRootElement();
    if (root instanceof XulDialog) {
        ((XulDialog) root).show();
    }
    if (root instanceof XulWindow) {
        ((XulWindow) root).open();
    }
    try {
        database = (DatabaseMeta) container.getEventHandler("dataHandler").getData();
    } catch (Exception e) {
        e.printStackTrace();
    }
    String message = DatabaseDialogHarness.setMessage(database);
    Shell shell = new Shell(SWT.DIALOG_TRIM);
    shell.setLayout(new RowLayout());
    Label label = new Label(shell, SWT.NONE);
    label.setText(message);
    Button button = new Button(shell, SWT.NONE);
    button.setText("Edit Database ...");
    button.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            try {
                showDialog();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
        if (!shell.getDisplay().readAndDispatch()) {
            shell.getDisplay().sleep();
        }
    }
}
Example 14
Project: CodingSpectator-master  File: UploadPreview.java View source code
private void createButtons(Composite parent) {
    Composite buttons = new Composite(parent, SWT.NONE);
    GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, false);
    buttons.setLayoutData(layoutData);
    buttons.setLayout(new RowLayout());
    createAddFilterButton(buttons);
    createRemoveFilterButton(buttons);
    final FilterChangeListener filterChangeListener = new FilterChangeListener() {

        public void filterChanged() {
            updateButtons();
        }
    };
    parameters.getFilter().addFilterChangeListener(filterChangeListener);
    parent.addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
            parameters.getFilter().removeFilterChangeListener(filterChangeListener);
        }
    });
    updateButtons();
}
Example 15
Project: teiid-designer-master  File: EditPropertyDialog.java View source code
@SuppressWarnings("unused")
private Section createPropertyValueSection(Composite body, FormToolkit toolkit) {
    Section section = FormUtil.createSection(this.managedForm, toolkit, body, Messages.editPropertyDialogPropertyValueSectionTitle, Messages.editPropertyDialogPropertyValueSectionDescription, SECTION_STYLE, true);
    final Composite finalContainer;
    SECTION: {
        Composite container = toolkit.createComposite(section);
        finalContainer = container;
        container.setLayout(new GridLayout());
        container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
        section.setClient(container);
    }
    TOP: {
        Button btnRequired = toolkit.createButton(finalContainer, Messages.editPropertyDialogRequiredButtonText, SWT.CHECK);
        this.requiredError.setControl(btnRequired);
        btnRequired.setSelection(this.propDefn.isRequired());
        btnRequired.setToolTipText(Messages.editPropertyDialogRequiredButtonToolTip);
        btnRequired.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                handleRequiredChanged(((Button) e.widget).getSelection());
            }
        });
        Button btnMasked = toolkit.createButton(finalContainer, Messages.editPropertyDialogMaskedButtonText, SWT.CHECK);
        this.maskedError.setControl(btnMasked);
        btnMasked.setSelection(this.propDefn.isMasked());
        btnMasked.setToolTipText(Messages.editPropertyDialogMaskedButtonToolTip);
        btnMasked.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                handleMaskedChanged(((Button) e.widget).getSelection());
            }
        });
    }
    MIDDLE: {
        Composite middle = toolkit.createComposite(finalContainer);
        GridLayout middleLayout = new GridLayout(2, false);
        middleLayout.horizontalSpacing = 0;
        middleLayout.marginHeight = 0;
        middleLayout.marginWidth = 0;
        middle.setLayout(middleLayout);
        middle.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
        this.btnAllowedValues = toolkit.createButton(middle, Messages.editPropertyDialogAllowedValuesButtonText, SWT.CHECK);
        this.btnAllowedValues.setToolTipText(Messages.editPropertyDialogAllowedValuesButtonToolTip);
        this.btnAllowedValues.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
        ((GridData) this.btnAllowedValues.getLayoutData()).horizontalSpan = 2;
        this.btnAllowedValues.setEnabled(Type.BOOLEAN != this.propDefn.getType());
        this.lstAllowedValues = new org.eclipse.swt.widgets.List(middle, SWT.SINGLE | SWT.BORDER);
        this.allowedValuesError.setControl(this.lstAllowedValues);
        this.lstAllowedValues.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
        ((GridData) this.lstAllowedValues.getLayoutData()).horizontalIndent = 20;
        ((GridData) this.lstAllowedValues.getLayoutData()).heightHint = this.lstAllowedValues.getItemHeight() * 5;
        this.lstAllowedValues.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                handleAllowedValueSelected();
            }
        });
        // wait until after populating list before adding selection listener
        this.btnAllowedValues.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                handleHasAllowedValuesSelected();
            }
        });
        Composite pnlButtons = toolkit.createComposite(middle);
        RowLayout btnLayout = new RowLayout(SWT.VERTICAL);
        btnLayout.marginLeft = 0;
        btnLayout.marginRight = 0;
        btnLayout.spacing = 0;
        btnLayout.marginTop = 0;
        btnLayout.marginBottom = 0;
        pnlButtons.setLayout(btnLayout);
        pnlButtons.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
        // configure add allowed value button
        this.btnAddValue = toolkit.createButton(pnlButtons, CoreStringUtil.Constants.EMPTY_STRING, SWT.FLAT);
        this.btnAddValue.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                handleAddAllowedValue();
            }
        });
        this.btnAddValue.setToolTipText(Messages.editPropertyDialogAddAllowedValueButtonToolTip);
        this.btnAddValue.setImage(Activator.getDefault().getImage(ImageIds.ADD_VALUE));
        // configure edit allowed value button
        this.btnEditValue = toolkit.createButton(pnlButtons, CoreStringUtil.Constants.EMPTY_STRING, SWT.FLAT);
        this.btnEditValue.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                handleEditAllowedValue();
            }
        });
        this.btnEditValue.setToolTipText(Messages.editPropertyDialogEditAllowedValueButtonToolTip);
        this.btnEditValue.setImage(Activator.getDefault().getImage(ImageIds.EDIT_VALUE));
        // configure remove allowed value button
        this.btnRemoveValue = toolkit.createButton(pnlButtons, CoreStringUtil.Constants.EMPTY_STRING, SWT.FLAT);
        this.btnRemoveValue.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                handleRemoveAllowedValue();
            }
        });
        this.btnRemoveValue.setToolTipText(Messages.editPropertyDialogRemoveAllowedValueButtonToolTip);
        this.btnRemoveValue.setImage(Activator.getDefault().getImage(ImageIds.REMOVE_VALUE));
        // populate allowed values and set initial enablements
        if (isEditMode()) {
            String[] allowedValues = this.propDefn.getAllowedValues();
            if ((allowedValues != null) && (allowedValues.length != 0)) {
                this.btnAllowedValues.setSelection(true);
                this.lstAllowedValues.setItems(allowedValues);
            }
        }
        boolean enable = this.btnAllowedValues.getSelection() && this.btnAllowedValues.getEnabled();
        this.lstAllowedValues.setEnabled(enable);
        this.btnAddValue.setEnabled(enable);
        this.btnEditValue.setEnabled(false);
        this.btnRemoveValue.setEnabled(false);
    }
    BOTTOM: {
        Composite bottom = toolkit.createComposite(finalContainer, SWT.NONE);
        bottom.setLayout(new GridLayout(2, false));
        bottom.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
        this.btnInitialValue = toolkit.createButton(bottom, Messages.editPropertyDialogInitialValueButtonText, SWT.CHECK);
        this.btnInitialValue.setToolTipText(Messages.editPropertyDialogInitialValueButtonToolTip);
        this.btnInitialValue.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                handleHasInitialValueSelected();
            }
        });
        this.txtInitialValue = toolkit.createText(bottom, CoreStringUtil.Constants.EMPTY_STRING, TEXT_STYLE);
        this.initialValueError.setControl(this.txtInitialValue);
        this.txtInitialValue.addModifyListener(new ModifyListener() {

            @Override
            public void modifyText(ModifyEvent e) {
                handleInitialValueChanged(((Text) e.widget).getText());
            }
        });
        this.txtInitialValue.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
        this.btnFixedValue = toolkit.createButton(bottom, Messages.editPropertyDialogFixedValueButtonText, SWT.CHECK);
        this.btnFixedValue.setToolTipText(Messages.editPropertyDialogFixedValueButtonToolTip);
        this.btnFixedValue.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                handleHasFixedValueSelected();
            }
        });
        this.btnFixedValue.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
        ((GridData) this.btnFixedValue.getLayoutData()).horizontalIndent = 20;
        ((GridData) this.btnFixedValue.getLayoutData()).horizontalSpan = 2;
        if (!CoreStringUtil.isEmpty(this.propDefn.getDefaultValue())) {
            this.btnInitialValue.setSelection(true);
            this.txtInitialValue.setText(this.propDefn.getDefaultValue());
        } else if (!CoreStringUtil.isEmpty(this.propDefn.getFixedValue())) {
            this.btnInitialValue.setSelection(true);
            this.btnFixedValue.setSelection(true);
            this.txtInitialValue.setText(this.propDefn.getFixedValue());
        } else {
            this.btnInitialValue.setSelection(false);
            this.btnFixedValue.setSelection(false);
            this.btnFixedValue.setEnabled(false);
        }
    }
    return section;
}
Example 16
Project: eclipse-integration-commons-master  File: DashboardMainPage.java View source code
private void createFeedsSection(Composite parent, final String title, FeedType feedType, String feedName) {
    final Section section = new Section(parent, ExpandableComposite.TITLE_BAR) {

        @Override
        public void redraw() {
            GridData compositeData = (GridData) feedsScrolled.getLayoutData();
            compositeData.widthHint = getSize().x - 35;
            compositeData.heightHint = getSize().y - 40;
            compositeData.grabExcessHorizontalSpace = false;
            compositeData.grabExcessVerticalSpace = false;
            super.redraw();
        }
    };
    form.addControlListener(new ControlAdapter() {

        @Override
        public void controlResized(ControlEvent e) {
            GridData data = (GridData) section.getLayoutData();
            data.heightHint = form.getSize().y - FEEDS_TEXT_WRAP_INDENT;
        }
    });
    toolkit.adapt(section);
    section.setTitleBarForeground(toolkit.getColors().getColor(IFormColors.TB_TOGGLE));
    section.setTitleBarBackground(toolkit.getColors().getColor(IFormColors.TB_BG));
    section.setTitleBarBorderColor(toolkit.getColors().getColor(IFormColors.TB_BORDER));
    section.setFont(FormFonts.getInstance().getBoldFont(getSite().getShell().getDisplay(), section.getFont()));
    section.setText(title);
    section.setLayout(new GridLayout());
    GridDataFactory.fillDefaults().grab(true, true).hint(300, 300).applyTo(section);
    final Composite headerComposite = toolkit.createComposite(section, SWT.NONE);
    RowLayout rowLayout = new RowLayout();
    rowLayout.marginTop = 0;
    rowLayout.marginBottom = 0;
    headerComposite.setLayout(rowLayout);
    headerComposite.setBackground(null);
    ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
    toolBarManager.createControl(headerComposite);
    final PageBook pagebook = new PageBook(section, SWT.NONE);
    toolkit.adapt(pagebook);
    pagebook.setLayoutData(new GridLayout());
    final Composite disclaimer = createDisclaimer(pagebook);
    feedsScrolled = new ScrolledComposite(pagebook, SWT.V_SCROLL);
    feedsScrolled.setExpandVertical(false);
    feedsScrolled.setLayout(new GridLayout());
    feedsScrolled.setAlwaysShowScrollBars(false);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(feedsScrolled);
    toolkit.adapt(feedsScrolled);
    feedsComposite = toolkit.createComposite(feedsScrolled);
    feedsComposite.setLayout(new TableWrapLayout());
    GridDataFactory.fillDefaults().grab(true, false).applyTo(feedsComposite);
    feedsScrolled.setContent(feedsComposite);
    feedsComposite.addPaintListener(new PaintListener() {

        public void paintControl(PaintEvent e) {
            GridData data = (GridData) feedsComposite.getLayoutData();
            data.widthHint = section.getSize().x - FEEDS_TEXT_WRAP_INDENT;
            data.heightHint = form.getSize().y - 50;
        }
    });
    section.addControlListener(new ControlAdapter() {

        @Override
        public void controlResized(ControlEvent e) {
            GridData data = (GridData) feedsScrolled.getLayoutData();
            data.heightHint = form.getSize().y - 50;
            data.grabExcessVerticalSpace = false;
            feedsScrolled.setSize(section.getSize().x - 40, form.getSize().y - 50);
            for (Control feedControl : feedControls) {
                if (!feedControl.isDisposed()) {
                    ((TableWrapData) feedControl.getLayoutData()).maxWidth = section.getSize().x - FEEDS_TEXT_WRAP_INDENT;
                // Point size = feedControl.computeSize(data.widthHint,
                // 400);
                // feedControl.setSize(size);
                // feedControl.pack(true);
                }
            }
            feedsComposite.pack();
        }

        ;
    });
    feedControls = new HashSet<Control>();
    final Map<String, String> springMap = new HashMap<String, String>();
    String[] urls = ResourceProvider.getUrls(RESOURCE_DASHBOARD_FEEDS_BLOGS);
    for (String url : urls) {
        springMap.put(url, null);
    }
    getEditorSite().getShell().getDisplay().asyncExec(new Runnable() {

        public void run() {
            FeedsReader reader = new FeedsReader();
            CachedFeedsManager manager = new CachedFeedsManager(title, springMap, reader);
            try {
                manager.readCachedFeeds(null);
                Set<SyndEntry> entries = new HashSet<SyndEntry>();
                for (SyndFeed entry : reader.getFeeds()) {
                    entries.addAll(entry.getEntries());
                }
                if (!getManagedForm().getForm().isDisposed()) {
                    displayFeeds(entries, feedsComposite, feedsScrolled, pagebook, disclaimer, section);
                }
            } catch (IllegalArgumentException e) {
                StatusHandler.log(new Status(IStatus.ERROR, IdeUiPlugin.PLUGIN_ID, "An unexpected error occurred while retrieving feed content from cache.", e));
            } catch (FeedException e) {
                StatusHandler.log(new Status(IStatus.ERROR, IdeUiPlugin.PLUGIN_ID, "An unexpected error occurred while retrieving feed content from cache.", e));
            }
        }
    });
    refreshFeedsAction = new Action("Refresh Feeds", CommonImages.REFRESH) {

        @Override
        public void run() {
            Map<String, String> springMap = getFeedsMap();
            displayFeeds(feedsComposite, feedsScrolled, pagebook, disclaimer, springMap, title, section);
        }
    };
    Action configureURLsAction = new Action("Configure URLs", StsUiImages.RSS_CONFIGURE) {

        @Override
        public void run() {
            PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getSite().getShell(), URL_CONFIGURATION_ID, new String[] { URL_CONFIGURATION_ID }, null);
            dialog.open();
        }
    };
    section.setClient(pagebook);
    section.setTextClient(headerComposite);
    toolBarManager.add(configureURLsAction);
    toolBarManager.add(refreshFeedsAction);
    toolBarManager.update(true);
    refreshFeedsAction.run();
}
Example 17
Project: dltk.ruby-master  File: RubyTestingMainLaunchConfigurationTab.java View source code
protected void createTestEngineEditor(Composite parent, String text) {
    Label fTestEngine = new Label(parent, SWT.NONE);
    fTestEngine.setText(text);
    engineType = new Combo(parent, SWT.SINGLE | SWT.BORDER | SWT.DROP_DOWN);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    engineType.setLayoutData(gd);
    engineType.addModifyListener(getWidgetListener());
    detect = createPushButton(parent, DLTKTestingMessages.MainLaunchConfigurationTab_detectEngine, null);
    ITestingEngine[] engines = TestingEngineManager.getEngines(getNatureID());
    for (int i = 0; i < engines.length; i++) {
        String name = engines[i].getName();
        this.engineType.add(name);
        nameToId.put(name, engines[i].getId());
    }
    detect.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            handleDetectButtonSelected();
        }
    });
    // place holder
    new Label(parent, SWT.NONE);
    Composite engineStatusComposite = new Composite(parent, SWT.NONE);
    gd = new GridData();
    gd.horizontalSpan = ((GridLayout) parent.getLayout()).numColumns - 1;
    engineStatusComposite.setLayoutData(gd);
    engineStatusComposite.setLayout(new RowLayout());
    engineMessageImageLabel = new Label(engineStatusComposite, SWT.NONE);
    engineMessageLabel = new Label(engineStatusComposite, SWT.NONE);
}
Example 18
Project: pmd-eclipse-plugin-master  File: PMDProjectPropertyPage.java View source code
/**
     * @see PropertyPage#createContents(Composite)
     */
@Override
protected Control createContents(final Composite parent) {
    log.info("PMD properties editing requested");
    controller = new PMDPropertyPageController(getShell());
    final IProject project = (IProject) getElement().getAdapter(IProject.class);
    controller.setProject(project);
    model = controller.getPropertyPageBean();
    Composite composite = null;
    noDefaultAndApplyButton();
    if (project.isAccessible() && model != null) {
        composite = new Composite(parent, SWT.NONE);
        final GridLayout layout = new GridLayout();
        composite.setLayout(layout);
        enablePMDButton = buildEnablePMDButton(composite);
        Label separator = new Label(composite, SWT.SEPARATOR | SWT.SHADOW_IN | SWT.HORIZONTAL);
        GridData data = new GridData();
        data.horizontalAlignment = GridData.FILL;
        data.grabExcessHorizontalSpace = true;
        separator.setLayoutData(data);
        includeDerivedFilesButton = buildIncludeDerivedFilesButton(composite);
        separator = new Label(composite, SWT.SEPARATOR | SWT.SHADOW_IN | SWT.HORIZONTAL);
        data = new GridData();
        data.horizontalAlignment = GridData.FILL;
        data.grabExcessHorizontalSpace = true;
        separator.setLayoutData(data);
        violationsAsErrorsButton = buildViolationsAsErrorsButton(composite);
        fullBuildEnabledButton = buildFullBuildEnabledButton(composite);
        separator = new Label(composite, SWT.SEPARATOR | SWT.SHADOW_IN | SWT.HORIZONTAL);
        data = new GridData();
        data.horizontalAlignment = GridData.FILL;
        data.grabExcessHorizontalSpace = true;
        separator.setLayoutData(data);
        selectedWorkingSetLabel = buildSelectedWorkingSetLabel(composite);
        data = new GridData();
        data.horizontalAlignment = GridData.FILL;
        data.grabExcessHorizontalSpace = true;
        selectedWorkingSetLabel.setLayoutData(data);
        Composite workingSetPanel = new Composite(composite, SWT.NONE);
        RowLayout rowLayout = new RowLayout();
        rowLayout.type = SWT.HORIZONTAL;
        rowLayout.justify = true;
        rowLayout.pack = false;
        rowLayout.wrap = false;
        workingSetPanel.setLayout(rowLayout);
        buildSelectWorkingSetButton(workingSetPanel);
        deselectWorkingSetButton = buildDeselectWorkingSetButton(workingSetPanel);
        separator = new Label(composite, SWT.SEPARATOR | SWT.SHADOW_IN | SWT.HORIZONTAL);
        data = new GridData();
        data.horizontalAlignment = GridData.FILL;
        data.grabExcessHorizontalSpace = true;
        separator.setLayoutData(data);
        Group ruleSourceGroup = new Group(composite, SWT.BORDER);
        ruleSourceGroup.setText("Rule source");
        activeControls.add(ruleSourceGroup);
        data = new GridData();
        data.grabExcessHorizontalSpace = true;
        data.grabExcessVerticalSpace = true;
        data.horizontalAlignment = GridData.FILL;
        data.verticalAlignment = GridData.FILL;
        ruleSourceGroup.setLayoutData(data);
        ruleSourceGroup.setLayout(new GridLayout());
        final Composite ruleSetPanel = new Composite(ruleSourceGroup, SWT.NONE);
        GridLayout gridLayout = new GridLayout();
        gridLayout.numColumns = 3;
        ruleSetPanel.setLayout(gridLayout);
        data = new GridData();
        data.grabExcessHorizontalSpace = true;
        data.horizontalAlignment = GridData.FILL;
        ruleSetPanel.setLayoutData(data);
        ruleSetStoredInProjectButton = buildStoreRuleSetInProjectButton(ruleSetPanel);
        ruleSetFileText = buildRuleSetFileText(ruleSetPanel);
        ruleSetBrowseButton = buildRuleSetBrowseButton(ruleSetPanel);
        data = new GridData(SWT.FILL, SWT.NONE, true, false);
        ruleSetFileText.setLayoutData(data);
        final Composite ruleTablePanel = new Composite(ruleSourceGroup, SWT.NONE);
        gridLayout = new GridLayout(2, false);
        ruleTablePanel.setLayout(gridLayout);
        data = new GridData();
        data.grabExcessHorizontalSpace = true;
        data.horizontalAlignment = GridData.FILL;
        data.widthHint = 230;
        ruleTablePanel.setLayoutData(data);
        //buildLabel(composite, StringKeys.PROPERTY_LABEL_SELECT_RULE);
        final Table availableRulesTable = buildAvailableRulesTableViewer(ruleTablePanel);
        data = new GridData();
        //	            data.grabExcessVerticalSpace = true;
        //	            data.horizontalAlignment = GridData.FILL;
        data.verticalAlignment = GridData.FILL;
        data.heightHint = 250;
        availableRulesTable.setLayoutData(data);
        ruleDescriptionField = new SummaryPanelManager("asdf", "asdf", null, null);
        ruleDescriptionPanel = ruleDescriptionField.setupOn(ruleTablePanel);
        data = new GridData();
        data.grabExcessHorizontalSpace = true;
        data.widthHint = 200;
        data.horizontalAlignment = GridData.FILL;
        data.verticalAlignment = GridData.FILL;
        ruleDescriptionPanel.setLayoutData(data);
        adjustControls();
    } else {
        setValid(false);
    }
    log.debug("Property page created");
    return composite;
}
Example 19
Project: WS171-development-master  File: SysinfoPanel.java View source code
/**
     * Create our controls for the UI panel.
     */
@Override
protected Control createControl(Composite parent) {
    Composite top = new Composite(parent, SWT.NONE);
    top.setLayout(new GridLayout(1, false));
    top.setLayoutData(new GridData(GridData.FILL_BOTH));
    Composite buttons = new Composite(top, SWT.NONE);
    buttons.setLayout(new RowLayout());
    mDisplayMode = new Combo(buttons, SWT.PUSH);
    for (String mode : CAPTIONS) {
        mDisplayMode.add(mode);
    }
    mDisplayMode.select(mMode);
    mDisplayMode.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            mMode = mDisplayMode.getSelectionIndex();
            if (mDataFile != null) {
                generateDataset(mDataFile);
            } else if (getCurrentDevice() != null) {
                loadFromDevice();
            }
        }
    });
    final Button loadButton = new Button(buttons, SWT.PUSH);
    loadButton.setText("Load from File");
    loadButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            FileDialog fileDialog = new FileDialog(loadButton.getShell(), SWT.OPEN);
            fileDialog.setText("Load bugreport");
            String filename = fileDialog.open();
            if (filename != null) {
                mDataFile = new File(filename);
                generateDataset(mDataFile);
            }
        }
    });
    mFetchButton = new Button(buttons, SWT.PUSH);
    mFetchButton.setText("Update from Device");
    mFetchButton.setEnabled(false);
    mFetchButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            loadFromDevice();
        }
    });
    mLabel = new Label(top, SWT.NONE);
    mLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    mDataset = new DefaultPieDataset();
    JFreeChart chart = ChartFactory.createPieChart("", mDataset, false, /* legend */
    true, /* tooltips */
    false);
    ChartComposite chartComposite = new ChartComposite(top, SWT.BORDER, chart, ChartComposite.DEFAULT_HEIGHT, ChartComposite.DEFAULT_HEIGHT, ChartComposite.DEFAULT_MINIMUM_DRAW_WIDTH, ChartComposite.DEFAULT_MINIMUM_DRAW_HEIGHT, 3000, // max draw width. We don't want it to zoom, so we put a big number
    3000, // off-screen buffer
    true, // properties
    true, // save
    true, // print
    true, // zoom
    false, true);
    chartComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    return top;
}
Example 20
Project: Disco-Build-System-master  File: FileGroupContentPropertyPage.java View source code
/*=====================================================================================*
	 * PROTECTED METHODS
	 *=====================================================================================*/
/**
	 * Create the widgets that appear within the properties dialog box.
	 */
@Override
protected Control createContents(Composite parent) {
    /* determine the numeric ID of the file group */
    UIFileGroup fileGroup = (UIFileGroup) GraphitiUtils.getBusinessObjectFromElement(getElement(), UIFileGroup.class);
    if (fileGroup == null) {
        return null;
    }
    fileGroupId = fileGroup.getId();
    fileGroupType = fileGroupMgr.getGroupType(fileGroupId);
    if (!fetchMembers(fileGroupId)) {
        return null;
    }
    setTitle("File Group Content:");
    /* 
		 * Create a panel in which all sub-widgets are added. The first (of 2)
		 * columns will content the "list" of files in the file group. The
		 * second (of 2) columns contain buttons for performing actions
		 * on those files.
		 */
    Composite panel = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    panel.setLayout(layout);
    /*
		 * The first column - the list of files in the file group.
		 */
    filesList = new TreeViewer(panel, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    filesList.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    contentProvider = new FileGroupContentProvider(buildStore, fileGroupType);
    filesList.setContentProvider(contentProvider);
    filesList.setLabelProvider(new FileGroupLabelProvider(buildStore, fileGroupType));
    /*
		 * The second column - buttons that we can press to modify the file group content
		 */
    Composite buttonPanel = new Composite(panel, SWT.NONE);
    buttonPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
    RowLayout buttonPanelLayout = new RowLayout(SWT.VERTICAL);
    buttonPanelLayout.fill = true;
    buttonPanelLayout.marginLeft = buttonPanelLayout.marginRight = 10;
    buttonPanelLayout.spacing = 10;
    buttonPanel.setLayout(buttonPanelLayout);
    /* add button - adds a new file to the source file group */
    if (fileGroupType == IFileGroupMgr.SOURCE_GROUP) {
        final Button newButton = new Button(buttonPanel, SWT.NONE);
        newButton.setText("Add File");
        newButton.addListener(SWT.Selection, new Listener() {

            @Override
            public void handleEvent(Event event) {
                performAddOperation();
            }
        });
    }
    /* delete button - deletes the selected files */
    final Button deleteButton = new Button(buttonPanel, SWT.NONE);
    deleteButton.setText("Delete");
    deleteButton.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(Event event) {
            performDeleteOperation();
        }
    });
    /* move up button - move the selected files upwards in the list */
    final Button moveUpButton = new Button(buttonPanel, SWT.NONE);
    moveUpButton.setText("Move Up");
    moveUpButton.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(Event event) {
            performMoveOperation(-1);
        }
    });
    /* move down button - move the selected files down the list */
    final Button moveDownButton = new Button(buttonPanel, SWT.NONE);
    moveDownButton.setText("Move Down");
    moveDownButton.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(Event event) {
            performMoveOperation(1);
        }
    });
    /*
		 * When items in the list box are selected/deselected, we need to enable/disable
		 * the buttons accordingly. By default, all buttons are disabled.
		 */
    deleteButton.setEnabled(false);
    moveUpButton.setEnabled(false);
    moveDownButton.setEnabled(false);
    filesList.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            if (programmaticallySelecting) {
                return;
            }
            int selectedFilesCount = handleSelection();
            deleteButton.setEnabled(selectedFilesCount >= 1);
            enableMoveButtons(moveUpButton, moveDownButton);
        }
    });
    /* populate the TreeViewer control with all the file members */
    populateList(filesList);
    return panel;
}
Example 21
Project: Eclipse-Postfix-Code-Completion-master  File: GenerateToStringDialog.java View source code
@Override
protected Composite createCommentSelection(Composite parentComposite) {
    Composite composite = super.createCommentSelection(parentComposite);
    Group group = new Group(parentComposite, SWT.NONE);
    group.setText(JavaUIMessages.GenerateToStringDialog_generated_code_group);
    GridLayout groupLayout = new GridLayout();
    group.setLayout(groupLayout);
    group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    Composite composite2 = new Composite(group, SWT.NONE);
    GridLayout layout = new GridLayout(3, false);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    composite2.setLayout(layout);
    composite2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    formatLabel = new Label(composite2, SWT.NONE);
    formatLabel.setText(JavaUIMessages.GenerateToStringDialog_string_format_combo);
    GridData gridData = new GridData(SWT.FILL, SWT.CENTER, false, false);
    formatLabel.setLayoutData(gridData);
    formatCombo = new Combo(composite2, SWT.READ_ONLY);
    formatCombo.setItems(getTemplateNames());
    formatCombo.select(fGenerationSettings.stringFormatTemplateNumber);
    formatCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    SWTUtil.setDefaultVisibleItemCount(formatCombo);
    formatCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            fGenerationSettings.stringFormatTemplateNumber = ((Combo) e.widget).getSelectionIndex();
        }
    });
    final Button formatButton = new Button(composite2, SWT.NONE);
    formatButton.setText(JavaUIMessages.GenerateToStringDialog_manage_templates_button);
    setButtonLayoutData(formatButton);
    formatButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            manageTemplatesButtonSelected();
        }
    });
    final Label styleLabel = new Label(composite2, SWT.NONE);
    styleLabel.setText(JavaUIMessages.GenerateToStringDialog_code_style_combo);
    gridData = new GridData(SWT.FILL, SWT.CENTER, false, false);
    styleLabel.setLayoutData(gridData);
    final Combo styleCombo = new Combo(composite2, SWT.READ_ONLY);
    styleCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    styleCombo.setItems(GenerateToStringOperation.getStyleNames());
    styleCombo.select(Math.min(fGenerationSettings.toStringStyle, styleCombo.getItemCount() - 1));
    SWTUtil.setDefaultVisibleItemCount(styleCombo);
    styleCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            changeToStringStyle(((Combo) e.widget).getSelectionIndex());
        }
    });
    styleButton = new Button(composite2, SWT.NONE);
    styleButton.setText(JavaUIMessages.GenerateToStringDialog_codeStyleConfigureButton);
    setButtonLayoutData(styleButton);
    styleButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            configureStyleButtonSelected();
        }
    });
    skipNullsButton = new Button(group, SWT.CHECK);
    skipNullsButton.setText(JavaUIMessages.GenerateToStringDialog_skip_null_button);
    skipNullsButton.setSelection(fGenerationSettings.skipNulls);
    skipNullsButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            fGenerationSettings.skipNulls = ((Button) event.widget).getSelection();
        }
    });
    final Button arrayButton = new Button(group, SWT.CHECK);
    arrayButton.setText(JavaUIMessages.GenerateToStringDialog_ignore_default_button);
    arrayButton.setSelection(fGenerationSettings.customArrayToString);
    arrayButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            fGenerationSettings.customArrayToString = ((Button) e.widget).getSelection();
        }
    });
    Composite limitRow = new Composite(group, SWT.NONE);
    RowLayout rowLayout = new RowLayout();
    rowLayout.center = true;
    rowLayout.marginLeft = rowLayout.marginRight = rowLayout.marginTop = rowLayout.marginBottom = 0;
    limitRow.setLayout(rowLayout);
    final Button limitButton = new Button(limitRow, SWT.CHECK);
    limitButton.setText(JavaUIMessages.GenerateToStringDialog_limit_elements_button);
    limitButton.setSelection(fGenerationSettings.limitElements);
    limitButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            fGenerationSettings.limitElements = ((Button) e.widget).getSelection();
        }
    });
    final Spinner limitSpinner = new Spinner(limitRow, SWT.BORDER);
    limitSpinner.setMinimum(0);
    limitSpinner.setSelection(fGenerationSettings.limitValue);
    limitSpinner.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            fGenerationSettings.limitValue = ((Spinner) e.widget).getSelection();
        }
    });
    //invoked to change initial enable state of controls
    changeToStringStyle(styleCombo.getSelectionIndex());
    return composite;
}