Java Code Examples for org.eclipse.swt.widgets.TreeColumn#setWidth()
The following examples show how to use
org.eclipse.swt.widgets.TreeColumn#setWidth() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SecurityEditor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
protected void createColumns ( final Tree tree ) { final TreeColumn typeFilterColumn = new TreeColumn ( tree, SWT.NONE ); typeFilterColumn.setText ( getString ( "_UI_TypeFilterColumn_label" ) ); //$NON-NLS-1$ typeFilterColumn.setResizable ( true ); typeFilterColumn.setWidth ( 200 ); final TreeColumn idFilterColumn = new TreeColumn ( tree, SWT.NONE ); idFilterColumn.setText ( getString ( "_UI_IdFilterColumn_label" ) ); //$NON-NLS-1$ idFilterColumn.setResizable ( true ); idFilterColumn.setWidth ( 200 ); final TreeColumn actionFilterColumn = new TreeColumn ( tree, SWT.NONE ); actionFilterColumn.setText ( getString ( "_UI_ActionFilterColumn_label" ) ); //$NON-NLS-1$ actionFilterColumn.setResizable ( true ); actionFilterColumn.setWidth ( 200 ); }
Example 2
Source File: ModelSortPageableTreeExample.java From nebula with Eclipse Public License 2.0 | 5 votes |
private static TreeViewerColumn createTreeViewerColumn(TreeViewer viewer, String title, int bound) { final TreeViewerColumn viewerColumn = new TreeViewerColumn(viewer, SWT.NONE); final TreeColumn column = viewerColumn.getColumn(); column.setText(title); column.setWidth(bound); column.setResizable(true); column.setMoveable(true); return viewerColumn; }
Example 3
Source File: AbapGitDialogObjLog.java From ADT_Frontend with MIT License | 5 votes |
private TreeViewerColumn createTableViewerColumn(String title, int bound) { TreeViewerColumn viewerColumn = new TreeViewerColumn(this.abapObjTable, SWT.NONE); TreeColumn column = viewerColumn.getColumn(); column.setText(title); column.setWidth(bound); column.setResizable(true); column.setMoveable(true); //-> still present for proper search if (column.getText().equals("Type")) { //$NON-NLS-1$ column.setWidth(0); column.setResizable(false); } return viewerColumn; }
Example 4
Source File: ProjectCompareTree.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** * Create an instance. */ public ProjectCompareTree(Composite parent, int style, ProjectCompareTreeHelper projectCompareTreeHelper) { super(parent, style); this.projectCompareTreeHelper = projectCompareTreeHelper; parent.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { onDispose(); } }); col_diff_error_fg = new Color(parent.getDisplay(), 255, 40, 40); col_diff_conformant_fg = new Color(parent.getDisplay(), 60, 127, 95); col_classifier_bg = new Color(parent.getDisplay(), 200, 220, 250); final Tree tree = getTree(); for (int n = 0; n < NUM_OF_COLUMNS; n++) { final TreeColumn colN = new TreeColumn(tree, SWT.LEFT); if (n == 0) colN.setWidth(300); // make API column a bit wider else colN.setWidth(200); } tree.setHeaderVisible(true); tree.setLinesVisible(true); setLabelProvider(new MyLabelProvider()); setContentProvider(new MyContentProvider()); setComparison(null, null, null); }
Example 5
Source File: EditColTableDef.java From depan with Apache License 2.0 | 5 votes |
public static void setupTree(EditColTableDef[] tableDef, Tree tree) { for (EditColTableDef d : tableDef) { TreeColumn col = new TreeColumn(tree, SWT.LEFT); col.setText(d.getLabel()); col.setWidth(d.getWidth()); } }
Example 6
Source File: ViewPropertiesOutput.java From arx with Apache License 2.0 | 5 votes |
/** * Creates the view. * * @param root */ private void create(final Composite root) { root.setLayout(new FillLayout()); final Tree tree = new Tree(root, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); tree.setHeaderVisible(true); treeViewer = new TreeViewer(tree); tree.setMenu(new ClipboardHandlerTree(treeViewer).getMenu()); final TreeColumn column1 = new TreeColumn(tree, SWT.LEFT); tree.setLinesVisible(true); column1.setAlignment(SWT.LEFT); column1.setText(Resources.getMessage("PropertiesView.1")); //$NON-NLS-1$ column1.setWidth(160); final TreeColumn column2 = new TreeColumn(tree, SWT.RIGHT); column2.setAlignment(SWT.LEFT); column2.setText(Resources.getMessage("PropertiesView.2")); //$NON-NLS-1$ column2.setWidth(100); treeViewer.setContentProvider(new OutputContentProvider()); treeViewer.setLabelProvider(new OutputLabelProvider()); treeViewer.setInput(roots); treeViewer.expandAll(); }
Example 7
Source File: ServerView.java From hadoop-gpu with Apache License 2.0 | 4 votes |
/** * Creates the columns for the view */ @Override public void createPartControl(Composite parent) { Tree main = new Tree(parent, SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); main.setHeaderVisible(true); main.setLinesVisible(false); main.setLayoutData(new GridData(GridData.FILL_BOTH)); TreeColumn serverCol = new TreeColumn(main, SWT.SINGLE); serverCol.setText("Location"); serverCol.setWidth(300); serverCol.setResizable(true); TreeColumn locationCol = new TreeColumn(main, SWT.SINGLE); locationCol.setText("Master node"); locationCol.setWidth(185); locationCol.setResizable(true); TreeColumn stateCol = new TreeColumn(main, SWT.SINGLE); stateCol.setText("State"); stateCol.setWidth(95); stateCol.setResizable(true); TreeColumn statusCol = new TreeColumn(main, SWT.SINGLE); statusCol.setText("Status"); statusCol.setWidth(300); statusCol.setResizable(true); viewer = new TreeViewer(main); viewer.setContentProvider(this); viewer.setLabelProvider(this); viewer.setInput(CONTENT_ROOT); // don't care getViewSite().setSelectionProvider(viewer); getViewSite().getActionBars().setGlobalActionHandler( ActionFactory.DELETE.getId(), deleteAction); getViewSite().getActionBars().getToolBarManager().add(editServerAction); getViewSite().getActionBars().getToolBarManager().add(newLocationAction); createActions(); createContextMenu(); }
Example 8
Source File: HopGuiWorkflowGridDelegate.java From hop with Apache License 2.0 | 4 votes |
/** * Add the controls to the tab */ private void addControls() { // Create the tree table... wTree = new Tree( workflowGraph.extraViewTabFolder, SWT.V_SCROLL | SWT.H_SCROLL ); wTree.setHeaderVisible( true ); TreeMemory.addTreeListener( wTree, STRING_CHEF_LOG_TREE_NAME ); TreeColumn column1 = new TreeColumn( wTree, SWT.LEFT ); column1.setText( BaseMessages.getString( PKG, "WorkflowLog.Column.WorkflowAction" ) ); column1.setWidth( 200 ); TreeColumn column2 = new TreeColumn( wTree, SWT.LEFT ); column2.setText( BaseMessages.getString( PKG, "WorkflowLog.Column.Comment" ) ); column2.setWidth( 200 ); TreeColumn column3 = new TreeColumn( wTree, SWT.LEFT ); column3.setText( BaseMessages.getString( PKG, "WorkflowLog.Column.Result" ) ); column3.setWidth( 100 ); TreeColumn column4 = new TreeColumn( wTree, SWT.LEFT ); column4.setText( BaseMessages.getString( PKG, "WorkflowLog.Column.Reason" ) ); column4.setWidth( 200 ); TreeColumn column5 = new TreeColumn( wTree, SWT.LEFT ); column5.setText( BaseMessages.getString( PKG, "WorkflowLog.Column.Filename" ) ); column5.setWidth( 200 ); TreeColumn column6 = new TreeColumn( wTree, SWT.RIGHT ); column6.setText( BaseMessages.getString( PKG, "WorkflowLog.Column.Nr" ) ); column6.setWidth( 50 ); TreeColumn column7 = new TreeColumn( wTree, SWT.RIGHT ); column7.setText( BaseMessages.getString( PKG, "WorkflowLog.Column.LogDate" ) ); column7.setWidth( 120 ); FormData fdTree = new FormData(); fdTree.left = new FormAttachment( 0, 0 ); fdTree.top = new FormAttachment( 0, 0 ); fdTree.right = new FormAttachment( 100, 0 ); fdTree.bottom = new FormAttachment( 100, 0 ); wTree.setLayoutData( fdTree ); final Timer tim = new Timer( "JobGrid: " + workflowGraph.getMeta().getName() ); TimerTask timtask = new TimerTask() { public void run() { Display display = workflowGraph.getDisplay(); if ( display != null && !display.isDisposed() ) { display.asyncExec( new Runnable() { public void run() { // Check if the widgets are not disposed. // This happens is the rest of the window is not yet disposed. // We ARE running in a different thread after all. // // TODO: add a "auto refresh" check box somewhere if ( !wTree.isDisposed() ) { refreshTreeTable(); } } } ); } } }; tim.schedule( timtask, 10L, 2000L ); // refresh every 2 seconds... workflowGraph.workflowLogDelegate.getJobLogTab().addDisposeListener( new DisposeListener() { public void widgetDisposed( DisposeEvent disposeEvent ) { tim.cancel(); } } ); }
Example 9
Source File: JobGridDelegate.java From pentaho-kettle with Apache License 2.0 | 4 votes |
/** * Add the controls to the tab */ private void addControls() { // Create the tree table... wTree = new Tree( jobGraph.extraViewTabFolder, SWT.V_SCROLL | SWT.H_SCROLL ); wTree.setHeaderVisible( true ); TreeMemory.addTreeListener( wTree, STRING_CHEF_LOG_TREE_NAME ); TreeColumn column1 = new TreeColumn( wTree, SWT.LEFT ); column1.setText( BaseMessages.getString( PKG, "JobLog.Column.JobJobEntry" ) ); column1.setWidth( 200 ); TreeColumn column2 = new TreeColumn( wTree, SWT.LEFT ); column2.setText( BaseMessages.getString( PKG, "JobLog.Column.Comment" ) ); column2.setWidth( 200 ); TreeColumn column3 = new TreeColumn( wTree, SWT.LEFT ); column3.setText( BaseMessages.getString( PKG, "JobLog.Column.Result" ) ); column3.setWidth( 100 ); TreeColumn column4 = new TreeColumn( wTree, SWT.LEFT ); column4.setText( BaseMessages.getString( PKG, "JobLog.Column.Reason" ) ); column4.setWidth( 200 ); TreeColumn column5 = new TreeColumn( wTree, SWT.LEFT ); column5.setText( BaseMessages.getString( PKG, "JobLog.Column.Filename" ) ); column5.setWidth( 200 ); TreeColumn column6 = new TreeColumn( wTree, SWT.RIGHT ); column6.setText( BaseMessages.getString( PKG, "JobLog.Column.Nr" ) ); column6.setWidth( 50 ); TreeColumn column7 = new TreeColumn( wTree, SWT.RIGHT ); column7.setText( BaseMessages.getString( PKG, "JobLog.Column.LogDate" ) ); column7.setWidth( 120 ); FormData fdTree = new FormData(); fdTree.left = new FormAttachment( 0, 0 ); fdTree.top = new FormAttachment( 0, 0 ); fdTree.right = new FormAttachment( 100, 0 ); fdTree.bottom = new FormAttachment( 100, 0 ); wTree.setLayoutData( fdTree ); final Timer tim = new Timer( "JobGrid: " + jobGraph.getMeta().getName() ); TimerTask timtask = new TimerTask() { public void run() { Display display = jobGraph.getDisplay(); if ( display != null && !display.isDisposed() ) { display.asyncExec( new Runnable() { public void run() { // Check if the widgets are not disposed. // This happens is the rest of the window is not yet disposed. // We ARE running in a different thread after all. // // TODO: add a "auto refresh" check box somewhere if ( !wTree.isDisposed() ) { refreshTreeTable(); } } } ); } } }; tim.schedule( timtask, 10L, 2000L ); // refresh every 2 seconds... jobGraph.jobLogDelegate.getJobLogTab().addDisposeListener( new DisposeListener() { public void widgetDisposed( DisposeEvent disposeEvent ) { tim.cancel(); } } ); }
Example 10
Source File: ViewPropertiesInput.java From arx with Apache License 2.0 | 4 votes |
/** * Creates the view. * * @param root */ private void create(final Composite root) { root.setLayout(new FillLayout()); Tree tree = new Tree(root, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); tree.setHeaderVisible(true); treeViewer = new TreeViewer(tree); tree.setMenu(new ClipboardHandlerTree(treeViewer).getMenu()); final TreeColumn column1 = new TreeColumn(tree, SWT.LEFT); tree.setLinesVisible(true); column1.setAlignment(SWT.LEFT); column1.setText(Resources.getMessage("PropertiesView.3")); //$NON-NLS-1$ column1.setWidth(160); final TreeColumn column2 = new TreeColumn(tree, SWT.RIGHT); column2.setAlignment(SWT.LEFT); column2.setText(Resources.getMessage("PropertiesView.4")); //$NON-NLS-1$ column2.setWidth(100); final TreeColumn column6 = new TreeColumn(tree, SWT.RIGHT); column6.setAlignment(SWT.LEFT); column6.setText(Resources.getMessage("PropertiesView.5")); //$NON-NLS-1$ column6.setWidth(100); final TreeColumn column7 = new TreeColumn(tree, SWT.RIGHT); column7.setAlignment(SWT.LEFT); column7.setText(Resources.getMessage("PropertiesView.101")); //$NON-NLS-1$ column7.setWidth(80); final TreeColumn column3 = new TreeColumn(tree, SWT.RIGHT); column3.setAlignment(SWT.LEFT); column3.setText(Resources.getMessage("PropertiesView.6")); //$NON-NLS-1$ column3.setWidth(50); final TreeColumn column4 = new TreeColumn(tree, SWT.RIGHT); column4.setAlignment(SWT.LEFT); column4.setText(Resources.getMessage("PropertiesView.7")); //$NON-NLS-1$ column4.setWidth(50); final TreeColumn column5 = new TreeColumn(tree, SWT.RIGHT); column5.setAlignment(SWT.LEFT); column5.setText(Resources.getMessage("PropertiesView.8")); //$NON-NLS-1$ column5.setWidth(50); final TreeColumn column8 = new TreeColumn(tree, SWT.RIGHT); column8.setAlignment(SWT.LEFT); column8.setText(Resources.getMessage("PropertiesView.113")); //$NON-NLS-1$ column8.setWidth(50); final TreeColumn column9 = new TreeColumn(tree, SWT.RIGHT); column9.setAlignment(SWT.LEFT); column9.setText(Resources.getMessage("PropertiesView.126")); //$NON-NLS-1$ column9.setWidth(50); treeViewer.setContentProvider(new InputContentProvider()); treeViewer.setLabelProvider(new InputLabelProvider()); treeViewer.setInput(roots); treeViewer.expandAll(); }
Example 11
Source File: TreeWithAddRemove.java From Pydev with Eclipse Public License 1.0 | 4 votes |
/** * @param initialItems: Can be a String[] or a HashMap<String, String> (if null it's considered String[]) */ public TreeWithAddRemove(Composite parent, int style, Object initialItems, boolean createEditButton) { super(parent, style); if (initialItems == null) { initialItems = new String[] {}; } GridLayout layout = new GridLayout(); layout.numColumns = 2; this.setLayout(layout); GridData data = new GridData(GridData.FILL_BOTH); tree = new Tree(this, SWT.BORDER | SWT.MULTI); data.grabExcessHorizontalSpace = true; data.grabExcessVerticalSpace = true; tree.setLayoutData(data); Composite buttonsSourceFolders = new Composite(this, SWT.NONE); buttonsSourceFolders.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; buttonsSourceFolders.setLayout(layout); for (int i = 0; i < getNumberOfAddButtons(); i++) { createAddButton(buttonsSourceFolders, i); } createRemoveButton(buttonsSourceFolders); if (createEditButton) { this.createEditButton(buttonsSourceFolders); } if (initialItems instanceof String[]) { editingStyle = EDITING_STYLE_ARRAY_OF_STRINGS; } else if (initialItems instanceof Map) { editingStyle = EDITING_STYLE_MAP_OF_STRINGS; tree.setHeaderVisible(true); TreeColumn column1 = new TreeColumn(tree, SWT.LEFT); column1.setText("Key"); column1.setWidth(200); TreeColumn column2 = new TreeColumn(tree, SWT.LEFT); column2.setText("Value"); column2.setWidth(200); columns = new TreeColumn[] { column1, column2 }; } else { throw new RuntimeException("Unexpected initial items: " + initialItems); } setTreeItems(initialItems); }
Example 12
Source File: ServerView.java From RDFS with Apache License 2.0 | 4 votes |
/** * Creates the columns for the view */ @Override public void createPartControl(Composite parent) { Tree main = new Tree(parent, SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); main.setHeaderVisible(true); main.setLinesVisible(false); main.setLayoutData(new GridData(GridData.FILL_BOTH)); TreeColumn serverCol = new TreeColumn(main, SWT.SINGLE); serverCol.setText("Location"); serverCol.setWidth(300); serverCol.setResizable(true); TreeColumn locationCol = new TreeColumn(main, SWT.SINGLE); locationCol.setText("Master node"); locationCol.setWidth(185); locationCol.setResizable(true); TreeColumn stateCol = new TreeColumn(main, SWT.SINGLE); stateCol.setText("State"); stateCol.setWidth(95); stateCol.setResizable(true); TreeColumn statusCol = new TreeColumn(main, SWT.SINGLE); statusCol.setText("Status"); statusCol.setWidth(300); statusCol.setResizable(true); viewer = new TreeViewer(main); viewer.setContentProvider(this); viewer.setLabelProvider(this); viewer.setInput(CONTENT_ROOT); // don't care getViewSite().setSelectionProvider(viewer); getViewSite().getActionBars().setGlobalActionHandler( ActionFactory.DELETE.getId(), deleteAction); getViewSite().getActionBars().getToolBarManager().add(editServerAction); getViewSite().getActionBars().getToolBarManager().add(newLocationAction); createActions(); createContextMenu(); }
Example 13
Source File: UpdateWizardPage.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
public void createControl(final Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout gridLayout = new GridLayout(); gridLayout.marginWidth = 0; gridLayout.marginHeight = 0; composite.setLayout(gridLayout); treeViewer = new TreeViewer(composite, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION); GridData data = new GridData(GridData.FILL_BOTH); Tree tree = treeViewer.getTree(); tree.setLayoutData(data); tree.setHeaderVisible(true); IUColumnConfig[] columns = getColumnConfig(); for (int i = 0; i < columns.length; i++) { TreeColumn tc = new TreeColumn(tree, SWT.LEFT, i); tc.setResizable(true); tc.setText(columns[i].getColumnTitle()); tc.setWidth(columns[i].getWidthInPixels(tree)); } contentProvider = new ProvElementContentProvider(); treeViewer.setContentProvider(contentProvider); labelProvider = new IUDetailsLabelProvider(null, getColumnConfig(), getShell()); treeViewer.setLabelProvider(labelProvider); setControl(composite); final Runnable runnable = new Runnable() { public void run() { // updateStatus(input, operation); setDrilldownElements(input, operation); treeViewer.setInput(input); } }; if (operation != null && !operation.hasResolved()) { try { getContainer().run(true, false, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) { operation.resolveModal(monitor); parent.getDisplay().asyncExec(runnable); } }); } catch (Exception e) { StatusManager.getManager().handle(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, e.getMessage(), e)); } } else { runnable.run(); } }
Example 14
Source File: GenerericTreeViewer.java From offspring with MIT License | 4 votes |
private void createColumns() { GC gc = new GC(getTree().getParent()); List<Integer> widths = new ArrayList<Integer>(); for (final IGenericTableColumn c : table.getColumns()) { TreeViewerColumn viewerColumn = new TreeViewerColumn(this, SWT.NONE); viewerColumn.setLabelProvider(new GenericLabelProvider(c .getDataProvider())); if (c.getEditable()) { viewerColumn.setEditingSupport(c.getEditingSupport(this)); } TreeColumn column = viewerColumn.getColumn(); if (c.getSortable() && comparator != null) { column.addSelectionListener(getSelectionAdapter(column, c)); } column.setText(c.getLabel()); column.setAlignment(c.getAlignMent()); int width; if (c.getWidth() != -1) { width = c.getWidth(); } else if (c.getTextExtent() != null && c.getLabel().length() < c.getTextExtent().length()) { width = gc.textExtent(c.getTextExtent()).x + 2; } else { width = gc.textExtent(c.getLabel()).x + 2; } widths.add(width); column.setWidth(width); column.setResizable(c.getResizable()); } gc.dispose(); // /* All columns have their prefered width set now calculate percentages */ // TreeColumnLayout layout = new TreeColumnLayout(); // for (int i = 0; i < widths.size(); i++) { // layout.setColumnData(getTree().getColumns()[i], new ColumnWeightData( // widths.get(i), widths.get(i), true)); // } // getTree().getParent().setLayout(layout); }
Example 15
Source File: UpdateWizardPage.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
public void createControl(final Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout gridLayout = new GridLayout(); gridLayout.marginWidth = 0; gridLayout.marginHeight = 0; composite.setLayout(gridLayout); treeViewer = new TreeViewer(composite, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION); GridData data = new GridData(GridData.FILL_BOTH); Tree tree = treeViewer.getTree(); tree.setLayoutData(data); tree.setHeaderVisible(true); IUColumnConfig[] columns = getColumnConfig(); for (int i = 0; i < columns.length; i++) { TreeColumn tc = new TreeColumn(tree, SWT.LEFT, i); tc.setResizable(true); tc.setText(columns[i].getColumnTitle()); tc.setWidth(columns[i].getWidthInPixels(tree)); } contentProvider = new ProvElementContentProvider(); treeViewer.setContentProvider(contentProvider); labelProvider = new IUDetailsLabelProvider(null, getColumnConfig(), getShell()); treeViewer.setLabelProvider(labelProvider); setControl(composite); final Runnable runnable = new Runnable() { public void run() { // updateStatus(input, operation); setDrilldownElements(input, operation); treeViewer.setInput(input); } }; if (operation != null && !operation.hasResolved()) { try { getContainer().run(true, false, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) { operation.resolveModal(monitor); parent.getDisplay().asyncExec(runnable); } }); } catch (Exception e) { StatusManager.getManager().handle(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, e.getMessage(), e)); } } else { runnable.run(); } }
Example 16
Source File: TSVEditor.java From hybris-commerce-eclipse-plugin with Apache License 2.0 | 4 votes |
void createPage1() { Composite composite = new Composite(getContainer(), SWT.NONE); FillLayout layout = new FillLayout(); composite.setLayout(layout); Tree tree = new Tree(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI); tree.setHeaderVisible(true); tree.setLinesVisible(true); TreeColumn column1 = new TreeColumn(tree, SWT.LEFT); column1.setWidth(250); column1.setResizable(true); TreeColumn column2 = new TreeColumn(tree, SWT.LEFT); column2.setWidth(40); column2.setResizable(true); TreeColumn column3 = new TreeColumn(tree, SWT.LEFT); column3.setWidth(250); column3.setResizable(true); TreeColumn column4 = new TreeColumn(tree, SWT.LEFT); column4.setWidth(600); column4.setResizable(true); TreeViewer resultsViewer = new TreeViewer(tree); resultsViewer.setLabelProvider(new TSVResultsLabelProvider()); resultsViewer.setContentProvider(new TSVResultsContentProvider(resultMap)); resultsViewer.setInput(createModel()); resultsViewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { IStructuredSelection structuredSelection = (IStructuredSelection) event.getSelection(); if (structuredSelection.isEmpty()) return; Object selection = structuredSelection.getFirstElement(); if (selection instanceof TSVResult) { String fileName = ((TSVResult) selection).getFilename(); int lineNumber = ((TSVResult) selection).getLineNumber(); String extensionName = fileName.replaceAll("-items.xml", ""); IProject extension = ResourcesPlugin.getWorkspace().getRoot().getProject(extensionName); IFile itemsxml = extension.getFile("resources/" + fileName); if (itemsxml.exists()) { IMarker marker; try { marker = itemsxml.createMarker(IMarker.TEXT); HashMap<String, Object> map = new HashMap<String, Object>(); map.put(IMarker.LINE_NUMBER, lineNumber); marker.setAttributes(map); IDE.openEditor(getSite().getPage(), marker); marker.delete(); } catch (CoreException e) { e.printStackTrace(); } } else { MessageBox dialog = new MessageBox(getContainer().getShell(), SWT.ICON_WARNING | SWT.OK); dialog.setText("Extension not found"); dialog.setMessage("The extension " + extensionName + " was not found in the workspace. Please import it and try again."); dialog.open(); } } } }); int index = addPage(composite); setPageText(index, "Results"); }
Example 17
Source File: AbstractSection.java From uima-uimaj with Apache License 2.0 | 3 votes |
/** * New tree column. * * @param container the container * @param width the width * @param alignment the alignment * @param header the header * @return the tree column */ protected TreeColumn newTreeColumn(Tree container, int width, int alignment, String header) { TreeColumn tc = new TreeColumn(container, alignment); if (header != null && (!header.equals(""))) { //$NON-NLS-1$ tc.setText(header); } tc.setWidth(width); return tc; }