Java Code Examples for org.eclipse.swt.layout.GridData

The following examples show how to use org.eclipse.swt.layout.GridData. These examples are extracted from open source projects.
Example 1
Project: translationstudio8   File: MachineTranslationPreferencePage.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * (non-Javadoc)
 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
 */
protected Control createContents(Composite parent) {
	Composite tparent = new Composite(parent, SWT.NONE);
	tparent.setLayout(new GridLayout(1, false));
	tparent.setLayoutData(new GridData(GridData.FILL_BOTH));

	createGoogleTranslateArea(tparent);

	createBingTranslateArea(tparent);

	createIgnoreArea(tparent);

	createTranslateSettingArea(tparent);
	// 设置界面的值
	setValues();
	// 设置界面状态
	setComponentsState();
	return parent;
}
 
Example 2
Project: ermasterr   File: ExportToDDLDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void createCreateCheckboxGroup(final Composite parent) {
    final Group group = new Group(parent, SWT.NONE);
    final GridData gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    gridData.verticalAlignment = GridData.FILL;
    gridData.grabExcessVerticalSpace = true;
    group.setLayoutData(gridData);

    group.setText("CREATE");

    final GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    group.setLayout(layout);

    createTablespace = CompositeFactory.createCheckbox(this, group, "label.tablespace", false);
    createSequence = CompositeFactory.createCheckbox(this, group, "label.sequence", false);
    createTrigger = CompositeFactory.createCheckbox(this, group, "label.trigger", false);
    createView = CompositeFactory.createCheckbox(this, group, "label.view", false);
    createIndex = CompositeFactory.createCheckbox(this, group, "label.index", false);
    createTable = CompositeFactory.createCheckbox(this, group, "label.table", false);
    createForeignKey = CompositeFactory.createCheckbox(this, group, "label.foreign.key", false);
    createComment = CompositeFactory.createCheckbox(this, group, "label.comment", false);
}
 
Example 3
Project: nebula   File: AbstractWidgetTest.java    License: Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void testAll() throws Exception {
	shell = new Shell();

	shell.open();
	shell.setLayout(new GridLayout(1, false));
	final Canvas canvas = new Canvas(shell, SWT.None);
	canvas.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	text = new Text(shell, SWT.READ_ONLY);
	text.setFont(XYGraphMediaFactory.getInstance().getFont("default", 18,
			SWT.BOLD));
	text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
	final LightweightSystem lws = new LightweightSystem(canvas);
	lws.setContents(getTestBench());
	shell.setSize(800, 500);
	testGetBeanInfo();
	testWidget();
}
 
Example 4
Project: birt   File: VariableDialog.java    License: Eclipse Public License 1.0 6 votes vote down vote up
protected Control createDialogArea( Composite parent )
{
	UIUtil.bindHelp( parent, IHelpContextIds.INSERT_EDIT_SORTKEY_DIALOG_ID );

	Composite area = (Composite) super.createDialogArea( parent );
	Composite contents = new Composite( area, SWT.NONE );
	contents.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	contents.setLayout( new GridLayout( ) );

	this.setTitle( title );
	getShell( ).setText( title );

	applyDialogFont( contents );
	initializeDialogUnits( area );
	createInputContents( contents );

	Composite space = new Composite( contents, SWT.NONE );
	GridData gdata = new GridData( GridData.FILL_HORIZONTAL );
	gdata.heightHint = 10;
	space.setLayoutData( gdata );

	Label lb = new Label( contents, SWT.SEPARATOR | SWT.HORIZONTAL );
	lb.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	return area;
}
 
Example 5
Project: birt   File: DataColumnBindingDialog.java    License: Eclipse Public License 1.0 6 votes vote down vote up
protected Control createDialogArea( Composite parent )
{

	Composite composite = (Composite) super.createDialogArea( parent );
	ScrolledComposite sc = new ScrolledComposite( composite, SWT.V_SCROLL );
	sc.setAlwaysShowScrollBars( false );
	sc.setExpandHorizontal( true );
	sc.setLayoutData( new GridData( GridData.FILL_BOTH ) );

	Composite content = new Composite( sc, SWT.NONE );
	sc.setContent( content );
	content.setLayout( new GridLayout( ) );

	// sc.setBackground( Display.getCurrent( ).getSystemColor(
	// SWT.COLOR_BLACK ) );
	// content.setBackground( Display.getCurrent( ).getSystemColor(
	// SWT.COLOR_BLUE ) );
	// composite.setBackground( Display.getCurrent( ).getSystemColor(
	// SWT.COLOR_RED ) );

	dialogHelper.setExpressionProvider( expressionProvider );
	dialogHelper.createContent( content );
	UIUtil.bindHelp( content, isTimePeriod || isEditTimePeriod()? IHelpContextIds.RELATIVE_TIME_PERIOD_DIALOG : IHelpContextIds.DATA_COLUMN_BINDING_DIALOG );
	return content;
}
 
Example 6
Project: corrosion   File: CargoTestTab.java    License: Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected Group createExtraControlsGroup(Composite container) {
	Group commandGroup = super.createExtraControlsGroup(container);
	Label testnameLabel = new Label(commandGroup, SWT.NONE);
	testnameLabel.setText(Messages.CargoTestTab_testName);
	testnameLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));

	testnameText = new Text(commandGroup, SWT.BORDER);
	testnameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
	testnameText.addModifyListener(e -> {
		setDirty(true);
		updateLaunchConfigurationDialog();
	});
	new Label(commandGroup, SWT.NONE);

	new Label(commandGroup, SWT.NONE);
	Label testnameExplanation = new Label(commandGroup, SWT.NONE);
	testnameExplanation.setText(Messages.CargoTestTab_testNameDescription);
	testnameExplanation.setEnabled(false);
	testnameExplanation.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
	return commandGroup;
}
 
Example 7
Project: Rel   File: StatusPanel.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Create the composite.
 * @param parent
 * @param style
 */
public StatusPanel(Composite parent, int style) {
	super(parent, style);
	GridLayout gridLayout = new GridLayout(4, false);
	gridLayout.marginHeight = 0;
	gridLayout.marginWidth = 2;
	gridLayout.horizontalSpacing = 1;
	gridLayout.verticalSpacing = 0;
	setLayout(gridLayout);
	
	lblStatus = new Label(this, SWT.NONE);
	lblStatus.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	lblStatus.setText("Ok");
	
	CheckForUpdates updateCheck = new CheckForUpdates(this, SWT.NONE);
	updateCheck.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, true, 1, 1));
	
	UsedCPUDisplay usedCPU = new UsedCPUDisplay(this, SWT.BORDER);
	usedCPU.setToolTipText("CPU usage.");
	usedCPU.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, true, 1, 1));
	
	UsedMemoryDisplay usedRAM = new UsedMemoryDisplay(this, SWT.BORDER);
	usedRAM.setToolTipText("RAM usage.");
	usedRAM.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, true, 1, 1));
}
 
Example 8
Project: typescript.java   File: OptionsConfigurationBlock.java    License: MIT License 6 votes vote down vote up
protected Button addCheckBox(Composite parent, String label, Key key, String[] values, int indent) {
	ControlData data = new ControlData(key, values);

	GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
	gd.horizontalSpan = 3;
	gd.horizontalIndent = indent;

	Button checkBox = new Button(parent, SWT.CHECK);
	checkBox.setFont(JFaceResources.getDialogFont());
	checkBox.setText(label);
	checkBox.setData(data);
	checkBox.setLayoutData(gd);
	checkBox.addSelectionListener(getSelectionListener());

	makeScrollableCompositeAware(checkBox);

	String currValue = getValue(key);
	checkBox.setSelection(data.getSelection(currValue) == 0);

	fCheckBoxes.add(checkBox);

	return checkBox;
}
 
Example 9
Project: tracecompass   File: RemoteFetchLogWizardRemotePage.java    License: Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void createControl(Composite parent) {
    initializeDialogUnits(parent);

    Composite composite = new Composite(parent, SWT.NULL);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL
            | GridData.HORIZONTAL_ALIGN_FILL));
    composite.setFont(parent.getFont());

    createToolBar(composite);
    createElementViewer(composite);

    createButtonsGroup(composite);

    createProjectGroup(composite);

    createOptionGroup(composite);

    restoreWidgetValues();
    updatePageCompletion();

    setControl(composite);
}
 
Example 10
Project: nebula   File: TableComboExampleTab.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @param parent
 */
private void createStyleGroup(Composite parent) {
	Group other = new Group(parent, SWT.NONE);
	other.setText("Style");
       other.setLayout(new GridLayout());
       other.setLayoutData(new GridData(GridData.FILL_VERTICAL));

	borderStyle = new Button(other, SWT.CHECK);
	borderStyle.setText("SWT.BORDER");
	borderStyle.setSelection(true);
	borderStyle.addListener(SWT.Selection, recreateListener);

	readOnlyStyle = new Button(other, SWT.CHECK);
	readOnlyStyle.setText("SWT.READ_ONLY");
	readOnlyStyle.setSelection(true);
	readOnlyStyle.addListener(SWT.Selection, recreateListener);

	flatStyle = new Button(other, SWT.CHECK);
	flatStyle.setText("SWT.FLAT");
	flatStyle.addListener(SWT.Selection, recreateListener);
}
 
Example 11
Project: ldparteditor   File: IsecalcDesign.java    License: MIT License 6 votes vote down vote up
/**
 * Create contents of the dialog.
 *
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite cmp_container = (Composite) super.createDialogArea(parent);
    GridLayout gridLayout = (GridLayout) cmp_container.getLayout();
    gridLayout.verticalSpacing = 10;
    gridLayout.horizontalSpacing = 10;

    Label lbl_specify = new Label(cmp_container, SWT.NONE);
    lbl_specify.setText(I18n.ISECALC_Title);

    Label lbl_separator = new Label(cmp_container, SWT.SEPARATOR | SWT.HORIZONTAL);
    lbl_separator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));

    Combo cmb_scope = new Combo(cmp_container, SWT.READ_ONLY);
    this.cmb_scope[0] = cmb_scope;
    cmb_scope.setItems(new String[] {I18n.ISECALC_ScopeFile, I18n.ISECALC_ScopeSelection});
    cmb_scope.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    cmb_scope.setText(cmb_scope.getItem(is.getScope()));
    cmb_scope.select(is.getScope());

    cmp_container.pack();
    return cmp_container;
}
 
Example 12
Project: birt   File: SeriesLabelSheet.java    License: Eclipse Public License 1.0 6 votes vote down vote up
protected void createInsets( Composite cmpRight, boolean bEnableUI )
{
	icInsets = getContext( ).getUIFactory( )
			.createChartInsetsComposite( cmpRight,
					SWT.NONE,
					2,
					getSeriesForProcessing( ).getLabel( ).getInsets( ),
					getChart( ).getUnits( ),
					getContext( ).getUIServiceProvider( ),
					getContext( ),
					defSeries.getLabel( ).getInsets( ) );
	{
		GridData gdICInsets = new GridData( GridData.FILL_HORIZONTAL );
		gdICInsets.grabExcessVerticalSpace = false;
		icInsets.setLayoutData( gdICInsets );
		icInsets.setEnabled( bEnableUI );
	}
}
 
Example 13
Project: tmxeditor8   File: LicenseManageDialog.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	Composite tparent = (Composite) super.createDialogArea(parent);

	GridLayout layout = new GridLayout();
	layout.marginWidth = 10;
	layout.marginTop = 10;
	tparent.setLayout(layout);

	GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
	tparent.setLayoutData(data);

	createStatusComp(tparent);
	createActiveComp(tparent);
	createBarComp(tparent);

	return super.createDialogArea(parent);
}
 
Example 14
Project: nebula   File: PreferenceWindow.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Builds the buttons
 */
private void buildButtons() {
	final Button buttonOK = new Button(shell, SWT.PUSH);
	buttonOK.setText(ResourceManager.getLabel(ResourceManager.OK));
	final GridData gridDataOk = new GridData(GridData.END, GridData.END, true, false);
	gridDataOk.widthHint = 100;
	buttonOK.setLayoutData(gridDataOk);
	buttonOK.addListener(SWT.Selection, e -> {
		returnedValue = true;
		shell.dispose();
	});
	shell.setDefaultButton(buttonOK);

	final Button buttonCancel = new Button(shell, SWT.PUSH);
	buttonCancel.setText(ResourceManager.getLabel(ResourceManager.CANCEL));
	final GridData gridDataCancel = new GridData(GridData.BEGINNING, GridData.END, false, false);
	gridDataCancel.widthHint = 100;
	buttonCancel.setLayoutData(gridDataCancel);
	buttonCancel.addListener(SWT.Selection, e -> {
		returnedValue = false;
		shell.dispose();
	});
}
 
Example 15
Project: gama   File: GamlEditTemplateDialog.java    License: GNU General Public License v3.0 6 votes vote down vote up
private SourceViewer createEditor(final Composite parent) {
	final SourceViewer viewer = createViewer(parent);
	int numberOfLines = viewer.getDocument().getNumberOfLines();
	if (numberOfLines < 7) {
		numberOfLines = 7;
	} else if (numberOfLines > 14) {
		numberOfLines = 14;
	}

	final Control control = viewer.getControl();
	final GridData data = new GridData(GridData.FILL_BOTH);
	data.widthHint = convertWidthInCharsToPixels(80);
	data.heightHint = convertHeightInCharsToPixels(numberOfLines);
	control.setLayoutData(data);
	return viewer;
}
 
Example 16
Project: birt   File: NumberDataElementComposite.java    License: Eclipse Public License 1.0 5 votes vote down vote up
public NumberDataElementComposite( Composite parent, DataElement data )
{
	super( parent,
			SWT.BORDER | SWT.SINGLE,
			TextEditorComposite.TYPE_NUMBERIC );
	GridData gd = new GridData( );
	gd.widthHint = 80;
	this.setLayoutData( gd );
	this.setDefaultValue( "" ); //$NON-NLS-1$

	setDataElement( data );
}
 
Example 17
Project: elexis-3-core   File: RnDialogs.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent){
	Composite ret = new Composite(parent, SWT.NONE);
	ret.setLayout(new GridLayout());
	ret.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
	Label lblSelectState = new Label(ret, SWT.NONE);
	lblSelectState.setText(Messages.RnDialogs_pleaseNewStateForMulti);
	
	cbStates = new Combo(ret, SWT.READ_ONLY);
	cbStates.setItems(RnStatus.getStatusTexts());
	cbStates.setVisibleItemCount(RnStatus.getStatusTexts().length);
	cbStates.select(rechnungen.get(0).getStatus());
	cbStates.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	
	tableViewer = new TableViewer(ret, SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
	GridData gd_Table = new GridData();
	gd_Table.grabExcessHorizontalSpace = true;
	gd_Table.horizontalSpan = 1;
	gd_Table.minimumHeight = 150;
	gd_Table.heightHint = 150;
	tableViewer.getTable().setLayoutData(gd_Table);
	tableViewer.getTable().setHeaderVisible(true);
	tableViewer.getTable().setLinesVisible(false);
	
	tableViewer.setContentProvider(new ArrayContentProvider());
	TableViewerColumn colRnNumber = new TableViewerColumn(tableViewer, SWT.NONE);
	colRnNumber.getColumn().setWidth(200);
	colRnNumber.getColumn().setText(Messages.RnDialogs_invoiceNumber);
	colRnNumber.setLabelProvider(new ColumnLabelProvider());
	
	tableViewer.setInput(rnNumbers);
	
	return ret;
}
 
Example 18
Project: MergeProcessor   File: WorkspaceMergeDialog.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates the text field showing the commit message.
 * 
 * @param parent the parent composite of the text field
 * @return the text field
 */
private static Text createCommitMessageText(final Composite parent) {
	final Composite composite = new Composite(parent, SWT.NONE);
	composite.setLayout(new GridLayout(2, false));
	GridDataFactory.fillDefaults().span(2, 1).applyTo(composite);
	new Label(composite, SWT.NONE).setText("Commit Message: ");
	final Text text = new Text(composite, SWT.BORDER);
	text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
	text.setEditable(false);
	return text;
}
 
Example 19
Project: xds-ide   File: SWTFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
    * Creates a Group widget
    * @param parent the parent composite to add this group to
    * @param text the text for the heading of the group
    * @param columns the number of columns within the group
    * @param hspan the horizontal span the group should take up on the parent
    * @param fill the style for how this composite should fill into its parent
    * @return the new group
    */
public static Group createGroup(Composite parent, String text, int columns, int hspan, int fill) {
   	Group g = new Group(parent, SWT.NONE);
   	g.setLayout(new GridLayout(columns, false));
   	g.setText(text);
   	g.setFont(parent.getFont());
   	GridData gd = new GridData(fill);
	gd.horizontalSpan = hspan;
   	g.setLayoutData(gd);
   	return g;
   }
 
Example 20
Project: goclipse   File: SWTFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Sets width and height hint for the button control.
 * <b>Note:</b> This is a NOP if the button's layout data is not
 * an instance of <code>GridData</code>.
 * 
 * @param	the button for which to set the dimension hint
 */		
public static void setButtonDimensionHint(Button button) {
	Assert.isNotNull(button);
	Object gd= button.getLayoutData();
	if (gd instanceof GridData) {
		((GridData)gd).widthHint= getButtonWidthHint(button);	
		((GridData)gd).horizontalAlignment = GridData.FILL;	 
	}
}
 
Example 21
Project: translationstudio8   File: CSV2TMXConverterDialog.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	Composite tparent = (Composite) super.createDialogArea(parent);
	GridLayoutFactory.swtDefaults().spacing(0, 0).numColumns(1).applyTo(tparent);
	GridDataFactory.fillDefaults().hint(750, 500).align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(tparent);

	createMenu();
	createToolBar(tparent);

	table = new Table(tparent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
	table.setLinesVisible(true);
	table.setHeaderVisible(true);
	table.setLayoutData(new GridData(GridData.FILL_BOTH));
	Composite cmpStatus = new Composite(tparent, SWT.BORDER);
	cmpStatus.setLayout(new GridLayout(2, true));
	cmpStatus.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	lblRowCount = new Label(cmpStatus, SWT.None);
	lblRowCount.setText(MessageFormat.format(Messages.getString("dialog.CSV2TMXConverterDialog.lblRowCount"), 0));
	lblRowCount.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
	lblColCount = new Label(cmpStatus, SWT.None);
	lblColCount.setText(MessageFormat.format(Messages.getString("dialog.CSV2TMXConverterDialog.lblColCount"), 0));
	lblColCount.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));

	tparent.layout();
	getShell().layout();
	return tparent;
}
 
Example 22
Project: AndroidRobot   File: SetToolTipImage.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Create contents of the window.
 */
protected void createContents() {
	shell = new Shell(SWT.NO_TRIM | SWT.ON_TOP);
	shell.setSize(width, height);
	shell.setBackground(display.getSystemColor(SWT.COLOR_DARK_MAGENTA));
	shell.setLayoutData(new GridData(GridData.FILL_BOTH));
	shell.setLayout(new GridLayout(1, true));
	
	//shell.setText("SWT Application");
	picture = new Label(shell,SWT.NULL);
	picture.setLayoutData(new GridData(GridData.FILL_BOTH));
	setImage();

}
 
Example 23
Project: ermasterr   File: EditAllAttributesDialog.java    License: Apache License 2.0 5 votes vote down vote up
protected Combo createWordCombo(final NormalColumn targetColumn) {
    final GridData gridData = new GridData();
    gridData.widthHint = 100;

    final Combo wordCombo = new Combo(attributeTable, SWT.READ_ONLY);
    initializeWordCombo(wordCombo);
    wordCombo.setLayoutData(gridData);
    setWordValue(wordCombo, targetColumn);

    return wordCombo;
}
 
Example 24
Project: tmxeditor8   File: ReverseConversionWizardPage.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void createControl(Composite parent) {
	initData(); // 先初始化本页面需要的数据

	Composite contents = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout();
	contents.setLayout(layout);
	GridData gridData = new GridData();
	gridData.horizontalAlignment = SWT.FILL;
	gridData.grabExcessHorizontalSpace = true;
	contents.setLayoutData(gridData);

	createFilesGroup(contents); // 文件列表区域
	createPropertiesGroup(contents); // 源文件属性区域组
	createConversionOptionsGroup(contents); // 转换选项组

	bindValue(); // 数据绑定

	try {
		loadFiles(); // 加载文件列表
	} catch (Exception e) {
		e.printStackTrace();
	}

	filesTable.select(0); // 默认选中第一行数据
	filesTable.notifyListeners(SWT.Selection, null);

	Dialog.applyDialogFont(parent);

	Point defaultMargins = LayoutConstants.getMargins();
	GridLayoutFactory.fillDefaults().numColumns(1).margins(defaultMargins.x, defaultMargins.y)
			.generateLayout(contents);

	setControl(contents);

	validate();
}
 
Example 25
Project: Eclipse-Postfix-Code-Completion   File: JarOptionsPage.java    License: Eclipse Public License 1.0 5 votes vote down vote up
public void createControl(Composite parent) {
	Composite composite= new Composite(parent, SWT.NULL);
	composite.setLayout(new GridLayout());
	composite.setLayoutData(
		new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));

	createOptionsGroup(composite);

	restoreWidgetValues();
	setControl(composite);
	update();

	Dialog.applyDialogFont(composite);
	PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IJavaHelpContextIds.JAROPTIONS_WIZARD_PAGE);
}
 
Example 26
Project: tm4e   File: GrammarPreferencePage.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Create "General" tab
 * 
 * @param folder
 */
private void createGeneralTab(TabFolder folder) {
	TabItem tab = new TabItem(folder, SWT.NONE);
	tab.setText(TMUIMessages.GrammarPreferencePage_tab_general_text);

	Composite parent = new Composite(folder, SWT.NONE);
	parent.setLayout(new GridLayout());
	parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	grammarInfoWidget = new GrammarInfoWidget(parent, SWT.NONE);
	grammarInfoWidget.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	tab.setControl(parent);

}
 
Example 27
Project: texlipse   File: ViewerConfigDialog.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Create the contents of the dialog.
 * @param parent parent component
 */
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);    

    GridLayout gl = (GridLayout) composite.getLayout();
    gl.numColumns = 2;
    
    Label descrLabel = new Label(composite, SWT.LEFT);
    descrLabel.setText(TexlipsePlugin.getResourceString("preferenceViewerDescriptionLabel"));
    GridData dgd = new GridData(GridData.FILL_HORIZONTAL);
    dgd.horizontalSpan = 2;
    descrLabel.setLayoutData(dgd);

    addConfigNameField(composite);
    addFileBrowser(composite);
    addArgumentsField(composite);
    addDDEGroups(composite);
    addFormatChooser(composite);
    addInverseChooser(composite);
    addForwardChooser(composite);
    
    Group group = new Group(composite, SWT.SHADOW_IN);
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    ((GridData)group.getLayoutData()).horizontalSpan = 2;
    group.setLayout(new GridLayout());
    statusField = new Label(group, SWT.LEFT);
    statusField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    statusField.setToolTipText(TexlipsePlugin.getResourceString("preferenceViewerStatusTooltip"));
    
    return composite;
}
 
Example 28
Project: goclipse   File: NativeEnvironmentSelectionDialog.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected StructuredViewer createViewer(Composite parent){
	//by default return a checkbox table viewer
	Table table = new Table(parent, SWT.BORDER | SWT.SINGLE | SWT.CHECK);
	GridData gd = new GridData(GridData.FILL_BOTH);
	gd.heightHint = 150;
	gd.widthHint = 250;
	table.setLayoutData(gd);
	return new CheckboxTableViewer(table);
}
 
Example 29
Project: tmxeditor8   File: InvalidateDialog.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create contents of the dialog.
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
	Composite container = (Composite) super.createDialogArea(parent);
	container.setLayout(new GridLayout(1, false));

	Composite composite = new Composite(container, SWT.NONE);
	GridLayout gl_composite = new GridLayout(2, false);
	gl_composite.marginWidth = 0;
	gl_composite.marginHeight = 0;
	composite.setLayout(gl_composite);
	composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));

	Label warningIcon = new Label(composite, SWT.NONE);
	warningIcon.setImage(Display.getDefault().getSystemImage(SWT.ICON_WARNING));

	Label msgLabel = new Label(composite, SWT.WRAP);
	GridData gd_lblNewLabel = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1);
	gd_lblNewLabel.heightHint = 75;
	gd_lblNewLabel.widthHint = 460;
	msgLabel.setLayoutData(gd_lblNewLabel);
	msgLabel.setText(Messages.getString("license.InvalidateDialog.msg1"));

	text = new Text(container, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP);
	text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
	text.setText(getValidateMessage());

	return container;
}
 
Example 30
Project: uima-uimaj   File: CDEpropertyPage.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates the 2 col composite.
 *
 * @param parent the parent
 * @return the composite
 */
private Composite create2ColComposite(Composite parent) {
  Composite composite = new Composite(parent, SWT.NULL);
  GridLayout layout = new GridLayout();
  layout.numColumns = 2;
  composite.setLayout(layout);

  GridData data = new GridData();
  data.verticalAlignment = GridData.FILL;
  data.horizontalAlignment = GridData.FILL;
  composite.setLayoutData(data);

  return composite;
}
 
Example 31
Project: xtext-eclipse   File: ParameterComposite.java    License: Eclipse Public License 2.0 5 votes vote down vote up
public ParameterComposite(Composite parent, int style, AbstractTemplate template, IParameterPage parameterPage) {
	super(parent, style);
	this.template = template;
	this.parameterPage = parameterPage;
	setLayout(new GridLayout(2, false));
	for (TemplateVariable variable : template.getVariables()) {
		Composite varParent = variable.getContainer() == null ? this : variable.getContainer().getWidget();
		if (variable.isLabeled()) {
			Label label = new Label(varParent, SWT.NONE);
			label.setText(variable.getLabel());
			label.setToolTipText(variable.getDescription());
			label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
			variable.createWidget(this, varParent);
			variable.getWidget().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
		} else {
			variable.createWidget(this, varParent);
			variable.getWidget().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
		}
		if (variable.getDescription() != null) {
			ControlDecoration decorator = new ControlDecoration(variable.getWidget(), SWT.RIGHT | SWT.TOP, varParent);
			decorator.setDescriptionText(variable.getDescription());
			decorator.setImage(
					FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
		}
	}
	update();
}
 
Example 32
Project: neoscada   File: TextWidgetFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void createInput ( final DataBindingContext dbc, final Label label, final Composite composite )
{
    this.input = new Text ( composite, SWT.BORDER );
    this.input.setLayoutData ( new GridData ( SWT.FILL, SWT.CENTER, true, false ) );
    dbc.bindValue ( WidgetProperties.text ( SWT.Modify ).observe ( this.input ), PojoProperties.value ( TextCallback.PROP_VALUE ).observe ( this.callback ) );
}
 
Example 33
Project: Eclipse-Postfix-Code-Completion   File: JavadocWizardPage.java    License: Eclipse Public License 1.0 5 votes vote down vote up
protected Combo createCombo(Composite composite, int style, String message, GridData gd) {
	Combo combo= new Combo(composite, style);
	SWTUtil.setDefaultVisibleItemCount(combo);
	if (message != null)
		combo.setText(message);
	combo.setLayoutData(gd);
	return combo;
}
 
Example 34
Project: birt   File: StringFieldEditor.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Fills this field editor's basic controls into the given parent.
 * <p>
 * The string field implementation of this <code>FieldEditor</code>
 * framework method contributes the text field. Subclasses may override but
 * must call <code>super.doFillIntoGrid</code>.
 * </p>
 */
protected void doFillIntoGrid( Composite parent, int numColumns )
{
	getLabelControl( parent );

	textField = getTextControl( parent );
	GridData gd = new GridData( );
	gd.horizontalSpan = numColumns - 1;
	if ( widthInChars != UNLIMITED )
	{
		GC gc = new GC( textField );
		try
		{
			Point extent = gc.textExtent( "X" );//$NON-NLS-1$
			gd.widthHint = widthInChars * extent.x;
		}
		finally
		{
			gc.dispose( );
		}
	}
	else
	{
		gd.horizontalAlignment = GridData.FILL;
		gd.grabExcessHorizontalSpace = true;
	}
	textField.setLayoutData( gd );
}
 
Example 35
Project: eip-designer   File: TransformerPropertiesEditionPartForm.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 
 */
protected Composite createFromChannelsReferencesTable(FormToolkit widgetFactory, Composite parent) {
	this.fromChannels = new ReferencesTable(getDescription(EipViewsRepository.Transformer.Properties.fromChannels, EipMessages.TransformerPropertiesEditionPart_FromChannelsLabel), new ReferencesTableListener	() {
		public void handleAdd() { addFromChannels(); }
		public void handleEdit(EObject element) { editFromChannels(element); }
		public void handleMove(EObject element, int oldIndex, int newIndex) { moveFromChannels(element, oldIndex, newIndex); }
		public void handleRemove(EObject element) { removeFromFromChannels(element); }
		public void navigateTo(EObject element) { }
	});
	this.fromChannels.setHelpText(propertiesEditionComponent.getHelpContent(EipViewsRepository.Transformer.Properties.fromChannels, EipViewsRepository.FORM_KIND));
	this.fromChannels.createControls(parent, widgetFactory);
	this.fromChannels.addSelectionListener(new SelectionAdapter() {
		
		public void widgetSelected(SelectionEvent e) {
			if (e.item != null && e.item.getData() instanceof EObject) {
				propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(TransformerPropertiesEditionPartForm.this, EipViewsRepository.Transformer.Properties.fromChannels, PropertiesEditionEvent.CHANGE, PropertiesEditionEvent.SELECTION_CHANGED, null, e.item.getData()));
			}
		}
		
	});
	GridData fromChannelsData = new GridData(GridData.FILL_HORIZONTAL);
	fromChannelsData.horizontalSpan = 3;
	this.fromChannels.setLayoutData(fromChannelsData);
	this.fromChannels.disableMove();
	fromChannels.setID(EipViewsRepository.Transformer.Properties.fromChannels);
	fromChannels.setEEFType("eef::AdvancedReferencesTable"); //$NON-NLS-1$
	// Start of user code for createFromChannelsReferencesTable

	// End of user code
	return parent;
}
 
Example 36
Project: xds-ide   File: TabPageIndentation.java    License: Eclipse Public License 1.0 5 votes vote down vote up
private Control addSettingControl(Composite parent, FormatterProfile.IndentSetting bs, String label) {
    if (bs.isRange()) {
        Button cbox = null;
        if (bs.isRangeWithCheckbox()) {
            cbox = SWTFactory.createCheckbox(parent, label, 1);
        } else {
            SWTFactory.createLabel(parent, label, 1);
        }
        Combo cmb = SWTFactory.createCombo(parent, 1, SWT.DROP_DOWN | SWT.READ_ONLY, GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END);
        for (int i=bs.getMinVal(); i<=bs.getMaxVal(); ++i) {
            cmb.add(""+i); //$NON-NLS-1$
        }
        cmb.select(fp.getValueForDialog(bs) - bs.getMinVal());
        SettingSelectionListener ssl = new SettingSelectionListener(cmb, cbox, bs);
        cmb.addSelectionListener(ssl);
        if (cbox != null) {
            boolean unch = fp.getRangeCheckboxUncheckedState(bs);
            cbox.setSelection(!unch);
            cmb.setEnabled(!unch);
            cbox.addSelectionListener(ssl);
        }
        return cmb;
    } else {
        Button cb = SWTFactory.createCheckbox(parent, label, 2);
        cb.setSelection(fp.getAsBoolean(bs));
        cb.addSelectionListener(new SettingSelectionListener(cb, null, bs));
        
        GridData gd = (GridData)cb.getLayoutData();
        gd.heightHint = prefHeight;
        cb.setLayoutData(gd);
        
        return cb;
    }
}
 
Example 37
Project: tmxeditor8   File: TmxEditor.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void createContent(TmxEditorViewer viewPart, Composite container) {
	this.parentComposite = container;
	this.viewPart = viewPart;
	GridLayout containerGdLt = new GridLayout(1, true);
	containerGdLt.marginWidth = 0;
	containerGdLt.marginHeight = 0;
	containerGdLt.verticalSpacing = 5;
	containerGdLt.marginTop = 0;
	containerGdLt.marginLeft = 0;
	containerGdLt.marginRight = 0;
	container.setLayout(containerGdLt);

	// tab 设置,分为数据查询以及品质检查
	TabFolder tab = new TabFolder(container, SWT.NONE);
	tab.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	TabItem editorItm = new TabItem(tab, SWT.NONE);
	editorItm.setText(Messages.getString("tmxeditor.filter.editor"));

	TabItem qaItm = new TabItem(tab, SWT.NONE);
	qaItm.setText(Messages.getString("tmxeditor.filter.qa"));

	Composite editorCmp = new Composite(tab, SWT.NONE);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(editorCmp);
	GridLayoutFactory.fillDefaults().numColumns(2).applyTo(editorCmp);
	createEditorArea(editorCmp);
	editorItm.setControl(editorCmp);

	Composite qaCmp = new Composite(tab, SWT.NONE);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(qaCmp);
	GridLayoutFactory.fillDefaults().numColumns(2).applyTo(qaCmp);
	createQaArea(qaCmp);
	qaItm.setControl(qaCmp);

	// create nattable composite
	Composite nattableComposite = new Composite(container, SWT.NONE);
	nattableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
	createNattable(nattableComposite, srcLangCode, tgtLangCode);
}
 
Example 38
Project: APICloud-Studio   File: SVNWizardPage.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Create a text field specific for this application
 *
 * @param parent  the parent of the new text field
 * @return the new text field
 */
static public Text createTextField(Composite parent) {
	Text text = new Text(parent, SWT.SINGLE | SWT.BORDER);
	GridData data = new GridData(GridData.FILL_HORIZONTAL);
	data.verticalAlignment = GridData.CENTER;
	data.grabExcessVerticalSpace = false;
	data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
	text.setLayoutData(data);
	return text;
}
 
Example 39
Project: tlaplus   File: SWTFactory.java    License: MIT License 5 votes vote down vote up
/**
 * Creates a composite that uses the parent's font and has a grid layout
 * 
 * @param parent the parent to add the composite to
 * @param columns the number of columns the composite should have
 * @param hspan the horizontal span the new composite should take up in the parent
 * @param fill the fill style of the composite {@link GridData}
 * @return a new composite with a grid layout
 */
public static Composite createComposite(Composite parent, int columns, int hspan, int fill) {
	Composite g = new Composite(parent, SWT.NONE);
   	g.setLayout(new GridLayout(columns, false));
   	g.setFont(parent.getFont());
   	GridData gd = new GridData(fill);
	gd.horizontalSpan = hspan;
	gd.grabExcessHorizontalSpace = true;
   	g.setLayoutData(gd);
   	return g;
}
 
Example 40
Project: M2Doc   File: M2DocTypeSelectionDialog.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createCustomArea(Composite parent) {
    final Composite container = new Composite(parent, parent.getStyle());
    container.setLayout(new GridLayout(1, false));
    container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    final FilteredTree filteredTree = new FilteredTree(container, SWT.BORDER, new PatternFilter(), true);
    final TreeViewer treeViewer = filteredTree.getViewer();
    final Tree tree = treeViewer.getTree();
    final GridData gdTable = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gdTable.minimumWidth = TABLE_MINIMUM_WIDTH;
    gdTable.minimumHeight = TABLE_MINIMUM_HEIGHT;
    tree.setLayoutData(gdTable);
    treeViewer.setContentProvider(new CollectionContentProvider());
    treeViewer.setLabelProvider(new LabelProvider());
    treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            final Object selected = ((IStructuredSelection) event.getSelection()).getFirstElement();
            selectedType = (String) selected;
        }
    });
    treeViewer.setInput(getAvailableTypes(nsURIs));
    if (defaultType != null) {
        treeViewer.setSelection(new StructuredSelection(defaultType));
    }

    return container;
}