sysperfana/analyzetoolext/com.nokia.s60tools.analyzetool/src/com/nokia/s60tools/analyzetool/internal/ui/graph/ChartContainer.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
96 //toolbar button to open the Eclipse Properties view |
96 //toolbar button to open the Eclipse Properties view |
97 ToolItem propViewItem = new ToolItem (toolBar, SWT.PUSH | SWT.FLAT ); |
97 ToolItem propViewItem = new ToolItem (toolBar, SWT.PUSH | SWT.FLAT ); |
98 propViewItem.addSelectionListener(new SelectionListener(){ |
98 propViewItem.addSelectionListener(new SelectionListener(){ |
99 |
99 |
100 public void widgetDefaultSelected(SelectionEvent e) { |
100 public void widgetDefaultSelected(SelectionEvent e) { |
|
101 //do nothing by design |
101 } |
102 } |
102 |
103 |
103 public void widgetSelected(SelectionEvent e) { |
104 public void widgetSelected(SelectionEvent e) { |
104 try { |
105 try { |
105 PlatformUI.getWorkbench() |
106 PlatformUI.getWorkbench() |
117 //toolbar button to show some navigation help and open the F1 help |
118 //toolbar button to show some navigation help and open the F1 help |
118 ToolItem helpItem = new ToolItem (toolBar, SWT.PUSH | SWT.FLAT ); |
119 ToolItem helpItem = new ToolItem (toolBar, SWT.PUSH | SWT.FLAT ); |
119 helpItem.addSelectionListener(new SelectionListener(){ |
120 helpItem.addSelectionListener(new SelectionListener(){ |
120 |
121 |
121 public void widgetDefaultSelected(SelectionEvent e) { |
122 public void widgetDefaultSelected(SelectionEvent e) { |
|
123 //do nothing by design |
122 } |
124 } |
123 |
125 |
124 public void widgetSelected(SelectionEvent e) { |
126 public void widgetSelected(SelectionEvent e) { |
125 PlatformUI.getWorkbench().getHelpSystem().displayHelp(AnalyzeToolHelpContextIDs.ANALYZE_GRAPH); |
127 PlatformUI.getWorkbench().getHelpSystem().displayHelp(AnalyzeToolHelpContextIDs.ANALYZE_GRAPH); |
126 } |
128 } |
176 }); |
178 }); |
177 |
179 |
178 graphCanvas.setBackground(new Color(Display.getDefault(), new RGB(255,255,255))); |
180 graphCanvas.setBackground(new Color(Display.getDefault(), new RGB(255,255,255))); |
179 graphCanvas.createContent(); |
181 graphCanvas.createContent(); |
180 graphCanvas.addControlListener(new ControlAdapter() { |
182 graphCanvas.addControlListener(new ControlAdapter() { |
|
183 @Override |
181 public void controlResized(ControlEvent e) { |
184 public void controlResized(ControlEvent e) { |
182 //the client area of the graph panel might change if a scrollbar gets added/removed |
185 //the client area of the graph panel might change if a scrollbar gets added/removed |
183 //this needs to be passed on to the y axis |
186 //this needs to be passed on to the y axis |
184 if (yAxis.getHeight() != graphCanvas.getClientArea().height){ |
187 if (yAxis.getHeight() != graphCanvas.getClientArea().height){ |
185 yAxis.setHeight(graphCanvas.getClientArea().height); |
188 yAxis.setHeight(graphCanvas.getClientArea().height); |
211 }; |
214 }; |
212 iRefreshUIJob.setSystem(true); |
215 iRefreshUIJob.setSystem(true); |
213 |
216 |
214 processCombo.addSelectionListener(new SelectionListener(){ |
217 processCombo.addSelectionListener(new SelectionListener(){ |
215 |
218 |
216 public void widgetDefaultSelected(SelectionEvent e) {} |
219 public void widgetDefaultSelected(SelectionEvent e) { |
|
220 //do nothing by design |
|
221 } |
217 |
222 |
218 public void widgetSelected(SelectionEvent e) { |
223 public void widgetSelected(SelectionEvent e) { |
219 int sel = processCombo.getSelectionIndex(); |
224 int sel = processCombo.getSelectionIndex(); |
220 if (model.getProcesses().size()>sel){ |
225 if (model.getProcesses().size()>sel){ |
221 ProcessInfo process = model.getProcesses().get(processCombo.getSelectionIndex()); |
226 ProcessInfo process = model.getProcesses().get(processCombo.getSelectionIndex()); |
236 /** |
241 /** |
237 * Sets a new model. Note the redraw of the new content only happens on |
242 * Sets a new model. Note the redraw of the new content only happens on |
238 * callbacks to model change listeners. |
243 * callbacks to model change listeners. |
239 * @param aProject The currently selected project in the IDE, used for pinpointing |
244 * @param aProject The currently selected project in the IDE, used for pinpointing |
240 * |
245 * |
241 * @param model the new IMemoryActivityModel to set |
246 * @param newModel the new IMemoryActivityModel to set |
242 */ |
247 */ |
243 public void setInput(IProject aProject, IMemoryActivityModel model) { |
248 public void setInput(IProject aProject, IMemoryActivityModel newModel) { |
244 if (this.model != null){ |
249 if (this.model != null){ |
245 this.model.removeListener(this); |
250 this.model.removeListener(this); |
246 } |
251 } |
247 this.model = model; |
252 this.model = newModel; |
248 this.model.addListener(this); |
253 this.model.addListener(this); |
249 |
254 |
250 graphCanvas.setInput(model); |
255 graphCanvas.setInput(model); |
251 yAxis.setInput(model); |
256 yAxis.setInput(model); |
252 if (aProject != null) { |
257 if (aProject != null) { |
256 |
261 |
257 /* (non-Javadoc) |
262 /* (non-Javadoc) |
258 * @see com.nokia.s60tools.analyzetool.engine.IMemoryActivityModelChangeListener#onProcessSelected(com.nokia.s60tools.analyzetool.engine.statistic.ProcessInfo) |
263 * @see com.nokia.s60tools.analyzetool.engine.IMemoryActivityModelChangeListener#onProcessSelected(com.nokia.s60tools.analyzetool.engine.statistic.ProcessInfo) |
259 */ |
264 */ |
260 public void onProcessSelected(ProcessInfo p) { |
265 public void onProcessSelected(ProcessInfo p) { |
|
266 //do nothing by design |
261 } |
267 } |
262 |
268 |
263 /* (non-Javadoc) |
269 /* (non-Javadoc) |
264 * @see com.nokia.s60tools.analyzetool.engine.IMemoryActivityModelChangeListener#onProcessesAdded() |
270 * @see com.nokia.s60tools.analyzetool.engine.IMemoryActivityModelChangeListener#onProcessesAdded() |
265 */ |
271 */ |
267 iRefreshUIJob.cancel(); |
273 iRefreshUIJob.cancel(); |
268 iRefreshUIJob.schedule(); |
274 iRefreshUIJob.schedule(); |
269 |
275 |
270 } |
276 } |
271 |
277 |
|
278 @Override |
272 public void update(){ |
279 public void update(){ |
273 graphCanvas.zoomGraph(); |
280 graphCanvas.zoomGraph(); |
274 graphCanvas.redraw(); |
281 graphCanvas.redraw(); |
275 yAxis.redraw(); |
282 yAxis.redraw(); |
276 } |
283 } |