List of usage examples for org.eclipse.swt.widgets Tree setLinesVisible
public void setLinesVisible(boolean value)
true
, and marks it invisible otherwise. From source file:org.eclipse.swt.snippets.Snippet232.java
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); shell.setText("Show results as a bar chart in Tree"); final Tree tree = new Tree(shell, SWT.BORDER); tree.setHeaderVisible(true);/* w w w . ja v a 2 s. c o m*/ tree.setLinesVisible(true); TreeColumn column1 = new TreeColumn(tree, SWT.NONE); column1.setText("Bug Status"); column1.setWidth(100); final TreeColumn column2 = new TreeColumn(tree, SWT.NONE); column2.setText("Percent"); column2.setWidth(200); String[] states = new String[] { "Resolved", "New", "Won't Fix", "Invalid" }; String[] teams = new String[] { "UI", "SWT", "OSGI" }; for (int i = 0; i < teams.length; i++) { TreeItem item = new TreeItem(tree, SWT.NONE); item.setText(teams[i]); for (int j = 0; j < states.length; j++) { TreeItem subItem = new TreeItem(item, SWT.NONE); subItem.setText(states[j]); } } /* * NOTE: MeasureItem, PaintItem and EraseItem are called repeatedly. * Therefore, it is critical for performance that these methods be * as efficient as possible. */ tree.addListener(SWT.PaintItem, new Listener() { int[] percents = new int[] { 50, 30, 5, 15 }; @Override public void handleEvent(Event event) { if (event.index == 1) { TreeItem item = (TreeItem) event.item; TreeItem parent = item.getParentItem(); if (parent != null) { GC gc = event.gc; int index = parent.indexOf(item); int percent = percents[index]; Color foreground = gc.getForeground(); Color background = gc.getBackground(); gc.setForeground(display.getSystemColor(SWT.COLOR_RED)); gc.setBackground(display.getSystemColor(SWT.COLOR_YELLOW)); int width = (column2.getWidth() - 1) * percent / 100; gc.fillGradientRectangle(event.x, event.y, width, event.height, true); Rectangle rect2 = new Rectangle(event.x, event.y, width - 1, event.height - 1); gc.drawRectangle(rect2); gc.setForeground(display.getSystemColor(SWT.COLOR_LIST_FOREGROUND)); String text = percent + "%"; Point size = event.gc.textExtent(text); int offset = Math.max(0, (event.height - size.y) / 2); gc.drawText(text, event.x + 2, event.y + offset, true); gc.setForeground(background); gc.setBackground(foreground); } } } }); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:TreeTableBarChart.java
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); shell.setText("Show results as a bar chart in Tree"); final Tree tree = new Tree(shell, SWT.BORDER); tree.setHeaderVisible(true);/* w w w.j av a 2s . co m*/ tree.setLinesVisible(true); TreeColumn column1 = new TreeColumn(tree, SWT.NONE); column1.setText("Bug Status"); column1.setWidth(100); final TreeColumn column2 = new TreeColumn(tree, SWT.NONE); column2.setText("Percent"); column2.setWidth(200); String[] states = new String[] { "Resolved", "New", "Won't Fix", "Invalid" }; String[] teams = new String[] { "UI", "SWT", "OSGI" }; for (int i = 0; i < teams.length; i++) { TreeItem item = new TreeItem(tree, SWT.NONE); item.setText(teams[i]); for (int j = 0; j < states.length; j++) { TreeItem subItem = new TreeItem(item, SWT.NONE); subItem.setText(states[j]); } } /* * NOTE: MeasureItem, PaintItem and EraseItem are called repeatedly. * Therefore, it is critical for performance that these methods be as * efficient as possible. */ tree.addListener(SWT.PaintItem, new Listener() { int[] percents = new int[] { 50, 30, 5, 15 }; public void handleEvent(Event event) { if (event.index == 1) { TreeItem item = (TreeItem) event.item; TreeItem parent = item.getParentItem(); if (parent != null) { GC gc = event.gc; int index = parent.indexOf(item); int percent = percents[index]; Color foreground = gc.getForeground(); Color background = gc.getBackground(); gc.setForeground(display.getSystemColor(SWT.COLOR_RED)); gc.setBackground(display.getSystemColor(SWT.COLOR_YELLOW)); int width = (column2.getWidth() - 1) * percent / 100; gc.fillGradientRectangle(event.x, event.y, width, event.height, true); Rectangle rect2 = new Rectangle(event.x, event.y, width - 1, event.height - 1); gc.drawRectangle(rect2); gc.setForeground(display.getSystemColor(SWT.COLOR_LIST_FOREGROUND)); String text = percent + "%"; Point size = event.gc.textExtent(text); int offset = Math.max(0, (event.height - size.y) / 2); gc.drawText(text, event.x + 2, event.y + offset, true); gc.setForeground(background); gc.setBackground(foreground); } } } }); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:TreeEventMeasurePaintErase.java
public static void main(String[] args) { Display display = new Display(); final Image image = display.getSystemImage(SWT.ICON_INFORMATION); Shell shell = new Shell(display); shell.setText("Images on the right side of the TreeItem"); shell.setLayout(new FillLayout()); Tree tree = new Tree(shell, SWT.MULTI | SWT.FULL_SELECTION); tree.setHeaderVisible(true);//from ww w . j ava2 s . c o m tree.setLinesVisible(true); int columnCount = 4; for (int i = 0; i < columnCount; i++) { TreeColumn column = new TreeColumn(tree, SWT.NONE); column.setText("Column " + i); } int itemCount = 3; for (int i = 0; i < itemCount; i++) { TreeItem item1 = new TreeItem(tree, SWT.NONE); item1.setText("item " + i); for (int c = 1; c < columnCount; c++) { item1.setText(c, "item [" + i + "-" + c + "]"); } for (int j = 0; j < itemCount; j++) { TreeItem item2 = new TreeItem(item1, SWT.NONE); item2.setText("item [" + i + " " + j + "]"); for (int c = 1; c < columnCount; c++) { item2.setText(c, "item [" + i + " " + j + "-" + c + "]"); } for (int k = 0; k < itemCount; k++) { TreeItem item3 = new TreeItem(item2, SWT.NONE); item3.setText("item [" + i + " " + j + " " + k + "]"); for (int c = 1; c < columnCount; c++) { item3.setText(c, "item [" + i + " " + j + " " + k + "-" + c + "]"); } } } } /* * NOTE: MeasureItem, PaintItem and EraseItem are called repeatedly. * Therefore, it is critical for performance that these methods be as * efficient as possible. */ Listener paintListener = new Listener() { public void handleEvent(Event event) { switch (event.type) { case SWT.MeasureItem: { Rectangle rect = image.getBounds(); event.width += rect.width; event.height = Math.max(event.height, rect.height + 2); break; } case SWT.PaintItem: { int x = event.x + event.width; Rectangle rect = image.getBounds(); int offset = Math.max(0, (event.height - rect.height) / 2); event.gc.drawImage(image, x, event.y + offset); break; } } } }; tree.addListener(SWT.MeasureItem, paintListener); tree.addListener(SWT.PaintItem, paintListener); for (int i = 0; i < columnCount; i++) { tree.getColumn(i).pack(); } shell.setSize(500, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } if (image != null) image.dispose(); display.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet226.java
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setText("Custom gradient selection for Tree"); shell.setLayout(new FillLayout()); final Tree tree = new Tree(shell, SWT.MULTI | SWT.FULL_SELECTION); tree.setHeaderVisible(true);//ww w . j av a 2 s .com tree.setLinesVisible(true); int columnCount = 4; for (int i = 0; i < columnCount; i++) { TreeColumn column = new TreeColumn(tree, SWT.NONE); column.setText("Column " + i); } int itemCount = 3; for (int i = 0; i < itemCount; i++) { TreeItem item1 = new TreeItem(tree, SWT.NONE); item1.setText("item " + i); for (int c = 1; c < columnCount; c++) { item1.setText(c, "item [" + i + "-" + c + "]"); } for (int j = 0; j < itemCount; j++) { TreeItem item2 = new TreeItem(item1, SWT.NONE); item2.setText("item [" + i + " " + j + "]"); for (int c = 1; c < columnCount; c++) { item2.setText(c, "item [" + i + " " + j + "-" + c + "]"); } for (int k = 0; k < itemCount; k++) { TreeItem item3 = new TreeItem(item2, SWT.NONE); item3.setText("item [" + i + " " + j + " " + k + "]"); for (int c = 1; c < columnCount; c++) { item3.setText(c, "item [" + i + " " + j + " " + k + "-" + c + "]"); } } } } /* * NOTE: MeasureItem, PaintItem and EraseItem are called repeatedly. * Therefore, it is critical for performance that these methods be * as efficient as possible. */ tree.addListener(SWT.EraseItem, event -> { event.detail &= ~SWT.HOT; if ((event.detail & SWT.SELECTED) != 0) { GC gc = event.gc; Rectangle area = tree.getClientArea(); /* * If you wish to paint the selection beyond the end of * last column, you must change the clipping region. */ int columnCount1 = tree.getColumnCount(); if (event.index == columnCount1 - 1 || columnCount1 == 0) { int width = area.x + area.width - event.x; if (width > 0) { Region region = new Region(); gc.getClipping(region); region.add(event.x, event.y, width, event.height); gc.setClipping(region); region.dispose(); } } gc.setAdvanced(true); if (gc.getAdvanced()) gc.setAlpha(127); Rectangle rect = event.getBounds(); Color foreground = gc.getForeground(); Color background = gc.getBackground(); gc.setForeground(display.getSystemColor(SWT.COLOR_RED)); gc.setBackground(display.getSystemColor(SWT.COLOR_LIST_BACKGROUND)); gc.fillGradientRectangle(0, rect.y, 500, rect.height, false); // restore colors for subsequent drawing gc.setForeground(foreground); gc.setBackground(background); event.detail &= ~SWT.SELECTED; } }); for (int i = 0; i < columnCount; i++) { tree.getColumn(i).pack(); } tree.setSelection(tree.getItem(0)); shell.setSize(500, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:TreeTableGradient.java
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setText("Custom gradient selection for Tree"); shell.setLayout(new FillLayout()); final Tree tree = new Tree(shell, SWT.MULTI | SWT.FULL_SELECTION); tree.setHeaderVisible(true);// w w w.ja va 2s .c om tree.setLinesVisible(true); int columnCount = 4; for (int i = 0; i < columnCount; i++) { TreeColumn column = new TreeColumn(tree, SWT.NONE); column.setText("Column " + i); } int itemCount = 3; for (int i = 0; i < itemCount; i++) { TreeItem item1 = new TreeItem(tree, SWT.NONE); item1.setText("item " + i); for (int c = 1; c < columnCount; c++) { item1.setText(c, "item [" + i + "-" + c + "]"); } for (int j = 0; j < itemCount; j++) { TreeItem item2 = new TreeItem(item1, SWT.NONE); item2.setText("item [" + i + " " + j + "]"); for (int c = 1; c < columnCount; c++) { item2.setText(c, "item [" + i + " " + j + "-" + c + "]"); } for (int k = 0; k < itemCount; k++) { TreeItem item3 = new TreeItem(item2, SWT.NONE); item3.setText("item [" + i + " " + j + " " + k + "]"); for (int c = 1; c < columnCount; c++) { item3.setText(c, "item [" + i + " " + j + " " + k + "-" + c + "]"); } } } } /* * NOTE: MeasureItem, PaintItem and EraseItem are called repeatedly. * Therefore, it is critical for performance that these methods be as * efficient as possible. */ tree.addListener(SWT.EraseItem, new Listener() { public void handleEvent(Event event) { if ((event.detail & SWT.SELECTED) != 0) { GC gc = event.gc; Rectangle area = tree.getClientArea(); /* * If you wish to paint the selection beyond the end of last column, * you must change the clipping region. */ int columnCount = tree.getColumnCount(); if (event.index == columnCount - 1 || columnCount == 0) { int width = area.x + area.width - event.x; if (width > 0) { Region region = new Region(); gc.getClipping(region); region.add(event.x, event.y, width, event.height); gc.setClipping(region); region.dispose(); } } gc.setAdvanced(true); if (gc.getAdvanced()) gc.setAlpha(127); Rectangle rect = event.getBounds(); Color foreground = gc.getForeground(); Color background = gc.getBackground(); gc.setForeground(display.getSystemColor(SWT.COLOR_RED)); gc.setBackground(display.getSystemColor(SWT.COLOR_LIST_BACKGROUND)); gc.fillGradientRectangle(0, rect.y, 500, rect.height, false); // restore colors for subsequent drawing gc.setForeground(foreground); gc.setBackground(background); event.detail &= ~SWT.SELECTED; } } }); for (int i = 0; i < columnCount; i++) { tree.getColumn(i).pack(); } tree.setSelection(tree.getItem(0)); shell.setSize(500, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:TreeItemLines.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Multiple lines in a TreeItem"); shell.setLayout(new FillLayout()); final Tree tree = new Tree(shell, SWT.MULTI | SWT.FULL_SELECTION); tree.setHeaderVisible(true);/* ww w . j av a 2s . c o m*/ tree.setLinesVisible(true); int columnCount = 4; for (int i = 0; i < columnCount; i++) { TreeColumn column = new TreeColumn(tree, SWT.NONE); column.setText("Column " + i); column.setWidth(100); } int itemCount = 3; for (int i = 0; i < itemCount; i++) { TreeItem item1 = new TreeItem(tree, SWT.NONE); item1.setText("item " + i); for (int c = 1; c < columnCount; c++) { item1.setText(c, "item [" + i + "-" + c + "]"); } for (int j = 0; j < itemCount; j++) { TreeItem item2 = new TreeItem(item1, SWT.NONE); item2.setText("item [" + i + " " + j + "]"); for (int c = 1; c < columnCount; c++) { item2.setText(c, "item [" + i + " " + j + "-" + c + "]"); } for (int k = 0; k < itemCount; k++) { TreeItem item3 = new TreeItem(item2, SWT.NONE); item3.setText("item [" + i + " " + j + " " + k + "]"); for (int c = 1; c < columnCount; c++) { item3.setText(c, "item [" + i + " " + j + " " + k + "-" + c + "]"); } } } } /* * NOTE: MeasureItem, PaintItem and EraseItem are called repeatedly. * Therefore, it is critical for performance that these methods be as * efficient as possible. */ Listener paintListener = new Listener() { public void handleEvent(Event event) { switch (event.type) { case SWT.MeasureItem: { TreeItem item = (TreeItem) event.item; String text = getText(item, event.index); Point size = event.gc.textExtent(text); event.width = size.x; event.height = Math.max(event.height, size.y); break; } case SWT.PaintItem: { TreeItem item = (TreeItem) event.item; String text = getText(item, event.index); Point size = event.gc.textExtent(text); int offset2 = event.index == 0 ? Math.max(0, (event.height - size.y) / 2) : 0; event.gc.drawText(text, event.x, event.y + offset2, true); break; } case SWT.EraseItem: { event.detail &= ~SWT.FOREGROUND; break; } } } String getText(TreeItem item, int column) { String text = item.getText(column); if (column != 0) { TreeItem parent = item.getParentItem(); int index = parent == null ? tree.indexOf(item) : parent.indexOf(item); if ((index + column) % 3 == 1) { text += "\nnew line"; } if ((index + column) % 3 == 2) { text += "\nnew line\nnew line"; } } return text; } }; tree.addListener(SWT.MeasureItem, paintListener); tree.addListener(SWT.PaintItem, paintListener); tree.addListener(SWT.EraseItem, paintListener); shell.setSize(600, 400); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet227.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Multiple lines in a TreeItem"); shell.setLayout(new FillLayout()); final Tree tree = new Tree(shell, SWT.MULTI | SWT.FULL_SELECTION); tree.setHeaderVisible(true);//from ww w . j av a 2 s. com tree.setLinesVisible(true); int columnCount = 4; for (int i = 0; i < columnCount; i++) { TreeColumn column = new TreeColumn(tree, SWT.NONE); column.setText("Column " + i); column.setWidth(100); } int itemCount = 3; for (int i = 0; i < itemCount; i++) { TreeItem item1 = new TreeItem(tree, SWT.NONE); item1.setText("item " + i); for (int c = 1; c < columnCount; c++) { item1.setText(c, "item [" + i + "-" + c + "]"); } for (int j = 0; j < itemCount; j++) { TreeItem item2 = new TreeItem(item1, SWT.NONE); item2.setText("item [" + i + " " + j + "]"); for (int c = 1; c < columnCount; c++) { item2.setText(c, "item [" + i + " " + j + "-" + c + "]"); } for (int k = 0; k < itemCount; k++) { TreeItem item3 = new TreeItem(item2, SWT.NONE); item3.setText("item [" + i + " " + j + " " + k + "]"); for (int c = 1; c < columnCount; c++) { item3.setText(c, "item [" + i + " " + j + " " + k + "-" + c + "]"); } } } } /* * NOTE: MeasureItem, PaintItem and EraseItem are called repeatedly. * Therefore, it is critical for performance that these methods be * as efficient as possible. */ Listener paintListener = new Listener() { @Override public void handleEvent(Event event) { switch (event.type) { case SWT.MeasureItem: { TreeItem item = (TreeItem) event.item; String text = getText(item, event.index); Point size = event.gc.textExtent(text); event.width = size.x; event.height = Math.max(event.height, size.y); break; } case SWT.PaintItem: { TreeItem item = (TreeItem) event.item; String text = getText(item, event.index); Point size = event.gc.textExtent(text); int offset2 = event.index == 0 ? Math.max(0, (event.height - size.y) / 2) : 0; event.gc.drawText(text, event.x, event.y + offset2, true); break; } case SWT.EraseItem: { event.detail &= ~SWT.FOREGROUND; break; } } } String getText(TreeItem item, int column) { String text = item.getText(column); if (column != 0) { TreeItem parent = item.getParentItem(); int index = parent == null ? tree.indexOf(item) : parent.indexOf(item); if ((index + column) % 3 == 1) { text += "\nnew line"; } if ((index + column) % 3 == 2) { text += "\nnew line\nnew line"; } } return text; } }; tree.addListener(SWT.MeasureItem, paintListener); tree.addListener(SWT.PaintItem, paintListener); tree.addListener(SWT.EraseItem, paintListener); shell.setSize(600, 400); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:fr.inria.soctrace.framesoc.ui.piechart.view.StatisticsPieChartView.java
@Override public void createFramesocPartControl(Composite parent) { // parent layout GridLayout gl_parent = new GridLayout(1, false); gl_parent.verticalSpacing = 2;//from w ww . jav a 2 s . c o m gl_parent.marginWidth = 0; gl_parent.horizontalSpacing = 0; gl_parent.marginHeight = 0; parent.setLayout(gl_parent); // ------------------------------- // Base GUI: pie + table // ------------------------------- SashForm sashForm = new SashForm(parent, SWT.BORDER | SWT.SMOOTH); sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); // Composite Left: composite combo + composite pie Composite compositeLeft = new Composite(sashForm, SWT.NONE); GridLayout gl_compositeLeft = new GridLayout(1, false); gl_compositeLeft.marginBottom = 3; gl_compositeLeft.verticalSpacing = 0; gl_compositeLeft.marginHeight = 0; compositeLeft.setLayout(gl_compositeLeft); // Composite Combo Composite compositeCombo = new Composite(compositeLeft, SWT.NONE); compositeCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); GridLayout gl_compositeCombo = new GridLayout(1, false); gl_compositeCombo.marginWidth = 0; compositeCombo.setLayout(gl_compositeCombo); // combo combo = new Combo(compositeCombo, SWT.READ_ONLY); combo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); combo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean firstTime = true; for (LoaderDescriptor d : loaderDescriptors) { firstTime = firstTime && !d.dataLoaded(); } if (firstTime) { return; } currentDescriptor = loaderDescriptors.get(combo.getSelectionIndex()); cleanTableFilter(); refreshTableFilter(); // use global load interval timeBar.setSelection(globalLoadInterval); loadPieChart(); } }); int position = 0; for (LoaderDescriptor descriptor : loaderDescriptors) { combo.add(descriptor.loader.getStatName(), position++); } combo.select(0); currentDescriptor = loaderDescriptors.get(0); combo.setEnabled(false); // Composite Pie compositePie = new Group(compositeLeft, SWT.NONE); // Fill layout with Grid Data (FILL) to allow correct resize compositePie.setLayout(new FillLayout()); compositePie.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); txtDescription = new Text(compositePie, SWT.READ_ONLY | SWT.WRAP | SWT.CENTER | SWT.MULTI); txtDescription.setEnabled(false); txtDescription.setEditable(false); txtDescription.setText("Select one of the above metrics, then press the Load button."); txtDescription.setVisible(false); // Composite Table Composite compositeTable = new Composite(sashForm, SWT.NONE); GridLayout gl_compositeTable = new GridLayout(1, false); compositeTable.setLayout(gl_compositeTable); // filter textFilter = new Text(compositeTable, SWT.BORDER); textFilter.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); textFilter.addFocusListener(new FocusListener() { @Override public void focusLost(FocusEvent e) { String filter = textFilter.getText().trim(); if (filter.isEmpty()) { cleanTableFilter(); } } @Override public void focusGained(FocusEvent e) { String filter = textFilter.getText().trim(); if (filter.equals(FILTER_HINT)) { textFilter.setText(""); textFilter.setData(""); textFilter.setForeground(blackColor); } } }); textFilter.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { if (e.keyCode == SWT.CR || textFilter.getText().trim().isEmpty()) { textFilter.setData(textFilter.getText()); refreshTableFilter(); } } }); // table tableTreeViewer = new TreeViewer(compositeTable, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER | SWT.VIRTUAL); tableTreeViewer.setContentProvider(new TreeContentProvider()); comparator = new StatisticsColumnComparator(); tableTreeViewer.setComparator(comparator); Tree table = tableTreeViewer.getTree(); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); table.setLinesVisible(true); table.setHeaderVisible(true); createColumns(); createContextMenu(); // status bar Composite statusBar = new Composite(compositeTable, SWT.BORDER); GridLayout statusBarLayout = new GridLayout(); GridData statusBarGridData = new GridData(); statusBarGridData.horizontalAlignment = SWT.FILL; statusBarGridData.grabExcessHorizontalSpace = true; statusBar.setLayoutData(statusBarGridData); statusBarLayout.numColumns = 1; statusBar.setLayout(statusBarLayout); // text statusText = new Text(statusBar, SWT.NONE); statusText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); statusText.setText(getStatus(0, 0)); // ------------------------------- // TIME MANAGEMENT BAR // ------------------------------- Composite timeComposite = new Composite(parent, SWT.BORDER); timeComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); GridLayout gl_timeComposite = new GridLayout(1, false); gl_timeComposite.horizontalSpacing = 0; timeComposite.setLayout(gl_timeComposite); // time manager timeBar = new TimeBar(timeComposite, SWT.NONE, true, true); timeBar.setEnabled(false); combo.setEnabled(false); IStatusLineManager statusLineManager = getViewSite().getActionBars().getStatusLineManager(); timeBar.setStatusLineManager(statusLineManager); // button to synch the timebar with the gantt timeBar.getSynchButton().addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (combo != null && timeBar != null && currentDescriptor != null) { if (currentDescriptor.dataLoaded()) { timeBar.setSelection(currentDescriptor.interval.startTimestamp, currentDescriptor.interval.endTimestamp); } else { timeBar.setSelection(currentShownTrace.getMinTimestamp(), currentShownTrace.getMaxTimestamp()); } } } }); timeBar.getSynchButton().setToolTipText("Synch Selection With Pie Chart"); // load button timeBar.getLoadButton().addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (combo.getSelectionIndex() == -1) return; currentDescriptor = loaderDescriptors.get(combo.getSelectionIndex()); cleanTableFilter(); refreshTableFilter(); loadPieChart(); } }); // ---------- // TOOL BAR // ---------- // filters and actions createFilterDialogs(); createActions(); // create SWT resources createResources(); // clean the filter, after creating the font cleanTableFilter(); }