author | Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com> |
Wed, 23 Jun 2010 15:05:09 +0300 | |
changeset 12 | ae255c9aa552 |
parent 5 | 844b047e260d |
permissions | -rw-r--r-- |
5
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
1 |
/* |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
8 |
* |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
11 |
* |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
13 |
* |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
14 |
* Description: |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
15 |
* |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
17 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
18 |
package com.nokia.carbide.cpp.pi.irq; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
19 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
20 |
import java.awt.event.MouseEvent; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
21 |
import java.util.Vector; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
22 |
import org.eclipse.jface.viewers.CheckStateChangedEvent; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
23 |
import org.eclipse.jface.viewers.CheckboxTableViewer; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
24 |
import org.eclipse.jface.viewers.ICheckStateListener; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
25 |
import org.eclipse.jface.viewers.IStructuredContentProvider; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
26 |
import org.eclipse.jface.viewers.Viewer; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
27 |
import org.eclipse.jface.viewers.ViewerSorter; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
28 |
import org.eclipse.swt.SWT; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
29 |
import org.eclipse.swt.events.MouseListener; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
30 |
import org.eclipse.swt.events.SelectionAdapter; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
31 |
import org.eclipse.swt.events.SelectionEvent; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
32 |
import org.eclipse.swt.widgets.Composite; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
33 |
import org.eclipse.swt.widgets.Menu; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
34 |
import org.eclipse.swt.widgets.MenuItem; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
35 |
import org.eclipse.swt.widgets.TableColumn; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
36 |
import org.eclipse.swt.widgets.TableItem; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
37 |
import com.nokia.carbide.cpp.internal.pi.visual.GenericTable; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
38 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
39 |
/** |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
40 |
* Software thread interrupt table |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
41 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
42 |
public class SwiThreadTable extends GenericTable implements ICheckStateListener { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
43 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
44 |
private IrqTraceGraph myGraph; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
45 |
private Composite parent; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
46 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
47 |
protected Vector<SwiThreadWrapper> tableItemData; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
48 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
49 |
// sort direction |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
50 |
private boolean sortAscending = true; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
51 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
52 |
/** |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
53 |
* Constructor |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
54 |
* @param myGraph irq graph |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
55 |
* @param parent parent where table is placed |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
56 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
57 |
public SwiThreadTable(IrqTraceGraph myGraph, Composite parent){ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
58 |
this.myGraph = myGraph; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
59 |
this.parent = parent; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
60 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
61 |
this.tableViewer = CheckboxTableViewer.newCheckList(parent, |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
62 |
SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
63 |
this.table = this.tableViewer.getTable(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
64 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
65 |
// add the check state handler, label provider and content provider |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
66 |
this.tableViewer.addCheckStateListener(this); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
67 |
this.tableViewer.setLabelProvider(new SwiThreadLabelProvider(this.table)); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
68 |
this.tableViewer.setContentProvider(new TableContentProvider()); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
69 |
this.tableViewer.setSorter(new SharedSorter()); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
70 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
71 |
// create the columns |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
72 |
TableColumn column; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
73 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
74 |
// data associated with the TableViewer will note which columns contain hex values |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
75 |
// Keep this in the order in which columns have been created |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
76 |
boolean[] isHex = {false, false, false, false}; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
77 |
this.table.setData("isHex", isHex); //$NON-NLS-1$ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
78 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
79 |
// Check column |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
80 |
column = new TableColumn(this.table, SWT.CENTER); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
81 |
column.setText(Messages.SwiThreadTable_0); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
82 |
column.setWidth(20); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
83 |
column.setData(COLUMN_ID_SWI_CHECK); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
84 |
column.setMoveable(true); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
85 |
column.setResizable(true); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
86 |
column.addSelectionListener(new ColumnSelectionHandler()); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
87 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
88 |
// Thread Name column |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
89 |
column = new TableColumn(this.table, SWT.LEFT); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
90 |
column.setText(Messages.SwiThreadTable_1); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
91 |
column.setWidth(COLUMN_WIDTH_THREAD_IRQ_LINE); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
92 |
column.setData(COLUMN_ID_SWI_THREAD); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
93 |
column.setMoveable(true); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
94 |
column.setResizable(true); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
95 |
column.addSelectionListener(new ColumnSelectionHandler()); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
96 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
97 |
// Thread address |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
98 |
column = new TableColumn(tableViewer.getTable(), SWT.RIGHT); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
99 |
column.setText(Messages.SwiThreadTable_2); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
100 |
column.setWidth(COLUMN_WIDTH_ADDRESS_COUNT); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
101 |
column.setData(COLUMN_ID_ADDRESS); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
102 |
column.setMoveable(true); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
103 |
column.setResizable(true); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
104 |
column.addSelectionListener(new ColumnSelectionHandler()); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
105 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
106 |
// add mouse listener and set other table settings |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
107 |
this.table.addMouseListener(new TableMouseListener()); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
108 |
this.table.setHeaderVisible(true); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
109 |
this.table.setLinesVisible(true); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
110 |
this.table.setRedraw(true); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
111 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
112 |
// format data into table |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
113 |
this.updateItemData(true); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
114 |
((SharedSorter) tableViewer.getSorter()).doSort(COLUMN_ID_SWI_THREAD); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
115 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
116 |
// Select initially no lines |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
117 |
this.tableViewer.setAllChecked(false); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
118 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
119 |
// listen for key sequences such as Ctrl-A and Ctrl-C |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
120 |
table.addKeyListener(new TableKeyListener()); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
121 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
122 |
tableViewer.refresh(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
123 |
table.redraw(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
124 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
125 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
126 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
127 |
/** |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
128 |
* Content provider for table |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
129 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
130 |
private static class TableContentProvider implements IStructuredContentProvider { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
131 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
132 |
/** |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
133 |
* Constructor |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
134 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
135 |
public TableContentProvider() { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
136 |
super(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
137 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
138 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
139 |
/* |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
140 |
* (non-Javadoc) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
141 |
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
142 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
143 |
@SuppressWarnings("unchecked") |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
144 |
public Object[] getElements(Object inputElement) { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
145 |
return ((Vector<SwiThreadWrapper>) inputElement).toArray(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
146 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
147 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
148 |
/* |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
149 |
* (non-Javadoc) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
150 |
* @see org.eclipse.jface.viewers.IContentProvider#dispose() |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
151 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
152 |
public void dispose() { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
153 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
154 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
155 |
/* |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
156 |
* (non-Javadoc) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
157 |
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
158 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
159 |
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
160 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
161 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
162 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
163 |
/* |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
164 |
* (non-Javadoc) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
165 |
* @see com.nokia.carbide.cpp.internal.pi.visual.GenericTable#action(java.lang.String) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
166 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
167 |
public void action(String actionString) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
168 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
169 |
if (actionString.equals("add")){ //$NON-NLS-1$ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
170 |
checkOrUncheckSelectedItems(true); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
171 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
172 |
else if (actionString.equals("remove")){ //$NON-NLS-1$ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
173 |
checkOrUncheckSelectedItems(false); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
174 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
175 |
else if (actionString.equals("addall")){ //$NON-NLS-1$ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
176 |
checkOrUncheckAllItems(true); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
177 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
178 |
else if (actionString.equals("removeall")){ //$NON-NLS-1$ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
179 |
checkOrUncheckAllItems(false); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
180 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
181 |
else if (actionString.equals("copy")) //$NON-NLS-1$ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
182 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
183 |
actionCopyOrSave(true, this.table, CHECKBOX_TEXT, false, "\t", "\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
184 |
return; // no redraw needed |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
185 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
186 |
else if (actionString.equals("copyTable")) //$NON-NLS-1$ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
187 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
188 |
actionCopyOrSave(true, this.table, CHECKBOX_TEXT, true, "\t", "\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
189 |
return; // no redraw needed |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
190 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
191 |
else if (actionString.equals("selectAll")) //$NON-NLS-1$ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
192 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
193 |
actionSelectAll(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
194 |
return; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
195 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
196 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
197 |
else if (actionString.equals("saveTable")) //$NON-NLS-1$ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
198 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
199 |
actionCopyOrSave(false, this.table, CHECKBOX_TEXT, true, ",", "\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
200 |
return; // no redraw needed |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
201 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
202 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
203 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
204 |
/** |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
205 |
* Checks or unchecks all selected threads from table |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
206 |
* @param value true if items are checked |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
207 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
208 |
private void checkOrUncheckSelectedItems(boolean value) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
209 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
210 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
211 |
TableItem[] selectedItems = this.table.getSelection(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
212 |
for (int i = 0; i < selectedItems.length; i++) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
213 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
214 |
if(selectedItems[i].getData().getClass() == SwiThreadWrapper.class){ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
215 |
selectedItems[i].setChecked(value); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
216 |
SwiThreadWrapper wrapper = (SwiThreadWrapper)selectedItems[i].getData(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
217 |
if(value){ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
218 |
myGraph.threadChecked(wrapper.threadName); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
219 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
220 |
else{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
221 |
myGraph.threadUnchecked(wrapper.threadName); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
222 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
223 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
224 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
225 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
226 |
myGraph.updateIrqCountsInLegendsAsynch(IrqTraceGraph.TYPE_SWI); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
227 |
myGraph.repaint(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
228 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
229 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
230 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
231 |
/** |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
232 |
* Checks or unchecks all table items |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
233 |
* @param value true if all items are checked |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
234 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
235 |
private void checkOrUncheckAllItems(boolean value) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
236 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
237 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
238 |
TableItem[] allItems = this.table.getItems(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
239 |
for (int i = 0; i < allItems.length; i++) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
240 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
241 |
if(allItems[i].getData().getClass() == SwiThreadWrapper.class){ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
242 |
allItems[i].setChecked(value); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
243 |
SwiThreadWrapper wrapper = (SwiThreadWrapper)allItems[i].getData(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
244 |
if(value){ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
245 |
myGraph.threadChecked(wrapper.threadName); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
246 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
247 |
else{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
248 |
myGraph.threadUnchecked(wrapper.threadName); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
249 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
250 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
251 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
252 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
253 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
254 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
255 |
myGraph.repaint(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
256 |
myGraph.updateIrqCountsInLegendsAsynch(IrqTraceGraph.TYPE_SWI); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
257 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
258 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
259 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
260 |
/** |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
261 |
* Formats item data into table |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
262 |
* @param setInput true if table needs to be refreshed |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
263 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
264 |
public void updateItemData(boolean setInput) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
265 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
266 |
tableItemData = ((IrqTrace)this.myGraph.getTrace()).getAllThreadWrappers(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
267 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
268 |
// refresh the table, if needed |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
269 |
if (setInput) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
270 |
refreshTableViewer(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
271 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
272 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
273 |
/** |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
274 |
* Refreshes table viewer |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
275 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
276 |
public void refreshTableViewer() |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
277 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
278 |
this.tableViewer.setInput(tableItemData); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
279 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
280 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
281 |
/** |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
282 |
* @return tableviewer of the thread table |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
283 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
284 |
public CheckboxTableViewer getTableViewer(){ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
285 |
return this.tableViewer; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
286 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
287 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
288 |
/* |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
289 |
* (non-Javadoc) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
290 |
* @see org.eclipse.jface.viewers.ICheckStateListener#checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
291 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
292 |
public void checkStateChanged(CheckStateChangedEvent event) { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
293 |
if(event.getElement().getClass() == SwiThreadWrapper.class){ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
294 |
SwiThreadWrapper wrapper = (SwiThreadWrapper) event.getElement(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
295 |
if(event.getChecked()){ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
296 |
myGraph.threadChecked(wrapper.threadName); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
297 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
298 |
else{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
299 |
myGraph.threadUnchecked(wrapper.threadName); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
300 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
301 |
myGraph.repaint(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
302 |
myGraph.updateIrqCountsInLegendsAsynch(IrqTraceGraph.TYPE_SWI); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
303 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
304 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
305 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
306 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
307 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
308 |
/** |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
309 |
* Mouse listener of the table |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
310 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
311 |
private class TableMouseListener implements MouseListener |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
312 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
313 |
/* |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
314 |
* (non-Javadoc) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
315 |
* @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt.events.MouseEvent) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
316 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
317 |
public void mouseDoubleClick(org.eclipse.swt.events.MouseEvent e) { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
318 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
319 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
320 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
321 |
/* |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
322 |
* (non-Javadoc) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
323 |
* @see org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events.MouseEvent) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
324 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
325 |
public void mouseDown(org.eclipse.swt.events.MouseEvent e) { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
326 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
327 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
328 |
/* |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
329 |
* (non-Javadoc) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
330 |
* @see org.eclipse.swt.events.MouseListener#mouseUp(org.eclipse.swt.events.MouseEvent) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
331 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
332 |
public void mouseUp(org.eclipse.swt.events.MouseEvent e) { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
333 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
334 |
if (e.button == MouseEvent.BUTTON3) { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
335 |
// get rid of last Menu created so we don't have double menu |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
336 |
// on click |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
337 |
if (contextMenu != null) { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
338 |
contextMenu.dispose(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
339 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
340 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
341 |
contextMenu = new Menu(table.getShell(), SWT.POP_UP); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
342 |
getCheckRows(contextMenu, table.getSelectionCount() > 0); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
343 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
344 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
345 |
// select all, copy, and copy all |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
346 |
new MenuItem(contextMenu, SWT.SEPARATOR); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
347 |
getSelectAllItem(contextMenu, table.getItemCount() > 0); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
348 |
getCopyItem(contextMenu, table.getSelectionCount() > 0); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
349 |
getCopyTableItem(contextMenu, table.getItemCount() > 0); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
350 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
351 |
// save all |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
352 |
new MenuItem(contextMenu, SWT.SEPARATOR); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
353 |
getSaveTableItem(contextMenu, table.getItemCount() > 0); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
354 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
355 |
// Recolor highlighted items |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
356 |
new MenuItem(contextMenu, SWT.SEPARATOR); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
357 |
getRecolorItem(contextMenu, Messages.SwiThreadTable_3, table.getSelectionCount() > 0); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
358 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
359 |
contextMenu.setLocation(parent.toDisplay(e.x + table.getLocation().x, e.y + table.getLocation().y)); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
360 |
contextMenu.setVisible(true); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
361 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
362 |
table.setMenu(contextMenu); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
363 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
364 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
365 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
366 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
367 |
/** |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
368 |
* Column selection handler for the table |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
369 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
370 |
private class ColumnSelectionHandler extends SelectionAdapter |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
371 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
372 |
public void widgetSelected(SelectionEvent e) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
373 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
374 |
if (!(e.widget instanceof TableColumn)) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
375 |
return; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
376 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
377 |
sortOnColumnSelection((TableColumn) e.widget); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
378 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
379 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
380 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
381 |
/** |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
382 |
* @param tableColumn which column is sorted |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
383 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
384 |
public void sortOnColumnSelection(TableColumn tableColumn) { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
385 |
int columnID = ((Integer) tableColumn.getData()).intValue(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
386 |
((SharedSorter) tableViewer.getSorter()).doSort(columnID); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
387 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
388 |
this.refreshTableViewer(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
389 |
this.table.redraw(); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
390 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
391 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
392 |
/** |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
393 |
* Sorter for the table |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
394 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
395 |
private class SharedSorter extends ViewerSorter { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
396 |
// last column sorted |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
397 |
private int column = -1; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
398 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
399 |
/* |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
400 |
* decide on which column to sort by, and the sort ordering |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
401 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
402 |
public void doSort(int column) { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
403 |
// ignore the column passed in and use the id set by the column selection handler |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
404 |
if (column == this.column) { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
405 |
// sort in other order |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
406 |
sortAscending = !sortAscending; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
407 |
} else { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
408 |
// changed columns, so sort in the default order |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
409 |
switch (column) { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
410 |
case COLUMN_ID_SWI_CHECK: |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
411 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
412 |
// sort in ascending order |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
413 |
sortAscending = true; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
414 |
break; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
415 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
416 |
case COLUMN_ID_SWI_THREAD: |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
417 |
case COLUMN_ID_ADDRESS: |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
418 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
419 |
// sort in descending order |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
420 |
sortAscending = false; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
421 |
break; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
422 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
423 |
default: |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
424 |
{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
425 |
// ignore the column |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
426 |
return; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
427 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
428 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
429 |
this.column = column; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
430 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
431 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
432 |
// find the TableColumn corresponding to column, and give it a column direction |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
433 |
TableColumn sortByColumn = null; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
434 |
for (int i = 0; i < table.getColumnCount(); i++) { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
435 |
if (table.getColumn(i).getData() instanceof Integer) { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
436 |
if (((Integer)table.getColumn(i).getData()) == column) { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
437 |
sortByColumn = table.getColumn(i); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
438 |
break; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
439 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
440 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
441 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
442 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
443 |
if (sortByColumn != null) { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
444 |
table.setSortColumn(sortByColumn); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
445 |
table.setSortDirection(sortAscending ? SWT.UP : SWT.DOWN); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
446 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
447 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
448 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
449 |
/* |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
450 |
* compare two items from a table column |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
451 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
452 |
public int compare(Viewer viewer, Object e1, Object e2) { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
453 |
int returnCode = 0; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
454 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
455 |
SwiThreadWrapper elem1 = (SwiThreadWrapper)e1; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
456 |
SwiThreadWrapper elem2 = (SwiThreadWrapper)e2; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
457 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
458 |
// find the memory information for the two threads |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
459 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
460 |
// compare based on the memory information |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
461 |
switch (column) { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
462 |
case COLUMN_ID_SWI_CHECK: |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
463 |
if(tableViewer.getChecked(e1) == true && tableViewer.getChecked(e2) == false){ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
464 |
returnCode = -1; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
465 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
466 |
else{ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
467 |
returnCode = 1; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
468 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
469 |
break; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
470 |
case COLUMN_ID_SWI_THREAD: |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
471 |
returnCode = elem1.threadName.compareToIgnoreCase(elem2.threadName); |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
472 |
break; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
473 |
case COLUMN_ID_ADDRESS: |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
474 |
returnCode = elem1.threadAddress > elem2.threadAddress ? 1 : -1; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
475 |
break; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
476 |
default: |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
477 |
break; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
478 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
479 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
480 |
// for descending order, reverse the sense of the compare |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
481 |
if (!sortAscending) |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
482 |
returnCode = -returnCode; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
483 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
484 |
return returnCode; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
485 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
486 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
487 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
488 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
489 |
/** |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
490 |
* sets sort direction |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
491 |
* @param sortAscending new sort direction |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
492 |
*/ |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
493 |
public void setSortAscending(boolean sortAscending) { |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
494 |
this.sortAscending = sortAscending; |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
495 |
} |
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
496 |
|
844b047e260d
Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff
changeset
|
497 |
} |