use of org.eclipse.jface.layout.TableColumnLayout in project portfolio by buchen.
the class AttributeListTab method createTab.
@Override
public CTabItem createTab(CTabFolder folder) {
Composite container = new Composite(folder, SWT.NONE);
TableColumnLayout layout = new TableColumnLayout();
container.setLayout(layout);
tableViewer = new TableViewer(container, SWT.FULL_SELECTION | SWT.MULTI);
ColumnEditingSupport.prepare(tableViewer);
ShowHideColumnHelper support = new ShowHideColumnHelper(AttributeListTab.class.getSimpleName(), preferences, tableViewer, layout);
addColumns(support);
support.createColumns();
tableViewer.getTable().setHeaderVisible(true);
tableViewer.getTable().setLinesVisible(true);
tableViewer.setContentProvider(new ArrayContentProvider());
tableViewer.setInput(client.getSettings().getAttributeTypes().toArray());
tableViewer.refresh();
new ContextMenu(tableViewer.getTable(), m -> fillContextMenu(m)).hook();
CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.AttributeTypeTitle);
item.setControl(container);
return item;
}
use of org.eclipse.jface.layout.TableColumnLayout in project InformationSystem by ObeoNetwork.
the class ExportProjectAsLibraryManifestPage method createControl.
/**
* Create contents of the wizard.
* @param parent
*/
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
setControl(container);
container.setLayout(new FillLayout(SWT.HORIZONTAL));
ScrolledComposite scrolledComposite = new ScrolledComposite(container, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setExpandVertical(true);
Composite composite = new Composite(scrolledComposite, SWT.NONE);
composite.setLayout(new GridLayout(3, false));
Label lblProjectId = new Label(composite, SWT.NONE);
lblProjectId.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblProjectId.setText("Project ID");
txtProjectId = new Text(composite, SWT.BORDER);
txtProjectId.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
setPageComplete(isInfoComplete(txtProjectId.getText(), txtVersion.getText()));
}
});
txtProjectId.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
new Label(composite, SWT.NONE);
Label lblVersion = new Label(composite, SWT.NONE);
lblVersion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblVersion.setText("Version");
txtVersion = new Text(composite, SWT.BORDER);
txtVersion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
txtVersion.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
setPageComplete(isInfoComplete(txtProjectId.getText(), txtVersion.getText()));
}
});
Label lblVersionHelp = new Label(composite, SWT.NONE);
lblVersionHelp.setToolTipText("major.minor.patch.qualifier (ex : 1.2.123.alpha)");
lblVersionHelp.setImage(ResourceManager.getPluginImage("org.eclipse.ui", "/icons/full/etool16/help_contents.png"));
Label lblPreviousversions = new Label(composite, SWT.NONE);
lblPreviousversions.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
lblPreviousversions.setText("PreviousVersions");
Composite compositeTbl = new Composite(composite, SWT.NONE);
compositeTbl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
TableColumnLayout tcl_compositeTbl = new TableColumnLayout();
compositeTbl.setLayout(tcl_compositeTbl);
tableViewer = new TableViewer(compositeTbl, SWT.BORDER | SWT.FULL_SELECTION);
table = tableViewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
TableViewerColumn tableViewerColumnVersion = new TableViewerColumn(tableViewer, SWT.NONE);
TableColumn tblclmnVersion = tableViewerColumnVersion.getColumn();
tcl_compositeTbl.setColumnData(tblclmnVersion, new ColumnWeightData(25, ColumnWeightData.MINIMUM_WIDTH, true));
tblclmnVersion.setText("Version");
TableViewerColumn tableViewerColumnID = new TableViewerColumn(tableViewer, SWT.NONE);
TableColumn tblclmnId = tableViewerColumnID.getColumn();
tcl_compositeTbl.setColumnData(tblclmnId, new ColumnWeightData(25, ColumnWeightData.MINIMUM_WIDTH, true));
tblclmnId.setText("ID");
TableViewerColumn tableViewerColumnComment = new TableViewerColumn(tableViewer, SWT.NONE);
TableColumn tblclmnComment = tableViewerColumnComment.getColumn();
tcl_compositeTbl.setColumnData(tblclmnComment, new ColumnWeightData(50, ColumnWeightData.MINIMUM_WIDTH, true));
tblclmnComment.setText("Comment");
new Label(composite, SWT.NONE);
Label lblComment = new Label(composite, SWT.NONE);
lblComment.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1));
lblComment.setText("Comment");
txtComment = new Text(composite, SWT.BORDER | SWT.MULTI);
txtComment.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
new Label(composite, SWT.NONE);
scrolledComposite.setContent(composite);
scrolledComposite.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
m_bindingContext = initDataBindings();
}
use of org.eclipse.jface.layout.TableColumnLayout in project InformationSystem by ObeoNetwork.
the class ImportLibraryIntoProjectFileSelectionPage method createControl.
/**
* Create contents of the wizard.
* @param parent
*/
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
setControl(container);
container.setLayout(new GridLayout(3, false));
Label lblModelingProject = new Label(container, SWT.NONE);
lblModelingProject.setText("Modeling project");
comboViewer = new ComboViewer(container, SWT.NONE);
comboViewer.setUseHashlookup(true);
Combo combo = comboViewer.getCombo();
combo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
computeDependenciesTable();
}
});
combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
Label lblNewLabel = new Label(container, SWT.NONE);
lblNewLabel.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD));
lblNewLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
lblNewLabel.setText("MAR File");
Label lblFileToImport = new Label(container, SWT.NONE);
lblFileToImport.setText("Import file");
txtMarFile = new Text(container, SWT.BORDER);
txtMarFile.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
Button btnBrowse = new Button(container, SWT.NONE);
btnBrowse.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
FileDialog dlg = new FileDialog(getShell());
dlg.setFileName(txtMarFile.getText());
dlg.setOverwrite(true);
dlg.setFilterExtensions(new String[] { "*.mar", "*.*" });
dlg.setFilterNames(new String[] { "MAR files (*.mar)", "All files (*.*)" });
String importFile = dlg.open();
if (importFile != null) {
try {
Manifest manifest = manifestServices.getManifestFromArchive(new File(importFile));
extractInfoFromManifest(manifest);
} catch (FileNotFoundException e1) {
// TODO Error thrown
e1.printStackTrace();
} catch (IOException e1) {
// TODO Error thrown
e1.printStackTrace();
}
txtMarFile.setText(importFile);
setPageComplete(isInfoComplete());
}
}
});
btnBrowse.setText("Browse...");
Label lblProjectId = new Label(container, SWT.NONE);
lblProjectId.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblProjectId.setText("Project ID");
txtProjectId = new Text(container, SWT.BORDER | SWT.READ_ONLY);
txtProjectId.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
Label lblVersion = new Label(container, SWT.NONE);
lblVersion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblVersion.setText("Version");
txtVersion = new Text(container, SWT.BORDER | SWT.READ_ONLY);
txtVersion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
Label lblCreationDate = new Label(container, SWT.NONE);
lblCreationDate.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblCreationDate.setText("Creation date");
txtCreationDate = new Text(container, SWT.BORDER | SWT.READ_ONLY);
txtCreationDate.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
Label lblComment = new Label(container, SWT.NONE);
lblComment.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1));
lblComment.setText("Comment");
txtComment = new Text(container, SWT.BORDER | SWT.READ_ONLY | SWT.MULTI);
txtComment.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
Label lblDependencies = new Label(container, SWT.NONE);
lblDependencies.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
lblDependencies.setText("Dependencies");
Composite composite = new Composite(container, SWT.NONE);
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
TableColumnLayout tcl_composite = new TableColumnLayout();
composite.setLayout(tcl_composite);
TableViewer tableViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION);
table = tableViewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
TableViewerColumn tableViewerColumnId = new TableViewerColumn(tableViewer, SWT.NONE);
TableColumn tblclmnProjectId = tableViewerColumnId.getColumn();
tcl_composite.setColumnData(tblclmnProjectId, new ColumnWeightData(1, ColumnWeightData.MINIMUM_WIDTH, true));
tblclmnProjectId.setText("Project ID");
tableViewerColumnId.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof DependencyRow) {
return ((DependencyRow) element).getId();
}
return super.getText(element);
}
});
TableViewerColumn tableViewerColumnVersion = new TableViewerColumn(tableViewer, SWT.NONE);
TableColumn tblclmnVersion = tableViewerColumnVersion.getColumn();
tcl_composite.setColumnData(tblclmnVersion, new ColumnWeightData(1, ColumnWeightData.MINIMUM_WIDTH, true));
tblclmnVersion.setText("Version");
tableViewerColumnVersion.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof DependencyRow) {
return ((DependencyRow) element).getVersion();
}
return super.getText(element);
}
});
TableViewerColumn tableViewerColumnExistingVersion = new TableViewerColumn(tableViewer, SWT.NONE);
TableColumn tblclmnExistingVersion = tableViewerColumnExistingVersion.getColumn();
tcl_composite.setColumnData(tblclmnExistingVersion, new ColumnWeightData(1, ColumnWeightData.MINIMUM_WIDTH, true));
tblclmnExistingVersion.setText("Existing version");
tableViewerColumnExistingVersion.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof DependencyRow) {
return ((DependencyRow) element).getExistingVersion();
}
return super.getText(element);
}
});
TableViewerColumn tableViewerColumnValid = new TableViewerColumn(tableViewer, SWT.NONE);
TableColumn tblclmnValid = tableViewerColumnValid.getColumn();
tcl_composite.setColumnData(tblclmnValid, new ColumnWeightData(1, ColumnWeightData.MINIMUM_WIDTH, true));
tblclmnValid.setText("Valid");
tableViewerColumnValid.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
// No text, we only want to display an image
return null;
}
@Override
public Image getImage(Object element) {
if (element instanceof DependencyRow) {
DependencyRow row = (DependencyRow) element;
if (ManifestUtils.isGreaterOrEqual(row.getVersion(), row.getExistingVersion())) {
return ResourceManager.getPluginImage("org.obeonetwork.tools.projectlibrary.ui", "icons/valid.gif");
} else {
return ResourceManager.getPluginImage("org.obeonetwork.tools.projectlibrary.ui", "icons/invalid.gif");
}
}
return super.getImage(element);
}
});
new Label(container, SWT.NONE);
new Label(container, SWT.NONE);
new Label(container, SWT.NONE);
tableViewer.setContentProvider(new ArrayContentProvider());
setPageComplete(isInfoComplete());
m_bindingContext = initDataBindings();
}
use of org.eclipse.jface.layout.TableColumnLayout in project InformationSystem by ObeoNetwork.
the class ReferencingElementsDialog method createDialogArea.
/**
* 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));
Label lblInfo = new Label(container, SWT.NONE);
lblInfo.setText("There are some references to elements which will be deleted.\r\nClick \"OK\" to continue : references will be invalidated.");
Composite composite = new Composite(container, SWT.NONE);
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
TableColumnLayout tcl_composite = new TableColumnLayout();
composite.setLayout(tcl_composite);
TableViewer tableViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
tableViewer.setUseHashlookup(true);
table = tableViewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
TableColumn tblclmnReferencingElement = tableViewerColumn.getColumn();
tcl_composite.setColumnData(tblclmnReferencingElement, new ColumnWeightData(1, true));
tblclmnReferencingElement.setText("Referencing element");
TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(tableViewer, SWT.NONE);
TableColumn tblclmnReferencingFeature = tableViewerColumn_1.getColumn();
tcl_composite.setColumnData(tblclmnReferencingFeature, new ColumnWeightData(1, true));
tblclmnReferencingFeature.setText("Referencing feature");
TableViewerColumn tableViewerColumn_2 = new TableViewerColumn(tableViewer, SWT.NONE);
TableColumn tblclmnReferencedElement = tableViewerColumn_2.getColumn();
tcl_composite.setColumnData(tblclmnReferencedElement, new ColumnWeightData(1, true));
tblclmnReferencedElement.setText("Referenced element");
tableViewer.setLabelProvider(new ReferenceDataLabelProvider());
tableViewer.setContentProvider(new ArrayContentProvider());
tableViewer.setInput(referencesData);
return container;
}
use of org.eclipse.jface.layout.TableColumnLayout in project portfolio by buchen.
the class CSVImportDefinitionPage method doProcessFile.
private void doProcessFile() {
try {
importer.processFile();
tableViewer.getTable().setRedraw(false);
for (TableColumn column : tableViewer.getTable().getColumns()) column.dispose();
TableColumnLayout layout = (TableColumnLayout) tableViewer.getTable().getParent().getLayout();
for (Column column : importer.getColumns()) {
TableColumn tableColumn = new TableColumn(tableViewer.getTable(), SWT.None);
layout.setColumnData(tableColumn, new ColumnPixelData(80, true));
setColumnLabel(tableColumn, column);
}
List<Object> input = new ArrayList<>();
input.add(importer);
input.addAll(importer.getRawValues());
tableViewer.setInput(input);
tableViewer.refresh();
tableViewer.getTable().pack();
for (TableColumn column : tableViewer.getTable().getColumns()) column.pack();
doUpdateErrorMessages();
} catch (IOException e) {
PortfolioPlugin.log(e);
ErrorDialog.openError(getShell(), Messages.LabelError, e.getMessage(), new Status(Status.ERROR, PortfolioPlugin.PLUGIN_ID, e.getMessage(), e));
} finally {
tableViewer.getTable().setRedraw(true);
}
}
Aggregations