use of org.eclipse.jface.viewers.ListViewer in project InformationSystem by ObeoNetwork.
the class OverviewEditor method createPages.
/**
* This is the method used by the framework to install your own controls.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void createPages() {
// Creates the model from the editor input
//
createModel();
//
if (!getEditingDomain().getResourceSet().getResources().isEmpty() && !(getEditingDomain().getResourceSet().getResources().get(0)).getContents().isEmpty()) {
// Create a page for the selection tree view.
//
{
ViewerPane viewerPane = new ViewerPane(getSite().getPage(), OverviewEditor.this) {
@Override
public Viewer createViewer(Composite composite) {
Tree tree = new Tree(composite, SWT.MULTI);
TreeViewer newTreeViewer = new TreeViewer(tree);
return newTreeViewer;
}
@Override
public void requestActivation() {
super.requestActivation();
setCurrentViewerPane(this);
}
};
viewerPane.createControl(getContainer());
selectionViewer = (TreeViewer) viewerPane.getViewer();
selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
selectionViewer.setInput(editingDomain.getResourceSet());
selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
viewerPane.setTitle(editingDomain.getResourceSet());
new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory);
createContextMenuFor(selectionViewer);
int pageIndex = addPage(viewerPane.getControl());
setPageText(pageIndex, getString("_UI_SelectionPage_label"));
}
// Create a page for the parent tree view.
//
// {
// ViewerPane viewerPane =
// new ViewerPane(getSite().getPage(), OverviewEditor.this) {
// @Override
// public Viewer createViewer(Composite composite) {
// Tree tree = new Tree(composite, SWT.MULTI);
// TreeViewer newTreeViewer = new TreeViewer(tree);
// return newTreeViewer;
// }
// @Override
// public void requestActivation() {
// super.requestActivation();
// setCurrentViewerPane(this);
// }
// };
// viewerPane.createControl(getContainer());
//
// parentViewer = (TreeViewer)viewerPane.getViewer();
// parentViewer.setAutoExpandLevel(30);
// parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory));
// parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
//
// createContextMenuFor(parentViewer);
// int pageIndex = addPage(viewerPane.getControl());
// setPageText(pageIndex, getString("_UI_ParentPage_label"));
// }
// This is the page for the list viewer
//
// {
// ViewerPane viewerPane =
// new ViewerPane(getSite().getPage(), OverviewEditor.this) {
// @Override
// public Viewer createViewer(Composite composite) {
// return new ListViewer(composite);
// }
// @Override
// public void requestActivation() {
// super.requestActivation();
// setCurrentViewerPane(this);
// }
// };
// viewerPane.createControl(getContainer());
// listViewer = (ListViewer)viewerPane.getViewer();
// listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
// listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
//
// createContextMenuFor(listViewer);
// int pageIndex = addPage(viewerPane.getControl());
// setPageText(pageIndex, getString("_UI_ListPage_label"));
// }
// This is the page for the tree viewer
//
// {
// ViewerPane viewerPane =
// new ViewerPane(getSite().getPage(), OverviewEditor.this) {
// @Override
// public Viewer createViewer(Composite composite) {
// return new TreeViewer(composite);
// }
// @Override
// public void requestActivation() {
// super.requestActivation();
// setCurrentViewerPane(this);
// }
// };
// viewerPane.createControl(getContainer());
// treeViewer = (TreeViewer)viewerPane.getViewer();
// treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
// treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
//
// new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory);
//
// createContextMenuFor(treeViewer);
// int pageIndex = addPage(viewerPane.getControl());
// setPageText(pageIndex, getString("_UI_TreePage_label"));
// }
// This is the page for the table viewer.
//
// {
// ViewerPane viewerPane =
// new ViewerPane(getSite().getPage(), OverviewEditor.this) {
// @Override
// public Viewer createViewer(Composite composite) {
// return new TableViewer(composite);
// }
// @Override
// public void requestActivation() {
// super.requestActivation();
// setCurrentViewerPane(this);
// }
// };
// viewerPane.createControl(getContainer());
// tableViewer = (TableViewer)viewerPane.getViewer();
//
// Table table = tableViewer.getTable();
// TableLayout layout = new TableLayout();
// table.setLayout(layout);
// table.setHeaderVisible(true);
// table.setLinesVisible(true);
//
// TableColumn objectColumn = new TableColumn(table, SWT.NONE);
// layout.addColumnData(new ColumnWeightData(3, 100, true));
// objectColumn.setText(getString("_UI_ObjectColumn_label"));
// objectColumn.setResizable(true);
//
// TableColumn selfColumn = new TableColumn(table, SWT.NONE);
// layout.addColumnData(new ColumnWeightData(2, 100, true));
// selfColumn.setText(getString("_UI_SelfColumn_label"));
// selfColumn.setResizable(true);
//
// tableViewer.setColumnProperties(new String [] {"a", "b"});
// tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
// tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
//
// createContextMenuFor(tableViewer);
// int pageIndex = addPage(viewerPane.getControl());
// setPageText(pageIndex, getString("_UI_TablePage_label"));
// }
// This is the page for the table tree viewer.
//
// {
// ViewerPane viewerPane =
// new ViewerPane(getSite().getPage(), OverviewEditor.this) {
// @Override
// public Viewer createViewer(Composite composite) {
// return new TreeViewer(composite);
// }
// @Override
// public void requestActivation() {
// super.requestActivation();
// setCurrentViewerPane(this);
// }
// };
// viewerPane.createControl(getContainer());
//
// treeViewerWithColumns = (TreeViewer)viewerPane.getViewer();
//
// Tree tree = treeViewerWithColumns.getTree();
// tree.setLayoutData(new FillLayout());
// tree.setHeaderVisible(true);
// tree.setLinesVisible(true);
//
// TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE);
// objectColumn.setText(getString("_UI_ObjectColumn_label"));
// objectColumn.setResizable(true);
// objectColumn.setWidth(250);
//
// TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE);
// selfColumn.setText(getString("_UI_SelfColumn_label"));
// selfColumn.setResizable(true);
// selfColumn.setWidth(200);
//
// treeViewerWithColumns.setColumnProperties(new String [] {"a", "b"});
// treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
// treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
//
// createContextMenuFor(treeViewerWithColumns);
// int pageIndex = addPage(viewerPane.getControl());
// setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label"));
// }
getSite().getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
setActivePage(0);
}
});
}
// Ensures that this editor will only display the page's tab
// area if there are more than one page
//
getContainer().addControlListener(new ControlAdapter() {
boolean guard = false;
@Override
public void controlResized(ControlEvent event) {
if (!guard) {
guard = true;
hideTabs();
guard = false;
}
}
});
getSite().getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
updateProblemIndication();
}
});
}
use of org.eclipse.jface.viewers.ListViewer in project InformationSystem by ObeoNetwork.
the class InteractionEditor method createPages.
/**
* This is the method used by the framework to install your own controls.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void createPages() {
// Creates the model from the editor input
//
createModel();
//
if (!getEditingDomain().getResourceSet().getResources().isEmpty()) {
// Create a page for the selection tree view.
//
{
ViewerPane viewerPane = new ViewerPane(getSite().getPage(), InteractionEditor.this) {
@Override
public Viewer createViewer(Composite composite) {
Tree tree = new Tree(composite, SWT.MULTI);
TreeViewer newTreeViewer = new TreeViewer(tree);
return newTreeViewer;
}
@Override
public void requestActivation() {
super.requestActivation();
setCurrentViewerPane(this);
}
};
viewerPane.createControl(getContainer());
selectionViewer = (TreeViewer) viewerPane.getViewer();
selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
selectionViewer.setInput(editingDomain.getResourceSet());
selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
viewerPane.setTitle(editingDomain.getResourceSet());
new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory);
createContextMenuFor(selectionViewer);
int pageIndex = addPage(viewerPane.getControl());
setPageText(pageIndex, getString("_UI_SelectionPage_label"));
}
// Create a page for the parent tree view.
//
{
ViewerPane viewerPane = new ViewerPane(getSite().getPage(), InteractionEditor.this) {
@Override
public Viewer createViewer(Composite composite) {
Tree tree = new Tree(composite, SWT.MULTI);
TreeViewer newTreeViewer = new TreeViewer(tree);
return newTreeViewer;
}
@Override
public void requestActivation() {
super.requestActivation();
setCurrentViewerPane(this);
}
};
viewerPane.createControl(getContainer());
parentViewer = (TreeViewer) viewerPane.getViewer();
parentViewer.setAutoExpandLevel(30);
parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory));
parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
createContextMenuFor(parentViewer);
int pageIndex = addPage(viewerPane.getControl());
setPageText(pageIndex, getString("_UI_ParentPage_label"));
}
// This is the page for the list viewer
//
{
ViewerPane viewerPane = new ViewerPane(getSite().getPage(), InteractionEditor.this) {
@Override
public Viewer createViewer(Composite composite) {
return new ListViewer(composite);
}
@Override
public void requestActivation() {
super.requestActivation();
setCurrentViewerPane(this);
}
};
viewerPane.createControl(getContainer());
listViewer = (ListViewer) viewerPane.getViewer();
listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
createContextMenuFor(listViewer);
int pageIndex = addPage(viewerPane.getControl());
setPageText(pageIndex, getString("_UI_ListPage_label"));
}
// This is the page for the tree viewer
//
{
ViewerPane viewerPane = new ViewerPane(getSite().getPage(), InteractionEditor.this) {
@Override
public Viewer createViewer(Composite composite) {
return new TreeViewer(composite);
}
@Override
public void requestActivation() {
super.requestActivation();
setCurrentViewerPane(this);
}
};
viewerPane.createControl(getContainer());
treeViewer = (TreeViewer) viewerPane.getViewer();
treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory);
createContextMenuFor(treeViewer);
int pageIndex = addPage(viewerPane.getControl());
setPageText(pageIndex, getString("_UI_TreePage_label"));
}
// This is the page for the table viewer.
//
{
ViewerPane viewerPane = new ViewerPane(getSite().getPage(), InteractionEditor.this) {
@Override
public Viewer createViewer(Composite composite) {
return new TableViewer(composite);
}
@Override
public void requestActivation() {
super.requestActivation();
setCurrentViewerPane(this);
}
};
viewerPane.createControl(getContainer());
tableViewer = (TableViewer) viewerPane.getViewer();
Table table = tableViewer.getTable();
TableLayout layout = new TableLayout();
table.setLayout(layout);
table.setHeaderVisible(true);
table.setLinesVisible(true);
TableColumn objectColumn = new TableColumn(table, SWT.NONE);
layout.addColumnData(new ColumnWeightData(3, 100, true));
objectColumn.setText(getString("_UI_ObjectColumn_label"));
objectColumn.setResizable(true);
TableColumn selfColumn = new TableColumn(table, SWT.NONE);
layout.addColumnData(new ColumnWeightData(2, 100, true));
selfColumn.setText(getString("_UI_SelfColumn_label"));
selfColumn.setResizable(true);
tableViewer.setColumnProperties(new String[] { "a", "b" });
tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
createContextMenuFor(tableViewer);
int pageIndex = addPage(viewerPane.getControl());
setPageText(pageIndex, getString("_UI_TablePage_label"));
}
// This is the page for the table tree viewer.
//
{
ViewerPane viewerPane = new ViewerPane(getSite().getPage(), InteractionEditor.this) {
@Override
public Viewer createViewer(Composite composite) {
return new TreeViewer(composite);
}
@Override
public void requestActivation() {
super.requestActivation();
setCurrentViewerPane(this);
}
};
viewerPane.createControl(getContainer());
treeViewerWithColumns = (TreeViewer) viewerPane.getViewer();
Tree tree = treeViewerWithColumns.getTree();
tree.setLayoutData(new FillLayout());
tree.setHeaderVisible(true);
tree.setLinesVisible(true);
TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE);
objectColumn.setText(getString("_UI_ObjectColumn_label"));
objectColumn.setResizable(true);
objectColumn.setWidth(250);
TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE);
selfColumn.setText(getString("_UI_SelfColumn_label"));
selfColumn.setResizable(true);
selfColumn.setWidth(200);
treeViewerWithColumns.setColumnProperties(new String[] { "a", "b" });
treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
createContextMenuFor(treeViewerWithColumns);
int pageIndex = addPage(viewerPane.getControl());
setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label"));
}
getSite().getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
setActivePage(0);
}
});
}
// Ensures that this editor will only display the page's tab
// area if there are more than one page
//
getContainer().addControlListener(new ControlAdapter() {
boolean guard = false;
@Override
public void controlResized(ControlEvent event) {
if (!guard) {
guard = true;
hideTabs();
guard = false;
}
}
});
getSite().getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
updateProblemIndication();
}
});
}
use of org.eclipse.jface.viewers.ListViewer in project erlide_eclipse by erlang.
the class ErlProjectPropertyPage method createContents.
@Override
protected Control createContents(final Composite parent) {
final Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new FillLayout(SWT.HORIZONTAL));
final TabFolder tabFolder = new TabFolder(composite, SWT.NONE);
// /////////////////////////////////////
final TabItem sourceTab = new TabItem(tabFolder, SWT.NONE);
sourceTab.setText("Source");
final Composite sourceComposite = new Composite(tabFolder, SWT.NONE);
sourceComposite.setLayout(new FormLayout());
sourceComposite.setBounds(0, 0, 443, 305);
sourceTab.setControl(sourceComposite);
Label lblSourceFoldersIn;
FormData formData_2;
{
lblSourceFoldersIn = new Label(sourceComposite, SWT.NONE);
{
formData_2 = new FormData();
formData_2.right = new FormAttachment(100);
formData_2.left = new FormAttachment(0, 8);
lblSourceFoldersIn.setLayoutData(formData_2);
}
lblSourceFoldersIn.setText("Source folders in the project:");
}
Button btnFolder;
FormData formData_5;
{
btnFolder = new Button(sourceComposite, SWT.NONE);
formData_2.bottom = new FormAttachment(btnFolder, -6);
{
formData_5 = new FormData();
formData_5.right = new FormAttachment(100);
formData_5.width = 84;
btnFolder.setLayoutData(formData_5);
}
btnFolder.setText("Add folder...");
}
Button btnSource;
{
btnSource = new Button(sourceComposite, SWT.NONE);
formData_5.bottom = new FormAttachment(btnSource, -6);
btnSource.setEnabled(false);
{
final FormData formData = new FormData();
formData.right = new FormAttachment(100);
formData.top = new FormAttachment(0, 62);
formData.width = 84;
btnSource.setLayoutData(formData);
}
btnSource.setText("Link source...");
}
Button btnEdit;
FormData formData_4;
{
btnEdit = new Button(sourceComposite, SWT.NONE);
{
formData_4 = new FormData();
formData_4.right = new FormAttachment(100);
formData_4.width = 84;
btnEdit.setLayoutData(formData_4);
}
btnEdit.setText("Edit...");
}
Button btnRemove;
{
btnRemove = new Button(sourceComposite, SWT.NONE);
formData_4.bottom = new FormAttachment(btnRemove, -6);
{
final FormData formData = new FormData();
formData.right = new FormAttachment(100);
formData.width = 84;
formData.top = new FormAttachment(0, 134);
btnRemove.setLayoutData(formData);
}
btnRemove.setText("Remove");
}
Button btnAllowOutputFolders;
FormData formData_6;
{
btnAllowOutputFolders = new Button(sourceComposite, SWT.CHECK);
{
formData_6 = new FormData();
formData_6.left = new FormAttachment(0, 10);
btnAllowOutputFolders.setLayoutData(formData_6);
}
btnAllowOutputFolders.setText("Allow output folders for source folders");
}
Text output_text;
FormData formData_3;
{
output_text = new Text(sourceComposite, SWT.BORDER);
formData_6.bottom = new FormAttachment(output_text, -6);
{
formData_3 = new FormData();
formData_3.left = new FormAttachment(0, 10);
output_text.setLayoutData(formData_3);
}
}
Button btnBrowse;
{
btnBrowse = new Button(sourceComposite, SWT.NONE);
formData_3.right = new FormAttachment(btnBrowse, -6);
formData_3.top = new FormAttachment(0, 268);
{
final FormData formData = new FormData();
formData.right = new FormAttachment(100);
formData.width = 84;
formData.bottom = new FormAttachment(output_text, 0, SWT.BOTTOM);
btnBrowse.setLayoutData(formData);
}
btnBrowse.setText("Browse...");
}
{
final TreeViewer treeViewer = new TreeViewer(sourceComposite, SWT.BORDER);
final Tree sources_tree = treeViewer.getTree();
{
final FormData formData = new FormData();
formData.left = new FormAttachment(0, 10);
formData.right = new FormAttachment(btnSource, -6);
formData.top = new FormAttachment(lblSourceFoldersIn, 6);
formData.bottom = new FormAttachment(btnAllowOutputFolders, -6);
sources_tree.setLayoutData(formData);
}
}
final Button btnWhenCleaningDelete = new Button(sourceComposite, SWT.CHECK);
final FormData fd_btnWhenCleaningDelete = new FormData();
fd_btnWhenCleaningDelete.top = new FormAttachment(output_text, 6);
fd_btnWhenCleaningDelete.left = new FormAttachment(lblSourceFoldersIn, 0, SWT.LEFT);
btnWhenCleaningDelete.setLayoutData(fd_btnWhenCleaningDelete);
btnWhenCleaningDelete.setText("When cleaning, delete the whole output directory (faster)");
sourceComposite.setTabList(new Control[] { btnFolder, btnSource, btnEdit, btnRemove, btnAllowOutputFolders, output_text, btnBrowse });
final TabItem includeTab = new TabItem(tabFolder, SWT.NONE);
includeTab.setText("Include");
final Composite includeComposite = new Composite(tabFolder, SWT.NONE);
includeComposite.setLayout(new FormLayout());
includeComposite.setBounds(0, 0, 443, 305);
includeTab.setControl(includeComposite);
final Label lblFoldersWithInclude = new Label(includeComposite, SWT.NONE);
{
final FormData formData = new FormData();
formData.right = new FormAttachment(100, -10);
formData.top = new FormAttachment(0, 10);
formData.left = new FormAttachment(0, 10);
lblFoldersWithInclude.setLayoutData(formData);
}
lblFoldersWithInclude.setText("Folders with include files:");
final Button btnAddFolder = new Button(includeComposite, SWT.NONE);
{
final FormData formData = new FormData();
formData.top = new FormAttachment(lblFoldersWithInclude, 9);
formData.right = new FormAttachment(lblFoldersWithInclude, 0, SWT.RIGHT);
btnAddFolder.setLayoutData(formData);
}
btnAddFolder.setText("Add folder...");
final Button btnEdit_1 = new Button(includeComposite, SWT.NONE);
FormData formData_1;
{
formData_1 = new FormData();
formData_1.right = new FormAttachment(lblFoldersWithInclude, 0, SWT.RIGHT);
formData_1.width = 77;
btnEdit_1.setLayoutData(formData_1);
}
btnEdit_1.setText("Edit...");
final Button btnRemove_1 = new Button(includeComposite, SWT.NONE);
formData_1.bottom = new FormAttachment(100, -216);
{
final FormData formData_7 = new FormData();
formData_7.top = new FormAttachment(btnEdit_1, 7);
formData_7.right = new FormAttachment(lblFoldersWithInclude, 0, SWT.RIGHT);
formData_7.width = 77;
btnRemove_1.setLayoutData(formData_7);
}
btnRemove_1.setText("Remove");
{
final ListViewer listViewer = new ListViewer(includeComposite, SWT.BORDER);
final org.eclipse.swt.widgets.List includes_list = listViewer.getList();
{
final FormData formData = new FormData();
formData.right = new FormAttachment(btnAddFolder, -6);
formData.left = new FormAttachment(0, 10);
formData.bottom = new FormAttachment(100, -10);
formData.top = new FormAttachment(lblFoldersWithInclude, 6);
includes_list.setLayoutData(formData);
}
}
final TabItem projectsTab = new TabItem(tabFolder, SWT.NONE);
projectsTab.setText("Projects");
final Composite dependenciesComposite = new Composite(tabFolder, SWT.NONE);
dependenciesComposite.setLayout(new FormLayout());
projectsTab.setControl(dependenciesComposite);
final Label lblProjectsOnThe = new Label(dependenciesComposite, SWT.NONE);
{
final FormData formData = new FormData();
formData.right = new FormAttachment(100, -10);
formData.top = new FormAttachment(0, 10);
formData.left = new FormAttachment(0, 10);
lblProjectsOnThe.setLayoutData(formData);
}
lblProjectsOnThe.setText("Required projects on the build path:");
final Button button = new Button(dependenciesComposite, SWT.NONE);
{
final FormData formData = new FormData();
formData.top = new FormAttachment(lblProjectsOnThe, 6);
formData.right = new FormAttachment(lblProjectsOnThe, 0, SWT.RIGHT);
button.setLayoutData(formData);
}
button.setText("New Button");
final Button button_1 = new Button(dependenciesComposite, SWT.NONE);
FormData formData_8;
{
formData_8 = new FormData();
formData_8.right = new FormAttachment(lblProjectsOnThe, 0, SWT.RIGHT);
button_1.setLayoutData(formData_8);
}
button_1.setText("New Button");
final Button button_2 = new Button(dependenciesComposite, SWT.NONE);
formData_8.bottom = new FormAttachment(button_2, -6);
{
final FormData formData = new FormData();
formData.top = new FormAttachment(0, 110);
formData.right = new FormAttachment(lblProjectsOnThe, 0, SWT.RIGHT);
button_2.setLayoutData(formData);
}
button_2.setText("New Button");
{
final ListViewer listViewer = new ListViewer(dependenciesComposite, SWT.BORDER);
final org.eclipse.swt.widgets.List projects_list = listViewer.getList();
{
final FormData formData = new FormData();
formData.right = new FormAttachment(button, -6);
formData.left = new FormAttachment(0, 10);
formData.bottom = new FormAttachment(100, -6);
formData.top = new FormAttachment(lblProjectsOnThe, 6);
projects_list.setLayoutData(formData);
}
}
final Collection<RuntimeInfo> rs = BackendCore.getRuntimeInfoCatalog().getRuntimes();
final List<String[]> vv = new ArrayList<>();
for (final RuntimeInfo ri : rs) {
vv.add(new String[] { ri.getName(), ri.getName() });
}
@SuppressWarnings("unused") final String[][] values = vv.toArray(new String[][] {});
final TabItem librariesTab = new TabItem(tabFolder, SWT.NONE);
librariesTab.setText("Libraries");
final Composite librariesComposite = new Composite(tabFolder, SWT.NONE);
librariesComposite.setLayout(new FormLayout());
librariesTab.setControl(librariesComposite);
final Label lblExternalLibrariesRequired = new Label(librariesComposite, SWT.NONE);
{
final FormData formData = new FormData();
formData.right = new FormAttachment(100, -10);
formData.top = new FormAttachment(0, 10);
formData.left = new FormAttachment(0, 10);
lblExternalLibrariesRequired.setLayoutData(formData);
}
lblExternalLibrariesRequired.setText("External libraries required on build path:");
final Button button_3 = new Button(librariesComposite, SWT.NONE);
{
final FormData formData = new FormData();
formData.top = new FormAttachment(lblExternalLibrariesRequired, 6);
formData.right = new FormAttachment(100, -10);
button_3.setLayoutData(formData);
}
button_3.setText("New Button");
final Button button_4 = new Button(librariesComposite, SWT.NONE);
{
final FormData formData = new FormData();
formData.top = new FormAttachment(button_3, 6);
formData.right = new FormAttachment(lblExternalLibrariesRequired, 0, SWT.RIGHT);
button_4.setLayoutData(formData);
}
button_4.setText("New Button");
final Button button_5 = new Button(librariesComposite, SWT.NONE);
FormData formData_9;
{
formData_9 = new FormData();
formData_9.right = new FormAttachment(lblExternalLibrariesRequired, 0, SWT.RIGHT);
button_5.setLayoutData(formData_9);
}
button_5.setText("New Button");
final Button button_6 = new Button(librariesComposite, SWT.NONE);
formData_9.bottom = new FormAttachment(100, -226);
{
final FormData formData = new FormData();
formData.top = new FormAttachment(button_5, 6);
formData.right = new FormAttachment(lblExternalLibrariesRequired, 0, SWT.RIGHT);
button_6.setLayoutData(formData);
}
button_6.setText("New Button");
{
final TreeViewer treeViewer = new TreeViewer(librariesComposite, SWT.BORDER);
final Tree libraries_tree = treeViewer.getTree();
{
final FormData formData = new FormData();
formData.right = new FormAttachment(button_3, -6);
formData.left = new FormAttachment(0, 10);
formData.top = new FormAttachment(lblExternalLibrariesRequired, 4);
formData.bottom = new FormAttachment(100, -10);
libraries_tree.setLayoutData(formData);
}
}
final TabItem orderTab = new TabItem(tabFolder, SWT.NONE);
orderTab.setText("Codepath order");
final Composite codepathComposite = new Composite(tabFolder, SWT.NONE);
codepathComposite.setLayout(new FormLayout());
orderTab.setControl(codepathComposite);
final Label lblOrderOfThe = new Label(codepathComposite, SWT.NONE);
{
final FormData formData = new FormData();
formData.right = new FormAttachment(100, -10);
formData.top = new FormAttachment(0, 10);
formData.left = new FormAttachment(0, 10);
lblOrderOfThe.setLayoutData(formData);
}
lblOrderOfThe.setText("Order of the dependencies on runtime code path:");
final Button button_7 = new Button(codepathComposite, SWT.NONE);
{
final FormData formData = new FormData();
formData.top = new FormAttachment(lblOrderOfThe, 6);
formData.right = new FormAttachment(lblOrderOfThe, 0, SWT.RIGHT);
button_7.setLayoutData(formData);
}
button_7.setText("New Button");
final Button button_8 = new Button(codepathComposite, SWT.NONE);
{
final FormData formData = new FormData();
formData.top = new FormAttachment(button_7, 6);
formData.right = new FormAttachment(lblOrderOfThe, 0, SWT.RIGHT);
button_8.setLayoutData(formData);
}
button_8.setText("New Button");
{
final ListViewer listViewer = new ListViewer(codepathComposite, SWT.BORDER);
final org.eclipse.swt.widgets.List codepath_list = listViewer.getList();
{
final FormData formData = new FormData();
formData.right = new FormAttachment(button_7, -6);
formData.left = new FormAttachment(0, 10);
formData.bottom = new FormAttachment(100, -10);
formData.top = new FormAttachment(lblOrderOfThe, 6);
codepath_list.setLayoutData(formData);
}
}
final TabItem tbtmPreprocessor = new TabItem(tabFolder, SWT.NONE);
tbtmPreprocessor.setText("Preprocessor");
final Composite composite_1 = new Composite(tabFolder, SWT.NONE);
composite_1.setLayout(new FormLayout());
tbtmPreprocessor.setControl(composite_1);
final Label lblMacrosDefinedFor = new Label(composite_1, SWT.NONE);
{
final FormData formData = new FormData();
formData.top = new FormAttachment(0, 10);
formData.left = new FormAttachment(0, 10);
lblMacrosDefinedFor.setLayoutData(formData);
}
lblMacrosDefinedFor.setText("Macros defined for this project");
final Button button_9 = new Button(composite_1, SWT.NONE);
{
final FormData formData_10 = new FormData();
formData_10.top = new FormAttachment(0, 31);
formData_10.right = new FormAttachment(100, -10);
button_9.setLayoutData(formData_10);
}
button_9.setText("New Button");
final Button button_10 = new Button(composite_1, SWT.NONE);
FormData formData_12;
{
formData_12 = new FormData();
formData_12.right = new FormAttachment(button_9, 0, SWT.RIGHT);
button_10.setLayoutData(formData_12);
}
button_10.setText("New Button");
final Button button_11 = new Button(composite_1, SWT.NONE);
formData_12.bottom = new FormAttachment(100, -262);
{
final FormData formData_11 = new FormData();
formData_11.top = new FormAttachment(button_10, 6);
formData_11.right = new FormAttachment(button_9, 0, SWT.RIGHT);
button_11.setLayoutData(formData_11);
}
button_11.setText("New Button");
{
final ListViewer listViewer = new ListViewer(composite_1, SWT.BORDER);
final org.eclipse.swt.widgets.List macros_list = listViewer.getList();
{
final FormData formData = new FormData();
formData.right = new FormAttachment(button_9, -6);
formData.left = new FormAttachment(0, 10);
formData.bottom = new FormAttachment(100, -10);
formData.top = new FormAttachment(lblMacrosDefinedFor, 6);
macros_list.setLayoutData(formData);
}
}
return composite;
}
use of org.eclipse.jface.viewers.ListViewer in project tmdm-studio-se by Talend.
the class ViewBrowserMainPage method createCharacteristicsContent.
@Override
protected void createCharacteristicsContent(FormToolkit toolkit, Composite charComposite) {
try {
Label vbeLabel = toolkit.createLabel(charComposite, Messages.ViewBrowserMainPage_ViewableElements, SWT.NULL);
vbeLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
Label sbeLabel = toolkit.createLabel(charComposite, Messages.ViewBrowserMainPage_SearchableElements, SWT.NULL);
sbeLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
viewableBEsList = new List(charComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
viewableBEsList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
((GridData) viewableBEsList.getLayoutData()).heightHint = 100;
searchableBEsList = new List(charComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
searchableBEsList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
((GridData) searchableBEsList.getLayoutData()).heightHint = 100;
Label wcLabel = toolkit.createLabel(charComposite, Messages.ViewBrowserMainPage_Conditions, SWT.NULL);
wcLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 2, 1));
wcListViewer = new ListViewer(charComposite, SWT.BORDER);
wcListViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
((GridData) wcListViewer.getControl().getLayoutData()).minimumHeight = 100;
wcListViewer.setContentProvider(new IStructuredContentProvider() {
@Override
public void dispose() {
}
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
@Override
public Object[] getElements(Object inputElement) {
return ((WSView) inputElement).getWhereConditions().toArray();
}
});
wcListViewer.setLabelProvider(new ILabelProvider() {
@Override
public Image getImage(Object element) {
return null;
}
@Override
public String getText(Object element) {
WSWhereCondition wc = (WSWhereCondition) element;
// $NON-NLS-1$
String text = wc.getLeftPath() + " ";
if (wc.getOperator().equals(WSWhereOperator.CONTAINS)) {
// $NON-NLS-1$
text += "Contains";
} else if (wc.getOperator().equals(WSWhereOperator.CONTAINS_SENTENCE)) {
// $NON-NLS-1$
text += "contains the sentence";
} else if (wc.getOperator().equals(WSWhereOperator.EQUALS)) {
// $NON-NLS-1$
text += "=";
} else if (wc.getOperator().equals(WSWhereOperator.GREATER_THAN)) {
// $NON-NLS-1$
text += ">";
} else if (wc.getOperator().equals(WSWhereOperator.GREATER_THAN_OR_EQUAL)) {
// $NON-NLS-1$
text += ">=";
} else if (wc.getOperator().equals(WSWhereOperator.JOIN)) {
// $NON-NLS-1$
text += "Joins With";
} else if (wc.getOperator().equals(WSWhereOperator.LOWER_THAN)) {
// $NON-NLS-1$
text += "<";
} else if (wc.getOperator().equals(WSWhereOperator.LOWER_THAN_OR_EQUAL)) {
// $NON-NLS-1$
text += "<=";
} else if (wc.getOperator().equals(WSWhereOperator.NOT_EQUALS)) {
// $NON-NLS-1$
text += "!=";
} else if (wc.getOperator().equals(WSWhereOperator.STARTSWITH)) {
// $NON-NLS-1$
text += "Starts With";
} else if (wc.getOperator().equals(WSWhereOperator.EMPTY_NULL)) {
// $NON-NLS-1$
text += "Is Empty Or Null";
} else if (wc.getOperator().equals(WSWhereOperator.FULLTEXTSEARCH)) {
// $NON-NLS-1$
text += "whole content contains";
}
// $NON-NLS-1$
text += " ";
if (!wc.getOperator().equals(WSWhereOperator.JOIN)) {
// $NON-NLS-1$
text += "\"";
}
text += wc.getRightValueOrPath();
if (!wc.getOperator().equals(WSWhereOperator.JOIN)) {
// $NON-NLS-1$
text += "\"";
}
// $NON-NLS-1$
text += " ";
if (wc.getStringPredicate().equals(WSStringPredicate.AND)) {
// $NON-NLS-1$
text += "[and]";
} else if (wc.getStringPredicate().equals(WSStringPredicate.NONE)) {
// $NON-NLS-1$
text += "";
} else if (wc.getStringPredicate().equals(WSStringPredicate.OR)) {
// $NON-NLS-1$
text += "[or]";
} else if (wc.getStringPredicate().equals(WSStringPredicate.NOT)) {
// $NON-NLS-1$
text += "[not]";
}
return text;
}
@Override
public void addListener(ILabelProviderListener listener) {
}
@Override
public void dispose() {
}
@Override
public boolean isLabelProperty(Object element, String property) {
return false;
}
@Override
public void removeListener(ILabelProviderListener listener) {
}
});
int columns = 6;
Composite resultsGroup = this.getNewSectionComposite(Messages.ViewBrowserMainPage_SearchAndResults);
resultsGroup.setLayout(new GridLayout(columns, false));
Composite createComposite = toolkit.createComposite(resultsGroup);
GridLayout layout = new GridLayout(3, false);
layout.marginWidth = 0;
createComposite.setLayout(layout);
createComposite.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
Label containerLabel = toolkit.createLabel(createComposite, Messages.ViewBrowserMainPage_Container, SWT.NULL);
containerLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1));
dataClusterCombo = new Combo(createComposite, SWT.READ_ONLY | SWT.DROP_DOWN | SWT.SINGLE);
dataClusterCombo.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1));
((GridData) dataClusterCombo.getLayoutData()).minimumWidth = 100;
clusterTypeCombo = new Combo(createComposite, SWT.READ_ONLY | SWT.SINGLE);
GridData typeLayout = new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1);
typeLayout.horizontalIndent = 10;
clusterTypeCombo.setLayoutData(typeLayout);
Label searchOnLabel = toolkit.createLabel(resultsGroup, Messages.ViewBrowserMainPage_SearchOn, SWT.NULL);
GridData layoutData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
layoutData.horizontalIndent = 20;
searchOnLabel.setLayoutData(layoutData);
searchItemCombo = new Combo(resultsGroup, SWT.READ_ONLY | SWT.DROP_DOWN | SWT.SINGLE);
searchItemCombo.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1));
((GridData) searchItemCombo.getLayoutData()).minimumWidth = 100;
searchItemCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (FULL_TEXT.equals(searchItemCombo.getText())) {
matchAllWordsBtn.setEnabled(true);
} else {
matchAllWordsBtn.setSelection(false);
matchAllWordsBtn.setEnabled(false);
}
}
});
// $NON-NLS-1$
searchText = toolkit.createText(resultsGroup, "", SWT.BORDER);
searchText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
searchText.addKeyListener(new KeyListener() {
@Override
public void keyPressed(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent e) {
if ((e.stateMask == 0) && (e.character == SWT.CR)) {
ViewBrowserMainPage.this.resultsViewer.setInput(getResults());
}
}
});
Button bSearch = toolkit.createButton(resultsGroup, Messages.ViewBrowserMainPage_Search, SWT.CENTER);
bSearch.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, true, 1, 1));
bSearch.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
ViewBrowserMainPage.this.resultsViewer.setInput(getResults());
}
});
matchAllWordsBtn = toolkit.createButton(resultsGroup, Messages.ViewBrowserMainPage_MatchWholeSentence, SWT.CHECK);
matchAllWordsBtn.setSelection(true);
// $NON-NLS-1$
resultsLabel = toolkit.createLabel(resultsGroup, "", SWT.NULL);
GridData resultLayoutData = new GridData(SWT.LEFT, SWT.CENTER, false, false, columns - 1, 1);
resultLayoutData.widthHint = 100;
resultsLabel.setLayoutData(resultLayoutData);
resultsViewer = new TableViewer(resultsGroup);
resultsViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, columns, 1));
((GridData) resultsViewer.getControl().getLayoutData()).heightHint = 500;
resultsViewer.setContentProvider(new ArrayContentProvider());
resultsViewer.setLabelProvider(new XMLTableLabelProvider());
resultsViewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
resultsViewer.setSelection(event.getSelection());
try {
new DOMViewAction(ViewBrowserMainPage.this.getSite().getShell(), resultsViewer).run();
} catch (Exception e) {
MessageDialog.openError(ViewBrowserMainPage.this.getSite().getShell(), Messages._Error, Messages.bind(Messages.ViewBrowserMainPage_ErrorMsg, e.getClass().getName(), e.getLocalizedMessage()));
}
}
});
hookContextMenu();
addListener();
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
Aggregations