javatips.net counter

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: rap-osgi-tutorial-ece2011-master  File: MenuBar.java View source code
@Override
public Control contribute(Composite parent) {
    final Composite result = new Composite(parent, SWT.INHERIT_DEFAULT);
    result.setData(WidgetUtil.CUSTOM_VARIANT, MENUBAR_BACKGROUND);
    RowLayout layout = new RowLayout();
    layout.marginTop = 8;
    layout.marginLeft = 30;
    result.setLayout(layout);
    final PageService pageService = serviceProvider.get(PageService.class);
    pageService.addPageTracker(new PageTracker() {

        @Override
        public void pageAdded(UIContributor page) {
            buttons.put(page.getId(), createMenuButton(result, pageService, page.getId()));
        }

        @Override
        public void pageRemoved(UIContributor page) {
            Button removed = buttons.remove(page.getId());
            removed.dispose();
            selectMenuBarButton();
        }
    });
    return result;
}
Example 2
Project: RWT_CONFIG_ADMIN_EXAMPLE-master  File: MenuBarProvider.java View source code
@Override
public Control contribute(Composite parent) {
    final Composite result = new Composite(parent, SWT.INHERIT_DEFAULT);
    result.setData(RWT.CUSTOM_VARIANT, MENUBAR_BACKGROUND);
    result.setLayout(new RowLayout());
    final PageService pageService = serviceProvider.get(PageService.class);
    pageService.addPageTracker(new PageTracker() {

        Map<UIContributor, Button> buttons = new HashMap<UIContributor, Button>();

        @Override
        public void pageAdded(UIContributor page) {
            buttons.put(page, createMenuButton(result, pageService, page.getId()));
        }

        @Override
        public void pageRemoved(UIContributor page) {
            Button removed = buttons.remove(page);
            removed.dispose();
        }
    });
    return result;
}
Example 3
Project: MOCBuilder-master  File: ColorPicker.java View source code
public void showDialog() {
    if (shell == null || shell.isDisposed()) {
        Display display = widget.getDisplay();
        shell = new Shell(display, SWT.CLOSE | SWT.TOOL | SWT.ON_TOP);
        shell.setText(title);
        shell.setLayout(new FormLayout());
        TabFolder tabFolder = new TabFolder(shell, SWT.NONE);
        tabFolder.setLayout(new RowLayout(SWT.HORIZONTAL));
        FormData fd_group = new FormData();
        fd_group.top = new FormAttachment(0, 0);
        fd_group.left = new FormAttachment(0, 0);
        fd_group.bottom = new FormAttachment(0, 210);
        fd_group.right = new FormAttachment(0, 600);
        tabFolder.setLayoutData(fd_group);
        int numOfColumns = 16;
        Button button;
        Composite unit;
        int counter = 0;
        for (ColorCategoryT colorCategoryT : ColorCategoryT.values()) {
            if (ColorLibrary.sharedColorLibrary().getColorTList(colorCategoryT).size() == 0)
                continue;
            unit = new Composite(tabFolder, SWT.NONE);
            unit.setLayout(new GridLayout(numOfColumns, true));
            TabItem tbtmNewItem = new TabItem(tabFolder, SWT.NONE);
            tbtmNewItem.setControl(unit);
            tbtmNewItem.setText("" + colorCategoryT);
            counter = 0;
            for (LDrawColorT colorT : ColorLibrary.sharedColorLibrary().getColorTList(colorCategoryT)) {
                button = new Button(unit, SWT.FLAT);
                button.setImage(imageMap.get(colorT));
                button.setData(colorT);
                button.setToolTipText(colorT.name().substring(5));
                button.addSelectionListener(listener);
                counter++;
            }
            if (counter >= numOfColumns)
                unit.setLayout(new GridLayout(numOfColumns, true));
            else
                unit.setLayout(new GridLayout(counter, true));
            unit.pack();
        }
        tabFolder.pack();
        shell.pack();
        shell.open();
    } else if (shell.isVisible()) {
        shell.setVisible(false);
    } else {
        shell.open();
    }
}
Example 4
Project: e4-rendering-master  File: TrimBarRenderer.java View source code
@Override
public void createWidget(MUIElement element, MElementContainer<MUIElement> parent) {
    if (!(element instanceof MTrimBar)) {
        return;
    }
    // CoolBar coolBar = new CoolBar((Shell) parent.getWidget(), SWT.NONE);
    Composite coolBar = new Composite((Shell) parent.getWidget(), SWT.NONE);
    // coolBar.setLocked(true);
    // CoolItem item = new CoolItem(coolBar, SWT.NONE);
    final MTrimBar trimBar = (MTrimBar) element;
    element.setWidget(coolBar);
    switch(trimBar.getSide().getValue()) {
        case SideValue.TOP_VALUE:
            coolBar.setLayoutData(SimpleTrimLayout.TOP);
            coolBar.setLayout(new RowLayout(SWT.HORIZONTAL));
            break;
        case SideValue.BOTTOM_VALUE:
            coolBar.setLayoutData(SimpleTrimLayout.BOTTOM);
            coolBar.setLayout(new RowLayout(SWT.HORIZONTAL));
            break;
        case SideValue.LEFT_VALUE:
            coolBar.setLayoutData(SimpleTrimLayout.LEFT);
            coolBar.setLayout(new RowLayout(SWT.VERTICAL));
            break;
        case SideValue.RIGHT_VALUE:
            coolBar.setLayoutData(SimpleTrimLayout.RIGHT);
            coolBar.setLayout(new RowLayout(SWT.VERTICAL));
            break;
    }
}
Example 5
Project: eclipse.platform.ui-master  File: Bug42024Test.java View source code
/*
     * @see TestCase#setUp()
     */
@Override
protected void doSetUp() throws Exception {
    super.doSetUp();
    // Create a window with a KeySequenceText
    Display display = Display.getCurrent();
    shell = new Shell(display);
    shell.setLayout(new RowLayout());
    text = new KeySequenceText(new Text(shell, SWT.BORDER));
    // Open it
    shell.pack();
    shell.open();
}
Example 6
Project: mylyn-reviews-master  File: AbstractUiFactoryProvider.java View source code
public Composite createControls(IUiContext context, Composite parent, FormToolkit toolkit, EObjectType object) {
    Composite buttonComposite = new Composite(parent, SWT.NONE);
    RowLayout layout = new RowLayout();
    layout.center = true;
    layout.spacing = 10;
    buttonComposite.setLayout(layout);
    List<AbstractUiFactory<EObjectType>> factories = createFactories(context, object);
    for (AbstractUiFactory<EObjectType> factory : factories) {
        factory.createControl(context, buttonComposite, toolkit);
    }
    return buttonComposite;
}
Example 7
Project: mylyn.commons-master  File: TestCredentialsDialog.java View source code
public static void main(String[] args) {
    Display display = new Display();
    final Shell shell = new Shell(display);
    shell.setText("Test Credentials Dialog");
    shell.setLayout(new RowLayout());
    Button userButton = new Button(shell, SWT.PUSH);
    userButton.setText("Username/Password");
    userButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            CredentialsDialog dialog = new CredentialsDialog(shell, Mode.USER);
            dialog.create();
            dialog.setMessage("Enter password");
            dialog.open();
            System.err.println("User name: " + dialog.getUserName());
            System.err.println("Password: " + dialog.getPassword());
            System.err.println("Save password: " + dialog.getSavePassword());
        }
    });
    Button domainButton = new Button(shell, SWT.PUSH);
    domainButton.setText("Domain");
    domainButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            CredentialsDialog dialog = new CredentialsDialog(shell, Mode.USER);
            dialog.setNeedsDomain(true);
            dialog.create();
            dialog.setMessage("Enter password");
            dialog.open();
            System.err.println("User name: " + dialog.getUserName());
            System.err.println("Password: " + dialog.getPassword());
            System.err.println("Domain: " + dialog.getDomain());
            System.err.println("Save password: " + dialog.getSavePassword());
        }
    });
    Button keyStoreButton = new Button(shell, SWT.PUSH);
    keyStoreButton.setText("Key Store");
    keyStoreButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            CredentialsDialog dialog = new CredentialsDialog(shell, Mode.KEY_STORE);
            dialog.create();
            dialog.setMessage("Enter keystore location");
            dialog.open();
            System.err.println("Key store filename: " + dialog.getKeyStoreFileName());
            System.err.println("Password: " + dialog.getPassword());
            System.err.println("Save password: " + dialog.getSavePassword());
        }
    });
    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
}
Example 8
Project: opal-master  File: SnippetGradientComposite.java View source code
public static void main(final String[] args) {
    final Display display = new Display();
    final Shell shell = new Shell(display);
    shell.setBackgroundMode(SWT.INHERIT_DEFAULT);
    final FillLayout layout1 = new FillLayout(SWT.VERTICAL);
    layout1.marginWidth = layout1.marginHeight = 10;
    shell.setLayout(layout1);
    // Displays the composite
    final GradientComposite composite = new GradientComposite(shell, SWT.NONE);
    composite.setGradientEnd(display.getSystemColor(SWT.COLOR_WHITE));
    composite.setGradientStart(display.getSystemColor(SWT.COLOR_DARK_RED));
    // And the content
    final RowLayout layout2 = new RowLayout(SWT.VERTICAL);
    layout2.marginWidth = layout2.marginHeight = layout2.spacing = 10;
    composite.setLayout(layout2);
    for (int i = 0; i < 8; i++) {
        final Button button = new Button(composite, SWT.RADIO);
        button.setForeground(display.getSystemColor(SWT.COLOR_RED));
        button.setText("Button " + i);
    }
    // Open the shell
    shell.setSize(640, 360);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    display.dispose();
}
Example 9
Project: org.eclipse.rap-master  File: ListExample.java View source code
public void createControl(final Composite parent) {
    parent.setLayout(ExampleUtil.createGridLayout(1, false, 10, 20));
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(ExampleUtil.createGridLayout(3, false, 5, 20));
    composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    final List leftList = new List(composite, LIST_STYLE);
    leftList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    addDragSupport(leftList);
    addDropSupport(leftList);
    Composite buttons = new Composite(composite, SWT.NONE);
    RowLayout layout = new RowLayout(SWT.VERTICAL);
    layout.fill = true;
    buttons.setLayout(layout);
    final Button addButton = createButton(buttons, "Add", IMG_ADD);
    final Button removeButton = createButton(buttons, "Remove", IMG_REMOVE);
    final List rightList = new List(composite, LIST_STYLE);
    rightList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    addDragSupport(rightList);
    addDropSupport(rightList);
    leftList.setItems(ELEMENTS);
    addButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            moveSelectedItems(leftList, rightList);
        }
    });
    removeButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            moveSelectedItems(rightList, leftList);
        }
    });
}
Example 10
Project: rap-master  File: Bug42024Test.java View source code
/*
     * @see TestCase#setUp()
     */
protected void doSetUp() throws Exception {
    super.doSetUp();
    // Create a window with a KeySequenceText
    Display display = Display.getCurrent();
    shell = new Shell(display);
    shell.setLayout(new RowLayout());
    text = new KeySequenceText(new Text(shell, SWT.BORDER));
    // Open it
    shell.pack();
    shell.open();
}
Example 11
Project: RedisClient-master  File: TableWithPageSize.java View source code
public static void main(String[] args) {
    Display display = new Display();
    final Shell shell = new Shell(display);
    shell.setLayout(new RowLayout(SWT.VERTICAL));
    final Table table = new Table(shell, SWT.VIRTUAL | SWT.BORDER);
    table.addListener(SWT.SetData, new Listener() {

        public void handleEvent(Event event) {
            TableItem item = (TableItem) event.item;
            int index = table.indexOf(item);
            int start = index / PAGE_SIZE * PAGE_SIZE;
            int end = Math.min(start + PAGE_SIZE, table.getItemCount());
            for (int i = start; i < end; i++) {
                item = table.getItem(i);
                item.setText("Item " + i);
            }
        }
    });
    table.setLayoutData(new RowData(200, 200));
    long t1 = System.currentTimeMillis();
    table.setItemCount(COUNT);
    long t2 = System.currentTimeMillis();
    System.out.println("Items: " + COUNT + ", Time: " + (t2 - t1) + " (ms) [page=" + PAGE_SIZE + "]");
    shell.layout();
    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}
Example 12
Project: sonarlint-eclipse-master  File: ServerUpdateAvailablePopup.java View source code
@Override
protected void createContentArea(Composite composite) {
    composite.setLayout(new GridLayout(1, true));
    Label messageLabel = new Label(composite, SWT.WRAP);
    GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
    messageLabel.setLayoutData(layoutData);
    messageLabel.setText("Updates are available on SonarQube server '" + server.getId() + "'.\nDo you want to download and update them now?");
    messageLabel.setBackground(composite.getBackground());
    Composite links = new Composite(composite, SWT.NONE);
    links.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    RowLayout rowLayout = new RowLayout();
    rowLayout.spacing = 20;
    links.setLayout(rowLayout);
    Link detailsLink = new Link(links, SWT.NONE);
    detailsLink.setText("<a>Remind me later</a>");
    detailsLink.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            ServerUpdateAvailablePopup.this.close();
        }
    });
    Link updateLink = new Link(links, SWT.NONE);
    updateLink.setText("<a>Update now</a>");
    updateLink.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            ServerUpdateAvailablePopup.this.close();
            ServerUpdateJob job = new ServerUpdateJob(server);
            JobUtils.scheduleAnalysisOfOpenFilesInBoundProjects(job, server, TriggerType.BINDING_CHANGE);
            job.schedule();
        }
    });
}
Example 13
Project: bundlemaker-master  File: RadioGroupDialogField.java View source code
/**
   * <p>
   * </p>
   * 
   */
protected void init() {
    // create the composite
    this.setLayout(new FillLayout(SWT.VERTICAL));
    // create the label
    Label aLabel = new Label(this, SWT.NO);
    aLabel.setText(_label);
    //
    SelectionListener selectionListener = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            _selection = ((Button) e.getSource()).getData();
        }
    };
    //
    _buttons = new Button[_values.length];
    Composite group1 = new Composite(this, SWT.NO);
    group1.setLayout(new RowLayout(_layoutType));
    for (int i = 0; i < _values.length; i++) {
        _buttons[i] = new Button(group1, SWT.RADIO);
        _buttons[i].setText(_names[i]);
        _buttons[i].setData(_values[i]);
        _buttons[i].addSelectionListener(selectionListener);
    }
}
Example 14
Project: CAL-Eclipse-Plug-in-master  File: BooleanEditor.java View source code
/**
     * @see org.openquark.cal.eclipse.ui.metadataeditor.EditorComponent#createEditorComponent(org.eclipse.swt.widgets.Composite, org.eclipse.ui.forms.widgets.FormToolkit)
     */
@Override
Control createEditorComponent(Composite parent, FormToolkit formToolkit) {
    editorPanel = formToolkit.createComposite(parent);
    editorPanel.setLayout(new RowLayout(SWT.HORIZONTAL));
    yesButton = formToolkit.createButton(editorPanel, MetadataEditorMessages.YesButtonLabel, SWT.RADIO);
    yesButton.addSelectionListener(selectionListener);
    noButton = formToolkit.createButton(editorPanel, MetadataEditorMessages.NoButtonLabel, SWT.RADIO);
    noButton.addSelectionListener(selectionListener);
    return editorPanel;
}
Example 15
Project: cdt-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 16
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 17
Project: com.packtpub.e4-master  File: TimeZoneView.java View source code
@Override
public void createPartControl(Composite parent) {
    Map<String, Set<ZoneId>> timeZones = TimeZoneComparator.getTimeZones();
    CTabFolder tabs = new CTabFolder(parent, SWT.BOTTOM);
    timeZones.forEach(( region,  zones) -> {
        CTabItem item = new CTabItem(tabs, SWT.NONE);
        item.setText(region);
        ScrolledComposite scrolled = new ScrolledComposite(tabs, SWT.H_SCROLL | SWT.V_SCROLL);
        Composite clocks = new Composite(scrolled, SWT.NONE);
        clocks.setBackground(clocks.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
        item.setControl(scrolled);
        scrolled.setContent(clocks);
        clocks.setLayout(new RowLayout());
        RGB rgb = new RGB(128, 128, 128);
        zones.forEach( zone -> {
            Group group = new Group(clocks, SWT.SHADOW_ETCHED_IN);
            group.setText(zone.getId().split("/")[1]);
            group.setLayout(new FillLayout());
            new ClockWidget(group, SWT.NONE, rgb).setZone(zone);
        });
        Point size = clocks.computeSize(SWT.DEFAULT, SWT.DEFAULT);
        scrolled.setMinSize(size);
        scrolled.setExpandHorizontal(true);
        scrolled.setExpandVertical(true);
    });
    tabs.setSelection(0);
}
Example 18
Project: extFM-Tooling-master  File: GeneratePropertiesDialog.java View source code
@Override
protected Control createCustomArea(Composite parent) {
    Composite composite1 = new Composite(parent, SWT.NULL);
    composite1.setLayout(new RowLayout());
    Label consistentLabel = new Label(composite1, SWT.NULL);
    consistentLabel.setText("Generate only mappings, where all viewpoints are consistent?");
    generateConsistentMappingButtonTrue = new Button(composite1, SWT.RADIO);
    generateConsistentMappingButtonTrue.setText("Yes");
    Button generateConsistentMappingButtonFalse = new Button(composite1, SWT.RADIO);
    generateConsistentMappingButtonFalse.setText("No.");
    Composite composite2 = new Composite(parent, SWT.NULL);
    composite2.setLayout(new RowLayout());
    Label generateViewmodelLabel = new Label(composite2, SWT.NULL);
    generateViewmodelLabel.setText("Generate view model?");
    generateViewmodelButtonTrue = new Button(composite2, SWT.RADIO);
    generateViewmodelButtonTrue.setText("Yes");
    Button generateViewmodelButtonFalse = new Button(composite2, SWT.RADIO);
    generateViewmodelButtonFalse.setText("No.");
    Composite composite3 = new Composite(parent, SWT.NULL);
    composite3.setLayout(new RowLayout());
    Label reuseMappingLabel = new Label(composite3, SWT.NULL);
    reuseMappingLabel.setText("Reuse mapping?");
    reuseMappingButtonTrue = new Button(composite3, SWT.RADIO);
    reuseMappingButtonTrue.setText("Yes");
    Button reuseMappingButtonFalse = new Button(composite3, SWT.RADIO);
    reuseMappingButtonFalse.setText("No.");
    // set Buttons selected
    boolean generateConsistentMapping = properties.isGenerateConsistentMapping();
    generateConsistentMappingButtonTrue.setSelection(generateConsistentMapping);
    generateConsistentMappingButtonFalse.setSelection(!generateConsistentMapping);
    boolean generateViewmodel = properties.isGenerateViewmodel();
    generateViewmodelButtonTrue.setSelection(generateViewmodel);
    generateViewmodelButtonFalse.setSelection(!generateViewmodel);
    boolean reuseMapping = properties.isReuseMapping();
    reuseMappingButtonTrue.setSelection(reuseMapping);
    reuseMappingButtonFalse.setSelection(!reuseMapping);
    return parent;
}
Example 19
Project: fsmls-master  File: EcoreFeatureGroupPage.java View source code
private void addPropertyWizardPageToComposite(Composite composite) {
    RowLayout rl = new RowLayout(SWT.VERTICAL);
    rl.fill = true;
    composite.setLayout(rl);
    //		if (attribute.getEType().getInstanceClassName().equals("char")||attribute.getEType().getInstanceClassName().equals("byte")||
    //				isAttributeANumericPrimitive(attribute.getEType().getInstanceClassName()) || attribute.getEType().getInstanceClass().equals(String.class)){
    //			new Label (composite, SWT.NONE).setText("Enter a value for " + attribute.getEContainingClass().getName()+"'s "+attribute.getName()+" ("+attribute.getEType().getInstanceClassName() + ") attribute.");
    //			valueText=new Text(composite,SWT.BORDER);
    //			if (attribute.getEType().getInstanceClassName().equals("char")){			
    //				valueText.setTextLimit(1);
    //			}
    //		}
    //		else if (attribute.getEType().getInstanceClassName().equals("boolean")){
    new Label(composite, SWT.NONE).setText("Make a selection");
    featureGroupCombo = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
    for (EStructuralFeature structuralFeature : structuralFeatures) {
        featureGroupCombo.add(structuralFeature.getName());
    }
//		}
//    	else{
//    		new Label (composite, SWT.NONE).setText("Fill in the constructor parameters for the " + attribute.getEContainingClass().getName()+"'s "+attribute.getName()+" ("+attribute.getEType().getInstanceClassName() + ") attribute.");
//    		Class attributeClass = attribute.getEType().getInstanceClass();
//    		if (attributeClass.getConstructors().length != 0){
//    			
//    			//first loop through and check for 1 primitive constructor. 
//    			for (Constructor currentConstructor : attributeClass.getConstructors()) {
//    				if (currentConstructor.getParameterTypes().length == 1 && (currentConstructor.getParameterTypes()[0].isPrimitive()||currentConstructor.getParameterTypes()[0].equals(String.class))){
//    					//if the single param is a primitive or a string then we have it. 
//    					classConstructor = currentConstructor;
//    					break;
//    				}
//    			}
//    			if (classConstructor == null){
//    				//otherwise serach for next simplist. 
//    				for (Constructor currentConstructor : attributeClass.getConstructors()) {
//    					boolean isConstructorPrimitive = true;
//    					for (Class paramType : currentConstructor.getParameterTypes()) {
//    						if (!paramType.isPrimitive()&& !paramType.equals(String.class)){
//    							isConstructorPrimitive = false;
//    							break;
//    						}
//    					}
//    					if (isConstructorPrimitive == true){
//    						classConstructor = currentConstructor;
//    						break;
//    					}
//    				}
//    			}
//    			if (classConstructor == null){
//    				return;
//    			}
//    			for (Class paramType : classConstructor.getParameterTypes()) {
//					if (paramType.isPrimitive() || paramType.equals(String.class)){
//						new Label (composite,SWT.NONE).setText("Enter a value for the " +paramType.getName()+" ("+ paramType.getSimpleName() + ") type constructor parameter." );
//						constructorParameters.add(new Text (composite,SWT.BORDER));
//					}
//				}
//    		}
//    	}
}
Example 20
Project: FURCAS-master  File: ChoosePrettyPrintModeDialog.java View source code
private void createContents(final Shell shell) {
    shell.setLayout(new GridLayout());
    Group buttonGroup = new Group(shell, SWT.SHADOW_IN);
    buttonGroup.setText(this.title);
    buttonGroup.setLayout(new RowLayout(SWT.VERTICAL));
    SelectionListener selectionListener = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            selectedMode = (PrettyPrintingModes) ((Button) e.getSource()).getData();
        }
    };
    for (PrettyPrintingModes ppm : PrettyPrintingModes.values()) {
        Button b = new Button(buttonGroup, SWT.RADIO);
        b.setText(ppm.getValue());
        b.setData(ppm);
        b.addSelectionListener(selectionListener);
    }
    Button buttonOK = new Button(shell, SWT.PUSH);
    buttonOK.setText("OK");
    buttonOK.setLayoutData(new GridData(SWT.RIGHT, SWT.BOTTOM, false, false));
    buttonOK.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            shell.close();
        }
    });
}
Example 21
Project: hale-master  File: CompatibilityModeComposite.java View source code
/**
	 * @see org.eclipse.jface.action.ControlContribution#createControl(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createControl(Composite parent) {
    // initiate the composite for the compatibility elements
    Composite comp = new Composite(parent, SWT.NONE);
    comp.setLayout(new RowLayout(SWT.HORIZONTAL));
    // label for displaying the status of the mode
    final Label statusLabel = new Label(comp, SWT.NONE);
    statusLabel.setImage(CommonSharedImages.getImageRegistry().get(CommonSharedImages.IMG_SIGNED_YES));
    // label for displaying the mode itself
    final Label modeLabel = new Label(comp, SWT.NONE);
    // Menu for mode selection on left click
    IContributionItem popupMenu = new CompatibilityMenu();
    final MenuManager mmanager = new MenuManager();
    mmanager.add(popupMenu);
    modeLabel.setMenu(mmanager.createContextMenu(modeLabel));
    modeLabel.addMouseListener(new MouseListener() {

        @Override
        public void mouseDoubleClick(MouseEvent e) {
        // TODO Auto-generated method stub
        }

        @Override
        public void mouseDown(MouseEvent e) {
        // TODO Auto-generated method stub
        }

        @Override
        public void mouseUp(MouseEvent e) {
            modeLabel.getMenu().setVisible(true);
        }
    });
    // listener to update the mode label
    modeListener = new ExclusiveExtensionListener<CompatibilityMode, CompatibilityModeFactory>() {

        @Override
        public void currentObjectChanged(final CompatibilityMode arg0, final CompatibilityModeFactory arg1) {
            PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {

                @Override
                public void run() {
                    modeLabel.setText(cs.getCurrentDefinition().getDisplayName());
                }
            });
        }
    };
    cs.addListener(modeListener);
    // listener for updating the mode status label
    compListener = new CompatibilityServiceListener() {

        @Override
        public void compatibilityChanged(final boolean isCompatible, List<Cell> incompatibleCells) {
            PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {

                @Override
                public void run() {
                    if (isCompatible) {
                        statusLabel.setImage(CommonSharedImages.getImageRegistry().get(CommonSharedImages.IMG_SIGNED_YES));
                        statusLabel.setToolTipText("No incompatibility detected!");
                    }
                    if (!isCompatible) {
                        statusLabel.setImage(CommonSharedImages.getImageRegistry().get(CommonSharedImages.IMG_SIGNED_NO));
                        statusLabel.setToolTipText("Incompatibility detected!");
                    }
                }
            });
        }
    };
    cs.addCompatibilityListener(compListener);
    modeLabel.setText(cs.getCurrentDefinition().getDisplayName());
    statusLabel.setToolTipText("No incompatibility detected!");
    return comp;
}
Example 22
Project: logbook-master  File: LauncherWindow.java View source code
/**
     * Create contents of the dialog.
     */
private void createContents() {
    super.createContents(this.parent, SWT.CLOSE | SWT.TITLE | SWT.RESIZE | SWT.TOOL, false);
    this.getShell().setText("ツール");
    final Shell shell = this.getShell();
    shell.setLayout(new RowLayout(SWT.HORIZONTAL));
    this.recreateButtons(AppConfig.get().getToolButtons());
    // 設定�クリックメニュー
    final MenuItem configButton = new MenuItem(this.getPopupMenu(), SWT.PUSH, 0);
    configButton.setText("ボタン設定");
    configButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            final ConfigDialog configDialog = new ConfigDialog(ApplicationMain.main);
            configDialog.open();
            shell.getDisplay().asyncExec(new Runnable() {

                @Override
                public void run() {
                    configDialog.selectPane("ツール");
                }
            });
        }
    });
    new MenuItem(this.getPopupMenu(), SWT.SEPARATOR, 1);
    shell.layout();
}
Example 23
Project: mobicents-master  File: SipPhoneView.java View source code
public void createPartControl(final Composite parent) {
    sipCommunicator = new SipCommunicatorOSGIBootstrap(SipPhoneActivator.getDefault().getBundle().getBundleContext());
    Composite main = new Composite(parent, SWT.NONE);
    GridLayout verticalLayout = new GridLayout();
    verticalLayout.numColumns = 1;
    verticalLayout.verticalSpacing = 1;
    verticalLayout.horizontalSpacing = 1;
    main.setLayout(verticalLayout);
    Composite upper = new Composite(main, SWT.NONE);
    Composite lower = new Composite(main, SWT.NONE);
    RowLayout upperRowLayout = new RowLayout();
    upperRowLayout.justify = false;
    upper.setLayout(upperRowLayout);
    outVisualization = new VisualizationCanvas(upper, SWT.NO_REDRAW_RESIZE | SWT.NO_BACKGROUND | SWT.DOUBLE_BUFFERED, 250, 80, 90);
    inVisualization = new VisualizationCanvas(upper, SWT.NO_REDRAW_RESIZE | SWT.NO_BACKGROUND | SWT.DOUBLE_BUFFERED, 250, 80, 90);
    RowLayout lowerRowLayout = new RowLayout();
    lowerRowLayout.justify = true;
    lowerRowLayout.wrap = false;
    lowerRowLayout.marginLeft = 0;
    lowerRowLayout.marginRight = 0;
    lowerRowLayout.spacing = 0;
    lower.setLayout(lowerRowLayout);
    PhoneControls phoneControls = new PhoneControls(lower, SWT.NONE);
    phoneControls.setSipPhoneView(this);
    keypad = new Keypad(lower, SWT.NONE);
    Dictionary propertiesOut = new Properties();
    propertiesOut.put("TYPE", "OUT");
    SipPhoneActivator.getDefault().getBundle().getBundleContext().registerService(VisualizationService.class.getName(), outVisualization, propertiesOut);
    Dictionary propertiesIn = new Properties();
    propertiesIn.put("TYPE", "IN");
    SipPhoneActivator.getDefault().getBundle().getBundleContext().registerService(VisualizationService.class.getName(), inVisualization, propertiesIn);
//phoneControls.setLayoutData(new RowData(150, 310));
}
Example 24
Project: nebula-master  File: PagePrintExample.java View source code
/**
	 * Executes the GridPrint example.
	 * 
	 * @param args
	 *            the command line arguments.
	 */
public static void main(String[] args) {
    final Display display = new Display();
    Shell shell = new Shell(display, SWT.SHELL_TRIM);
    shell.setText("PagePrintExample.java");
    shell.setLayout(new GridLayout());
    shell.setSize(600, 800);
    final PrintJob job = new PrintJob("PagePrintExample.java", createPrint());
    Composite buttonPanel = new Composite(shell, SWT.NONE);
    buttonPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    buttonPanel.setLayout(new RowLayout(SWT.HORIZONTAL));
    final PrintPreview preview = new PrintPreview(shell, SWT.BORDER);
    Button prev = new Button(buttonPanel, SWT.PUSH);
    prev.setText("<< Prev");
    prev.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            preview.setPageIndex(Math.max(preview.getPageIndex() - 1, 0));
        }
    });
    Button next = new Button(buttonPanel, SWT.PUSH);
    next.setText("Next >>");
    next.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            preview.setPageIndex(Math.min(preview.getPageIndex() + 1, preview.getPageCount() - 1));
        }
    });
    Button print = new Button(buttonPanel, SWT.PUSH);
    print.setText("Print");
    print.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            PaperClips.print(job, new PrinterData());
        }
    });
    preview.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    preview.setFitHorizontal(true);
    preview.setFitVertical(true);
    preview.setPrintJob(job);
    shell.open();
    while (!shell.isDisposed()) if (!display.readAndDispatch())
        display.sleep();
    display.dispose();
}
Example 25
Project: org.eclipse.rap.ui.views.properties.tabbed-master  File: SampleView.java View source code
/**
     * This is a callback that will allow us to create the viewer and initialize
     * it.
     */
public void createPartControl(Composite parent) {
    // create all the GUI controls
    // create two groups
    viewer = new ListViewer(parent, SWT.SINGLE);
    grp1 = new Group(parent, SWT.NONE);
    //$NON-NLS-1$
    grp1.setText("Preview");
    RowLayout rowLayout = new RowLayout();
    grp1.setLayout(rowLayout);
    Button btn = new Button(grp1, SWT.PUSH);
    //$NON-NLS-1$
    btn.setText("Hello");
    // fill in the element
    ArrayList ctlList = new ArrayList();
    //$NON-NLS-1$
    ButtonElement btnEl = new ButtonElement(btn, "Button");
    ctlList.add(btnEl);
    viewer.setContentProvider(new ArrayContentProvider());
    viewer.setLabelProvider(new WorkbenchLabelProvider());
    viewer.setInput(ctlList);
    getSite().setSelectionProvider(viewer);
}
Example 26
Project: penrose-studio-master  File: SelectAttributeTypeDialog.java View source code
public void createControl(final Shell parent) {
    parent.setLayout(new GridLayout());
    attributeTable = new Table(parent, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
    attributeTable.setHeaderVisible(true);
    attributeTable.setLinesVisible(true);
    attributeTable.setLayoutData(new GridData(GridData.FILL_BOTH));
    TableColumn tc = new TableColumn(attributeTable, SWT.NONE);
    tc.setText("Name");
    tc.setWidth(200);
    tc = new TableColumn(attributeTable, SWT.NONE);
    tc.setText("Description");
    tc.setWidth(350);
    Composite buttons = new Composite(parent, SWT.NONE);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalAlignment = GridData.END;
    buttons.setLayoutData(gd);
    buttons.setLayout(new RowLayout());
    Button saveButton = new Button(buttons, SWT.PUSH);
    saveButton.setText("Select");
    saveButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            TableItem items[] = attributeTable.getSelection();
            for (TableItem item : items) {
                selections.add(item.getText());
            }
            action = Window.OK;
            shell.close();
        }
    });
    Button cancelButton = new Button(buttons, SWT.PUSH);
    cancelButton.setText("Cancel");
    cancelButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            shell.close();
        }
    });
}
Example 27
Project: riena-master  File: SvgSubModuleView.java View source code
@Override
protected void basicCreatePartControl(final Composite parent) {
    parent.setBackground(LnfManager.getLnf().getColor(LnfKeyConstants.SUB_MODULE_BACKGROUND));
    final RowLayout rowLayout = new RowLayout();
    rowLayout.type = SWT.VERTICAL;
    parent.setLayout(rowLayout);
    final Composite textComposite = new Composite(parent, SWT.NONE);
    textComposite.setLayout(rowLayout);
    final Label lblInfo = new Label(textComposite, SWT.WRAP);
    lblInfo.setText(//$NON-NLS-1$
    "Actually available for this example are three svg images(cloud.svg,cloudX.svg and cloudY.svg). The cloud.svg is the default icon and will be used when the user requests a specific version of the cloud icon which is not available. The other icons were mapped to a specific IconSize.");
    lblInfo.setLayoutData(new RowData(500, SWT.DEFAULT));
    final Label lblMapping = new Label(textComposite, SWT.WRAP);
    lblMapping.setText(//$NON-NLS-1$
    "The mapping is a great way to reduce the amount of icons needed for different purposes, like icons in buttons or toolbars or for use as the application logo.");
    lblMapping.setLayoutData(new RowData(500, SWT.DEFAULT));
    final Label lblmapping = new Label(textComposite, SWT.NONE);
    //$NON-NLS-1$
    lblmapping.setText("The mapping looks like:\nIconSize.B22 -> X\nIconSize.E64 -> Y ");
    final Composite pictureComposite = new Composite(parent, SWT.NONE);
    pictureComposite.setLayout(rowLayout);
    final GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    final Composite compositeA = new Composite(pictureComposite, SWT.NONE);
    compositeA.setLayout(layout);
    final Label lblA = UIControlsFactory.createLabel(compositeA, "", "lblX");
    final Label lblTA = new Label(compositeA, SWT.WRAP);
    lblTA.setText(//$NON-NLS-1$
    "This is the cloudX.svg. By requesting the cloud image with the IconSize of B22 the application automatically used the X variant of the cloud.svg. The X group is ment to be used for small Iconsizes with less details. ");
    lblTA.setLayoutData(new GridData(500, SWT.DEFAULT));
    final Composite compositeB = new Composite(pictureComposite, SWT.NONE);
    compositeB.setLayout(layout);
    final Label lblB = UIControlsFactory.createLabel(compositeB, "", "lblY");
    final Label lblTB = new Label(compositeB, SWT.WRAP);
    lblTB.setText(//$NON-NLS-1$
    "This is the cloudY.svg. By requesting the cloud image with the IconSize of E64 the application automatically used the Y variant of the cloud.svg. The Y group is ment to be used for bigger Iconsizes with more details.");
    lblTB.setLayoutData(new GridData(500, SWT.DEFAULT));
    final Composite compositeC = new Composite(pictureComposite, SWT.NONE);
    compositeC.setLayout(layout);
    final Label lblC = new Label(compositeC, SWT.NONE);
    //$NON-NLS-1$
    final Image imageC = ImageStore.getInstance().getImage("cloud", IconSize.C32);
    lblC.setImage(imageC);
    final Label lblTC = new Label(compositeC, SWT.WRAP);
    lblTC.setText(//$NON-NLS-1$
    "This is the cloud.svg. Here we tried to request the cloud Image with IconSize of C32, but the IconSize C32 was not mapped to a specific group, so the application used the default image");
    lblTC.setLayoutData(new GridData(500, SWT.DEFAULT));
}
Example 28
Project: sloot-editor-master  File: RowLayoutSnippet.java View source code
/**
   * The main method.
   *
   * @param args the arguments
   */
public static void main(String[] args) {
    Display display = new Display();
    Image image1 = display.getSystemImage(SWT.ICON_WORKING);
    Image image2 = display.getSystemImage(SWT.ICON_QUESTION);
    Image image3 = display.getSystemImage(SWT.ICON_ERROR);
    Shell shell = new Shell(display);
    shell.setLayout(new FillLayout());
    final ScrolledComposite scrollComposite = new ScrolledComposite(shell, SWT.V_SCROLL | SWT.BORDER);
    final Composite parent = new Composite(scrollComposite, SWT.NONE);
    for (int i = 0; i <= 300; i++) {
        Label label = new Label(parent, SWT.NONE);
        if (i % 3 == 0) {
            label.setImage(image1);
            Point p = label.getLocation();
            p.x = p.x * -1;
            label.setLocation(p);
        }
        if (i % 3 == 1)
            label.setImage(image2);
        if (i % 3 == 2)
            label.setImage(image3);
    }
    RowLayout layout = new RowLayout(SWT.HORIZONTAL);
    layout.wrap = true;
    parent.setLayout(layout);
    scrollComposite.setContent(parent);
    scrollComposite.setExpandVertical(true);
    scrollComposite.setExpandHorizontal(true);
    scrollComposite.addControlListener(new ControlAdapter() {

        public void controlResized(ControlEvent e) {
            Rectangle r = scrollComposite.getClientArea();
            scrollComposite.setMinSize(parent.computeSize(r.width, SWT.DEFAULT));
        }
    });
    shell.setSize(300, 300);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    display.dispose();
}
Example 29
Project: SpagoBI-Studio-master  File: NewConsoleTemplateWizardPage.java View source code
public void createControl(Composite parent) {
    logger.debug("IN");
    try {
        Composite all = new Composite(parent, SWT.NONE);
        Shell shell = all.getShell();
        setPageComplete(false);
        all.setLayout(new RowLayout(SWT.VERTICAL));
        Group nameComposite = new org.eclipse.swt.widgets.Group(all, SWT.BORDER);
        GridLayout nameLayout = new GridLayout();
        int ncol = 2;
        nameLayout.numColumns = ncol;
        nameComposite.setLayout(nameLayout);
        nameComposite.setLayoutData(new RowData(500, 90));
        //Name Field
        Label setName = new Label(nameComposite, SWT.NONE);
        setName.setText("Name:");
        GridData gridDataName = new GridData();
        gridDataName.horizontalAlignment = GridData.FILL;
        gridDataName.grabExcessHorizontalSpace = true;
        setName.setLayoutData(gridDataName);
        templateNameText = new Text(nameComposite, SWT.BORDER);
        templateNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
        templateNameText.addModifyListener(new ModifyListener() {

            public void modifyText(ModifyEvent event) {
                if (templateNameText.getText().equalsIgnoreCase("")) {
                    setPageComplete(false);
                } else {
                    setPageComplete(true);
                }
            }
        });
        // Group down
        /*
			final Group belowComposite=new Group(all,SWT.BORDER);		
			belowComposite.setLayoutData(new RowData(500,300));
			final StackLayout layout = new StackLayout();
			belowComposite.setLayout(layout);
			*/
        setControl(all);
    } catch (Exception e) {
        logger.error("Error in opening the wizard", e);
    }
    logger.debug("OUT");
}
Example 30
Project: stocks-master  File: SecurityMasterDataPage.java View source code
@Override
public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    setControl(container);
    GridLayoutFactory.fillDefaults().numColumns(2).margins(5, 5).applyTo(container);
    //$NON-NLS-1$
    ComboViewer currencyCode = bindings.bindCurrencyCodeCombo(container, Messages.ColumnCurrency, "currencyCode");
    if (model.getSecurity().hasTransactions(model.getClient())) {
        currencyCode.getCombo().setEnabled(false);
        // empty cell
        //$NON-NLS-1$
        new Label(container, SWT.NONE).setText("");
        Composite info = new Composite(container, SWT.NONE);
        info.setLayout(new RowLayout());
        Label l = new Label(info, SWT.NONE);
        l.setImage(Images.INFO.image());
        l = new Label(info, SWT.NONE);
        l.setText(Messages.MsgInfoChangingCurrencyNotPossible);
    }
    //$NON-NLS-1$
    bindings.bindISINInput(container, Messages.ColumnISIN, "isin");
    //$NON-NLS-1$
    bindings.bindStringInput(container, Messages.ColumnTicker, "tickerSymbol", SWT.NONE, 12);
    //$NON-NLS-1$
    bindings.bindStringInput(container, Messages.ColumnWKN, "wkn", SWT.NONE, 12);
    //$NON-NLS-1$
    Control control = bindings.bindBooleanInput(container, Messages.ColumnRetired, "retired");
    Image image = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage();
    ControlDecoration deco = new ControlDecoration(control, SWT.TOP | SWT.LEFT);
    deco.setDescriptionText(Messages.MsgInfoRetiredSecurities);
    deco.setImage(image);
    deco.show();
    //$NON-NLS-1$
    bindings.bindStringInput(container, Messages.ColumnNote, "note");
}
Example 31
Project: swtknob-master  File: Example4.java View source code
/**
	 * Creates the window's contents
	 * 
	 * @param shell
	 *            the parent shell
	 */
private void createContents(Shell shell) {
    shell.setLayout(new GridLayout(1, true));
    // Create the buttons to create tabs
    Composite composite = new Composite(shell, SWT.NONE);
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    composite.setLayout(new RowLayout());
    // Create the tabs
    tabFolder = new CTabFolder(shell, SWT.TOP);
    tabFolder.setBorderVisible(true);
    tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
    CTabItem item1 = new CTabItem(tabFolder, SWT.NONE);
    item1.setText("Tab-1");
    Group group = new Group(tabFolder, SWT.NONE);
    group.setText("Knob-1");
    group.setLayout(new FillLayout());
    item1.setControl(group);
    // Create Knob
    new Knob<Integer>(group, SWT.NULL, new KnobRange.Integer(0, 10));
}
Example 32
Project: swtxml-master  File: SwtXmlNewPage.java View source code
public void createControl(Composite parent) {
    initializeDialogUnits(parent);
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setFont(parent.getFont());
    int nColumns = 4;
    composite.setLayout(new GridLayout(nColumns, false));
    createContainerControls(composite, nColumns);
    createPackageControls(composite, nColumns);
    createSeparator(composite, nColumns);
    createTypeNameControls(composite, nColumns);
    Label type = new Label(composite, SWT.NONE);
    type.setText("Base class:");
    Composite group = new Composite(composite, SWT.NONE);
    group.setLayout(new RowLayout());
    SelectionAdapter selectSuperClassListener = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            Object data = ((Button) e.widget).getData();
            String classname = ((Class<?>) data).getName();
            setSuperClass(classname, false);
        }
    };
    for (Class<?> clazz : swtXmlClasses) {
        Button btn = new Button(group, SWT.RADIO);
        btn.setText(clazz.getSimpleName().replace("SwtXml", ""));
        btn.setData(clazz);
        btn.addSelectionListener(selectSuperClassListener);
        if (SwtXmlComposite.class.equals(clazz)) {
            btn.setSelection(true);
            setSuperClass(SwtXmlComposite.class.getName(), false);
        }
    }
    setControl(composite);
}
Example 33
Project: thym-master  File: CheckboxTableSelectionGroup.java View source code
private void createGroup() {
    setLayout(new GridLayout(2, false));
    tableViewer = CheckboxTableViewer.newCheckList(this, SWT.BORDER | SWT.FULL_SELECTION);
    Table table = tableViewer.getTable();
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    tableViewer.addCheckStateListener(new ICheckStateListener() {

        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            sendSelectionEvent();
        }
    });
    Composite projectButtons = new Composite(this, SWT.NONE);
    projectButtons.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
    RowLayout rl_projectButtons = new RowLayout(SWT.VERTICAL);
    rl_projectButtons.center = true;
    rl_projectButtons.fill = true;
    rl_projectButtons.justify = true;
    rl_projectButtons.pack = false;
    projectButtons.setLayout(rl_projectButtons);
    Button btnSelectAll = new Button(projectButtons, SWT.NONE);
    btnSelectAll.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            tableViewer.setAllChecked(true);
            sendSelectionEvent();
        }
    });
    btnSelectAll.setText("Select All");
    Button btnDeselectAll = new Button(projectButtons, SWT.NONE);
    btnDeselectAll.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            tableViewer.setAllChecked(false);
            sendSelectionEvent();
        }
    });
    btnDeselectAll.setText("Deselect All");
}
Example 34
Project: wazaabi-master  File: AbstractTestRowLayout.java View source code
public void createSWTRowLayoutOneButton(String layoutData) {
    createSWTWidgetOneButton();
    RowLayout swtRowLayout = new RowLayout();
    swtRowLayout.marginTop = LAYOUT1_MARGIN_TOP_INITIAL_VALUE;
    swtComposite.setLayout(swtRowLayout);
    if (layoutData.equalsIgnoreCase("RowData")) {
        RowData swtRowData1 = new RowData();
        swtButton1.setLayoutData(swtRowData1);
        swtRowData1.height = BUTTON1_HEIGHT;
        swtRowData1.width = BUTTON1_WIDTH;
    }
    swtShell.open();
}
Example 35
Project: xiliary-master  File: NavigationItem.java View source code
private static Composite createComposite(Composite parent) {
    Composite result = new Composite(parent, SWT.NONE);
    RowLayout layout = new RowLayout();
    layout.center = true;
    layout.fill = true;
    layout.marginLeft = 0;
    layout.marginTop = 0;
    layout.marginRight = 0;
    layout.marginBottom = 0;
    result.setLayout(layout);
    return result;
}
Example 36
Project: AcademicTorrents-Downloader-master  File: DeviceTemplateChooser.java View source code
private void createDeviceTemplateList2(SWTSkinObjectContainer soList) {
    DeviceTemplate[] devices = mf.getDeviceTemplates();
    if (devices.length == 0) {
        noDevices();
        return;
    }
    Arrays.sort(devices, new Comparator<DeviceTemplate>() {

        public int compare(DeviceTemplate o1, DeviceTemplate o2) {
            return o1.getName().compareToIgnoreCase(o2.getName());
        }
    });
    Composite parent = soList.getComposite();
    if (parent.getChildren().length > 0) {
        Utils.disposeComposite(parent, false);
    }
    SWTSkin skin = skinnedDialog.getSkin();
    SWTSkinObjectText soInfoTitle = (SWTSkinObjectText) skin.getSkinObject("info-title");
    SWTSkinObjectText soInfoText = (SWTSkinObjectText) skin.getSkinObject("info-text");
    RowLayout layout = new RowLayout(SWT.HORIZONTAL);
    layout.spacing = 0;
    layout.marginLeft = layout.marginRight = 0;
    layout.wrap = true;
    layout.justify = true;
    layout.fill = true;
    parent.setLayout(layout);
    Listener clickListener = new Listener() {

        boolean down = false;

        public void handleEvent(Event event) {
            if (event.type == SWT.MouseDown) {
                down = true;
            } else if (event.type == SWT.MouseUp && down) {
                Widget widget = (event.widget instanceof Label) ? ((Label) event.widget).getParent() : event.widget;
                selectedDeviceTemplate = (DeviceTemplate) widget.getData("obj");
                if (selectedDeviceTemplate == null) {
                    Debug.out("selectedDeviceTemplate is null!");
                }
                skinnedDialog.close();
                down = false;
            }
        }
    };
    GridData gridData;
    for (DeviceTemplate deviceTemplate : devices) {
        if (deviceTemplate.isAuto()) {
            continue;
        }
        // deviceTemplate.getIconURL();
        String iconURL = null;
        TranscodeChooser.addImageBox(parent, clickListener, null, deviceTemplate, iconURL, deviceTemplate.getName());
    }
    SWTSkinObjectText soTitle = (SWTSkinObjectText) skin.getSkinObject("title");
    if (soTitle != null) {
        soTitle.setTextID("devices.choose.device.title");
    }
    SWTSkinObjectText soSubTitle = (SWTSkinObjectText) skin.getSkinObject("subtitle");
    if (soSubTitle != null) {
        soSubTitle.setTextID("label.clickone");
    }
    Point computeSize = skinnedDialog.getShell().computeSize(600, SWT.DEFAULT, true);
    skinnedDialog.getShell().setSize(computeSize);
    Shell mainShell = UIFunctionsManagerSWT.getUIFunctionsSWT().getMainShell();
    Utils.centerWindowRelativeTo(skinnedDialog.getShell(), mainShell);
}
Example 37
Project: BitMate-master  File: DeviceTemplateChooser.java View source code
private void createDeviceTemplateList2(SWTSkinObjectContainer soList) {
    DeviceTemplate[] devices = mf.getDeviceTemplates();
    if (devices.length == 0) {
        noDevices();
        return;
    }
    Arrays.sort(devices, new Comparator<DeviceTemplate>() {

        public int compare(DeviceTemplate o1, DeviceTemplate o2) {
            return o1.getName().compareToIgnoreCase(o2.getName());
        }
    });
    Composite parent = soList.getComposite();
    if (parent.getChildren().length > 0) {
        Utils.disposeComposite(parent, false);
    }
    SWTSkin skin = skinnedDialog.getSkin();
    SWTSkinObjectText soInfoTitle = (SWTSkinObjectText) skin.getSkinObject("info-title");
    SWTSkinObjectText soInfoText = (SWTSkinObjectText) skin.getSkinObject("info-text");
    RowLayout layout = new RowLayout(SWT.HORIZONTAL);
    layout.spacing = 0;
    layout.marginLeft = layout.marginRight = 0;
    layout.wrap = true;
    layout.justify = true;
    layout.fill = true;
    parent.setLayout(layout);
    Listener clickListener = new Listener() {

        boolean down = false;

        public void handleEvent(Event event) {
            if (event.type == SWT.MouseDown) {
                down = true;
            } else if (event.type == SWT.MouseUp && down) {
                Widget widget = (event.widget instanceof Label) ? ((Label) event.widget).getParent() : event.widget;
                selectedDeviceTemplate = (DeviceTemplate) widget.getData("obj");
                if (selectedDeviceTemplate == null) {
                    Debug.out("selectedDeviceTemplate is null!");
                }
                skinnedDialog.close();
                down = false;
            }
        }
    };
    GridData gridData;
    for (DeviceTemplate deviceTemplate : devices) {
        if (deviceTemplate.isAuto()) {
            continue;
        }
        // deviceTemplate.getIconURL();
        String iconURL = null;
        TranscodeChooser.addImageBox(parent, clickListener, null, deviceTemplate, iconURL, deviceTemplate.getName());
    }
    SWTSkinObjectText soTitle = (SWTSkinObjectText) skin.getSkinObject("title");
    if (soTitle != null) {
        soTitle.setTextID("devices.choose.device.title");
    }
    SWTSkinObjectText soSubTitle = (SWTSkinObjectText) skin.getSkinObject("subtitle");
    if (soSubTitle != null) {
        soSubTitle.setTextID("label.clickone");
    }
    Point computeSize = skinnedDialog.getShell().computeSize(600, SWT.DEFAULT, true);
    skinnedDialog.getShell().setSize(computeSize);
    Shell mainShell = UIFunctionsManagerSWT.getUIFunctionsSWT().getMainShell();
    Utils.centerWindowRelativeTo(skinnedDialog.getShell(), mainShell);
}
Example 38
Project: DroidNavi-master  File: OptionEvent.java View source code
private void init() {
    // Set up group
    Group eventGroup = new Group(m_parentFolder, SWT.NONE);
    eventGroup.setText("Event Notifications");
    eventGroup.setToolTipText("Events to show notifications for");
    m_tabItem.setControl(eventGroup);
    // Set Layout
    RowLayout layout = new RowLayout(SWT.VERTICAL);
    eventGroup.setLayout(layout);
    // Preference Manager to get initial vals from
    PreferenceManager pref = PreferenceManager.getPreferenceManager();
    // Incoming Event
    Button incoming = new Button(eventGroup, SWT.CHECK);
    incoming.setText("Incoming Calls");
    incoming.setToolTipText("Show notifications for incoming calls");
    incoming.setData(EventType.INCOMING_CALL);
    incoming.setSelection((Boolean) pref.get(PreferenceKey.SHOW_INCOMING, Boolean.TRUE));
    // Missed Call event
    Button missed = new Button(eventGroup, SWT.CHECK);
    missed.setText("Missed Calls");
    missed.setToolTipText("Show notifications for missed calls");
    missed.setData(EventType.MISSED_CALL);
    missed.setSelection((Boolean) pref.get(PreferenceKey.SHOW_MISSED, Boolean.TRUE));
    // Connect Event
    Button connect = new Button(eventGroup, SWT.CHECK);
    connect.setText("Phone connect");
    connect.setToolTipText("Show notifications when phones connect");
    connect.setData(EventType.CLIENT_CONNECT);
    connect.setSelection((Boolean) pref.get(PreferenceKey.SHOW_CONNECT, Boolean.TRUE));
}
Example 39
Project: elexis-3-base-master  File: ImpfplanPreferences.java View source code
@Override
protected Control createContents(Composite parent) {
    Composite ret = new Composite(parent, SWT.NONE);
    ret.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    ret.setLayout(new GridLayout());
    tv = new TableViewer(ret);
    tv.getControl().setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    tv.setContentProvider(new ContentProviderAdapter() {

        @Override
        public Object[] getElements(Object arg0) {
            return ImpfplanController.allVaccs().toArray();
        }
    });
    tv.setLabelProvider(new LabelProvider() {

        @Override
        public String getText(Object element) {
            if (element instanceof VaccinationType) {
                return ((VaccinationType) element).getLabel();
            }
            //$NON-NLS-1$
            return "?";
        }
    });
    tv.addDoubleClickListener(new IDoubleClickListener() {

        @Override
        public void doubleClick(DoubleClickEvent event) {
            edit();
        }
    });
    Composite cButtons = new Composite(ret, SWT.NONE);
    cButtons.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
    cButtons.setLayout(new RowLayout(SWT.HORIZONTAL));
    Button bAdd = new Button(cButtons, SWT.PUSH);
    bAdd.setText(Messages.ImpfplanPreferences_addCaption);
    bAdd.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            EditVaccinationDialog dlg = new EditVaccinationDialog(getShell(), new VaccinationType(Messages.ImpfplanPreferences_nameDummy, Messages.ImpfplanPreferences_vaccDummy));
            if (dlg.open() == Dialog.OK) {
                tv.refresh();
            }
        }
    });
    MenuManager menu = new MenuManager();
    menu.add(removeAction);
    tv.getControl().setMenu(menu.createContextMenu(tv.getControl()));
    tv.setInput(this);
    return ret;
}
Example 40
Project: erlide-master  File: ComboInputPage.java View source code
@Override
public void createControl(final Composite parent) {
    composite = new Composite(parent, SWT.NONE);
    inputLabel = new Label(composite, SWT.LEFT);
    inputLabel.setText(labelText);
    // GridData gridData = new GridData();
    // gridData.horizontalAlignment = GridData.FILL;
    // gridData.horizontalSpan = 2;
    // inputLabel.setLayoutData(gridData);
    selectionList = new Combo(composite, SWT.DROP_DOWN);
    for (final String s : moduleNames) {
        selectionList.add(s);
    }
    // gridData = new GridData();
    // gridData.horizontalAlignment = GridData.FILL;
    // gridData.horizontalSpan = 2;
    // selectionList.setLayoutData(gridData);
    // GridLayout layout = new GridLayout();
    final RowLayout layout = new RowLayout();
    layout.spacing = 5;
    layout.center = true;
    composite.setLayout(layout);
    setControl(composite);
    selectionList.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetDefaultSelected(final SelectionEvent e) {
        }

        @Override
        @SuppressWarnings("synthetic-access")
        public void widgetSelected(final SelectionEvent e) {
            ((SimpleOneStepWranglerRefactoring) getRefactoring()).setUserInput(selectionList.getText());
            setPageComplete(true);
        }
    });
    final IValidator validator = new AtomValidator();
    selectionList.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            if (validator.isValid(selectionList.getText())) {
                ((SimpleWranglerRefactoring) getRefactoring()).setUserInput(selectionList.getText());
                setErrorMessage(null);
                setPageComplete(true);
            } else {
                setPageComplete(false);
                setErrorMessage("Module name must be a a valid atom!");
            }
        }
    });
}
Example 41
Project: erlide_eclipse-master  File: ComboInputPage.java View source code
@Override
public void createControl(final Composite parent) {
    composite = new Composite(parent, SWT.NONE);
    inputLabel = new Label(composite, SWT.LEFT);
    inputLabel.setText(labelText);
    // GridData gridData = new GridData();
    // gridData.horizontalAlignment = GridData.FILL;
    // gridData.horizontalSpan = 2;
    // inputLabel.setLayoutData(gridData);
    selectionList = new Combo(composite, SWT.DROP_DOWN);
    for (final String s : moduleNames) {
        selectionList.add(s);
    }
    // gridData = new GridData();
    // gridData.horizontalAlignment = GridData.FILL;
    // gridData.horizontalSpan = 2;
    // selectionList.setLayoutData(gridData);
    // GridLayout layout = new GridLayout();
    final RowLayout layout = new RowLayout();
    layout.spacing = 5;
    layout.center = true;
    composite.setLayout(layout);
    setControl(composite);
    selectionList.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetDefaultSelected(final SelectionEvent e) {
        }

        @Override
        @SuppressWarnings("synthetic-access")
        public void widgetSelected(final SelectionEvent e) {
            ((SimpleOneStepWranglerRefactoring) getRefactoring()).setUserInput(selectionList.getText());
            setPageComplete(true);
        }
    });
    final IValidator validator = new AtomValidator();
    selectionList.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            if (validator.isValid(selectionList.getText())) {
                ((SimpleWranglerRefactoring) getRefactoring()).setUserInput(selectionList.getText());
                setErrorMessage(null);
                setPageComplete(true);
            } else {
                setPageComplete(false);
                setErrorMessage("Module name must be a a valid atom!");
            }
        }
    });
}
Example 42
Project: exsite9-master  File: ListMetadataCategoriesWizardPage.java View source code
@Override
public void createControl(final Composite parent) {
    this.container = new Composite(parent, SWT.NULL);
    final GridLayout layout = new GridLayout();
    this.container.setLayout(layout);
    layout.numColumns = 2;
    this.metadataCategoriesList = new org.eclipse.swt.widgets.List(this.container, SWT.BORDER | SWT.SINGLE | SWT.WRAP | SWT.V_SCROLL);
    for (final MetadataCategory metadataCategory : this.metadataCategories) {
        this.metadataCategoriesList.add(metadataCategory.getName());
    }
    final GridData multiLineGridData = new GridData(GridData.FILL_BOTH);
    this.metadataCategoriesList.setLayoutData(multiLineGridData);
    this.metadataCategoriesList.addSelectionListener(this);
    final Composite rowComp = new Composite(container, SWT.NULL);
    final RowLayout rowLayout = new RowLayout();
    rowLayout.type = SWT.VERTICAL;
    rowLayout.pack = false;
    rowLayout.justify = true;
    rowComp.setLayout(rowLayout);
    this.removeButton = new Button(rowComp, SWT.PUSH);
    this.removeButton.setText("Delete");
    this.removeButton.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            final int selectedIndex = metadataCategoriesList.getSelectionIndex();
            final MetadataCategory metadataCategoryToDelete = metadataCategories.remove(selectedIndex);
            metadataCategoriesList.remove(selectedIndex);
            metadataCategoriesToDelete.add(metadataCategoryToDelete);
            removeButton.setEnabled(false);
            selectedMetadataCategory = null;
            setPageComplete(true);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    this.removeButton.setEnabled(false);
    this.removeButton.setVisible(this.showRemoveButton);
    setControl(this.container);
    setPageComplete(false);
}
Example 43
Project: frostwire-common-master  File: DeviceTemplateChooser.java View source code
private void createDeviceTemplateList2(SWTSkinObjectContainer soList) {
    DeviceTemplate[] devices = mf.getDeviceTemplates();
    if (devices.length == 0) {
        noDevices();
        return;
    }
    Arrays.sort(devices, new Comparator<DeviceTemplate>() {

        public int compare(DeviceTemplate o1, DeviceTemplate o2) {
            return o1.getName().compareToIgnoreCase(o2.getName());
        }
    });
    Composite parent = soList.getComposite();
    if (parent.getChildren().length > 0) {
        Utils.disposeComposite(parent, false);
    }
    SWTSkin skin = skinnedDialog.getSkin();
    SWTSkinObjectText soInfoTitle = (SWTSkinObjectText) skin.getSkinObject("info-title");
    SWTSkinObjectText soInfoText = (SWTSkinObjectText) skin.getSkinObject("info-text");
    RowLayout layout = new RowLayout(SWT.HORIZONTAL);
    layout.spacing = 0;
    layout.marginLeft = layout.marginRight = 0;
    layout.wrap = true;
    layout.justify = true;
    layout.fill = true;
    parent.setLayout(layout);
    Listener clickListener = new Listener() {

        boolean down = false;

        public void handleEvent(Event event) {
            if (event.type == SWT.MouseDown) {
                down = true;
            } else if (event.type == SWT.MouseUp && down) {
                Widget widget = (event.widget instanceof Label) ? ((Label) event.widget).getParent() : event.widget;
                selectedDeviceTemplate = (DeviceTemplate) widget.getData("obj");
                if (selectedDeviceTemplate == null) {
                    Debug.out("selectedDeviceTemplate is null!");
                }
                skinnedDialog.close();
                down = false;
            }
        }
    };
    GridData gridData;
    for (DeviceTemplate deviceTemplate : devices) {
        if (deviceTemplate.isAuto()) {
            continue;
        }
        // deviceTemplate.getIconURL();
        String iconURL = null;
        TranscodeChooser.addImageBox(parent, clickListener, null, deviceTemplate, iconURL, deviceTemplate.getName());
    }
    SWTSkinObjectText soTitle = (SWTSkinObjectText) skin.getSkinObject("title");
    if (soTitle != null) {
        soTitle.setTextID("devices.choose.device.title");
    }
    SWTSkinObjectText soSubTitle = (SWTSkinObjectText) skin.getSkinObject("subtitle");
    if (soSubTitle != null) {
        soSubTitle.setTextID("label.clickone");
    }
    Point computeSize = skinnedDialog.getShell().computeSize(600, SWT.DEFAULT, true);
    skinnedDialog.getShell().setSize(computeSize);
    Shell mainShell = UIFunctionsManagerSWT.getUIFunctionsSWT().getMainShell();
    Utils.centerWindowRelativeTo(skinnedDialog.getShell(), mainShell);
}
Example 44
Project: gda-common-rcp-master  File: GenericDialog.java View source code
/**
	 * @param userData (may be null) 
	 * @return the selected file
	 */
public Object open(final Object userData) {
    final Shell parent = getParent();
    final Shell shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE);
    shell.setLayout(new GridLayout());
    shell.setText(getText());
    createContents(shell, userData);
    final Composite buttons = new Composite(shell, SWT.NONE);
    buttons.setLayout(new RowLayout());
    buttons.setLayoutData(new GridData(SWT.RIGHT, SWT.BOTTOM, true, true));
    final Button ok = new Button(buttons, SWT.NONE);
    ok.setText("OK");
    ok.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            GenericDialog.this.ok = true;
            if (checker == null) {
                shell.dispose();
            } else if (checker.isValid()) {
                shell.dispose();
            }
        }
    });
    ok.setFocus();
    final Button cancel = new Button(buttons, SWT.NONE);
    cancel.setText("Cancel");
    cancel.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            GenericDialog.this.ok = false;
            shell.dispose();
        }
    });
    GenericDialog.this.ok = false;
    if (shouldPack())
        shell.pack();
    shell.open();
    Display display = parent.getDisplay();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    if (GenericDialog.this.ok) {
        return currentSelection;
    }
    return null;
}
Example 45
Project: gyrex-admin-master  File: AdminUiUtil.java View source code
public static RowLayout createRowLayout(final int type, final boolean setMargin) {
    final RowLayout result = new RowLayout(type);
    result.marginTop = 0;
    result.marginLeft = 0;
    result.marginHeight = 0;
    if (setMargin) {
        result.marginBottom = DEFAULT_SPACE;
        result.marginWidth = DEFAULT_SPACE;
    } else {
        result.marginBottom = 0;
        result.marginWidth = 0;
    }
    return result;
}
Example 46
Project: java.old-master  File: XMLReader.java View source code
private void createBottons(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayoutData(BorderData.NORTH);
    composite.setLayout(new RowLayout());
    Button btnStart = new Button(composite, SWT.NONE);
    // btnStart.setLayoutData(BorderData.NORTH);
    btnStart.setText("&Start");
    btnStart.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            try {
                parseXML();
            } catch (Exception e1) {
                textInfo.setText("Parse failed: " + e1.getMessage());
            }
        }
    });
}
Example 47
Project: jbosstools-forge-master  File: RadioControlBuilder.java View source code
@Override
@SuppressWarnings({ "unchecked" })
public Control build(final ForgeWizardPage page, final InputComponent<?, ?> input, final String inputName, final Composite parent) {
    // Create the label
    Label label = new Label(parent, SWT.NULL);
    label.setText(getMnemonicLabel(input, true));
    label.setToolTipText(input.getDescription());
    Composite container = new Composite(parent, SWT.NULL);
    container.setData(LABEL_DATA_KEY, label);
    container.setLayout(new RowLayout());
    container.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    final ConverterFactory converterFactory = FurnaceService.INSTANCE.getConverterFactory();
    UISelectOne<Object> selectOne = (UISelectOne<Object>) input;
    Converter<Object, String> itemLabelConverter = InputComponents.getItemLabelConverter(converterFactory, selectOne);
    Object originalValue = InputComponents.getValueFor(input);
    Iterable<Object> valueChoices = selectOne.getValueChoices();
    if (valueChoices != null) {
        for (final Object choice : valueChoices) {
            final String itemLabel = itemLabelConverter.convert(choice);
            final Button button = new Button(container, SWT.RADIO);
            button.setText(itemLabel);
            button.setToolTipText(input.getDescription());
            boolean selected = Proxies.areEquivalent(choice, originalValue);
            button.setSelection(selected);
            button.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    if (button.getSelection()) {
                        final CommandController controller = page.getController();
                        controller.setValueFor(inputName, Proxies.unwrap(choice));
                    }
                }
            });
        }
    }
    // skip the thrid column
    Label dummy = new Label(parent, SWT.NONE);
    dummy.setText("");
    return container;
}
Example 48
Project: jenkow-plugin-master  File: CreateDefaultActivitiDiagramInitialContentPage.java View source code
@Override
public void createControl(Composite parent) {
    FormToolkit toolkit = new FormToolkit(parent.getDisplay());
    toolkit.setBackground(parent.getBackground());
    Composite container = toolkit.createComposite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    container.setLayout(layout);
    layout.numColumns = 1;
    GridData data = null;
    Group contentSourceGroup = new Group(container, SWT.SHADOW_IN);
    contentSourceGroup.setText("Do you want to add content to your diagram to start editing?");
    data = new GridData();
    data.grabExcessHorizontalSpace = true;
    data.horizontalAlignment = SWT.FILL;
    contentSourceGroup.setLayoutData(data);
    contentSourceGroup.setLayout(new RowLayout(SWT.VERTICAL));
    contentSourceNone = toolkit.createButton(contentSourceGroup, "No, just create an empty diagram", SWT.RADIO);
    contentSourceNone.setSelection(true);
    contentSourceImport = toolkit.createButton(contentSourceGroup, "Yes, import a BPMN 2.0 file", SWT.RADIO);
    contentSourceImport.setEnabled(false);
    contentSourceTemplate = toolkit.createButton(contentSourceGroup, "Yes, use a template", SWT.RADIO);
    contentSourceTemplate.setEnabled(true);
    Group templateGroup = new Group(container, SWT.SHADOW_IN);
    templateGroup.setText("Choose template");
    data = new GridData();
    data.grabExcessHorizontalSpace = true;
    data.horizontalAlignment = SWT.FILL;
    templateGroup.setLayoutData(data);
    templateGroup.setLayout(new RowLayout(SWT.VERTICAL));
    templateTable = toolkit.createTable(templateGroup, SWT.BORDER);
    for (String description : TemplateInfo.templateDescriptions) {
        TableItem tableItem = new TableItem(templateTable, SWT.NONE);
        tableItem.setText(description);
    }
    templateTable.setEnabled(false);
    templateTable.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    contentSourceNone.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            templateTable.setEnabled(false);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent event) {
        }
    });
    contentSourceTemplate.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            templateTable.setEnabled(true);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent event) {
        }
    });
    setControl(container);
    setPageComplete(false);
}
Example 49
Project: jucy-master  File: FavHubEditor.java View source code
public void createPartControl(Composite parent) {
    parent.setLayout(new GridLayout());
    table = new Table(parent, SWT.CHECK | SWT.SINGLE | SWT.FULL_SELECTION | SWT.HIDE_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.HIDE_SELECTION);
    tableViewer = new CheckboxTableViewer(table);
    tableViewer.addDoubleClickListener(new CommandDoubleClickListener(OpenHubHandler.COMMAND_ID));
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    table.setHeaderVisible(true);
    tva = new TableViewerAdministrator<FavHub>(tableViewer, Arrays.asList(new FavHubName(tableViewer), new Description(), new Nick(), new Password(), new Address(), new UserDescription(), new Email(), new ChatOnly()), GUIPI.favHubsTable, TableViewerAdministrator.NoSorting, false);
    FavHubContentProvider fh = new FavHubContentProvider();
    tableViewer.setContentProvider(fh);
    tva.apply();
    tableViewer.setComparator(new ViewerComparator() {

        @Override
        public int compare(Viewer viewer, Object e1, Object e2) {
            Integer a = ((FavHub) e1).getOrder();
            Integer b = ((FavHub) e2).getOrder();
            return a.compareTo(b);
        }
    });
    getSite().setSelectionProvider(tableViewer);
    createContextPopup(tableViewer);
    final Composite comp = new Composite(parent, SWT.NONE);
    comp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
    comp.setLayout(new RowLayout());
    final Composite composite = new Composite(comp, SWT.NONE);
    composite.setLayoutData(new RowData());
    FillLayout fillLayout = new FillLayout();
    fillLayout.spacing = 5;
    composite.setLayout(fillLayout);
    for (String command : new String[] { CreateFavHubsHandler.COMMAND_ID, ChangeFHPropertiesHandler.COMMAND_ID, RemoveHandler.COMMAND_ID, MoveUpHandler.COMMAND_ID, MoveDownHandler.COMMAND_ID, OpenHubHandler.COMMAND_ID }) {
        Button button = new Button(composite, SWT.NONE);
        CommandButton.setCommandToButton(command, button, getSite(), false);
    }
    tableViewer.setInput(favHubs);
    favHubs.addObserver(this);
    logger.debug("created FavHub editor");
    setControlsForFontAndColour(tableViewer.getTable());
}
Example 50
Project: LanguageBuddy-master  File: TagFilterPage.java View source code
/* (non-Javadoc)
     * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
     */
public void createControl(Composite parent) {
    this.setDescription(MessageUtil.getString("TagFilter"));
    mainGroup = new Group(parent, SWT.CENTER);
    setControl(mainGroup);
    rowLayout = new RowLayout();
    rowLayout.type = SWT.VERTICAL;
    rowLayout.fill = true;
    mainGroup.setLayout(rowLayout);
    enableFilter = new Button(mainGroup, SWT.CHECK);
    enableFilter.setText(MessageUtil.getString("TagFilterEnable"));
    enableFilter.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (filterComposite != null && filterComposite.isDisposed() == false) {
                boolean enabled = enableFilter.getSelection();
                filterComposite.setEnabled(enabled);
                anyTagsButton.setEnabled(enabled);
                allTagsButton.setEnabled(enabled);
            }
            validate();
        }
    });
    anyTagsButton = new Button(mainGroup, SWT.RADIO);
    anyTagsButton.setText(MessageUtil.getString("AnyTagsMatchFilter"));
    anyTagsButton.setSelection(true);
    anyTagsButton.setEnabled(false);
    allTagsButton = new Button(mainGroup, SWT.RADIO);
    allTagsButton.setText(MessageUtil.getString("AllTagsMatchFilter"));
    allTagsButton.setEnabled(false);
    filterComposite = new TagFilterComposite(mainGroup, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    filterComposite.setEnabled(false);
}
Example 51
Project: LinGUIne-master  File: InstallWizardPage.java View source code
/**
	 * Generates all the UI components
	 */
@Override
public void createControl(Composite parent) {
    //Establish the Layouts
    RowLayout parentLayout = new RowLayout();
    parentLayout.type = SWT.VERTICAL;
    parentLayout.marginTop = 5;
    parentLayout.marginBottom = 5;
    parentLayout.marginLeft = 5;
    parentLayout.marginRight = 5;
    parentLayout.justify = true;
    RowLayout topLayout = new RowLayout();
    topLayout.type = SWT.HORIZONTAL;
    topLayout.marginTop = 5;
    topLayout.marginBottom = 5;
    topLayout.marginLeft = 5;
    topLayout.marginRight = 5;
    topLayout.justify = true;
    container = new Composite(parent, SWT.NONE);
    container.setLayout(parentLayout);
    Composite topContainer = new Composite(container, SWT.NONE);
    topContainer.setLayout(topLayout);
    repositoryLabel = new Label(topContainer, SWT.NONE);
    repositoryLabel.setText("Repository:");
    repositoryLabel.setLayoutData(new RowData(60, 15));
    directoryLabel = new Label(topContainer, SWT.NONE);
    directoryLabel.setText("");
    directoryLabel.setLayoutData(new RowData(500, 15));
    browseButton = new Button(topContainer, SWT.NONE);
    browseButton.setText("Browse");
    browseButton.addSelectionListener(this);
    browseButton.setLayoutData(new RowData(60, 24));
    contentTable = new Table(container, SWT.MULTI | SWT.CHECK | SWT.VIRTUAL | SWT.BORDER);
    contentTable.setLayoutData(new RowData(620, 300));
    contentTable.setLinesVisible(true);
    contentTable.setHeaderVisible(true);
    contentTable.addSelectionListener(this);
    idColumn = new TableColumn(contentTable, SWT.NONE);
    idColumn.setText("Plugin ID");
    versionColumn = new TableColumn(contentTable, SWT.NONE);
    versionColumn.setText("Version");
    idColumn.pack();
    versionColumn.pack();
    parent.pack();
    container.pack();
    topContainer.pack();
    setControl(parent);
    setPageComplete(false);
}
Example 52
Project: marabou-master  File: AboutWindow.java View source code
/**
     * shows various information about marabou in a small window
     */
public void show() {
    final Display display = Display.getCurrent();
    final Shell shell = new Shell(display);
    shell.setText(i18n("About Marabou"));
    shell.setImage(new ImageLoader().getImage(AvailableImage.LOGO_SMALL));
    FormLayout formLayout = new FormLayout();
    formLayout.marginBottom = 10;
    formLayout.marginTop = 10;
    formLayout.marginLeft = 10;
    formLayout.marginRight = 10;
    shell.setLayout(formLayout);
    Composite comp1 = new Composite(shell, SWT.NONE);
    RowLayout rowLayout = new RowLayout(1);
    rowLayout.center = true;
    comp1.setLayout(rowLayout);
    // close window on ESC
    shell.addListener(SWT.Traverse, new Listener() {

        @Override
        public void handleEvent(Event event) {
            if (event.detail == SWT.TRAVERSE_ESCAPE) {
                shell.dispose();
            }
        }
    });
    // project name and version
    Label text = new Label(comp1, SWT.NONE);
    text.setText(i18n("Marabou - Audio Tagger \n" + "Version " + projectVersion));
    Image logo = new ImageLoader().getImage(AvailableImage.LOGO_BIG);
    Label labelImage = new Label(comp1, SWT.NONE);
    labelImage.setImage(logo);
    labelImage.pack();
    Label labelText = new Label(comp1, SWT.NONE);
    labelText.setAlignment(SWT.CENTER);
    labelText.setText(i18n("\nThe Marabou is a scavenger and so is this software.\n" + "It's written to eat badly tagged music files.\n"));
    labelText.pack();
    // button with project's url
    final String url = "https://github.com/hennr/marabou";
    final Button linkButton = new Button(comp1, SWT.PUSH);
    linkButton.setText(url);
    linkButton.pack();
    linkButton.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(Event event) {
            try {
                Desktop.getDesktop().browse(new URI(url));
            } catch (Exception e) {
            }
        }
    });
    // dirty hack to get vertical space between the buttons
    Label space = new Label(comp1, SWT.NONE);
    space.pack();
    // horizontal row for buttons
    Composite comp2 = new Composite(comp1, SWT.None);
    RowLayout rowLayout2 = new RowLayout();
    comp2.setLayout(rowLayout2);
    Button credits = new Button(comp2, SWT.None);
    credits.setText(i18n("Cr&edits"));
    credits.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(Event event) {
            CreditsWindow.showCredits();
        }
    });
    credits.pack();
    final Button licence = new Button(comp2, SWT.None);
    licence.setText(i18n("&Licence"));
    licence.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(Event event) {
            new LicenceWindow().showLicence();
        }
    });
    licence.pack();
    Button close = new Button(comp2, SWT.NONE);
    close.setText(i18n("&Close"));
    close.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(Event event) {
            shell.dispose();
        }
    });
    close.pack();
    shell.pack();
    shell.open();
    // close also if display gets disposed
    while (!shell.isDisposed() && display.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
}
Example 53
Project: Monitor-master  File: ProxyTableView.java View source code
@Override
public void createPartControl(Composite parent) {
    Composite composite = createComposite(parent);
    Composite titleComposite = new Composite(composite, SWT.NONE);
    titleComposite.setLayout(new RowLayout(SWT.HORIZONTAL));
    new Label(titleComposite, SWT.NONE).setText(" ");
    createTitleLabel(titleComposite);
    createTableViewer(composite);
    PlatformUtil.getRouter().getRuleManager().addRuleChangeListener(this);
}
Example 54
Project: nebula.widgets.nattable-master  File: AbstractE4NatExamplePart.java View source code
protected void showSourceLinks(Composite parent, String examplePath) {
    Composite panel = new Composite(parent, SWT.NONE);
    RowLayout layout = new RowLayout();
    layout.spacing = 5;
    panel.setLayout(layout);
    GridDataFactory.defaultsFor(panel).applyTo(panel);
    Link link = new Link(panel, SWT.NONE);
    link.setText("<a href=\"" + examplePath + "\">View source</a>");
    final SelectionAdapter linkSelectionListener = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            String path = event.text;
            path = path.replaceAll("\\.", "/");
            if (!path.startsWith("/")) {
                path = "/" + path;
            }
            String source = getResourceAsString("/src" + path + ".java");
            if (source != null) {
                viewSource(part.getLabel(), source);
            }
        }
    };
    link.addSelectionListener(linkSelectionListener);
    Link cssLink = new Link(panel, SWT.NONE);
    cssLink.setText("<a href=\"/css/default.css\">View CSS</a>");
    final SelectionAdapter cssLinkSelectionListener = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            String source = getResourceAsString(event.text);
            if (source != null) {
                viewSource("default.css", source);
            }
        }
    };
    cssLink.addSelectionListener(cssLinkSelectionListener);
}
Example 55
Project: org.nabucco.framework.generator-master  File: SearchViewLayouterTemplate.java View source code
public void layout(final Composite parent, final NabuccoMessageManager aMessageManager, final TemplateSearchModel aModel) {
    NabuccoFormToolkit ntk = new NabuccoFormToolkit(new FormToolkit(parent.getDisplay()));
    widgetFactory = new SearchViewWidgetFactoryTemplate(ntk, aModel);
    messageManager = aMessageManager;
    parent.addPaintListener(new PaintListener() {

        @Override
        public void paintControl(PaintEvent arg0) {
            messageManager.showMessages(MESSAGE_OWNER_ID);
        }
    });
    Section section = ntk.createSection(parent, "SectionName", new RowLayout());
    Composite child = ntk.createComposite(section, new GridLayout(2, true));
    // create widgets
    section.setClient(child);
}
Example 56
Project: org.nabucco.testautomation-master  File: TestEngineConfigurationSearchViewLayouter.java View source code
private Composite layout(final Composite parent, final NabuccoMessageManager aMessageManager, final TestEngineConfigurationSearchViewModel aModel) {
    NabuccoFormToolkit ntk = new NabuccoFormToolkit(parent);
    TestEngineConfigurationSearchViewWidgetFactory widgetFactory = new TestEngineConfigurationSearchViewWidgetFactory(ntk, aModel);
    messageManager = aMessageManager;
    // define paint listener
    parent.addPaintListener(new PaintListener() {

        @Override
        public void paintControl(PaintEvent arg0) {
            messageManager.showMessages(MESSAGE_OWNER_ID);
        }
    });
    // build a section to host the other controls
    Section section = ntk.createSection(parent, CONFIG_TEXT, new RowLayout());
    Composite child = ntk.createComposite(section, new GridLayout(2, true));
    section.setClient(child);
    // ui elements pair-wise: label + input field or combo
    widgetFactory.createLabelConfigName(child);
    widgetFactory.createInputFieldConfigName(child);
    widgetFactory.createLabelConfigHost(child);
    widgetFactory.createInputFieldConfigHost(child);
    widgetFactory.createLabelConfigPort(child);
    widgetFactory.createInputFieldConfigPort(child);
    widgetFactory.createLabelConfigRemoteReferenceName(child);
    widgetFactory.createInputFieldConfigRemoteReferenceName(child);
    return null;
}
Example 57
Project: org.nabucco.testautomation.schema-master  File: SchemaConfigSearchViewLayouter.java View source code
@Override
public Composite layout(Composite parent, NabuccoMessageManager messageManager, SchemaConfigSearchViewModel model) {
    NabuccoFormToolkit ntk = new NabuccoFormToolkit(parent);
    SchemaConfigSearchViewWidgetFactory widgetFactory = new SchemaConfigSearchViewWidgetFactory(ntk, model);
    // build a section to host the other controls
    Section section = ntk.createSection(parent, SCHEMA_CONFIG_TEXT, new RowLayout());
    Composite child = ntk.createComposite(section, new GridLayout(2, false));
    section.setClient(child);
    // add description and name label and input fields (pair-wise)
    layoutName(widgetFactory, child);
    layoutKey(widgetFactory, child);
    return null;
}
Example 58
Project: phenoscape-nlp-master  File: Type4Document.java View source code
/**
	 * @wbp.parser.entryPoint
	 */
public String showType4Document() {
    final Display display = Display.getDefault();
    final Shell shell = new Shell();
    shell.setSize(613, 437);
    shell.setText("Type 4 Documents");
    shell.setLayout(new RowLayout(SWT.HORIZONTAL));
    final Group group = new Group(shell, SWT.NONE);
    group.setLayoutData(new RowData(585, 377));
    group.setBounds(10, 10, 500, 115);
    final Combo combo = new Combo(group, SWT.NONE);
    combo.setBounds(114, 11, 109, 10);
    combo.setText("TaxonX");
    combo.add("Phenoscape");
    Button button = new Button(group, SWT.NONE);
    button.setBounds(408, 360, 75, 25);
    button.setText("Save");
    button.addMouseListener(new MouseListener() {

        public void mouseUp(MouseEvent mEvent) {
            String[] paragraphs = text.getText().split("\r\n");
            try {
                xml = combo.getText();
                configDb.saveParagraphTagDetails(combo.getText(), paragraphs);
                ApplicationUtilities.showPopUpWindow(ApplicationUtilities.getProperty("popup.info.savetype3"), ApplicationUtilities.getProperty("popup.header.info"), SWT.ICON_INFORMATION);
                shell.dispose();
            } catch (SQLException sqle) {
                LOGGER.error("Unable to save paragraphs to db in Type3Document", sqle);
                sqle.printStackTrace();
            }
        }

        public void mouseDown(MouseEvent mEvent) {
        }

        public void mouseDoubleClick(MouseEvent mEvent) {
        }
    });
    /*Button button_1 = new Button(group, SWT.NONE);
		button_1.setBounds(498, 360, 75, 25);
		button_1.setText("Skip");
		button_1.addMouseListener(new MouseListener(){
			public void mouseUp(MouseEvent mEvent){
					shell.dispose();				
			}
			
			public void mouseDown(MouseEvent mEvent) { }
			public void mouseDoubleClick(MouseEvent mEvent) {}
		})*/
    ;
    Label label = new Label(group, SWT.NONE);
    label.setBounds(10, 40, 482, 15);
    label.setText("If you have a sample paragraph for morphological description, please paste that below : ");
    text = new Text(group, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
    text.setBounds(10, 82, 563, 272);
    Label label_1 = new Label(group, SWT.NONE);
    label_1.setBounds(10, 61, 387, 15);
    label_1.setText("* Please separate the paragraphs by line breaks.");
    label_1.setForeground(new Color(display, 255, 0, 0));
    Label lblDocumentFormat = new Label(group, SWT.NONE);
    lblDocumentFormat.setBounds(10, 11, 109, 15);
    lblDocumentFormat.setText("Document Format : ");
    shell.open();
    shell.layout();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    return xml;
}
Example 59
Project: rhostudio-master  File: CapabDialog.java View source code
public List<Capabilities> open() {
    Shell parent = getParent();
    final Shell shell = new Shell(parent, SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL);
    shell.setText("Select capabilities");
    shell.setLayout(new GridLayout(1, true));
    RowData buttonAligment = new RowData(buttonWidht, SWT.DEFAULT);
    // 1 row
    Label label = new Label(shell, SWT.NULL);
    label.setText("Please select:");
    // 2 row
    Composite rowContainer1 = new Composite(shell, SWT.NULL);
    rowContainer1.setLayout(new RowLayout());
    m_capabTable = new Table(rowContainer1, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    m_capabTable.setLayoutData(new RowData(200, 300));
    // 3 row
    Composite rowContainer2 = new Composite(shell, SWT.NULL);
    RowLayout rowLayout = new RowLayout();
    rowLayout.center = true;
    rowContainer2.setLayout(rowLayout);
    // event handlers
    final Button buttonOK = new Button(rowContainer2, SWT.PUSH);
    buttonOK.setText("Ok");
    buttonOK.setLayoutData(buttonAligment);
    final Button buttonCancel = new Button(rowContainer2, SWT.PUSH);
    buttonCancel.setText("Cancel");
    buttonCancel.setLayoutData(buttonAligment);
    buttonOK.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            handleOk(event);
            shell.dispose();
        }
    });
    buttonCancel.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            nandleCancel(event);
            shell.dispose();
        }
    });
    shell.addListener(SWT.Traverse, new Listener() {

        public void handleEvent(Event event) {
            if (event.detail == SWT.TRAVERSE_ESCAPE)
                event.doit = false;
        }
    });
    // init
    List<Capabilities> selCapabList = null;
    if (m_ymlFile != null) {
        selCapabList = m_ymlFile.getCapabilities();
    }
    String[] capabTypes = Capabilities.getPublicIds();
    for (int i = 0; i < capabTypes.length; i++) {
        String currItemText = capabTypes[i];
        TableItem item = new TableItem(m_capabTable, SWT.NONE);
        item.setText(currItemText);
        if (selCapabList != null) {
            for (Capabilities c : selCapabList) {
                if (c == Capabilities.fromId(currItemText)) {
                    item.setChecked(true);
                    break;
                }
            }
        }
    }
    // show dialog
    shell.pack();
    shell.open();
    Display display = parent.getDisplay();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    return capabList;
}
Example 60
Project: Secure-Service-Specification-and-Deployment-master  File: CreateDefaultActivitiDiagramInitialContentPage.java View source code
@Override
public void createControl(Composite parent) {
    FormToolkit toolkit = new FormToolkit(parent.getDisplay());
    toolkit.setBackground(parent.getBackground());
    Composite container = toolkit.createComposite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    container.setLayout(layout);
    layout.numColumns = 1;
    GridData data = null;
    Group contentSourceGroup = new Group(container, SWT.SHADOW_IN);
    contentSourceGroup.setText("Do you want to add content to your diagram to start editing?");
    data = new GridData();
    data.grabExcessHorizontalSpace = true;
    data.horizontalAlignment = SWT.FILL;
    contentSourceGroup.setLayoutData(data);
    contentSourceGroup.setLayout(new RowLayout(SWT.VERTICAL));
    contentSourceNone = toolkit.createButton(contentSourceGroup, "No, just create an empty diagram", SWT.RADIO);
    contentSourceNone.setSelection(true);
    contentSourceImport = toolkit.createButton(contentSourceGroup, "Yes, import a BPMN 2.0 file", SWT.RADIO);
    contentSourceImport.setEnabled(false);
    contentSourceTemplate = toolkit.createButton(contentSourceGroup, "Yes, use a template", SWT.RADIO);
    contentSourceTemplate.setEnabled(true);
    Group templateGroup = new Group(container, SWT.SHADOW_IN);
    templateGroup.setText("Choose template");
    data = new GridData();
    data.grabExcessHorizontalSpace = true;
    data.horizontalAlignment = SWT.FILL;
    templateGroup.setLayoutData(data);
    templateGroup.setLayout(new RowLayout(SWT.VERTICAL));
    templateTable = toolkit.createTable(templateGroup, SWT.BORDER);
    for (String description : TemplateInfo.templateDescriptions) {
        TableItem tableItem = new TableItem(templateTable, SWT.NONE);
        tableItem.setText(description);
    }
    templateTable.setEnabled(false);
    templateTable.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    contentSourceNone.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            templateTable.setEnabled(false);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent event) {
        }
    });
    contentSourceTemplate.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            templateTable.setEnabled(true);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent event) {
        }
    });
    setControl(container);
    setPageComplete(false);
}
Example 61
Project: Security-Service-Validation-and-Verification-master  File: CreateDefaultActivitiDiagramInitialContentPage.java View source code
@Override
public void createControl(Composite parent) {
    FormToolkit toolkit = new FormToolkit(parent.getDisplay());
    toolkit.setBackground(parent.getBackground());
    Composite container = toolkit.createComposite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    container.setLayout(layout);
    layout.numColumns = 1;
    GridData data = null;
    Group contentSourceGroup = new Group(container, SWT.SHADOW_IN);
    contentSourceGroup.setText("Do you want to add content to your diagram to start editing?");
    data = new GridData();
    data.grabExcessHorizontalSpace = true;
    data.horizontalAlignment = SWT.FILL;
    contentSourceGroup.setLayoutData(data);
    contentSourceGroup.setLayout(new RowLayout(SWT.VERTICAL));
    contentSourceNone = toolkit.createButton(contentSourceGroup, "No, just create an empty diagram", SWT.RADIO);
    contentSourceNone.setSelection(true);
    contentSourceImport = toolkit.createButton(contentSourceGroup, "Yes, import a BPMN 2.0 file", SWT.RADIO);
    contentSourceImport.setEnabled(false);
    contentSourceTemplate = toolkit.createButton(contentSourceGroup, "Yes, use a template", SWT.RADIO);
    contentSourceTemplate.setEnabled(true);
    Group templateGroup = new Group(container, SWT.SHADOW_IN);
    templateGroup.setText("Choose template");
    data = new GridData();
    data.grabExcessHorizontalSpace = true;
    data.horizontalAlignment = SWT.FILL;
    templateGroup.setLayoutData(data);
    templateGroup.setLayout(new RowLayout(SWT.VERTICAL));
    templateTable = toolkit.createTable(templateGroup, SWT.BORDER);
    for (String description : TemplateInfo.templateDescriptions) {
        TableItem tableItem = new TableItem(templateTable, SWT.NONE);
        tableItem.setText(description);
    }
    templateTable.setEnabled(false);
    templateTable.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    contentSourceNone.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            templateTable.setEnabled(false);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent event) {
        }
    });
    contentSourceTemplate.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            templateTable.setEnabled(true);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent event) {
        }
    });
    setControl(container);
    setPageComplete(false);
}
Example 62
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 63
Project: tracecompass-master  File: AddBookmarkDialog.java View source code
@Override
protected Control createDialogArea(Composite parent) {
    Composite areaComposite = (Composite) super.createDialogArea(parent);
    Composite colorComposite = new Composite(areaComposite, SWT.NONE);
    RowLayout layout = new RowLayout();
    layout.center = true;
    colorComposite.setLayout(layout);
    colorComposite.moveBelow(getText());
    Label colorLabel = new Label(colorComposite, SWT.NONE);
    colorLabel.setText(Messages.AddBookmarkDialog_Color);
    fColorSelector = new ColorSelector(colorComposite);
    fColorSelector.setColorValue(new RGB(255, 0, 0));
    Label alphaLabel = new Label(colorComposite, SWT.NONE);
    alphaLabel.setText(Messages.AddBookmarkDialog_Alpha);
    fAlphaScale = new Scale(colorComposite, SWT.NONE);
    fAlphaScale.setMaximum(255);
    fAlphaScale.setSelection(fAlpha);
    fAlphaScale.setIncrement(1);
    fAlphaScale.setPageIncrement(16);
    fAlphaScale.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            fAlpha = fAlphaScale.getSelection();
            fAlphaLabel.setText(Integer.toString(fAlpha));
        }
    });
    fAlphaLabel = new Label(colorComposite, SWT.NONE);
    fAlphaLabel.setText(Integer.toString(fAlpha));
    return areaComposite;
}
Example 64
Project: webtools.jsf-master  File: AbstractMasterForm.java View source code
/**
     * @param form
     */
public final void createHead(final Form form) {
    final Composite head = form.getHead();
    final Composite container = getToolkit().createComposite(head);
    container.setLayout(new RowLayout());
    // sub-class contribution
    contributeToHeadArea(getToolkit(), container);
    _toolBarManager = new ToolBarManager(SWT.FLAT);
    ToolBar toolbar = _toolBarManager.createControl(container);
    // _toolkit.adapt(toolbar, false, false);
    toolbar.setBackground(form.getHead().getBackground());
    toolbar.setForeground(form.getHead().getForeground());
    //toolbar.setCursor(FormsResources.getHandCursor());
    container.addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
            if (_toolBarManager != null) {
                _toolBarManager.dispose();
                _toolBarManager = null;
            }
        }
    });
    form.setHeadClient(container);
}
Example 65
Project: ares-studio-master  File: GenerateInterfaceDialog.java View source code
@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    control = new Control[xmlDialog.getLstMenuInterfaceGroup().size()][];
    for (int groupIndex = 0; groupIndex < xmlDialog.getLstMenuInterfaceGroup().size(); groupIndex++) {
        DialogInterfaceGroup group = xmlDialog.getLstMenuInterfaceGroup().get(groupIndex);
        final List<DialogInterfaceItem> lstItem = group.getLstMenuInterfaceItem();
        Composite subComposite;
        if (group.isUse()) {
            Group menuGroup = new Group(composite, SWT.NONE);
            menuGroup.setVisible(true);
            menuGroup.setLayout(new RowLayout());
            menuGroup.setText(group.getGroupName());
            subComposite = menuGroup;
        } else {
            // ´´½¨Ò»¸ö×Ó×é¼þ£¬ÓÃÓÚ°Ú·ÅgroupÖ®ÍâµÄ²¼¾Ö¿Ø¼þ
            subComposite = new Composite(composite, SWT.NONE);
        }
        GridLayout layout = new GridLayout(6, false);
        layout.marginWidth = 0;
        layout.marginHeight = 0;
        subComposite.setLayout(layout);
        control[groupIndex] = new Control[lstItem.size()];
        for (int i = 0; i < lstItem.size(); i++) {
            if (lstItem.get(i).getSwtType().equalsIgnoreCase("CHECK") || lstItem.get(i).getSwtType().equalsIgnoreCase("RADIO")) {
                // °´Å¥¿Ø¼þ
                int swtType = SWT.NULL;
                if (lstItem.get(i).getSwtType().equalsIgnoreCase("CHECK"))
                    swtType = SWT.CHECK;
                if (lstItem.get(i).getSwtType().equalsIgnoreCase("RADIO"))
                    swtType = SWT.RADIO;
                Button btn = new Button(subComposite, swtType);
                btn.setText(lstItem.get(i).getLableName());
                btn.setData(lstItem.get(i).getId());
                btn.setSelection(lstItem.get(i).getValue().equalsIgnoreCase("true"));
                control[groupIndex][i] = btn;
            } else if (lstItem.get(i).getSwtType().equalsIgnoreCase("TEXT")) {
                // Text¿Ø¼þ
                Label lable = new Label(subComposite, SWT.NONE);
                lable.setText(lstItem.get(i).getLableName() + ":");
                Text text = new Text(subComposite, SWT.BORDER);
                text.setData(lstItem.get(i).getId());
                text.setText(lstItem.get(i).getValue());
                control[groupIndex][i] = text;
            } else if (lstItem.get(i).getSwtType().equalsIgnoreCase("COMBO")) {
                // ÏÂÀ­¿ò¿Ø¼þ
                Label lable = new Label(subComposite, SWT.NONE);
                lable.setText(lstItem.get(i).getLableName() + ":");
                Combo combo = new Combo(subComposite, SWT.BORDER);
                String[] values = lstItem.get(i).getValue().split(",");
                for (String value : values) combo.add(value);
                combo.select(0);
                combo.setData(lstItem.get(i).getId());
                control[groupIndex][i] = combo;
            }
        }
    }
    return composite;
}
Example 66
Project: atdl4j-master  File: SWTRadioButtonListWidget.java View source code
public Widget createWidget(Composite parent, int style) {
    String tooltip = getTooltip();
    GridData controlGD = new GridData(SWT.FILL, SWT.FILL, false, false);
    // label
    if (control.getLabel() != null) {
        label = new Label(parent, SWT.NONE);
        label.setText(control.getLabel());
        if (tooltip != null)
            label.setToolTipText(tooltip);
        controlGD.horizontalSpan = 1;
    } else {
        controlGD.horizontalSpan = 2;
    }
    Composite c = new Composite(parent, SWT.NONE);
    c.setLayoutData(controlGD);
    if (((RadioButtonListT) control).getOrientation() != null && PanelOrientationT.VERTICAL.equals(((RadioButtonListT) control).getOrientation())) {
        c.setLayout(new GridLayout(1, false));
    } else {
        RowLayout rl = new RowLayout();
        rl.wrap = false;
        c.setLayout(rl);
    }
    // radioButton
    for (ListItemT listItem : ((RadioButtonListT) control).getListItem()) {
        Button radioElement = new Button(c, style | SWT.RADIO);
        radioElement.setText(listItem.getUiRep());
        if (parameter != null) {
            for (EnumPairT enumPair : parameter.getEnumPair()) {
                if (enumPair.getEnumID() == listItem.getEnumID()) {
                    radioElement.setToolTipText(enumPair.getDescription());
                    break;
                }
            }
        } else
            radioElement.setToolTipText(tooltip);
        buttons.add(radioElement);
    }
    // set initValue
    if (ControlHelper.getInitValue(control, getAtdl4jOptions()) != null)
        setValue((String) ControlHelper.getInitValue(control, getAtdl4jOptions()), true);
    return c;
}
Example 67
Project: axdt-master  File: NewAs3FileWizardPage.java View source code
protected void createTemplateContent(Composite parent) {
    Label label = new Label(parent, SWT.NULL);
    label.setText("Template:");
    SelectionAdapter adapter = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            Button b = (Button) e.widget;
            template = b.getText().replaceAll("&", "");
        }
    };
    Composite group = new Composite(parent, SWT.NONE);
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    group.setLayout(new RowLayout());
    createTemplateRadioButton(group, "&Simple", adapter);
    createTemplateRadioButton(group, "&Class", adapter).setSelection(true);
    createTemplateRadioButton(group, "&Interface", adapter);
    template = "Class";
}
Example 68
Project: dbeaver-master  File: DB2TruncateDialog.java View source code
@Override
protected void createControls(Composite parent) {
    Group optionsGroup = UIUtils.createControlGroup(parent, DB2Messages.dialog_table_tools_options, 1, 0, 0);
    optionsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    Composite composite = new Composite(optionsGroup, 2);
    composite.setLayout(new GridLayout(2, false));
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    // Drop/Reuse Storage
    UIUtils.createLabel(composite, DB2Messages.dialog_table_tools_truncate_storage_title).setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
    Composite groupCols = new Composite(composite, SWT.NONE);
    groupCols.setLayout(new RowLayout(SWT.VERTICAL));
    dlgStorageDrop = new Button(groupCols, SWT.RADIO);
    dlgStorageDrop.setText(DB2Messages.dialog_table_tools_truncate_storage_drop);
    dlgStorageDrop.addSelectionListener(SQL_CHANGE_LISTENER);
    dlgStorageReuse = new Button(groupCols, SWT.RADIO);
    dlgStorageReuse.setText(DB2Messages.dialog_table_tools_truncate_storage_reuse);
    dlgStorageReuse.addSelectionListener(SQL_CHANGE_LISTENER);
    // Triggers Clauses
    UIUtils.createLabel(composite, DB2Messages.dialog_table_tools_truncate_triggers_title).setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
    Composite groupIx = new Composite(composite, SWT.NULL);
    groupIx.setLayout(new RowLayout(SWT.VERTICAL));
    dlgTriggersDelete = new Button(groupIx, SWT.RADIO);
    dlgTriggersDelete.setText(DB2Messages.dialog_table_tools_truncate_triggers_ignore);
    dlgTriggersDelete.addSelectionListener(SQL_CHANGE_LISTENER);
    dlgTriggersRestrict = new Button(groupIx, SWT.RADIO);
    dlgTriggersRestrict.setText(DB2Messages.dialog_table_tools_truncate_triggers_restrict);
    dlgTriggersRestrict.addSelectionListener(SQL_CHANGE_LISTENER);
    // Initial setup
    dlgStorageDrop.setSelection(true);
    dlgTriggersDelete.setSelection(true);
    // Object Selector
    createObjectsSelector(parent);
}
Example 69
Project: drc-master  File: SpecialCharacterView.java View source code
@Override
public void createPartControl(Composite parent) {
    ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.BORDER);
    Composite specialCharacterComposite = new Composite(scrolledComposite, SWT.NONE);
    scrolledComposite.setContent(specialCharacterComposite);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setExpandHorizontal(true);
    RowLayout rowLayout = new RowLayout(SWT.HORIZONTAL);
    rowLayout.spacing = 5;
    rowLayout.pack = true;
    specialCharacterComposite.setLayout(rowLayout);
    initSCButtons(specialCharacterComposite);
    scrolledComposite.setMinSize(specialCharacterComposite.computeSize(SWT.MIN, SWT.DEFAULT));
}
Example 70
Project: earthsci-master  File: LayerTreeControlProvider.java View source code
@Override
public Control getControl(Composite parent, Object element, Item item, ControlEditor editor) {
    editor.grabVertical = true;
    editor.minimumWidth = 20;
    editor.horizontalAlignment = SWT.RIGHT;
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setBackground(parent.getBackground());
    RowLayout layout = new RowLayout(SWT.HORIZONTAL);
    layout.marginBottom = layout.marginLeft = layout.marginRight = layout.marginTop = 0;
    composite.setLayout(layout);
    if (element instanceof ILayerTreeNode) {
        ILayerTreeNode node = (ILayerTreeNode) element;
        createURLClickableLabel(composite, node, node.getInformationURL(), ImageRegistry.getInstance().get(ImageRegistry.ICON_INFORMATION_WHITE), ImageRegistry.getInstance().get(ImageRegistry.ICON_INFORMATION), true);
        createURLClickableLabel(composite, node, node.getLegendURL(), ImageRegistry.getInstance().get(ImageRegistry.ICON_LEGEND_WHITE), ImageRegistry.getInstance().get(ImageRegistry.ICON_LEGEND), false);
    }
    return composite;
}
Example 71
Project: Eclipse-EGit-master  File: NewRemoteDialog.java View source code
@Override
protected Control createDialogArea(Composite parent) {
    Composite main = new Composite(parent, SWT.NONE);
    main.setLayout(new GridLayout(2, false));
    GridDataFactory.fillDefaults().grab(true, true).applyTo(main);
    Label nameLabel = new Label(main, SWT.NONE);
    nameLabel.setText(UIText.NewRemoteDialog_NameLabel);
    nameText = new Text(main, SWT.BORDER);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(nameText);
    nameText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            checkPage();
        }
    });
    Composite buttonComposite = new Composite(main, SWT.NONE);
    GridDataFactory.fillDefaults().span(2, 1).applyTo(buttonComposite);
    buttonComposite.setLayout(new RowLayout(SWT.VERTICAL));
    forPush = new Button(buttonComposite, SWT.RADIO);
    forPush.setText(UIText.NewRemoteDialog_PushRadio);
    forPush.setSelection(true);
    Button forFetch = new Button(buttonComposite, SWT.RADIO);
    forFetch.setText(UIText.NewRemoteDialog_FetchRadio);
    nameText.setFocus();
    applyDialogFont(main);
    main.setTabList(new Control[] { nameText, buttonComposite });
    return main;
}
Example 72
Project: eclipse-sbt-plugin-master  File: SbtProjectWizardPage.java View source code
private Composite createSbtSelectorPanel(Composite parent) {
    Composite group = new Composite(parent, SWT.NULL);
    group.setLayout(new RowLayout(SbtVersion.values().length));
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    sbtRadioButtons = new ArrayList<Button>();
    for (final SbtVersion version : SbtVersion.values()) {
        Button sbtRadioButton = new Button(group, SWT.RADIO);
        sbtRadioButton.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                configuration.setSbtVersion(version);
            }
        });
        sbtRadioButton.setText("sbt " + version.getPrefix());
        sbtRadioButton.setData(version);
        if (version.equals(configuration.getSbtVersion())) {
            sbtRadioButton.setSelection(true);
        }
        sbtRadioButtons.add(sbtRadioButton);
    }
    return group;
}
Example 73
Project: eclipse.platform.text-master  File: MarkerInformationControl.java View source code
@SuppressWarnings("unchecked")
@Override
public void setInput(Object input) {
    this.markers = (List<IMarker>) input;
    for (IMarker marker : this.markers) {
        Composite markerComposite = new Composite(parent, SWT.NONE);
        GridLayout gridLayout = new GridLayout(1, false);
        gridLayout.verticalSpacing = 0;
        markerComposite.setLayout(gridLayout);
        Composite markerLine = new Composite(markerComposite, SWT.NONE);
        markerLine.setLayout(new RowLayout());
        Label markerImage = new Label(markerLine, SWT.NONE);
        markerImage.setImage(getImage(marker));
        Label markerLabel = new Label(markerLine, SWT.NONE);
        //$NON-NLS-1$
        markerLabel.setText(marker.getAttribute(IMarker.MESSAGE, "missing message"));
        for (IMarkerResolution resolution : IDE.getMarkerHelpRegistry().getResolutions(marker)) {
            Composite resolutionComposite = new Composite(markerComposite, SWT.NONE);
            GridData layoutData = new GridData();
            layoutData.horizontalIndent = 10;
            resolutionComposite.setLayoutData(layoutData);
            RowLayout rowLayout = new RowLayout();
            rowLayout.marginBottom = 0;
            resolutionComposite.setLayout(rowLayout);
            Label resolutionImage = new Label(resolutionComposite, SWT.NONE);
            // TODO: try to retrieve icon from QuickFix command
            Image resolutionPic = null;
            if (resolution instanceof IMarkerResolution2) {
                resolutionPic = ((IMarkerResolution2) resolution).getImage();
            }
            if (resolutionPic == null) {
                resolutionPic = PlatformUI.getWorkbench().getSharedImages().getImage(SharedImages.IMG_OPEN_MARKER);
            }
            resolutionImage.setImage(resolutionPic);
            Link resolutionLink = new Link(resolutionComposite, SWT.NONE);
            //$NON-NLS-1$ //$NON-NLS-2$
            resolutionLink.setText("<A>" + resolution.getLabel() + "</a>");
            resolutionLink.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    Job resolutionJob = new Job("apply resolution - " + //$NON-NLS-1$
                    resolution.getLabel()) {

                        @Override
                        protected IStatus run(IProgressMonitor monitor) {
                            resolution.run(marker);
                            return Status.OK_STATUS;
                        }
                    };
                    resolutionJob.setUser(true);
                    resolutionJob.setSystem(true);
                    resolutionJob.setPriority(Job.INTERACTIVE);
                    resolutionJob.schedule();
                    getShell().dispose();
                }
            });
        }
    }
    parent.pack(true);
}
Example 74
Project: eclox-master  File: BooleanEditor.java View source code
/**
	 * @see eclox.ui.editor.editors.IEditor#createContent(org.eclipse.swt.widgets.Composite, org.eclipse.ui.forms.widgets.FormToolkit)
	 */
public void createContent(Composite parent, FormToolkit formToolkit) {
    // Initialize the parent control.
    RowLayout layout = new RowLayout(SWT.VERTICAL);
    layout.marginWidth = 0;
    parent.setLayout(layout);
    // Creates the buttons.
    yesButton = formToolkit.createButton(parent, "Yes", SWT.RADIO);
    noButton = formToolkit.createButton(parent, "No", SWT.RADIO);
    defaultButton = formToolkit.createButton(parent, "Default", SWT.RADIO);
    // Attaches a selection listener instance to each button.
    yesButton.addSelectionListener(new MySelectionListener());
    noButton.addSelectionListener(new MySelectionListener());
    defaultButton.addSelectionListener(new MySelectionListener());
}
Example 75
Project: EGit-master  File: NewRemoteDialog.java View source code
@Override
protected Control createDialogArea(Composite parent) {
    Composite main = new Composite(parent, SWT.NONE);
    main.setLayout(new GridLayout(2, false));
    GridDataFactory.fillDefaults().grab(true, true).applyTo(main);
    Label nameLabel = new Label(main, SWT.NONE);
    nameLabel.setText(UIText.NewRemoteDialog_NameLabel);
    nameText = new Text(main, SWT.BORDER);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(nameText);
    nameText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            checkPage();
        }
    });
    Composite buttonComposite = new Composite(main, SWT.NONE);
    GridDataFactory.fillDefaults().span(2, 1).applyTo(buttonComposite);
    buttonComposite.setLayout(new RowLayout(SWT.VERTICAL));
    forPush = new Button(buttonComposite, SWT.RADIO);
    forPush.setText(UIText.NewRemoteDialog_PushRadio);
    forPush.setSelection(true);
    Button forFetch = new Button(buttonComposite, SWT.RADIO);
    forFetch.setText(UIText.NewRemoteDialog_FetchRadio);
    nameText.setFocus();
    applyDialogFont(main);
    main.setTabList(new Control[] { nameText, buttonComposite });
    return main;
}
Example 76
Project: elexis-3-core-master  File: XIDEdit.java View source code
@Override
protected Control createDialogArea(Composite parent) {
    Composite ret = (Composite) super.createDialogArea(parent);
    ret.setLayout(new RowLayout(SWT.VERTICAL));
    new Label(ret, SWT.NONE).setText(mine.getDomainName());
    tShort = new Text(ret, SWT.BORDER);
    tShort.setText(mine.getSimpleName());
    new Label(ret, SWT.SEPARATOR | SWT.HORIZONTAL);
    new Label(ret, SWT.NONE).setText(Messages.XIDEdit_ShowWith);
    bPerson = new Button(ret, SWT.CHECK);
    bOrg = new Button(ret, SWT.CHECK);
    bPerson.setText(Messages.XIDEdit_Persons);
    bOrg.setText(Messages.XIDEdit_Organizations);
    if (mine.isDisplayedFor(Person.class)) {
        bPerson.setSelection(true);
    }
    if (mine.isDisplayedFor(Organisation.class)) {
        bOrg.setSelection(true);
    }
    return ret;
}
Example 77
Project: examples.toast-master  File: SoftwareView.java View source code
// private IProvisioner provisioner;
public void createPartControl(final Composite parent) {
    GridLayout parentLayout = LayoutUtil.createGridLayout(3, false, 10, 10);
    parent.setLayout(parentLayout);
    viewer = new ListViewer(parent, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);
    viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    viewer.setLabelProvider(new LabelProvider() {

        public String getText(Object element) {
            return (((IInstallableUnit) element).getProperty(IInstallableUnit.PROP_NAME));
        }
    });
    viewer.setContentProvider(new ArrayContentProvider());
    Composite comp = new Composite(parent, SWT.NONE);
    RowLayout layout = new RowLayout(SWT.VERTICAL);
    layout.fill = true;
    comp.setLayout(layout);
    Button addButton = new Button(comp, SWT.PUSH);
    addButton.setText("Add");
    addButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            final ProvisioningDialog dialog = new ProvisioningDialog(parent.getShell());
            Collection ius = getAvailablePackages(vehicle);
            dialog.setInput(new ArrayList(ius));
            dialog.open();
            List selectedPackages = dialog.getSelectedPackages();
            if (selectedPackages != null && !selectedPackages.isEmpty()) {
                IProvisioner provisioner = Component.getProvisioner();
                IInstallableUnit iu = (IInstallableUnit) selectedPackages.get(0);
                provisioner.install(vehicle.getName(), iu.getId(), null);
                Component.getTickler().tickle(vehicle.getName());
            }
            viewer.setInput(getInstalledPackages(vehicle));
        }
    });
    Button removeButton = new Button(comp, SWT.PUSH);
    removeButton.setText("Remove");
    removeButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
            IProvisioner provisioner = Component.getProvisioner();
            IInstallableUnit iu = (IInstallableUnit) selection.getFirstElement();
            provisioner.uninstall(vehicle.getName(), iu.getId(), null);
            Component.getTickler().tickle(vehicle.getName());
            viewer.setInput(getInstalledPackages(vehicle));
        }
    });
    Button confButton = new Button(comp, SWT.PUSH);
    confButton.setText("Configure");
    createSelectionListener();
}
Example 78
Project: FileBunker-master  File: AboutDialog.java View source code
protected Control createDialogArea(Composite parent) {
    Label spacer;
    Composite contents = new Composite(parent, SWT.NONE);
    RowLayout layout = new RowLayout(SWT.VERTICAL);
    layout.fill = true;
    layout.marginHeight = 10;
    layout.marginWidth = 30;
    layout.spacing = 0;
    contents.setLayout(layout);
    Label header = new Label(contents, SWT.CENTER);
    header.setFont(headerFont);
    header.setText("FileBunker");
    Label versionLabel = new Label(contents, SWT.CENTER);
    versionLabel.setText("Version " + version + "   Copyright 2004  Garrick Toubassi");
    return contents;
}
Example 79
Project: geotools-master  File: AbstractSimpleConfigurator.java View source code
protected void setLayout(Composite parent) {
    RowLayout layout = new RowLayout();
    layout.pack = false;
    layout.wrap = true;
    layout.type = SWT.HORIZONTAL;
    layout.fill = true;
    layout.marginLeft = 0;
    layout.marginRight = 0;
    layout.marginTop = 0;
    layout.marginBottom = 0;
    layout.spacing = 0;
    parent.setLayout(layout);
}
Example 80
Project: geotools_trunk-master  File: AbstractSimpleConfigurator.java View source code
protected void setLayout(Composite parent) {
    RowLayout layout = new RowLayout();
    layout.pack = false;
    layout.wrap = true;
    layout.type = SWT.HORIZONTAL;
    layout.fill = true;
    layout.marginLeft = 0;
    layout.marginRight = 0;
    layout.marginTop = 0;
    layout.marginBottom = 0;
    layout.spacing = 0;
    parent.setLayout(layout);
}
Example 81
Project: Goko-master  File: MacroExecutionPart.java View source code
private void updateButtons() throws GkException {
    parent.setLayout(new FillLayout(SWT.HORIZONTAL));
    Composite composite = new Composite(parent, SWT.NONE);
    RowLayout rowLayout = new RowLayout(SWT.HORIZONTAL);
    rowLayout.fill = true;
    rowLayout.pack = true;
    rowLayout.spacing = 6;
    composite.setLayout(rowLayout);
    List<GCodeMacro> lstMacro = macroService.getGCodeMacro();
    for (GCodeMacro macro : lstMacro) {
        if (macro.isShowInMacroPanel()) {
            Button btnMacro = new Button(composite, SWT.NONE);
            btnMacro.setText(macro.getCode());
            //	btnMacro.setLayoutData(new RowData(100, 35));
            if (macro.getButtonColor() != null) {
                btnMacro.setBackground(ResourceManager.getColor(Math.round(macro.getButtonColor().x * 255), Math.round(macro.getButtonColor().y * 255), Math.round(macro.getButtonColor().z * 255)));
            }
            btnMacro.addMouseListener(new MouseAdapter() {

                /** (inheritDoc)
					 * @see org.eclipse.swt.events.MouseAdapter#mouseUp(org.eclipse.swt.events.MouseEvent)
					 */
                @Override
                public void mouseUp(MouseEvent e) {
                    super.mouseUp(e);
                    try {
                        boolean executionConfirmed = true;
                        if (macro.isRequestConfirmBeforeExecution()) {
                            executionConfirmed = MessageDialog.openConfirm(parent.getShell(), "Confirm execution", "Do your really want to immediately execute the macro " + macro.getCode() + " ?");
                        }
                        if (executionConfirmed) {
                            if (executionService.isReadyForExecution()) {
                                executionService.clearExecutionQueue(ExecutionQueueType.SYSTEM);
                                executionService.addToExecutionQueue(ExecutionQueueType.SYSTEM, macroService.getGCodeProviderByMacro(macro.getId()));
                                executionService.beginQueueExecution(ExecutionQueueType.SYSTEM);
                            }
                        }
                    } catch (GkException ex) {
                        LOG.error(ex);
                    }
                }
            });
        }
    }
    parent.layout(true);
    parent.update();
}
Example 82
Project: HBuilder-opensource-master  File: DocstringsPrefPage.java View source code
/**
     * Creates the field editors. Field editors are abstractions of the common
     * GUI blocks needed to manipulate various types of preferences. Each field
     * editor knows how to save and restore itself.
     */
public void createFieldEditors() {
    Composite p = getFieldEditorParent();
    Composite p2 = new Composite(p, 0);
    p2.setLayout(new RowLayout());
    RadioGroupFieldEditor docstringCharEditor = new RadioGroupFieldEditor(P_DOCSTRINGCHARACTER, "Docstring character", 1, new String[][] { { "Quotation mark (\")", "\"" }, { "Apostrophe (')", "'" } }, p2, true);
    addField(docstringCharEditor);
    RadioGroupFieldEditor docstringStyleEditor = new RadioGroupFieldEditor(P_DOCSTRINGSTYLE, "Docstring style", 1, new String[][] { { "Sphinx (:tag name:)", DOCSTRINGSTYLE_SPHINX }, { "EpyDoc (@tag name:)", DOCSTRINGSTYLE_EPYDOC } }, p2, true);
    addField(docstringStyleEditor);
    Group typeDoctagGroup = new Group(p2, 0);
    typeDoctagGroup.setText("Type doctag generation (@type x:...)");
    typeDoctagEditor = new RadioGroupFieldEditor(P_TYPETAGGENERATION, "", 1, new String[][] { { "&Always", TYPETAG_GENERATION_ALWAYS }, { "&Never", TYPETAG_GENERATION_NEVER }, { "&Custom", TYPETAG_GENERATION_CUSTOM } }, typeDoctagGroup);
    addField(typeDoctagEditor);
    addField(new ParameterNamePrefixListEditor(P_DONT_GENERATE_TYPETAGS, "Don't create for parameters with prefix", typeDoctagGroup));
}
Example 83
Project: idart-jss-master  File: ManageDownReferral.java View source code
@Override
protected void createCompOptions() {
    RowLayout rowLayout = new RowLayout();
    rowLayout.wrap = false;
    rowLayout.pack = true;
    rowLayout.justify = true;
    compOptions.setLayout(rowLayout);
    GridLayout gl = new GridLayout(2, false);
    gl.verticalSpacing = 30;
    gl.marginTop = 70;
    Composite compOptionsInner = new Composite(compOptions, SWT.NONE);
    compOptionsInner.setLayout(gl);
    GridData gdPic = new GridData();
    gdPic.heightHint = 43;
    gdPic.widthHint = 50;
    GridData gdBtn = new GridData();
    gdBtn.heightHint = 40;
    gdBtn.widthHint = 360;
    // Scan out from pharmacy
    Label label = new Label(compOptionsInner, SWT.NONE);
    label.setLayoutData(gdPic);
    label.setImage(ResourceUtils.getImage(iDartImage.OUTGOINGPACKAGES));
    label.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseUp(MouseEvent mu) {
            cmdScanOutFromPharmacySelected();
        }
    });
    // Scan out from pharmacy
    Button button = new Button(compOptionsInner, SWT.NONE);
    button.setText("Scan Out Packages from Pharmacy");
    button.setFont(ResourceUtils.getFont(iDartFont.VERASANS_10));
    button.setLayoutData(gdBtn);
    button.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {

        @Override
        public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            cmdScanOutFromPharmacySelected();
        }
    });
    if (!iDartProperties.downReferralMode.equalsIgnoreCase(null)) {
        // Scan in at Clinic
        label = new Label(compOptionsInner, SWT.NONE);
        label.setLayoutData(gdPic);
        label.setImage(ResourceUtils.getImage(iDartImage.PACKAGESARRIVE));
        label.addMouseListener(new MouseAdapter() {

            @Override
            public void mouseUp(MouseEvent mu) {
                cmdScanInAtClinicSelected();
            }
        });
        // Scan in at Clinic
        button = new Button(compOptionsInner, SWT.NONE);
        button.setLayoutData(gdBtn);
        button.setText("Scan in Packages at Clinic");
        button.setFont(ResourceUtils.getFont(iDartFont.VERASANS_10));
        button.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {

            @Override
            public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
                cmdScanInAtClinicSelected();
            }
        });
    }
    // Scan out to patient
    label = new Label(compOptionsInner, SWT.NONE);
    label.setLayoutData(gdPic);
    label.setImage(ResourceUtils.getImage(iDartImage.PATIENTARRIVES));
    label.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseUp(MouseEvent mu) {
            cmdScanToPatientSelected();
        }
    });
    // Scan out to patient
    button = new Button(compOptionsInner, SWT.NONE);
    button.setLayoutData(gdBtn);
    button.setText("Scan Out Packages to Patients at Clinic");
    button.setFont(ResourceUtils.getFont(iDartFont.VERASANS_10));
    button.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {

        @Override
        public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            cmdScanToPatientSelected();
        }
    });
    compOptions.layout();
    compOptionsInner.layout();
}
Example 84
Project: janglipse-master  File: NewAS3FileWizardPage.java View source code
protected void createTemplateContent(Composite parent) {
    Label label = new Label(parent, SWT.NULL);
    label.setText("Template:");
    SelectionAdapter adapter = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            Button b = (Button) e.widget;
            template = b.getText().replaceAll("&", "");
        }
    };
    Composite group = new Composite(parent, SWT.NONE);
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    group.setLayout(new RowLayout());
    createTemplateRadioButton(group, "&Simple", adapter);
    createTemplateRadioButton(group, "&Class", adapter).setSelection(true);
    createTemplateRadioButton(group, "&Interface", adapter);
    template = "Class";
}
Example 85
Project: javasec-master  File: SelectProjectTypeWizardPage.java View source code
@SuppressWarnings("unchecked")
public void createControl(Composite parent) {
    //定义列数
    int columns = 5;
    ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.BORDER);
    scrolledComposite.setLayout(new RowLayout(SWT.VERTICAL));
    //强制显示滚动�  
    scrolledComposite.setAlwaysShowScrollBars(true);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setMinHeight(600);
    scrolledComposite.setLayout(new GridLayout(1, false));
    Composite container = new Composite(scrolledComposite, SWT.BORDER);
    GridLayout layout = new GridLayout();
    layout.numColumns = columns;
    layout.verticalSpacing = 9;
    container.setLayout(layout);
    scrolledComposite.setContent(container);
    final List<Element> lArchetype = gpRule.getMainRule().selectNodes("/archetypes/archetype");
    int index = 0;
    for (final Element archetype : lArchetype) {
        Button buttonSelect = new Button(container, SWT.RADIO);
        buttonSelect.setText(archetype.valueOf("title"));
        buttonSelect.setData(archetype);
        buttonSelect.addSelectionListener(new SelectionListener() {

            public void widgetSelected(SelectionEvent e) {
                radioToDocument(lArchetype, archetype);
            }

            public void widgetDefaultSelected(SelectionEvent e) {
                radioToDocument(lArchetype, archetype);
            }
        });
        if (index == 0) {
            buttonSelect.setSelection(true);
            radioToDocument(lArchetype, archetype);
        }
        Label labelFrame1 = new Label(container, SWT.RIGHT);
        labelFrame1.setText("框架:");
        Label labelFrame2 = new Label(container, SWT.LEFT);
        labelFrame2.setText(archetype.valueOf("framework"));
        Label labelAuthor1 = new Label(container, SWT.RIGHT);
        labelAuthor1.setText("作者:");
        Label labelAuthor2 = new Label(container, SWT.LEFT);
        labelAuthor2.setText(archetype.valueOf("author"));
        Text textDescription = new Text(container, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.WRAP | SWT.READ_ONLY);
        GridData gd = new GridData(GridData.VERTICAL_ALIGN_FILL);
        gd.horizontalSpan = columns;
        gd.verticalSpan = 6;
        gd.widthHint = 800;
        textDescription.setLayoutData(gd);
        textDescription.setText(archetype.valueOf("description"));
        if (++index < lArchetype.size()) {
            createLine(container, columns);
        }
    }
    setControl(container);
}
Example 86
Project: linuxtools-master  File: MainPackagePage.java View source code
@Override
protected void createFormContent(IManagedForm managedForm) {
    super.createFormContent(managedForm);
    FormToolkit toolkit = managedForm.getToolkit();
    ScrolledForm form = managedForm.getForm();
    form.setText(Messages.MainPackagePage_2);
    GridLayout layout = new GridLayout();
    layout.marginWidth = layout.marginHeight = 5;
    layout.numColumns = 2;
    RowLayout rowLayout = new RowLayout();
    rowLayout.type = SWT.VERTICAL;
    rowLayout.justify = true;
    rowLayout.fill = true;
    form.getBody().setLayout(rowLayout);
    form.getBody().setLayoutData(rowLayout);
    layout.numColumns = 2;
    GridData gd = new GridData();
    gd.horizontalSpan = 2;
    gd.horizontalAlignment = SWT.FILL;
    final Section mainPackageSection = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
    mainPackageSection.setText(Messages.MainPackagePage_3);
    mainPackageSection.setLayout(new GridLayout());
    Composite mainPackageClient = toolkit.createComposite(mainPackageSection);
    GridLayout gridLayout = new GridLayout();
    gridLayout.marginWidth = gridLayout.marginHeight = 5;
    gridLayout.numColumns = 2;
    mainPackageClient.setLayout(gridLayout);
    new RpmTagText(mainPackageClient, RpmTags.NAME, specfile);
    new RpmTagText(mainPackageClient, RpmTags.VERSION, specfile);
    new RpmTagText(mainPackageClient, RpmTags.RELEASE, specfile);
    new RpmTagText(mainPackageClient, RpmTags.URL, specfile);
    new RpmTagText(mainPackageClient, RpmTags.LICENSE, specfile);
    new RpmTagText(mainPackageClient, RpmTags.GROUP, specfile);
    new RpmTagText(mainPackageClient, RpmTags.EPOCH, specfile);
    new RpmTagText(mainPackageClient, RpmTags.BUILD_ROOT, specfile);
    new RpmTagText(mainPackageClient, RpmTags.BUILD_ARCH, specfile);
    new RpmTagText(mainPackageClient, RpmTags.SUMMARY, specfile, SWT.MULTI);
    // BuildRequires
    final Section buildRequiresSection = toolkit.createSection(mainPackageClient, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
    buildRequiresSection.setText(Messages.MainPackagePage_4);
    buildRequiresSection.setLayout(rowLayout);
    buildRequiresSection.setExpanded(false);
    Composite buildRequiresClient = toolkit.createComposite(buildRequiresSection);
    buildRequiresClient.setLayout(gridLayout);
    for (SpecfileTag buildRequire : specfile.getBuildRequires()) {
        new RpmTagText(buildRequiresClient, buildRequire, specfile);
    }
    buildRequiresSection.setClient(buildRequiresClient);
    toolkit.paintBordersFor(buildRequiresClient);
    toolkit.paintBordersFor(buildRequiresSection);
    // Requires
    final Section requiresSection = toolkit.createSection(mainPackageClient, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
    requiresSection.setText(Messages.MainPackagePage_5);
    requiresSection.setLayout(rowLayout);
    requiresSection.setExpanded(false);
    Composite requiresClient = toolkit.createComposite(requiresSection);
    requiresClient.setLayout(gridLayout);
    requiresClient.setLayoutData(gd);
    for (SpecfileTag require : specfile.getRequires()) {
        new RpmTagText(requiresClient, require, specfile);
    }
    requiresSection.setClient(requiresClient);
    toolkit.paintBordersFor(requiresClient);
    toolkit.paintBordersFor(requiresSection);
    mainPackageSection.setClient(mainPackageClient);
    toolkit.paintBordersFor(mainPackageClient);
    toolkit.paintBordersFor(mainPackageSection);
    // subpackages
    final Section packagesSection = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
    packagesSection.setText(Messages.MainPackagePage_6);
    packagesSection.setLayout(gridLayout);
    Composite packagesClient = toolkit.createComposite(packagesSection);
    packagesClient.setLayout(gridLayout);
    packagesClient.setLayoutData(gd);
    for (SpecfilePackage specfilePackage : specfile.getPackages().getPackages()) {
        if (specfilePackage.isMainPackage()) {
            continue;
        }
        final Section packageSection = toolkit.createSection(packagesClient, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
        packageSection.setText(specfilePackage.getFullPackageName());
        packageSection.setExpanded(false);
        packageSection.setLayout(rowLayout);
        Composite packageClient = toolkit.createComposite(packageSection);
        packageClient.setLayout(gridLayout);
        packageClient.setLayoutData(gd);
        new RpmTagText(packageClient, RpmTags.SUMMARY, specfile, specfilePackage, SWT.MULTI);
        new RpmTagText(packageClient, RpmTags.GROUP, specfile, specfilePackage, SWT.MULTI);
        final Section packageRequiresSection = toolkit.createSection(packageClient, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
        packageRequiresSection.setText(Messages.MainPackagePage_7);
        packageRequiresSection.setLayout(rowLayout);
        packageRequiresSection.setLayoutData(gd);
        Composite packageRequiresClient = toolkit.createComposite(packageRequiresSection);
        packageRequiresClient.setLayout(gridLayout);
        packageRequiresClient.setLayoutData(gd);
        for (SpecfileTag require : specfilePackage.getRequires()) {
            new RpmTagText(packageRequiresClient, require, specfile);
        }
        packageRequiresSection.setClient(packageRequiresClient);
        toolkit.paintBordersFor(packageRequiresClient);
        toolkit.paintBordersFor(packageRequiresSection);
        packageSection.setClient(packageClient);
        toolkit.paintBordersFor(packageClient);
        toolkit.paintBordersFor(packageSection);
    }
    packagesSection.setClient(packagesClient);
    toolkit.paintBordersFor(packagesClient);
    toolkit.paintBordersFor(packagesSection);
    managedForm.refresh();
}
Example 87
Project: LuaEclipse-master  File: EditInterpreterDialog.java View source code
protected void createLocationEntryField(Composite composite) {
    (new Label(composite, 0)).setText("Path:");
    Composite locationComposite = new Composite(composite, 0);
    RowLayout locationLayout = new RowLayout();
    locationLayout.marginLeft = 0;
    locationComposite.setLayout(locationLayout);
    interpreterLocationText = new Text(locationComposite, 2052);
    interpreterLocationText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            allStatus[1] = validateInterpreterLocationText();
            updateStatusLine();
        }
    });
    interpreterLocationText.setLayoutData(new RowData(200, -1));
    Button browseButton = new Button(composite, 8);
    browseButton.setLayoutData(new GridData(128));
    browseButton.setText("Browse...");
    browseButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            browseForInstallDir();
        }
    });
}
Example 88
Project: marketcetera-master  File: CommandLineTrimWidget.java View source code
@Override
protected Control createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new RowLayout());
    composite.setData(this);
    Label command = new Label(composite, SWT.NONE);
    command.setText(Messages.CommandStatusLineContribution_CommandLabel.getText());
    textArea = new Text(composite, SWT.BORDER);
    IFocusService focusService = (IFocusService) getWorkbenchWindow().getService(IFocusService.class);
    focusService.addFocusTracker(textArea, ID);
    Point sizeHint = EclipseUtils.getTextAreaSize(composite, text, charWidth, heightFactor);
    RowData rowData = new RowData();
    rowData.width = sizeHint.x;
    rowData.height = sizeHint.y;
    textArea.setLayoutData(rowData);
    textArea.setText(text);
    textArea.addKeyListener(new KeyAdapter() {

        public void keyReleased(KeyEvent e) {
            handleKeyReleased(e);
        }
    });
    if (tooltip != null) {
        textArea.setToolTipText(tooltip);
    }
    return composite;
}
Example 89
Project: monkeytalk-master  File: ArgumentEditorDialog.java View source code
@Override
protected Control createContents(Composite parent) {
    Composite contents = new Composite(parent, SWT.NONE);
    contents.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    this.createButtonBar(parent);
    Composite argsHolder = new Composite(contents, SWT.NONE);
    FillLayout fillLayout = new FillLayout();
    fillLayout.type = SWT.VERTICAL;
    argsHolder.setLayout(fillLayout);
    editors = new HashMap<String, Text>();
    for (String name : args.keySet()) {
        Composite c = new Composite(argsHolder, SWT.NONE);
        RowLayout rl = new RowLayout();
        c.setLayout(rl);
        Label l = new Label(c, SWT.LEFT);
        l.setText(name + ":");
        l.setLayoutData(new RowData(125, 20));
        Text input = new Text(c, SWT.BORDER);
        input.setText(args.get(name));
        input.setLayoutData(new RowData(200, 20));
        editors.put(name, input);
    }
    Dialog.applyDialogFont(parent);
    Point defaultMargins = LayoutConstants.getMargins();
    GridLayoutFactory.fillDefaults().numColumns(2).margins(defaultMargins.x, defaultMargins.y).generateLayout(contents);
    return contents;
}
Example 90
Project: Mura-Tools-for-Eclipse-Core-master  File: DisplayObjectsPage.java View source code
[email protected]
public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    setControl(composite);
    composite.setLayout(new RowLayout(SWT.VERTICAL));
    Group grpDisplayObjects = new Group(composite, SWT.NONE);
    grpDisplayObjects.setLayoutData(new RowData(560, 174));
    grpDisplayObjects.setText("Display Objects");
    grpDisplayObjects.setLayout(new FillLayout(SWT.HORIZONTAL));
    table = new Table(grpDisplayObjects, SWT.BORDER | SWT.FULL_SELECTION);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    TableColumn tblclmnName = new TableColumn(table, SWT.NONE);
    tblclmnName.setWidth(195);
    tblclmnName.setText("Name");
    TableColumn tblclmnFileName = new TableColumn(table, SWT.NONE);
    tblclmnFileName.setWidth(360);
    tblclmnFileName.setText("File Name");
    Composite composite_1 = new Composite(composite, SWT.NONE);
    composite_1.setLayout(null);
    composite_1.setLayoutData(new RowData(564, 27));
    Button btnRemoveDisplayObject = new Button(composite_1, SWT.NONE);
    btnRemoveDisplayObject.setBounds(301, 3, 134, 25);
    btnRemoveDisplayObject.setText("Remove Display Object");
    btnRemoveDisplayObject.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            int selectionIndex = table.getSelectionIndex();
            table.remove(selectionIndex);
            displayObjects.remove(selectionIndex);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
    Button btnClearDisplayObject = new Button(composite_1, SWT.NONE);
    btnClearDisplayObject.setBounds(441, 3, 123, 25);
    btnClearDisplayObject.setText("Clear Display Objects");
    btnClearDisplayObject.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            table.removeAll();
            displayObjects.removeAll(displayObjects);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
    Group grpAddNewDisplay = new Group(composite, SWT.NONE);
    grpAddNewDisplay.setLayoutData(new RowData(560, SWT.DEFAULT));
    grpAddNewDisplay.setText("Add New Display Object");
    grpAddNewDisplay.setLayout(new GridLayout(5, false));
    Label lblName = new Label(grpAddNewDisplay, SWT.NONE);
    lblName.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblName.setText("Name");
    txtName = new Text(grpAddNewDisplay, SWT.BORDER);
    txtName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    Label lblFileName = new Label(grpAddNewDisplay, SWT.NONE);
    lblFileName.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblFileName.setText("File Name");
    txtFileName = new Text(grpAddNewDisplay, SWT.BORDER);
    txtFileName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    Button btnAddDisplayObject = new Button(grpAddNewDisplay, SWT.NONE);
    btnAddDisplayObject.setText("Add Display Object");
    btnAddDisplayObject.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            TableItem item = new TableItem(table, SWT.NONE);
            item.setText(0, txtName.getText());
            item.setText(1, txtFileName.getText());
            displayObjects.add(new DisplayObject(txtName.getText(), txtFileName.getText()));
            txtName.setText("");
            txtFileName.setText("");
            txtName.setFocus();
        }
    });
}
Example 91
Project: mylyn.tasks-master  File: AbstractTaskEditorSection.java View source code
@Override
protected void setSection(FormToolkit toolkit, Section section) {
    if (section.getTextClient() == null) {
        ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
        fillToolBar(toolBarManager);
        if (toolBarManager.getSize() > 0) {
            Composite toolbarComposite = toolkit.createComposite(section);
            toolbarComposite.setBackground(null);
            RowLayout rowLayout = new RowLayout();
            rowLayout.marginLeft = 0;
            rowLayout.marginRight = 0;
            rowLayout.marginTop = 0;
            rowLayout.marginBottom = 0;
            rowLayout.center = true;
            toolbarComposite.setLayout(rowLayout);
            createInfoOverlay(toolbarComposite, section, toolkit);
            toolBarManager.createControl(toolbarComposite);
            section.clientVerticalSpacing = 0;
            section.descriptionVerticalSpacing = 0;
            section.setTextClient(toolbarComposite);
        }
    }
    setControl(section);
}
Example 92
Project: org.eclipse.mylyn.tasks-master  File: AbstractTaskEditorSection.java View source code
@Override
protected void setSection(FormToolkit toolkit, Section section) {
    if (section.getTextClient() == null) {
        ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
        fillToolBar(toolBarManager);
        if (toolBarManager.getSize() > 0) {
            Composite toolbarComposite = toolkit.createComposite(section);
            toolbarComposite.setBackground(null);
            RowLayout rowLayout = new RowLayout();
            rowLayout.marginLeft = 0;
            rowLayout.marginRight = 0;
            rowLayout.marginTop = 0;
            rowLayout.marginBottom = 0;
            rowLayout.center = true;
            toolbarComposite.setLayout(rowLayout);
            createInfoOverlay(toolbarComposite, section, toolkit);
            toolBarManager.createControl(toolbarComposite);
            section.clientVerticalSpacing = 0;
            section.descriptionVerticalSpacing = 0;
            section.setTextClient(toolbarComposite);
        }
    }
    setControl(section);
}
Example 93
Project: org.nabucco.framework.common.authorization-master  File: AuthorizationOverviewLayouter.java View source code
/**
     * Layouts the overview view.
     * 
     * @param parent
     *            the parent composite
     * @param nabuccoOverviewModel
     *            the overview model
     * 
     * @return the layouted composite
     */
public Composite layout(Composite parent, NabuccoOverviewModel nabuccoOverviewModel) {
    this.model = nabuccoOverviewModel;
    NabuccoFormToolkit ntk = new NabuccoFormToolkit(parent);
    Composite frame = ntk.createComposite(parent, new RowLayout(SWT.VERTICAL | SWT.NO_SCROLL));
    this.widgetFactory = new AuthorizationOverviewWidgetFactory(ntk);
    createSectionSummary(frame);
    createSectionBottom(frame);
    return null;
}
Example 94
Project: org.nabucco.framework.common.dynamiccode-master  File: DynamicCodeOverviewLayouter.java View source code
private Composite layout(Composite parent, NabuccoOverviewModel nabuccoOverviewModel) {
    model = nabuccoOverviewModel;
    NabuccoFormToolkit ntk = new NabuccoFormToolkit(parent);
    Composite frame = ntk.createComposite(parent, new RowLayout(SWT.VERTICAL | SWT.NO_SCROLL));
    widgetFactory = new DynamicCodeOverviewWidgetFactory(ntk);
    createSectionSummary(frame);
    createSectionBottom(frame);
    return null;
}
Example 95
Project: platform_tools_motodev-master  File: TooltipDisplayConfigContriutionItem.java View source code
/* (non-Javadoc)
     * @see org.eclipse.jface.action.ControlContribution#createControl(org.eclipse.swt.widgets.Composite)
     */
@Override
protected Control createControl(Composite parent) {
    // adjust layout in order to produce space to the left
    Composite mainComposite = new Composite(parent, SWT.NONE);
    RowLayout layout = new RowLayout(SWT.FILL);
    layout.center = true;
    layout.marginLeft = 10;
    mainComposite.setLayout(layout);
    // create the check box button
    showToolTipButton = new Button(mainComposite, SWT.CHECK);
    showToolTipButton.setText(AndroidSnippetsNLS.TooltipDisplayConfigContriutionItem_ShowPreview);
    showToolTipButton.addSelectionListener(new TooltipSelectionListener());
    // set the selection persisted
    IEclipsePreferences preferences = getEclipsePreferences();
    boolean isTooltipDisplayed = preferences.getBoolean(DIALOG_SETTINGS__IS_TOOLTIP_DISPLAYED, true);
    showToolTipButton.setSelection(isTooltipDisplayed);
    performButtonSelection();
    return mainComposite;
}
Example 96
Project: Pydev-master  File: DocstringsPrefPage.java View source code
/**
     * Creates the field editors. Field editors are abstractions of the common
     * GUI blocks needed to manipulate various types of preferences. Each field
     * editor knows how to save and restore itself.
     */
@Override
public void createFieldEditors() {
    Composite p = getFieldEditorParent();
    Composite p2 = new Composite(p, 0);
    p2.setLayout(new RowLayout());
    RadioGroupFieldEditor docstringCharEditor = new RadioGroupFieldEditor(P_DOCSTRINGCHARACTER, "Docstring character", 1, new String[][] { { "Quotation mark (\")", "\"" }, { "Apostrophe (')", "'" } }, p2, true);
    addField(docstringCharEditor);
    RadioGroupFieldEditor docstringStyleEditor = new RadioGroupFieldEditor(P_DOCSTRINGSTYLE, "Docstring style", 1, new String[][] { { "Sphinx (:tag name:)", DOCSTRINGSTYLE_SPHINX }, { "EpyDoc (@tag name:)", DOCSTRINGSTYLE_EPYDOC } }, p2, true);
    addField(docstringStyleEditor);
    Group typeDoctagGroup = new Group(p2, 0);
    typeDoctagGroup.setText("Type doctag generation (@type x:...)");
    typeDoctagEditor = new RadioGroupFieldEditor(P_TYPETAGGENERATION, "", 1, new String[][] { { "&Always", TYPETAG_GENERATION_ALWAYS }, { "&Never", TYPETAG_GENERATION_NEVER }, { "&Custom", TYPETAG_GENERATION_CUSTOM } }, typeDoctagGroup);
    addField(typeDoctagEditor);
    addField(new ParameterNamePrefixListEditor(P_DONT_GENERATE_TYPETAGS, "Don't create for parameters with prefix", typeDoctagGroup));
}
Example 97
Project: qb-core-master  File: SelectProjectTypeWizardPage.java View source code
@SuppressWarnings("unchecked")
public void createControl(Composite parent) {
    //定义列数
    int columns = 5;
    ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.BORDER);
    scrolledComposite.setLayout(new RowLayout(SWT.VERTICAL));
    //强制显示滚动�  
    scrolledComposite.setAlwaysShowScrollBars(true);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setMinHeight(600);
    scrolledComposite.setLayout(new GridLayout(1, false));
    Composite container = new Composite(scrolledComposite, SWT.BORDER);
    GridLayout layout = new GridLayout();
    layout.numColumns = columns;
    layout.verticalSpacing = 9;
    container.setLayout(layout);
    scrolledComposite.setContent(container);
    final List<Element> lArchetype = gpRule.getMainRule().selectNodes("/archetypes/archetype");
    int index = 0;
    for (final Element archetype : lArchetype) {
        Button buttonSelect = new Button(container, SWT.RADIO);
        buttonSelect.setText(archetype.valueOf("title"));
        buttonSelect.setData(archetype);
        buttonSelect.addSelectionListener(new SelectionListener() {

            public void widgetSelected(SelectionEvent e) {
                radioToDocument(lArchetype, archetype);
            }

            public void widgetDefaultSelected(SelectionEvent e) {
                radioToDocument(lArchetype, archetype);
            }
        });
        if (index == 0) {
            buttonSelect.setSelection(true);
            radioToDocument(lArchetype, archetype);
        }
        Label labelFrame1 = new Label(container, SWT.RIGHT);
        labelFrame1.setText("框架:");
        Label labelFrame2 = new Label(container, SWT.LEFT);
        labelFrame2.setText(archetype.valueOf("framework"));
        Label labelAuthor1 = new Label(container, SWT.RIGHT);
        labelAuthor1.setText("作者:");
        Label labelAuthor2 = new Label(container, SWT.LEFT);
        labelAuthor2.setText(archetype.valueOf("author"));
        Text textDescription = new Text(container, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.WRAP | SWT.READ_ONLY);
        GridData gd = new GridData(GridData.VERTICAL_ALIGN_FILL);
        gd.horizontalSpan = columns;
        gd.verticalSpan = 6;
        gd.widthHint = 800;
        textDescription.setLayoutData(gd);
        textDescription.setText(archetype.valueOf("description"));
        if (++index < lArchetype.size()) {
            createLine(container, columns);
        }
    }
    setControl(container);
}
Example 98
Project: rap-d3charts-master  File: ChartExamplePage.java View source code
private static Composite createTabBar(Composite parent) {
    Composite bar = new Composite(parent, SWT.NONE);
    RowLayout layout = new RowLayout(SWT.HORIZONTAL);
    layout.marginLeft = 25;
    layout.marginRight = 25;
    layout.marginTop = 5;
    layout.marginBottom = 5;
    layout.spacing = 10;
    bar.setLayout(layout);
    FormData layoutData = new FormData();
    layoutData.top = new FormAttachment(100, -30);
    layoutData.left = new FormAttachment(0);
    layoutData.right = new FormAttachment(100);
    layoutData.bottom = new FormAttachment(100);
    bar.setLayoutData(layoutData);
    return bar;
}
Example 99
Project: rce-master  File: ScriptSection.java View source code
@Override
protected void createCompositeContent(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
    super.createCompositeContent(parent, aTabbedPropertySheetPage);
    /*
         * Inspecting the build-up of super-class section. Parent composite has a section which has a layout composite. The label-text will
         * be inserted at first position.
         */
    Composite parentComposite = null;
    Control[] parentChildControls = parent.getChildren();
    if (parentChildControls[0] instanceof Section) {
        Control[] sectionChildControls = ((Section) parentChildControls[0]).getChildren();
        for (int i = 0; i < sectionChildControls.length; i++) {
            if (sectionChildControls[i] instanceof Composite) {
                parentComposite = (Composite) sectionChildControls[i];
                break;
            }
        }
    }
    if (parentComposite != null) {
        TabbedPropertySheetWidgetFactory factory = aTabbedPropertySheetPage.getWidgetFactory();
        Composite scriptParent = factory.createFlatFormComposite(parentComposite);
        scriptParent.setLayout(new RowLayout());
        new Label(scriptParent, SWT.NONE).setText(Messages.chooseLanguage);
        languages = new CCombo(scriptParent, SWT.BORDER | SWT.READ_ONLY);
        languages.setData(CONTROL_PROPERTY_KEY, ScriptComponentConstants.SCRIPT_LANGUAGE);
        ServiceRegistryAccess serviceRegistryAccess = ServiceRegistry.createAccessFor(this);
        ScriptExecutorFactoryRegistry scriptExecutorRegistry = serviceRegistryAccess.getService(ScriptExecutorFactoryRegistry.class);
        List<ScriptLanguage> languagesForCombo = scriptExecutorRegistry.getCurrentRegisteredExecutorLanguages();
        for (ScriptLanguage sl : languagesForCombo) {
            languages.add(sl.getName());
        }
        scriptParent.moveAbove(parentComposite.getChildren()[0]);
    }
}
Example 100
Project: rdt-master  File: InlineClassPage.java View source code
private void initList(Composite control) {
    RowLayout panelLayout = new RowLayout(SWT.VERTICAL);
    panelLayout.wrap = false;
    Label selectText = new Label(control, SWT.NONE);
    selectText.setText(Messages.InlineClassPage_SelectTargetClass);
    List classList = new List(control, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL);
    setListLayout(classList);
    fillList(classList);
    initSelectionListener(classList);
}
Example 101
Project: ripla-master  File: Skin.java View source code
@Override
public Composite getMenuBar(final Composite inParent) {
    final Composite lFill = new Composite(inParent, SWT.NONE);
    lFill.setLayout(GridLayoutHelper.createGridLayout());
    lFill.setLayoutData(GridLayoutHelper.createFillLayoutData());
    final Composite out = new Composite(lFill, SWT.BORDER);
    final RowLayout lLayout = new RowLayout(SWT.HORIZONTAL);
    lLayout.marginTop = 0;
    out.setLayout(lLayout);
    out.setLayoutData(GridLayoutHelper.createFillLayoutData());
    out.setData(RWT.CUSTOM_VARIANT, "modest-menubar");
    return out;
}