Java Code Examples for org.eclipse.swt.widgets.Table#getShell()

The following examples show how to use org.eclipse.swt.widgets.Table#getShell() . 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: CharacterPairsTableWidget.java    From tm4e with Eclipse Public License 1.0 6 votes vote down vote up
public CharacterPairsTableWidget(Table table) {
	super(table);
	setContentProvider(new CharacterPairContentProvider());
	setLabelProvider(new CharacterPairLabelProvider());

	GC gc = new GC(table.getShell());
	gc.setFont(JFaceResources.getDialogFont());
	TableColumnLayout columnLayout = new TableColumnLayout();

	TableColumn column1 = new TableColumn(table, SWT.NONE);
	column1.setText(LanguageConfigurationMessages.CharacterPairsTableWidget_start);
	int minWidth = computeMinimumColumnWidth(gc, LanguageConfigurationMessages.CharacterPairsTableWidget_start);
	columnLayout.setColumnData(column1, new ColumnWeightData(2, minWidth, true));

	TableColumn column2 = new TableColumn(table, SWT.NONE);
	column2.setText(LanguageConfigurationMessages.CharacterPairsTableWidget_end);
	minWidth = computeMinimumColumnWidth(gc, LanguageConfigurationMessages.CharacterPairsTableWidget_end);
	columnLayout.setColumnData(column2, new ColumnWeightData(2, minWidth, true));
}
 
Example 2
Source File: OnEnterRuleTableWidget.java    From tm4e with Eclipse Public License 1.0 5 votes vote down vote up
public OnEnterRuleTableWidget(Table table) {
	super(table);
	setContentProvider(new OnEnterRuleContentProvider());
	setLabelProvider(new OnEnterRuleLabelProvider());

	GC gc = new GC(table.getShell());
	gc.setFont(JFaceResources.getDialogFont());
	TableColumnLayout columnLayout = new TableColumnLayout();

	TableColumn column1 = new TableColumn(table, SWT.NONE);
	column1.setText(LanguageConfigurationMessages.OnEnterRuleTableWidget_beforeText);
	int minWidth = computeMinimumColumnWidth(gc, LanguageConfigurationMessages.OnEnterRuleTableWidget_beforeText);
	columnLayout.setColumnData(column1, new ColumnWeightData(2, minWidth, true));

	TableColumn column2 = new TableColumn(table, SWT.NONE);
	column2.setText(LanguageConfigurationMessages.OnEnterRuleTableWidget_afterText);
	minWidth = computeMinimumColumnWidth(gc, LanguageConfigurationMessages.OnEnterRuleTableWidget_afterText);
	columnLayout.setColumnData(column2, new ColumnWeightData(2, minWidth, true));

	TableColumn column3 = new TableColumn(table, SWT.NONE);
	column3.setText(LanguageConfigurationMessages.OnEnterRuleTableWidget_indentAction);
	minWidth = computeMinimumColumnWidth(gc, LanguageConfigurationMessages.OnEnterRuleTableWidget_indentAction);
	columnLayout.setColumnData(column3, new ColumnWeightData(1, minWidth, true));

	TableColumn column4 = new TableColumn(table, SWT.NONE);
	column4.setText(LanguageConfigurationMessages.OnEnterRuleTableWidget_appendText);
	minWidth = computeMinimumColumnWidth(gc, LanguageConfigurationMessages.OnEnterRuleTableWidget_appendText);
	columnLayout.setColumnData(column4, new ColumnWeightData(1, minWidth, true));

	TableColumn column5 = new TableColumn(table, SWT.NONE);
	column5.setText(LanguageConfigurationMessages.OnEnterRuleTableWidget_removeText);
	minWidth = computeMinimumColumnWidth(gc, LanguageConfigurationMessages.OnEnterRuleTableWidget_removeText);
	columnLayout.setColumnData(column5, new ColumnWeightData(1, minWidth, true));
}
 
Example 3
Source File: AutoClosingPairConditionalTableWidget.java    From tm4e with Eclipse Public License 1.0 5 votes vote down vote up
public AutoClosingPairConditionalTableWidget(Table table) {
	super(table);
	setLabelProvider(new AutoClosingPairConditionalLabelProvider());
	GC gc = new GC(table.getShell());
	gc.setFont(JFaceResources.getDialogFont());
	TableColumnLayout columnLayout = new TableColumnLayout();

	TableColumn column2 = new TableColumn(table, SWT.NONE);
	column2.setText(LanguageConfigurationMessages.AutoClosingPairConditionalTableWidget_notIn);
	int minWidth = computeMinimumColumnWidth(gc,
			LanguageConfigurationMessages.AutoClosingPairConditionalTableWidget_notIn);
	columnLayout.setColumnData(column2, new ColumnWeightData(2, minWidth, true));
}
 
Example 4
Source File: GamlSearchField.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Checks if the text or shell has focus. If not, closes the shell.
 *
 * @param table
 *            the shell's table
 * @param text
 *            the search text field
 */
protected void checkFocusLost(final Table table, final Text text) {
	if (!shell.isDisposed() && !table.isDisposed() && !text.isDisposed()) {
		if (table.getDisplay().getActiveShell() == table.getShell()) {
			// If the user selects the trim shell, leave focus on the text
			// so shell stays open
			text.setFocus();
			return;
		}
		if (!shell.isFocusControl() && !table.isFocusControl() && !text.isFocusControl()) {
			quickAccessContents.doClose();
		}
	}
}