Revision 56a14252
Added by Cherian Mathew about 9 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/sessions/InspectSessionsDialog.java | ||
---|---|---|
21 | 21 |
import org.eclipse.jface.viewers.Viewer; |
22 | 22 |
import org.eclipse.jface.viewers.ViewerCell; |
23 | 23 |
import org.eclipse.swt.SWT; |
24 |
import org.eclipse.swt.custom.SashForm; |
|
25 |
import org.eclipse.swt.events.SelectionAdapter; |
|
26 |
import org.eclipse.swt.events.SelectionEvent; |
|
24 | 27 |
import org.eclipse.swt.layout.GridData; |
25 | 28 |
import org.eclipse.swt.layout.GridLayout; |
29 |
import org.eclipse.swt.widgets.Button; |
|
30 |
import org.eclipse.swt.widgets.Composite; |
|
26 | 31 |
import org.eclipse.swt.widgets.Dialog; |
27 | 32 |
import org.eclipse.swt.widgets.Display; |
28 | 33 |
import org.eclipse.swt.widgets.Label; |
... | ... | |
47 | 52 |
|
48 | 53 |
protected Object result; |
49 | 54 |
protected Shell shlInspectSessions; |
50 |
private Text text;
|
|
55 |
private Text txtDebugInfo;
|
|
51 | 56 |
private Label lblDebugInformation; |
52 | 57 |
|
53 | 58 |
private final Cache cdmlibModelCache; |
... | ... | |
55 | 60 |
private final ICdmEntitySession activeSession; |
56 | 61 |
|
57 | 62 |
private TreeViewer treeViewer; |
63 |
private Button btnClose; |
|
64 |
EntityCacherDebugResult ecdr; |
|
65 |
private SashForm sashForm; |
|
66 |
private Composite compositeDebug; |
|
58 | 67 |
/** |
59 | 68 |
* Create the dialog. |
60 | 69 |
* @param parent |
... | ... | |
62 | 71 |
*/ |
63 | 72 |
public InspectSessionsDialog(Shell parent, int style) { |
64 | 73 |
super(parent, style); |
65 |
setText("SWT Dialog");
|
|
74 |
setText("Inspect Active Session");
|
|
66 | 75 |
cdmlibModelCache = CdmRemoteCacheManager.getInstance().getCdmModelGetMethodsCache(); |
67 | 76 |
activeSession = CdmStore.getCurrentSessionManager().getActiveSession(); |
77 |
ecdr = activeSession.debug(); |
|
68 | 78 |
} |
69 | 79 |
|
70 | 80 |
/** |
... | ... | |
72 | 82 |
* @return the result |
73 | 83 |
*/ |
74 | 84 |
public Object open() { |
85 |
|
|
75 | 86 |
createContents(); |
87 |
setDebugInfoText(); |
|
76 | 88 |
treeViewer.setContentProvider(new SessionsTreeContentProvider()); |
77 | 89 |
treeViewer.setLabelProvider(new SessionsTreeLabelProvider()); |
78 | 90 |
treeViewer.setInput(getRootElements()); |
... | ... | |
91 | 103 |
* Create contents of the dialog. |
92 | 104 |
*/ |
93 | 105 |
private void createContents() { |
94 |
shlInspectSessions = new Shell(getParent(), getStyle());
|
|
95 |
shlInspectSessions.setSize(641, 529);
|
|
106 |
shlInspectSessions = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.RESIZE);
|
|
107 |
shlInspectSessions.setSize(641, 631);
|
|
96 | 108 |
shlInspectSessions.setText("Inspect Sessions"); |
97 | 109 |
shlInspectSessions.setLayout(new GridLayout(1, false)); |
98 | 110 |
|
99 |
TreeViewer treeViewer = new TreeViewer(shlInspectSessions, SWT.BORDER); |
|
100 |
Tree tree = treeViewer.getTree(); |
|
101 |
tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); |
|
111 |
sashForm = new SashForm(shlInspectSessions, SWT.VERTICAL); |
|
112 |
sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); |
|
113 |
|
|
114 |
treeViewer = new TreeViewer(sashForm, SWT.BORDER); |
|
115 |
Tree tree = treeViewer.getTree(); |
|
102 | 116 |
|
103 |
lblDebugInformation = new Label(shlInspectSessions, SWT.NONE); |
|
104 |
lblDebugInformation.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL)); |
|
105 |
lblDebugInformation.setText("Debug Information :"); |
|
117 |
compositeDebug = new Composite(sashForm, SWT.NONE); |
|
118 |
compositeDebug.setLayout(new GridLayout(1, false)); |
|
106 | 119 |
|
107 |
text = new Text(shlInspectSessions, SWT.BORDER); |
|
108 |
text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); |
|
120 |
lblDebugInformation = new Label(compositeDebug, SWT.NONE); |
|
121 |
lblDebugInformation.setAlignment(SWT.CENTER); |
|
122 |
lblDebugInformation.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1)); |
|
123 |
lblDebugInformation.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL)); |
|
124 |
lblDebugInformation.setText("Debug Information"); |
|
125 |
|
|
126 |
txtDebugInfo = new Text(compositeDebug, SWT.BORDER | SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI); |
|
127 |
txtDebugInfo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); |
|
128 |
sashForm.setWeights(new int[] {338, 184}); |
|
129 |
|
|
130 |
btnClose = new Button(shlInspectSessions, SWT.NONE); |
|
131 |
btnClose.addSelectionListener(new SelectionAdapter() { |
|
132 |
@Override |
|
133 |
public void widgetSelected(SelectionEvent e) { |
|
134 |
shlInspectSessions.dispose(); |
|
135 |
} |
|
136 |
}); |
|
137 |
GridData gd_btnClose = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); |
|
138 |
gd_btnClose.widthHint = 70; |
|
139 |
btnClose.setLayoutData(gd_btnClose); |
|
140 |
btnClose.setText("Close"); |
|
109 | 141 |
|
110 | 142 |
} |
111 | 143 |
|
144 |
private void setDebugInfoText() { |
|
145 |
txtDebugInfo.setText(ecdr.toString()); |
|
146 |
} |
|
112 | 147 |
private CdmEntityInfo[] getRootElements() { |
113 |
EntityCacherDebugResult ecdr = activeSession.debug(); |
|
114 |
return (CdmEntityInfo[]) ecdr.getRootElements().toArray(); |
|
148 |
|
|
149 |
List<CdmEntityInfo> rootElemnts = ecdr.getRootElements(); |
|
150 |
return rootElemnts.toArray(new CdmEntityInfo[rootElemnts.size()]); |
|
115 | 151 |
} |
116 | 152 |
|
117 | 153 |
class SessionsTreeContentProvider implements ITreeContentProvider { |
Also available in: Unified diff
OpenInspectSessionsHandler : handler for opening the inspect session dialog
CacheLoader : moved recursive logic from cdm transient cacher to new class
CdmServiceCacher : now uses CacheLoader to recursively load entities
CdmTransientEntityCacher : moved recursive logic from cdm transient cacher to new class and corrected caching issues
EntityCacherDebugResult : corrected recursion and added getter method for debug output
CdmEntitySessionManager : now sets active session to null when it is disposed
remotingApplicationContext.xml : corrected exclude
AbstractUtility : new utility method to execute handler
InspectSessionsDialog : added debug text info and cosmetic changes
SessionsViewPart : now opens inspect sessions dialog on button push