Java Code Examples for org.eclipse.swt.widgets.Control#setLayoutData()
The following examples show how to use
org.eclipse.swt.widgets.Control#setLayoutData() .
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: CheckstylePropertyPage.java From eclipse-cs with GNU Lesser General Public License v2.1 | 6 votes |
private Control createLocalConfigArea(Composite parent) { Composite noteAndEditor = new Composite(parent, SWT.NULL); noteAndEditor.setLayout(new GridLayout(1, false)); noteAndEditor.setLayoutData(new GridData(GridData.FILL_BOTH)); Label lblHint = new Label(noteAndEditor, SWT.WRAP); lblHint.setText(Messages.CheckstylePropertyPage_msgLocalConfigs); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.widthHint = 200; lblHint.setLayoutData(gd); mWorkingSetEditor = new CheckConfigurationWorkingSetEditor( mProjectConfig.getLocalCheckConfigWorkingSet(), false); Control editorControl = mWorkingSetEditor.createContents(noteAndEditor); editorControl.setLayoutData(new GridData(GridData.FILL_BOTH)); return noteAndEditor; }
Example 2
Source File: JavaTemplatePreferencePage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override protected SourceViewer createViewer(Composite parent) { IDocument document= new Document(); JavaTextTools tools= JavaPlugin.getDefault().getJavaTextTools(); tools.setupJavaDocumentPartitioner(document, IJavaPartitions.JAVA_PARTITIONING); IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore(); SourceViewer viewer= new JavaSourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL, store); SimpleJavaSourceViewerConfiguration configuration= new SimpleJavaSourceViewerConfiguration(tools.getColorManager(), store, null, IJavaPartitions.JAVA_PARTITIONING, false); viewer.configure(configuration); viewer.setEditable(false); viewer.setDocument(document); Font font= JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT); viewer.getTextWidget().setFont(font); new JavaSourcePreviewerUpdater(viewer, configuration, store); Control control= viewer.getControl(); GridData data= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL); control.setLayoutData(data); return viewer; }
Example 3
Source File: LevelPropertyDialog.java From birt with Eclipse Public License 1.0 | 6 votes |
public static void setExcludeGridData( Control control, boolean exclude ) { Object obj = control.getLayoutData( ); if ( obj == null ) control.setLayoutData( new GridData( ) ); else if ( !( obj instanceof GridData ) ) return; GridData data = (GridData) control.getLayoutData( ); if ( exclude ) { data.heightHint = 0; } else { data.heightHint = -1; } control.setLayoutData( data ); control.getParent( ).layout( ); control.setVisible( !exclude ); }
Example 4
Source File: PropertyAndPreferencePage.java From typescript.java with MIT License | 6 votes |
@Override protected Control createContents(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; composite.setLayout(layout); composite.setFont(parent.getFont()); GridData data = new GridData(GridData.FILL, GridData.FILL, true, true); Control header = createPreferenceHeaderContent(composite); if (header != null) { header.setLayoutData(data); } fConfigurationBlockControl = createPreferenceBodyContent(composite); fConfigurationBlockControl.setLayoutData(data); if (isProjectPreferencePage()) { boolean useProjectSettings = hasProjectSpecificOptions(getProject()); enableProjectSpecificSettings(useProjectSettings); } Dialog.applyDialogFont(composite); return composite; }
Example 5
Source File: AbstractDescriptionPropertyPage.java From birt with Eclipse Public License 1.0 | 6 votes |
public Control createPageControl(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout( ); layout.marginWidth = 0; layout.marginHeight = 0; composite.setLayout(layout); if(getPageDescription() != null) { pageDescription = new Label(composite, SWT.NONE); pageDescription.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); pageDescription.setText(getPageDescription()); pageDescription.setToolTipText(getPageDescription()); } GridData data = new GridData(GridData.FILL_BOTH); Control control = createContents(composite); control.setLayoutData(data); return composite; }
Example 6
Source File: AbstractEditor.java From gama with GNU General Public License v3.0 | 6 votes |
protected Control createEditorControl(final Composite comp) { Control paramControl; try { paramControl = !isEditable ? createLabelParameterControl(comp) : isCombo ? createComboParameterControl(comp) : createCustomParameterControl(comp); } catch (final GamaRuntimeException e1) { e1.addContext("The editor for " + name + " could not be created"); GAMA.reportError(GAMA.getRuntimeScope(), e1, false); return null; } final GridData data = getParameterGridData(); paramControl.setLayoutData(data); paramControl.setBackground(comp.getBackground()); addToolbarHiders(paramControl); return paramControl; }
Example 7
Source File: TypeScriptTemplatePreferencePage.java From typescript.java with MIT License | 6 votes |
protected SourceViewer createViewer(Composite parent) { IDocument document= new Document(); JavaScriptTextTools tools= JSDTTypeScriptUIPlugin.getDefault().getJavaTextTools(); tools.setupJavaDocumentPartitioner(document, IJavaScriptPartitions.JAVA_PARTITIONING); IPreferenceStore store= JSDTTypeScriptUIPlugin.getDefault().getCombinedPreferenceStore(); SourceViewer viewer= new JavaSourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL, store); SimpleJavaSourceViewerConfiguration configuration= new SimpleJavaSourceViewerConfiguration(tools.getColorManager(), store, null, IJavaScriptPartitions.JAVA_PARTITIONING, false); viewer.configure(configuration); viewer.setEditable(false); viewer.setDocument(document); Font font= JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT); viewer.getTextWidget().setFont(font); new TypeScriptSourcePreviewerUpdater(viewer, configuration, store); Control control= viewer.getControl(); GridData data= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL); control.setLayoutData(data); return viewer; }
Example 8
Source File: ColorsPreferencePage.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
protected void doFillIntoGrid(Composite parent, int numColumns) { Control control = getLabelControl(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = numColumns - 1; control.setLayoutData(gd); colorButton = getChangeControl(parent); GridData dataBtn = new GridData(); dataBtn.widthHint = 100; colorButton.setLayoutData(dataBtn); fExtent = computeImageSize(parent); colorButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { updateColorImage(); } }); }
Example 9
Source File: WSO2PluginListSelectionPage.java From developer-studio with Apache License 2.0 | 5 votes |
public void createDescriptionIn(Composite composite) { descriptionBrowser = new WSO2PluginFormBrowser(SWT.BORDER | SWT.V_SCROLL); descriptionBrowser.setText(""); descriptionBrowser.createControl(composite); Control c = descriptionBrowser.getControl(); GridData gd = new GridData(GridData.FILL_BOTH); gd.widthHint = 200; c.setLayoutData(gd); }
Example 10
Source File: ActionSpecialDialog.java From hop with Apache License 2.0 | 5 votes |
private void placeControl( Shell pShell, String text, Control control, Control under ) { int middle = props.getMiddlePct(); int margin = props.getMargin(); Label label = new Label( pShell, SWT.RIGHT ); label.setText( text ); props.setLook( label ); FormData formDataLabel = new FormData(); formDataLabel.left = new FormAttachment( 0, 0 ); if ( under != null ) { formDataLabel.top = new FormAttachment( under, margin ); } else { formDataLabel.top = new FormAttachment( 0, 0 ); } formDataLabel.right = new FormAttachment( middle, 0 ); label.setLayoutData( formDataLabel ); props.setLook( control ); FormData formDataControl = new FormData(); formDataControl.left = new FormAttachment( middle, 0 ); if ( under != null ) { formDataControl.top = new FormAttachment( under, margin ); } else { formDataControl.top = new FormAttachment( 0, 0 ); } formDataControl.right = new FormAttachment( 100, 0 ); control.setLayoutData( formDataControl ); }
Example 11
Source File: Separator.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
/** * Creates the separator and fills it in a MGridLayout. * @param height The height of the separator */ public Control[] doFillIntoGrid(Composite parent, int nColumns, int height) { Control separator= getSeparator(parent); separator.setLayoutData(gridDataForSeperator(nColumns, height)); return new Control[] { separator }; }
Example 12
Source File: UI.java From olca-app with Mozilla Public License 2.0 | 5 votes |
public static GridData gridData(Control control, boolean hFill, boolean vFill) { int hStyle = hFill ? SWT.FILL : SWT.LEFT; int vStyle = vFill ? SWT.FILL : SWT.CENTER; GridData data = new GridData(hStyle, vStyle, hFill, vFill); control.setLayoutData(data); return data; }
Example 13
Source File: TermDbManagerDialog.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * @param control * the <code>Control</code> to lay out. */ protected void layoutTreeAreaControl(Control control) { GridData gd = new GridData(GridData.FILL_VERTICAL); gd.widthHint = getLastRightWidth(); gd.verticalSpan = 1; control.setLayoutData(gd); }
Example 14
Source File: KontaktFieldEditor.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
@Override protected void doFillIntoGrid(Composite parent, int numColumns){ Control control = getLabelControl(parent); GridData gd = new GridData(); gd.horizontalSpan = numColumns - 1; control.setLayoutData(gd); Label cLabel = getChangeControl(parent); cLabel.setLayoutData(new GridData()); }
Example 15
Source File: JavadocLocationDialog.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override protected Control createDialogArea(Composite parent) { Composite composite= (Composite) super.createDialogArea(parent); Control inner= fJavadocConfigurationBlock.createContents(composite); inner.setLayoutData(new GridData(GridData.FILL_BOTH)); applyDialogFont(composite); return composite; }
Example 16
Source File: LoginDialog.java From neoscada with Eclipse Public License 1.0 | 4 votes |
private void applyLayout ( final Control control ) { control.setLayoutData ( new GridData ( SWT.FILL, SWT.CENTER, true, false ) ); }
Example 17
Source File: MigrationTaskEditor.java From depan with Apache License 2.0 | 4 votes |
/** * Create the editor's GUI. * * @param parent Parent Composite. * @return the top level Control for the GUI. */ private Control createControl(Composite parent) { // controls Composite topLevel = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, false); topLevel.setLayout(layout); Label labelId = new Label(topLevel, SWT.NONE); id = new Text(topLevel, SWT.BORDER); Label labelName = new Label(topLevel, SWT.NONE); name = new Text(topLevel, SWT.BORDER); Label labelDescription = new Label(topLevel, SWT.NONE); description = new Text( topLevel, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); Label labelQuarter = new Label(topLevel, SWT.NONE); quarter = new Text(topLevel, SWT.BORDER); Label labelUpdatedBy = new Label(topLevel, SWT.NONE); updatedBy = new Text(topLevel, SWT.BORDER); Label labelUpdateDate = new Label(topLevel, SWT.NONE); updateDate = new DateTime(topLevel, SWT.CALENDAR); Label labelEngineers = new Label(topLevel, SWT.None); Control engineersEdit = createEngineersEditor(topLevel); // content labelId.setText("ID"); labelName.setText("Name"); labelDescription.setText("Description"); labelQuarter.setText("Quarter"); labelUpdatedBy.setText("Updated by"); labelUpdateDate.setText("Updated date"); labelEngineers.setText("Engineers"); // layout labelUpdateDate.setLayoutData( new GridData(SWT.FILL, SWT.TOP, false, false)); labelDescription.setLayoutData( new GridData(SWT.FILL, SWT.TOP, false, false)); labelEngineers.setLayoutData( new GridData(SWT.FILL, SWT.TOP, false, false)); id.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); name.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); quarter.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); updatedBy.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); GridData descriptionLayout = new GridData(SWT.FILL, SWT.FILL, true, false); descriptionLayout.heightHint = 150; description.setLayoutData(descriptionLayout); engineersEdit.setLayoutData(descriptionLayout); fillContent(); return topLevel; }
Example 18
Source File: AbstractPydevPrefs.java From Pydev with Eclipse Public License 1.0 | 4 votes |
protected static void indent(Control control) { GridData gridData = new GridData(); gridData.horizontalIndent = 20; control.setLayoutData(gridData); }
Example 19
Source File: JavaSearchPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public void createControl(Composite parent) { initializeDialogUnits(parent); readConfiguration(); Composite result= new Composite(parent, SWT.NONE); GridLayout layout= new GridLayout(2, true); layout.horizontalSpacing= 10; result.setLayout(layout); Control expressionComposite= createExpression(result); expressionComposite.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); Label separator= new Label(result, SWT.NONE); separator.setVisible(false); GridData data= new GridData(GridData.FILL, GridData.FILL, false, false, 2, 1); data.heightHint= convertHeightInCharsToPixels(1) / 3; separator.setLayoutData(data); Control searchFor= createSearchFor(result); searchFor.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 1, 1)); Control limitTo= createLimitTo(result); limitTo.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 1, 1)); Control includeMask= createIncludeMask(result); includeMask.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1)); //createParticipants(result); SelectionAdapter javaElementInitializer= new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { if (getSearchFor() == fInitialData.getSearchFor()) fJavaElement= fInitialData.getJavaElement(); else fJavaElement= null; setLimitTo(getSearchFor(), getLimitTo()); setIncludeMask(getIncludeMask()); doPatternModified(); } }; for (int i= 0; i < fSearchFor.length; i++) { fSearchFor[i].addSelectionListener(javaElementInitializer); } setControl(result); Dialog.applyDialogFont(result); PlatformUI.getWorkbench().getHelpSystem().setHelp(result, IJavaHelpContextIds.JAVA_SEARCH_PAGE); }
Example 20
Source File: PWRow.java From nebula with Eclipse Public License 2.0 | 4 votes |
/** * @see org.eclipse.nebula.widgets.opal.preferencewindow.PWContainer#build(org.eclipse.swt.widgets.Composite) */ @Override public void build(final Composite parent) { final int size = this.widgets.size(); int columIndex = 0; for (int i = 0; i < size; i++) { final PWWidget widget = this.widgets.get(i); final Control control = widget.checkAndBuild(parent); if (control != null && control.getLayoutData() == null) { final int colSpan; final boolean grabExcessSpace; final int alignment; if (size == 1) { if (widget.isSingleWidget()) { colSpan = this.parentNumberOfColums; } else { colSpan = this.parentNumberOfColums - widget.getNumberOfColumns() + 1; } grabExcessSpace = true; } else { if (i == size - 1) { colSpan = this.parentNumberOfColums - columIndex; grabExcessSpace = widget.isGrabExcessSpace(); } else { colSpan = 1; grabExcessSpace = widget instanceof PWButton && i == 0 ? true : widget.isGrabExcessSpace(); } } columIndex += widget.getNumberOfColumns(); if (i == 0 && grabExcessSpace && size > 1) { if (widget instanceof PWLabel || widget instanceof PWButton) { alignment = GridData.END; } else { alignment = GridData.BEGINNING; } } else { alignment = widget.getAlignment(); } final GridData gd = new GridData(alignment, GridData.BEGINNING, grabExcessSpace, false, colSpan, 1); gd.horizontalIndent = widget.getIndent(); gd.widthHint = widget.getWidth(); if (widget.getHeight() != -1) { gd.heightHint = widget.getHeight(); } control.setLayoutData(gd); } } }