List of usage examples for org.eclipse.jface.util BidiUtils BTD_DEFAULT
String BTD_DEFAULT
To view the source code for org.eclipse.jface.util BidiUtils BTD_DEFAULT.
Click Source Link
From source file:com.mywork.eclipse.base.MyWizardNewProjectCreationPage.java
License:Open Source License
/** * Creates the project name specification controls. * * @param parent the parent composite//from ww w . j a v a 2 s . c om */ private final void createProjectNameGroup(Composite parent) { // project specification group Composite projectGroup = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; projectGroup.setLayout(layout); projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // new project label Label projectLabel = new Label(projectGroup, SWT.NONE); projectLabel.setText("&Project name"); projectLabel.setFont(parent.getFont()); // new project name entry field projectNameField = new Text(projectGroup, SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = SIZING_TEXT_FIELD_WIDTH; projectNameField.setLayoutData(data); projectNameField.setFont(parent.getFont()); // new template label Label authorLabel = new Label(projectGroup, SWT.NONE); authorLabel.setText("author"); authorLabel.setFont(parent.getFont()); // new template entry field authorField = new Text(projectGroup, SWT.BORDER); data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = SIZING_TEXT_FIELD_WIDTH; authorField.setLayoutData(data); authorField.setFont(parent.getFont()); // Set the initial value first before listener // to avoid handling an event during the creation. if (initialProjectFieldValue != null) { projectNameField.setText(initialProjectFieldValue); } projectNameField.addListener(SWT.Modify, nameModifyListener); BidiUtils.applyBidiProcessing(projectNameField, BidiUtils.BTD_DEFAULT); }
From source file:com.sas.seleniumplus.projects.AdvanceProjectPageWizard.java
License:Open Source License
/** * Creates the project name specification controls. * * @param parent the parent composite/*from w ww. ja va2 s . c om*/ */ private final void createProjectNameGroup(Composite parent) { // project specification group Composite projectGroup = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; projectGroup.setLayout(layout); projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // new project label Label projectLabel = new Label(projectGroup, SWT.NONE); projectLabel.setText(IDEWorkbenchMessages.WizardNewProjectCreationPage_nameLabel); projectLabel.setFont(parent.getFont()); // new project name entry field projectNameField = new Text(projectGroup, SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = SIZING_TEXT_FIELD_WIDTH; projectNameField.setLayoutData(data); projectNameField.setFont(parent.getFont()); // new company initial label projectLabel = new Label(projectGroup, SWT.NONE); projectLabel.setText(lblCompanyInitial); projectLabel.setFont(parent.getFont()); // new company name entry field companyInitialField = new Text(projectGroup, SWT.BORDER); data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = SIZING_TEXT_FIELD_WIDTH; companyInitialField.setLayoutData(data); companyInitialField.setFont(parent.getFont()); // Set the initial value first before listener // to avoid handling an event during the creation. if (initialProjectFieldValue != null) { projectNameField.setText(initialProjectFieldValue); } projectNameField.addListener(SWT.Modify, nameModifyListener); BidiUtils.applyBidiProcessing(projectNameField, BidiUtils.BTD_DEFAULT); // Set the initial value first before listener // to avoid handling an event during the creation. if (companyInitialField != null) { companyInitialField.setText(initialCompanyInitialFieldValue); } companyInitialField.addListener(SWT.Modify, nameModifyListener); BidiUtils.applyBidiProcessing(companyInitialField, BidiUtils.BTD_DEFAULT); }
From source file:com.sas.seleniumplus.projects.SeleniumProjectPageWizard.java
License:Open Source License
/** * Creates the project name specification controls. * * @param parent the parent composite/*from w w w . ja v a 2 s . c o m*/ */ private final void createProjectNameGroup(Composite parent) { // project specification group Composite projectGroup = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; projectGroup.setLayout(layout); projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // new project label Label projectLabel = new Label(projectGroup, SWT.NONE); projectLabel.setText(IDEWorkbenchMessages.WizardNewProjectCreationPage_nameLabel); projectLabel.setFont(parent.getFont()); // new project name entry field projectNameField = new Text(projectGroup, SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = SIZING_TEXT_FIELD_WIDTH; projectNameField.setLayoutData(data); projectNameField.setFont(parent.getFont()); // Set the initial value first before listener // to avoid handling an event during the creation. if (initialProjectFieldValue != null) { projectNameField.setText(initialProjectFieldValue); } projectNameField.addListener(SWT.Modify, nameModifyListener); BidiUtils.applyBidiProcessing(projectNameField, BidiUtils.BTD_DEFAULT); }
From source file:e4.handler.E4TemplatePreferencePage.java
License:Open Source License
@Override protected Control createContents(Composite ancestor) { Composite parent = new Composite(ancestor, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2;// w w w .j a v a2 s .c o m layout.marginHeight = 0; layout.marginWidth = 0; parent.setLayout(layout); Composite innerParent = new Composite(parent, SWT.NONE); GridLayout innerLayout = new GridLayout(); innerLayout.numColumns = 2; innerLayout.marginHeight = 0; innerLayout.marginWidth = 0; innerParent.setLayout(innerLayout); GridData gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 2; innerParent.setLayoutData(gd); Composite tableComposite = new Composite(innerParent, SWT.NONE); GridData data = new GridData(GridData.FILL_BOTH); data.widthHint = 360; data.heightHint = convertHeightInCharsToPixels(10); tableComposite.setLayoutData(data); ColumnLayout columnLayout = new ColumnLayout(); tableComposite.setLayout(columnLayout); Table table = new Table(tableComposite, SWT.CHECK | SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); table.setHeaderVisible(true); table.setLinesVisible(true); GC gc = new GC(getShell()); gc.setFont(JFaceResources.getDialogFont()); TableColumn column1 = new TableColumn(table, SWT.NONE); column1.setText(TemplatesMessages.TemplatePreferencePage_column_name); int minWidth = computeMinimumColumnWidth(gc, TemplatesMessages.TemplatePreferencePage_column_name); columnLayout.addColumnData(new ColumnWeightData(2, minWidth, true)); TableColumn column2 = new TableColumn(table, SWT.NONE); column2.setText(TemplatesMessages.TemplatePreferencePage_column_context); minWidth = computeMinimumContextColumnWidth(gc); columnLayout.addColumnData(new ColumnWeightData(1, minWidth, true)); TableColumn column3 = new TableColumn(table, SWT.NONE); column3.setText(TemplatesMessages.TemplatePreferencePage_column_description); minWidth = computeMinimumColumnWidth(gc, TemplatesMessages.TemplatePreferencePage_column_description); columnLayout.addColumnData(new ColumnWeightData(3, minWidth, true)); TableColumn column4 = new TableColumn(table, SWT.NONE); column4.setAlignment(SWT.CENTER); column4.setText(TemplatesMessages.TemplatePreferencePage_column_autoinsert); minWidth = computeMinimumColumnWidth(gc, TemplatesMessages.TemplatePreferencePage_column_autoinsert); minWidth = Math.max(minWidth, computeMinimumColumnWidth(gc, TemplatesMessages.TemplatePreferencePage_on)); columnLayout.addColumnData(new ColumnPixelData(minWidth, false, false)); gc.dispose(); fTableViewer = new CheckboxTableViewer(table); fTableViewer.setLabelProvider(new TemplateLabelProvider()); fTableViewer.setContentProvider(new TemplateContentProvider()); fTableViewer.setComparator(new ViewerComparator() { @Override public int compare(Viewer viewer, Object object1, Object object2) { if ((object1 instanceof TemplatePersistenceData) && (object2 instanceof TemplatePersistenceData)) { Template left = ((TemplatePersistenceData) object1).getTemplate(); Template right = ((TemplatePersistenceData) object2).getTemplate(); int result = Collator.getInstance().compare(left.getName(), right.getName()); if (result != 0) return result; return Collator.getInstance().compare(left.getDescription(), right.getDescription()); } return super.compare(viewer, object1, object2); } @Override public boolean isSorterProperty(Object element, String property) { return true; } }); fTableViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent e) { edit(); } }); fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent e) { selectionChanged1(); } }); fTableViewer.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { TemplatePersistenceData d = (TemplatePersistenceData) event.getElement(); d.setEnabled(event.getChecked()); } }); BidiUtils.applyTextDirection(fTableViewer.getControl(), BidiUtils.BTD_DEFAULT); Composite buttons = new Composite(innerParent, SWT.NONE); buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; buttons.setLayout(layout); fAddButton = new Button(buttons, SWT.PUSH); fAddButton.setText(TemplatesMessages.TemplatePreferencePage_new); fAddButton.setLayoutData(getButtonGridData(fAddButton)); fAddButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { add(); } }); fEditButton = new Button(buttons, SWT.PUSH); fEditButton.setText(TemplatesMessages.TemplatePreferencePage_edit); fEditButton.setLayoutData(getButtonGridData(fEditButton)); fEditButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { edit(); } }); fRemoveButton = new Button(buttons, SWT.PUSH); fRemoveButton.setText(TemplatesMessages.TemplatePreferencePage_remove); fRemoveButton.setLayoutData(getButtonGridData(fRemoveButton)); fRemoveButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { remove(); } }); createSeparator(buttons); fRestoreButton = new Button(buttons, SWT.PUSH); fRestoreButton.setText(TemplatesMessages.TemplatePreferencePage_restore); fRestoreButton.setLayoutData(getButtonGridData(fRestoreButton)); fRestoreButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { restoreDeleted(); } }); fRevertButton = new Button(buttons, SWT.PUSH); fRevertButton.setText(TemplatesMessages.TemplatePreferencePage_revert); fRevertButton.setLayoutData(getButtonGridData(fRevertButton)); fRevertButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { revert(); } }); createSeparator(buttons); fImportButton = new Button(buttons, SWT.PUSH); fImportButton.setText(TemplatesMessages.TemplatePreferencePage_import); fImportButton.setLayoutData(getButtonGridData(fImportButton)); fImportButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { import_(); } }); fExportButton = new Button(buttons, SWT.PUSH); fExportButton.setText(TemplatesMessages.TemplatePreferencePage_export); fExportButton.setLayoutData(getButtonGridData(fExportButton)); fExportButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { export(); } }); fPatternViewer = doCreateViewer(parent); if (isShowFormatterSetting()) { fFormatButton = new Button(parent, SWT.CHECK); fFormatButton.setText(TemplatesMessages.TemplatePreferencePage_use_code_formatter); GridData gd1 = new GridData(); gd1.horizontalSpan = 2; fFormatButton.setLayoutData(gd1); fFormatButton.setSelection(getPreferenceStore().getBoolean(getFormatterPreferenceKey())); } fTableViewer.setInput(fTemplateStore); fTableViewer.setAllChecked(false); fTableViewer.setCheckedElements(getEnabledTemplates()); updateButtons(); Dialog.applyDialogFont(parent); innerParent.layout(); return parent; }
From source file:org.dslforge.ace.generator.ui.wizard.NewWebEditorWizardPage.java
License:Open Source License
private final void createLanguageGroup(Composite parent) { Group group = new Group(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2;// w w w . j a v a 2 s. com group.setLayout(layout); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); group.setText("Language Specification"); // new language label Label projectLabel = new Label(group, SWT.NONE); projectLabel.setText("&Name:"); projectLabel.setFont(parent.getFont()); // new language name entry field languageNameField = new Text(group, SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = SIZING_TEXT_FIELD_WIDTH; languageNameField.setLayoutData(data); languageNameField.setFont(parent.getFont()); if (initialLanguageFieldValue != null) { languageNameField.setText(initialLanguageFieldValue); } languageNameField.addModifyListener(languageNameModifyListener); BidiUtils.applyBidiProcessing(languageNameField, BidiUtils.BTD_DEFAULT); // new grammar path label Label grammarPathLabel = new Label(group, SWT.NONE); grammarPathLabel.setText("&ANTLR file:"); grammarPathLabel.setFont(parent.getFont()); // new grammar path entry field grammarPathField = new Text(group, SWT.BORDER); GridData pathData = new GridData(GridData.FILL_HORIZONTAL); pathData.widthHint = SIZING_TEXT_FIELD_WIDTH; grammarPathField.setLayoutData(pathData); grammarPathField.setFont(parent.getFont()); grammarPathField.setEditable(false); if (grammarPathField != null) { grammarPathField.setText(initialGrammarPathFieldValue); } BidiUtils.applyBidiProcessing(grammarPathField, BidiUtils.BTD_DEFAULT); }
From source file:org.dslforge.xtext.generator.ui.wizard.NewWebEditorFromXtextWizardPage.java
License:Open Source License
protected void createProjectNameGroup(Composite parent) { Composite projectGroup = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2;/*from ww w. j a va 2 s . co m*/ projectGroup.setLayout(layout); projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // new project field Label projectLabel = new Label(projectGroup, SWT.NONE); projectLabel.setText(IDEWorkbenchMessages.WizardNewProjectCreationPage_nameLabel); projectLabel.setFont(parent.getFont()); projectNameField = new Text(projectGroup, SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = SIZING_TEXT_FIELD_WIDTH; projectNameField.setLayoutData(data); projectNameField.setFont(parent.getFont()); if (initialProjectFieldValue != null) { projectNameField.setText(initialProjectFieldValue); } projectNameField.addModifyListener(projectNameModifyListener); BidiUtils.applyBidiProcessing(projectNameField, BidiUtils.BTD_DEFAULT); }
From source file:org.dslforge.xtext.generator.ui.wizard.NewWebEditorFromXtextWizardPage.java
License:Open Source License
protected void createLanguageGroup(Composite parent) { Group group = new Group(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2;/*w ww. java 2s. co m*/ group.setLayout(layout); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); group.setText("ANTLR Specification"); // new grammar field Label xtextGrammarLabel = new Label(group, SWT.NONE); xtextGrammarLabel.setLayoutData(new GridData(160, SWT.DEFAULT)); xtextGrammarLabel.setText("&Grammar file:"); grammarPathField = new Text(group, SWT.BORDER); GridData layoutData = new GridData(GridData.FILL_HORIZONTAL); layoutData.grabExcessHorizontalSpace = true; grammarPathField.setLayoutData(layoutData); grammarPathField.setFont(parent.getFont()); grammarPathField.setEnabled(false); if (descriptor != null) grammarPathField.setText(descriptor.getGrammar().getFullPath().toString()); // new language field Label projectLabel = new Label(group, SWT.NONE); projectLabel.setText("&Grammar name:"); projectLabel.setFont(parent.getFont()); languageNameField = new Text(group, SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = SIZING_TEXT_FIELD_WIDTH; languageNameField.setLayoutData(data); languageNameField.setFont(parent.getFont()); if (descriptor != null) languageNameField.setText(descriptor.getGrammar().getName()); BidiUtils.applyBidiProcessing(languageNameField, BidiUtils.BTD_DEFAULT); //Target Platform Label targetLabel = new Label(group, SWT.NONE); targetLabel.setText("&RAP Target:"); targetLabel.setFont(parent.getFont()); generateTarget = new Button(group, SWT.CHECK); generateTarget.setSelection(true); generateTarget.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { descriptor.setOption(IWebProjectDescriptor.TARGET_PLATFORM, new Boolean(generateTarget.getSelection())); } @Override public void widgetDefaultSelected(SelectionEvent e) { descriptor.setOption(IWebProjectDescriptor.TARGET_PLATFORM, new Boolean(true)); } }); //Packaging Projct Label buildLabel = new Label(group, SWT.NONE); buildLabel.setText("&WAR Build:"); buildLabel.setFont(parent.getFont()); generateBuild = new Button(group, SWT.CHECK); generateBuild.setSelection(true); generateBuild.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { descriptor.setOption(IWebProjectDescriptor.BUILD_PROJECT, new Boolean(generateBuild.getSelection())); } @Override public void widgetDefaultSelected(SelectionEvent e) { descriptor.setOption(IWebProjectDescriptor.BUILD_PROJECT, new Boolean(true)); } }); }
From source file:org.dslforge.xtext.generator.ui.wizard.XtextGrammarImportPage.java
License:Open Source License
/** * Creates the language name specification controls. * * @param parent/*from w w w .j av a2 s .c o m*/ * the parent composite */ private final void createLanguageGroup(Composite parent) { Group group = new Group(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 3; group.setLayout(layout); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); group.setText("Language Specification"); //Label Label xtextGrammarLabel = new Label(group, SWT.NONE); xtextGrammarLabel.setLayoutData(new GridData(160, SWT.DEFAULT)); xtextGrammarLabel.setText("&Xtext grammar:"); //Text grammarPathField = new Text(group, SWT.BORDER); GridData layoutData = new GridData(GridData.FILL_HORIZONTAL); layoutData.grabExcessHorizontalSpace = true; grammarPathField.setLayoutData(layoutData); grammarPathField.setEditable(false); // Button browseWorkspace = new Button(group, SWT.PUSH); browseWorkspace.setText("&Browse..."); setButtonLayoutData(browseWorkspace); browseWorkspace.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleBrowseFileSystem(); } }); //Label Label languageLabel = new Label(group, SWT.NONE); languageLabel.setLayoutData(new GridData(160, SWT.DEFAULT)); languageLabel.setText("&Short Name:"); languageLabel.setFont(parent.getFont()); //Text grammarNameField = new Text(group, SWT.BORDER); GridData languageData = new GridData(GridData.FILL_HORIZONTAL); languageData.widthHint = SIZING_TEXT_FIELD_WIDTH; grammarNameField.setLayoutData(languageData); languageData.grabExcessHorizontalSpace = true; languageData.horizontalSpan = 2; grammarNameField.setFont(parent.getFont()); grammarNameField.setText(""); grammarNameField.setEditable(false); BidiUtils.applyBidiProcessing(grammarNameField, BidiUtils.BTD_DEFAULT); //Label Label projectLabel = new Label(group, SWT.NONE); projectLabel.setLayoutData(new GridData(160, SWT.DEFAULT)); projectLabel.setText("&Runtime Project:"); projectLabel.setFont(parent.getFont()); //Text runtimeProjectNameField = new Text(group, SWT.BORDER); GridData projectData = new GridData(GridData.FILL_HORIZONTAL); projectData.widthHint = SIZING_TEXT_FIELD_WIDTH; projectData.grabExcessHorizontalSpace = true; projectData.horizontalSpan = 2; runtimeProjectNameField.setLayoutData(projectData); runtimeProjectNameField.setFont(parent.getFont()); runtimeProjectNameField.setEditable(false); BidiUtils.applyBidiProcessing(runtimeProjectNameField, BidiUtils.BTD_DEFAULT); //Label Label entryRuleLabel = new Label(group, SWT.NONE); entryRuleLabel.setLayoutData(new GridData(160, SWT.DEFAULT)); entryRuleLabel.setText("&Entry rule:"); entryRuleLabel.setFont(parent.getFont()); //Text entryRuleNameField = new Text(group, SWT.BORDER); GridData entryRuleData = new GridData(GridData.FILL_HORIZONTAL); entryRuleData.widthHint = SIZING_TEXT_FIELD_WIDTH; entryRuleData.grabExcessHorizontalSpace = true; entryRuleData.horizontalSpan = 2; entryRuleNameField.setLayoutData(entryRuleData); entryRuleNameField.setFont(parent.getFont()); entryRuleNameField.setText(""); entryRuleNameField.setEditable(false); BidiUtils.applyBidiProcessing(entryRuleNameField, BidiUtils.BTD_DEFAULT); }
From source file:org.eclipse.gemoc.execution.concurrent.ccsljavaxdsml.ui.wizards.pages.AskMoCInfoWizardPage.java
License:Open Source License
/** * @param parent the parent composite/*w w w.j av a2 s.c o m*/ */ private final void createTemplateMoCFileGroup(Composite parent) { // project specification group Composite templateMoCFileGroup = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; templateMoCFileGroup.setLayout(layout); templateMoCFileGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // root container label Label label = new Label(templateMoCFileGroup, SWT.NONE); label.setText("new MoCC file base name"); label.setFont(parent.getFont()); // new project name entry field templateMoCFileField = new Text(templateMoCFileGroup, SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = SIZING_TEXT_FIELD_WIDTH; templateMoCFileField.setLayoutData(data); templateMoCFileField.setFont(parent.getFont()); // Set the initial value first before listener // to avoid handling an event during the creation. if (initialTemplateMoCFileFieldValue != null) { templateMoCFileField.setText(initialTemplateMoCFileFieldValue); } templateMoCFileField.addListener(SWT.Modify, genericModifyListener); BidiUtils.applyBidiProcessing(templateMoCFileField, BidiUtils.BTD_DEFAULT); }
From source file:org.eclipse.tm4e.languageconfiguration.internal.preferences.LanguageConfigurationPreferencePage.java
License:Open Source License
/** * Create grammar list content./* ww w . j a va2 s . co m*/ * * @param parent */ private void createDefinitionsListContent(Composite parent) { Label description = new Label(parent, SWT.NONE); description.setText(LanguageConfigurationMessages.LanguageConfigurationPreferencePage_description2); description.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1)); Composite tableComposite = new Composite(parent, SWT.NONE); GridData data = new GridData(GridData.FILL_BOTH); data.widthHint = 360; data.heightHint = convertHeightInCharsToPixels(10); tableComposite.setLayoutData(data); TableColumnLayout columnLayout = new TableColumnLayout(); tableComposite.setLayout(columnLayout); Table table = new Table(tableComposite, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); table.setHeaderVisible(true); table.setLinesVisible(true); GC gc = new GC(getShell()); gc.setFont(JFaceResources.getDialogFont()); ColumnViewerComparator viewerComparator = new ColumnViewerComparator(); definitionViewer = new TableViewer(table); TableColumn column1 = new TableColumn(table, SWT.NONE); column1.setText(LanguageConfigurationMessages.LanguageConfigurationPreferencePage_contentType); int minWidth = computeMinimumColumnWidth(gc, LanguageConfigurationMessages.LanguageConfigurationPreferencePage_contentType); columnLayout.setColumnData(column1, new ColumnWeightData(2, minWidth, true)); column1.addSelectionListener(new ColumnSelectionAdapter(column1, definitionViewer, 0, viewerComparator)); TableColumn column2 = new TableColumn(table, SWT.NONE); column2.setText(LanguageConfigurationMessages.LanguageConfigurationPreferencePage_path); minWidth = computeMinimumColumnWidth(gc, LanguageConfigurationMessages.LanguageConfigurationPreferencePage_path); columnLayout.setColumnData(column2, new ColumnWeightData(2, minWidth, true)); column2.addSelectionListener(new ColumnSelectionAdapter(column2, definitionViewer, 1, viewerComparator)); TableColumn column3 = new TableColumn(table, SWT.NONE); column3.setText(LanguageConfigurationMessages.LanguageConfigurationPreferencePage_pluginId); minWidth = computeMinimumColumnWidth(gc, LanguageConfigurationMessages.LanguageConfigurationPreferencePage_pluginId); columnLayout.setColumnData(column3, new ColumnWeightData(2, minWidth, true)); column3.addSelectionListener(new ColumnSelectionAdapter(column3, definitionViewer, 2, viewerComparator)); gc.dispose(); definitionViewer.setLabelProvider(new LanguageConfigurationLabelProvider()); definitionViewer.setContentProvider(new LanguageConfigurationContentProvider()); definitionViewer.setComparator(viewerComparator); definitionViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent e) { IStructuredSelection selection = definitionViewer.getStructuredSelection(); infoWidget.refresh(null, manager); if (selection.isEmpty()) { return; } ILanguageConfigurationDefinition definition = (ILanguageConfigurationDefinition) (selection) .getFirstElement(); // Update button definitionRemoveButton.setEnabled(definition.getPluginId() == null); selectDefinition(definition); } private void selectDefinition(ILanguageConfigurationDefinition definition) { infoWidget.refresh(definition, manager); } }); // Specify default sorting table.setSortColumn(column1); table.setSortDirection(viewerComparator.getDirection()); BidiUtils.applyTextDirection(definitionViewer.getControl(), BidiUtils.BTD_DEFAULT); Composite buttons = new Composite(parent, SWT.NONE); buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; buttons.setLayout(layout); definitionNewButton = new Button(buttons, SWT.PUSH); definitionNewButton.setText(LanguageConfigurationMessages.LanguageConfigurationPreferencePage_new); definitionNewButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); definitionNewButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { add(); } private void add() { // Open import wizard for language configurations. LanguageConfigurationImportWizard wizard = new LanguageConfigurationImportWizard(false); wizard.setRegistryManager(manager); WizardDialog dialog = new WizardDialog(getShell(), wizard); if (dialog.open() == Window.OK) { ILanguageConfigurationDefinition created = wizard.getCreatedDefinition(); definitionViewer.refresh(); definitionViewer.setSelection(new StructuredSelection(created)); } } }); definitionRemoveButton = new Button(buttons, SWT.PUSH); definitionRemoveButton.setText(LanguageConfigurationMessages.LanguageConfigurationPreferencePage_remove); definitionRemoveButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); definitionRemoveButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { remove(); } private void remove() { Collection<ILanguageConfigurationDefinition> definitions = getSelectedUserDefinitions(); if (!definitions.isEmpty()) { for (ILanguageConfigurationDefinition definition : definitions) { manager.unregisterLanguageConfigurationDefinition(definition); } definitionViewer.refresh(); } } }); }