Java Code Examples for org.eclipse.jface.layout.GridDataFactory#applyTo()
The following examples show how to use
org.eclipse.jface.layout.GridDataFactory#applyTo() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultiCellEditDialog.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
@Override protected Control createDialogArea(Composite parent) { Composite panel = new Composite(parent, SWT.NONE); GridDataFactory.fillDefaults().grab(true, true).applyTo(panel); GridLayout panelLayout = new GridLayout(allowIncrementDecrement ? 2 : 1,false); panel.setLayout(panelLayout); if (allowIncrementDecrement) { createUpdateCombo(panel); } ActiveCellEditor.close(); ActiveCellEditor.activate(cellEditor, panel, originalCanonicalValue, initialEditValue, dataTypeConverter, cellStyle, dataValidator, new MultiEditHandler(), 0, 0, 0, 0); Control editorControl = ActiveCellEditor.getControl(); // propagate the ESC event from the editor to the dialog editorControl.addKeyListener(getEscKeyListener()); final GridDataFactory layoutData = GridDataFactory.fillDefaults().grab(true, false).hint(100, 20); if (allowIncrementDecrement) { layoutData.indent(5, 0); } layoutData.applyTo(editorControl); return panel; }
Example 2
Source File: MultiCellEditDialog.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
@Override protected Control createDialogArea(Composite parent) { Composite panel = new Composite(parent, SWT.NONE); GridDataFactory.fillDefaults().grab(true, true).applyTo(panel); GridLayout panelLayout = new GridLayout(allowIncrementDecrement ? 2 : 1,false); panel.setLayout(panelLayout); if (allowIncrementDecrement) { createUpdateCombo(panel); } ActiveCellEditor.close(); ActiveCellEditor.activate(cellEditor, panel, originalCanonicalValue, initialEditValue, dataTypeConverter, cellStyle, dataValidator, new MultiEditHandler(), 0, 0, 0, 0); Control editorControl = ActiveCellEditor.getControl(); // propagate the ESC event from the editor to the dialog editorControl.addKeyListener(getEscKeyListener()); final GridDataFactory layoutData = GridDataFactory.fillDefaults().grab(true, false).hint(100, 20); if (allowIncrementDecrement) { layoutData.indent(5, 0); } layoutData.applyTo(editorControl); return panel; }
Example 3
Source File: NodeAttachDebugTab.java From wildwebdeveloper with Eclipse Public License 2.0 | 4 votes |
@Override public void createControl(Composite parent) { super.createControl(parent); Composite composite = (Composite)getControl(); Composite rootMapComposite = new Composite(composite, SWT.NONE); GridDataFactory.swtDefaults().align(SWT.FILL, SWT.BEGINNING).span(((GridLayout)composite.getLayout()).numColumns, 1).grab(true, false).indent(0, 40).applyTo(rootMapComposite); rootMapComposite.setLayout(new GridLayout(3, false)); Label rootMapDescription = new Label(rootMapComposite, SWT.NONE); rootMapDescription.setText(Messages.NodeAttach_rootMapDescription); rootMapDescription.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false, 3, 1)); GridDataFactory indentFactory = GridDataFactory.swtDefaults().indent(20, 0); Label remoteRootLabel = new Label(rootMapComposite, SWT.NONE); remoteRootLabel.setText(Messages.NodeAttach_remoteRoot); indentFactory.applyTo(remoteRootLabel); remoteRootText = new Text(rootMapComposite, SWT.BORDER); remoteRootText.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false, 2, 1)); remoteRootText.addModifyListener(e -> { setDirty(true); updateLaunchConfigurationDialog(); }); Label localRootLabel = new Label(rootMapComposite, SWT.NONE); localRootLabel.setText(Messages.NodeAttach_localRoot); indentFactory.applyTo(localRootLabel); localRootText = new Text(rootMapComposite, SWT.BORDER); localRootText.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false)); Button browseLocalButton = new Button(rootMapComposite, SWT.PUSH); browseLocalButton.setText(Messages.AbstractRunHTMLDebugTab_browse); browseLocalButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { DirectoryDialog directoryDialog = new DirectoryDialog(browseLocalButton.getShell()); directoryDialog.setText(Messages.NodeAttach_localRoot); String selectedDirString = directoryDialog.open(); if (selectedDirString != null) { localRootText.setText(selectedDirString); } })); ControlDecoration invalidDirectoryDecoration = new ControlDecoration(localRootText, SWT.TOP | SWT.LEFT); invalidDirectoryDecoration.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage()); invalidDirectoryDecoration.setDescriptionText(Messages.NodeAttach_invalidLocalRootDirectory); invalidDirectoryDecoration.hide(); localRootText.addModifyListener(e -> { if (!localRootText.getText().isEmpty() && !new File(localRootText.getText()).isDirectory()) { invalidDirectoryDecoration.show(); setWarningMessage(Messages.NodeAttach_invalidLocalRootDirectory); } else { invalidDirectoryDecoration.hide(); setWarningMessage(null); } setDirty(true); updateLaunchConfigurationDialog(); }); }
Example 4
Source File: JSParserValidatorPreferenceCompositeFactory.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
public Composite createPreferenceComposite(Composite parent, final IBuildParticipantWorkingCopy participant) { Composite master = new Composite(parent, SWT.NONE); master.setLayout(GridLayoutFactory.fillDefaults().create()); GridDataFactory fillHoriz = GridDataFactory.fillDefaults().grab(true, false); // Options Group group = new Group(master, SWT.BORDER); group.setText(Messages.JSParserValidatorPreferenceCompositeFactory_OptionsGroup); group.setLayout(new GridLayout()); group.setLayoutData(fillHoriz.create()); Composite pairs = new Composite(group, SWT.NONE); pairs.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create()); Label label = new Label(pairs, SWT.WRAP); label.setText(Messages.JSParserValidatorPreferenceCompositeFactory_MissingSemicolons); Combo combo = new Combo(pairs, SWT.READ_ONLY | SWT.SINGLE); for (IProblem.Severity severity : IProblem.Severity.values()) { combo.add(severity.label()); combo.setData(severity.label(), severity); } String severityValue = participant.getPreferenceString(IPreferenceConstants.PREF_MISSING_SEMICOLON_SEVERITY); combo.setText(IProblem.Severity.create(severityValue).label()); combo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Combo c = ((Combo) e.widget); int index = c.getSelectionIndex(); String text = c.getItem(index); IProblem.Severity s = (Severity) c.getData(text); participant.setPreference(IPreferenceConstants.PREF_MISSING_SEMICOLON_SEVERITY, s.id()); } }); fillHoriz.applyTo(pairs); // Filters Composite filtersGroup = new ValidatorFiltersPreferenceComposite(master, participant); filtersGroup.setLayoutData(fillHoriz.grab(true, true).hint(SWT.DEFAULT, 150).create()); return master; }
Example 5
Source File: JSLintValidatorPreferenceCompositeFactory.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
public Composite createPreferenceComposite(Composite parent, final IBuildParticipantWorkingCopy participant) { Composite master = new Composite(parent, SWT.NONE); master.setLayout(GridLayoutFactory.fillDefaults().create()); GridDataFactory fillHoriz = GridDataFactory.fillDefaults().grab(true, false); // JSON Options Group group = new Group(master, SWT.BORDER); group.setText(Messages.JSLintValidatorPreferenceCompositeFactory_OptionsTitle); group.setLayout(new GridLayout()); group.setLayoutData(fillHoriz.create()); Label label = new Label(group, SWT.WRAP); label.setText(Messages.JSLintValidatorPreferenceCompositeFactory_OptionsMsg); fillHoriz.applyTo(label); final Text text = new Text(group, SWT.MULTI | SWT.V_SCROLL); final ControlDecoration decoration = new ControlDecoration(text, SWT.LEFT | SWT.TOP); decoration.setDescriptionText(Messages.JSLintValidatorPreferenceCompositeFactory_OptionsParseError); decoration.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_DEC_FIELD_ERROR)); decoration.hide(); text.setText(participant.getPreferenceString(IPreferenceConstants.JS_LINT_OPTIONS)); fillHoriz.hint(SWT.DEFAULT, 100).applyTo(text); text.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { decoration.hide(); try { String optionsAsJSON = text.getText(); JSON.parse(optionsAsJSON); participant.setPreference(IPreferenceConstants.JS_LINT_OPTIONS, text.getText()); } catch (IllegalStateException e1) { decoration.show(); } } }); // Filters Composite filtersGroup = new ValidatorFiltersPreferenceComposite(master, participant); filtersGroup.setLayoutData(fillHoriz.grab(true, true).hint(SWT.DEFAULT, 150).create()); return master; }