org.eclipse.swt.layout.GridData Java Examples

The following examples show how to use org.eclipse.swt.layout.GridData. 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: PreferenceWindow.java    From nebula with 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 #2
Source File: VariableDialog.java    From birt with 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 #3
Source File: SeriesLabelSheet.java    From birt with 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 #4
Source File: TableComboExampleTab.java    From nebula with 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 #5
Source File: RemoteFetchLogWizardRemotePage.java    From tracecompass with 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 #6
Source File: AbstractWidgetTest.java    From nebula with 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 #7
Source File: LicenseManageDialog.java    From tmxeditor8 with 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 #8
Source File: OptionsConfigurationBlock.java    From typescript.java with 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
Source File: DataColumnBindingDialog.java    From birt with 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 #10
Source File: IsecalcDesign.java    From ldparteditor with 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 #11
Source File: StatusPanel.java    From Rel with 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 #12
Source File: GamlEditTemplateDialog.java    From gama with 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 #13
Source File: ExportToDDLDialog.java    From ermasterr with 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 #14
Source File: CargoTestTab.java    From corrosion with 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 #15
Source File: MachineTranslationPreferencePage.java    From translationstudio8 with 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 #16
Source File: MainView.java    From mappwidget with Apache License 2.0 5 votes vote down vote up
private Text fillName(Composite parent)
{
	Text text = new Text(parent, SWT.SINGLE | SWT.BORDER);

	GridData gd = new GridData();
	gd.grabExcessHorizontalSpace = true;
	gd.horizontalAlignment = GridData.FILL;
	text.setLayoutData(gd);
	text.setText(DEFAULT_NAME);

	return text;
}
 
Example #17
Source File: JavaBasePreferencePage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private Button addCheckBox(Composite parent, String label, String key) {
	GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);

	Button button= new Button(parent, SWT.CHECK);
	button.setText(label);
	button.setData(key);
	button.setLayoutData(gd);

	button.setSelection(getPreferenceStore().getBoolean(key));

	fCheckBoxes.add(button);
	return button;
}
 
Example #18
Source File: BreadcrumbSnippet.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private static void createToggleButtonsBreadCrumb(final Shell shell) {
	final Label label = new Label(shell, SWT.NONE);
	label.setText("Toggle buttons breadcrumb:");
	label.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));

	createBreadcrumb(shell, SWT.BORDER, SWT.CENTER | SWT.TOGGLE, false);
	new Label(shell, SWT.NONE);

	createBreadcrumb(shell, SWT.NONE, SWT.CENTER | SWT.TOGGLE, false);
}
 
Example #19
Source File: WorkspaceDialog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	Composite composite = (Composite) super.createDialogArea(parent);

	GridLayout layout = new GridLayout();
	layout.numColumns = 1;
	composite.setLayout(layout);
	final GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
	composite.setLayoutData(data);

	getShell().setText(Messages.getString("dialog.WorkspaceDialog.shell"));

	wsTreeViewer = new TreeViewer(composite, SWT.BORDER);
	final GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
	gd.widthHint = 550;
	gd.heightHint = 250;
	wsTreeViewer.getTree().setLayoutData(gd);

	wsTreeViewer.setContentProvider(new LocationPageContentProvider());
	wsTreeViewer.setLabelProvider(new WorkbenchLabelProvider());
	wsTreeViewer.setInput(ResourcesPlugin.getWorkspace());

	final Composite group = new Composite(composite, SWT.NONE);
	layout = new GridLayout(2, false);
	layout.marginWidth = 0;
	group.setLayout(layout);
	group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

	final Label label = new Label(group, SWT.NONE);
	label.setLayoutData(new GridData());
	label.setText(Messages.getString("dialog.WorkspaceDialog.label"));

	wsFilenameText = new Text(group, SWT.BORDER);
	wsFilenameText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));

	setupListeners();

	return parent;
}
 
Example #20
Source File: ScriptSWTFactory.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Create the single text.
 * 
 * @param parent
 * @param hspan
 * @return
 */
public static Text createSingleText( Composite parent, int hspan )
{
	Text t = new Text( parent, SWT.SINGLE | SWT.BORDER );
	t.setFont( parent.getFont( ) );
	GridData gd = new GridData( GridData.FILL_HORIZONTAL );
	gd.horizontalSpan = hspan;
	t.setLayoutData( gd );
	return t;
}
 
Example #21
Source File: SvnDialog.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected Label createWrappingLabel(Composite parent, String text, int indent, int horizontalSpan) {
	Label label = new Label(parent, SWT.LEFT | SWT.WRAP);
	label.setText(text);
	GridData data = new GridData();
	data.horizontalSpan = horizontalSpan;
	data.horizontalAlignment = GridData.FILL;
	data.horizontalIndent = indent;
	data.grabExcessHorizontalSpace = true;
	data.widthHint = LABEL_WIDTH_HINT;
	label.setLayoutData(data);
	return label;
}
 
Example #22
Source File: AbstractModifyDialogTab.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected Composite doCreatePreviewPane(Composite composite, int numColumns) {
	createLabel(numColumns, composite, "Preview");
	formatterPreview = previewFactory.createNewPreview(composite, previewText());
	doUpdatePreview();
	Control control = formatterPreview.getEditorViewer().getControl();

	fDefaultFocusManager.add(control);

	final GridData gd = createGridData(numColumns, GridData.FILL_BOTH, 0);
	gd.widthHint = 0;
	gd.heightHint = 0;
	control.setLayoutData(gd);
	return composite;
}
 
Example #23
Source File: TabPageIndentation.java    From xds-ide with 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 #24
Source File: RowLayouter.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void applyDelta(GridData gd) {
	if (spanHorizontalAlignment != -1)
		gd.horizontalAlignment= spanHorizontalAlignment;

	if (spanGrabExcessHorizontalSpace != -1) {
		if (spanGrabExcessHorizontalSpace == 0)
			gd.grabExcessHorizontalSpace= false;
		else
			gd.grabExcessHorizontalSpace= true;
	}


	if (spanHorizontalSpan != -1)
		gd.horizontalSpan= spanHorizontalSpan;

	if (spanHorizontalIndent != -1)
		gd.horizontalIndent= spanHorizontalIndent;

	if (spanWidthHint != -1)
		gd.widthHint= spanWidthHint;

	if (spanVerticalAlignment != -1)
		gd.verticalAlignment= spanVerticalAlignment;

	if (spanGrabExcessVerticalSpace != -1) {
		if (spanGrabExcessVerticalSpace == 0)
			gd.grabExcessVerticalSpace= false;
		else
			gd.grabExcessVerticalSpace= true;
	}

	if (spanVerticalSpan != -1)
		gd.verticalSpan= spanVerticalSpan;

	if (spanHeightHint != -1)
		gd.heightHint= spanHeightHint;
}
 
Example #25
Source File: XViewerCustomizeDialog.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private void createVisibleButtonsComposition(Composite parent) {
   final Composite visibleTableComp = new Composite(parent, SWT.NONE);
   visibleTableComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
   final GridLayout gridLayout_6 = new GridLayout();
   gridLayout_6.marginWidth = 0;
   gridLayout_6.marginHeight = 0;
   visibleTableComp.setLayout(gridLayout_6);

   final Label visibleColumnsLabel = new Label(visibleTableComp, SWT.NONE);
   visibleColumnsLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
   visibleColumnsLabel.setText(XViewerText.get("heading.visible")); //$NON-NLS-1$

   // Visible Column Table
   visibleColTable = new XViewerFilteredTree(visibleTableComp);
   final Tree table = visibleColTable.getViewer().getTree();
   final GridData gd_table = new GridData(SWT.FILL, SWT.FILL, true, true);
   gd_table.widthHint = 300;
   table.setLayoutData(gd_table);
   visibleColTable.getViewer().setLabelProvider(new XViewerColumnLabelProvider());
   visibleColTable.getViewer().setContentProvider(new ArrayTreeContentProvider());
   visibleColTable.getViewer().addSelectionChangedListener(event ->updateButtonEnablements());

   visibleColTable.getViewer().addDragSupport(DND.DROP_MOVE, new Transfer[] {TextTransfer.getInstance()},
      visibleTableDragListener);
   visibleColTable.getViewer().addDropSupport(DND.DROP_MOVE, new Transfer[] {TextTransfer.getInstance()},
      visibleTableDropListener);
   hiddenColTable.getViewer().addDragSupport(DND.DROP_MOVE, new Transfer[] {TextTransfer.getInstance()},
      hiddenTableDragListener);
   hiddenColTable.getViewer().addDropSupport(DND.DROP_MOVE, new Transfer[] {TextTransfer.getInstance()},
      hiddenTableDropListener);

}
 
Example #26
Source File: M2DocTypeSelectionDialog.java    From M2Doc with 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;
}
 
Example #27
Source File: SWTFactory.java    From tlaplus with 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 #28
Source File: SVNWizardPage.java    From APICloud-Studio with 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 #29
Source File: TmxEditor.java    From tmxeditor8 with 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 #30
Source File: NumberDataElementComposite.java    From birt with 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 );
}