1 /*******************************************************************************
2 * Copyright (c) 2010 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.ui
.editors
;
15 import java
.lang
.reflect
.Constructor
;
16 import java
.lang
.reflect
.InvocationTargetException
;
17 import java
.util
.List
;
19 import org
.eclipse
.core
.resources
.IFile
;
20 import org
.eclipse
.core
.resources
.IMarker
;
21 import org
.eclipse
.core
.resources
.IMarkerDelta
;
22 import org
.eclipse
.core
.resources
.IResource
;
23 import org
.eclipse
.core
.resources
.IResourceChangeEvent
;
24 import org
.eclipse
.core
.resources
.IResourceChangeListener
;
25 import org
.eclipse
.core
.resources
.IResourceDelta
;
26 import org
.eclipse
.core
.resources
.ResourcesPlugin
;
27 import org
.eclipse
.core
.runtime
.CoreException
;
28 import org
.eclipse
.core
.runtime
.IConfigurationElement
;
29 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
30 import org
.eclipse
.core
.runtime
.InvalidRegistryObjectException
;
31 import org
.eclipse
.core
.runtime
.Platform
;
32 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.Activator
;
33 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.parsers
.custom
.CustomEventsTable
;
34 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.parsers
.custom
.CustomTxtTrace
;
35 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.parsers
.custom
.CustomXmlTrace
;
36 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.project
.handlers
.Messages
;
37 import org
.eclipse
.linuxtools
.tmf
.core
.TmfCommonConstants
;
38 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfEvent
;
39 import org
.eclipse
.linuxtools
.tmf
.core
.event
.TmfEvent
;
40 import org
.eclipse
.linuxtools
.tmf
.core
.event
.TmfTimeRange
;
41 import org
.eclipse
.linuxtools
.tmf
.core
.exceptions
.TmfTraceException
;
42 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfSignalHandler
;
43 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfTraceSelectedSignal
;
44 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.ITmfTrace
;
45 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.TmfExperiment
;
46 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.TmfTrace
;
47 import org
.eclipse
.linuxtools
.tmf
.ui
.project
.model
.ITmfProjectModelElement
;
48 import org
.eclipse
.linuxtools
.tmf
.ui
.project
.model
.TmfExperimentElement
;
49 import org
.eclipse
.linuxtools
.tmf
.ui
.project
.model
.TmfNavigatorContentProvider
;
50 import org
.eclipse
.linuxtools
.tmf
.ui
.project
.model
.TmfProjectElement
;
51 import org
.eclipse
.linuxtools
.tmf
.ui
.project
.model
.TmfProjectRegistry
;
52 import org
.eclipse
.linuxtools
.tmf
.ui
.project
.model
.TmfTraceElement
;
53 import org
.eclipse
.linuxtools
.tmf
.ui
.project
.model
.TmfTraceType
;
54 import org
.eclipse
.linuxtools
.tmf
.ui
.signal
.TmfTraceClosedSignal
;
55 import org
.eclipse
.linuxtools
.tmf
.ui
.signal
.TmfTraceOpenedSignal
;
56 import org
.eclipse
.linuxtools
.tmf
.ui
.signal
.TmfTraceParserUpdatedSignal
;
57 import org
.eclipse
.linuxtools
.tmf
.ui
.viewers
.events
.TmfEventsTable
;
58 import org
.eclipse
.swt
.widgets
.Composite
;
59 import org
.eclipse
.swt
.widgets
.Display
;
60 import org
.eclipse
.ui
.IEditorInput
;
61 import org
.eclipse
.ui
.IEditorPart
;
62 import org
.eclipse
.ui
.IEditorSite
;
63 import org
.eclipse
.ui
.IFileEditorInput
;
64 import org
.eclipse
.ui
.IPropertyListener
;
65 import org
.eclipse
.ui
.IReusableEditor
;
66 import org
.eclipse
.ui
.PartInitException
;
67 import org
.eclipse
.ui
.ide
.IGotoMarker
;
68 import org
.eclipse
.ui
.part
.FileEditorInput
;
69 import org
.osgi
.framework
.Bundle
;
72 * <b><u>TmfEventsEditor</u></b>
74 public class TmfEventsEditor
extends TmfEditor
implements ITmfTraceEditor
, IReusableEditor
, IPropertyListener
, IResourceChangeListener
{
76 public static final String ID
= "org.eclipse.linuxtools.tmf.ui.editors.events"; //$NON-NLS-1$
78 private TmfEventsTable fEventsTable
;
80 @SuppressWarnings("rawtypes")
81 private ITmfTrace fTrace
;
82 private Composite fParent
;
85 public void doSave(final IProgressMonitor monitor
) {
89 public void doSaveAs() {
92 @SuppressWarnings({ "unchecked", "rawtypes" })
94 public void init(final IEditorSite site
, IEditorInput input
) throws PartInitException
{
95 if (input
instanceof TmfEditorInput
) {
96 fFile
= ((TmfEditorInput
) input
).getFile();
97 fTrace
= ((TmfEditorInput
) input
).getTrace();
98 input
= new FileEditorInput(fFile
);
99 } else if (input
instanceof IFileEditorInput
) {
100 fFile
= ((IFileEditorInput
) input
).getFile();
102 throw new PartInitException("Invalid IFileEditorInput: " + input
); //$NON-NLS-1$
104 final String traceTypeId
= fFile
.getPersistentProperty(TmfCommonConstants
.TRACETYPE
);
105 if (traceTypeId
== null)
106 throw new PartInitException(Messages
.OpenTraceHandler_NoTraceType
);
107 if (traceTypeId
.equals(TmfExperiment
.class.getCanonicalName())) {
108 // Special case: experiment bookmark resource
109 final TmfNavigatorContentProvider ncp
= new TmfNavigatorContentProvider();
110 ncp
.getChildren(fFile
.getProject()); // force the model to be populated
111 final TmfProjectElement project
= TmfProjectRegistry
.getProject(fFile
.getProject());
113 throw new PartInitException(Messages
.OpenExperimentHandler_NoTraceType
);
114 for (final ITmfProjectModelElement projectElement
: project
.getExperimentsFolder().getChildren()) {
115 final String traceName
= fFile
.getParent().getName();
116 if (projectElement
.getName().equals(traceName
)) {
117 final TmfExperimentElement experimentElement
= (TmfExperimentElement
) projectElement
;
118 // Instantiate the experiment's traces
119 final List
<TmfTraceElement
> traceEntries
= experimentElement
.getTraces();
120 final int nbTraces
= traceEntries
.size();
121 int cacheSize
= Integer
.MAX_VALUE
;
122 final ITmfTrace
<?
>[] traces
= new ITmfTrace
[nbTraces
];
123 for (int i
= 0; i
< nbTraces
; i
++) {
124 final TmfTraceElement traceElement
= traceEntries
.get(i
);
125 final ITmfTrace trace
= traceElement
.instantiateTrace();
126 final ITmfEvent traceEvent
= traceElement
.instantiateEvent();
127 if ((trace
== null) || (traceEvent
== null)) {
128 for (int j
= 0; j
< i
; j
++)
130 throw new PartInitException(Messages
.OpenExperimentHandler_NoTraceType
);
133 trace
.initTrace(traceElement
.getResource(), traceElement
.getLocation().getPath(), traceEvent
.getClass());
134 } catch (final TmfTraceException e
) {
136 cacheSize
= Math
.min(cacheSize
, trace
.getCacheSize());
139 final TmfExperiment experiment
= new TmfExperiment(ITmfEvent
.class, experimentElement
.getName(), traces
, cacheSize
) {
141 public void initTrace(IResource resource
, String path
, Class type
) {
142 super.initTrace(resource
, path
, type
);
143 getIndexer().buildIndex(getNbEvents(), TmfTimeRange
.ETERNITY
, false);
146 experiment
.setBookmarksFile(fFile
);
148 experiment
.initTrace(null, null, null);
152 } else if (traceTypeId
.equals(TmfTrace
.class.getCanonicalName())) {
153 // Special case: trace bookmark resource
154 final TmfNavigatorContentProvider ncp
= new TmfNavigatorContentProvider();
155 ncp
.getChildren(fFile
.getProject()); // force the model to be populated
156 final TmfProjectElement project
= TmfProjectRegistry
.getProject(fFile
.getProject());
157 for (final ITmfProjectModelElement projectElement
: project
.getTracesFolder().getChildren()) {
158 final String traceName
= fFile
.getParent().getName();
159 if (projectElement
.getName().equals(traceName
)) {
160 final TmfTraceElement traceElement
= (TmfTraceElement
) projectElement
;
161 // Instantiate the trace
162 final ITmfTrace trace
= traceElement
.instantiateTrace();
163 final ITmfEvent traceEvent
= traceElement
.instantiateEvent();
164 if ((trace
== null) || (traceEvent
== null))
165 throw new PartInitException(Messages
.OpenTraceHandler_NoTraceType
);
167 trace
.initTrace(traceElement
.getResource(), traceElement
.getLocation().getPath(), traceEvent
.getClass());
168 } catch (final TmfTraceException e
) {
175 final TmfNavigatorContentProvider ncp
= new TmfNavigatorContentProvider();
176 ncp
.getChildren(fFile
.getProject()); // force the model to be populated
177 final TmfProjectElement project
= TmfProjectRegistry
.getProject(fFile
.getProject());
178 for (final ITmfProjectModelElement projectElement
: project
.getTracesFolder().getChildren())
179 if (projectElement
.getResource().equals(fFile
)) {
180 final TmfTraceElement traceElement
= (TmfTraceElement
) projectElement
;
181 // Instantiate the trace
182 final ITmfTrace trace
= traceElement
.instantiateTrace();
183 final ITmfEvent traceEvent
= traceElement
.instantiateEvent();
184 if ((trace
== null) || (traceEvent
== null))
185 throw new PartInitException(Messages
.OpenTraceHandler_NoTraceType
);
187 trace
.initTrace(traceElement
.getResource(), traceElement
.getLocation().getPath(), traceEvent
.getClass());
188 } catch (final TmfTraceException e
) {
194 } catch (final InvalidRegistryObjectException e
) {
195 Activator
.getDefault().logError("Error initializing TmfEventsEditor", e
); //$NON-NLS-1$
196 } catch (final CoreException e
) {
197 Activator
.getDefault().logError("Error initializing TmfEventsEditor", e
); //$NON-NLS-1$
200 throw new PartInitException("Invalid IEditorInput: " + input
.getClass()); //$NON-NLS-1$
202 throw new PartInitException("Invalid IEditorInput: " + fFile
.getName()); //$NON-NLS-1$
204 super.setInput(input
);
208 public boolean isDirty() {
213 public boolean isSaveAsAllowed() {
218 public void setInput(final IEditorInput input
) {
219 super.setInput(input
);
220 firePropertyChange(IEditorPart
.PROP_INPUT
);
224 public void propertyChanged(final Object source
, final int propId
) {
225 if (propId
== IEditorPart
.PROP_INPUT
) {
226 broadcast(new TmfTraceClosedSignal(this, fTrace
));
227 fFile
= ((TmfEditorInput
) getEditorInput()).getFile();
228 fTrace
= ((TmfEditorInput
) getEditorInput()).getTrace();
229 super.setInput(new FileEditorInput(fFile
));
230 fEventsTable
.dispose();
231 if (fTrace
!= null) {
232 fEventsTable
= createEventsTable(fParent
, fTrace
.getCacheSize());
233 fEventsTable
.setTrace(fTrace
, true);
234 fEventsTable
.refreshBookmarks(fFile
);
235 broadcast(new TmfTraceOpenedSignal(this, fTrace
, fFile
, fEventsTable
));
237 fEventsTable
= new TmfEventsTable(fParent
, 0);
243 public void createPartControl(final Composite parent
) {
245 if (fTrace
!= null) {
246 setPartName(fTrace
.getName());
247 fEventsTable
= createEventsTable(parent
, fTrace
.getCacheSize());
248 fEventsTable
.setTrace(fTrace
, true);
249 fEventsTable
.refreshBookmarks(fFile
);
250 broadcast(new TmfTraceOpenedSignal(this, fTrace
, fFile
, fEventsTable
));
252 setPartName(getEditorInput().getName());
253 fEventsTable
= new TmfEventsTable(parent
, 0);
255 addPropertyListener(this);
256 ResourcesPlugin
.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent
.POST_CHANGE
);
260 public void dispose() {
261 ResourcesPlugin
.getWorkspace().removeResourceChangeListener(this);
262 removePropertyListener(this);
264 broadcast(new TmfTraceClosedSignal(this, fTrace
));
265 if (fEventsTable
!= null)
266 fEventsTable
.dispose();
270 protected TmfEventsTable
createEventsTable(final Composite parent
, final int cacheSize
) {
271 TmfEventsTable eventsTable
= getEventsTable(parent
, cacheSize
);
272 if (eventsTable
== null)
273 eventsTable
= new TmfEventsTable(parent
, cacheSize
);
277 private TmfEventsTable
getEventsTable(final Composite parent
, final int cacheSize
) {
278 if (fTrace
instanceof TmfExperiment
)
279 return getExperimentEventsTable((TmfExperiment
<?
>) fTrace
, parent
, cacheSize
);
280 TmfEventsTable eventsTable
= null;
282 if (fTrace
.getResource() == null)
284 final String traceType
= fTrace
.getResource().getPersistentProperty(TmfCommonConstants
.TRACETYPE
);
285 if (traceType
== null)
287 if (traceType
.startsWith(CustomTxtTrace
.class.getCanonicalName()))
288 return new CustomEventsTable(((CustomTxtTrace
) fTrace
).getDefinition(), parent
, cacheSize
);
289 if (traceType
.startsWith(CustomXmlTrace
.class.getCanonicalName()))
290 return new CustomEventsTable(((CustomXmlTrace
) fTrace
).getDefinition(), parent
, cacheSize
);
291 for (final IConfigurationElement ce
: TmfTraceType
.getTypeElements())
292 if (ce
.getAttribute(TmfTraceType
.ID_ATTR
).equals(traceType
)) {
293 final IConfigurationElement
[] eventsTableTypeCE
= ce
.getChildren(TmfTraceType
.EVENTS_TABLE_TYPE_ELEM
);
294 if (eventsTableTypeCE
.length
!= 1)
296 final String eventsTableType
= eventsTableTypeCE
[0].getAttribute(TmfTraceType
.CLASS_ATTR
);
297 if ((eventsTableType
== null) || (eventsTableType
.length() == 0))
299 final Bundle bundle
= Platform
.getBundle(ce
.getContributor().getName());
300 final Class
<?
> c
= bundle
.loadClass(eventsTableType
);
301 final Class
<?
>[] constructorArgs
= new Class
[] { Composite
.class, int.class };
302 final Constructor
<?
> constructor
= c
.getConstructor(constructorArgs
);
303 final Object
[] args
= new Object
[] { parent
, cacheSize
};
304 eventsTable
= (TmfEventsTable
) constructor
.newInstance(args
);
307 } catch (final InvalidRegistryObjectException e
) {
308 Activator
.getDefault().logError("Error getting TmfEventsTable", e
); //$NON-NLS-1$
309 } catch (final CoreException e
) {
310 Activator
.getDefault().logError("Error getting TmfEventsTable", e
); //$NON-NLS-1$
311 } catch (final ClassNotFoundException e
) {
312 Activator
.getDefault().logError("Error getting TmfEventsTable", e
); //$NON-NLS-1$
313 } catch (final SecurityException e
) {
314 Activator
.getDefault().logError("Error getting TmfEventsTable", e
); //$NON-NLS-1$
315 } catch (final NoSuchMethodException e
) {
316 Activator
.getDefault().logError("Error getting TmfEventsTable", e
); //$NON-NLS-1$
317 } catch (final IllegalArgumentException e
) {
318 Activator
.getDefault().logError("Error getting TmfEventsTable", e
); //$NON-NLS-1$
319 } catch (final InstantiationException e
) {
320 Activator
.getDefault().logError("Error getting TmfEventsTable", e
); //$NON-NLS-1$
321 } catch (final IllegalAccessException e
) {
322 Activator
.getDefault().logError("Error getting TmfEventsTable", e
); //$NON-NLS-1$
323 } catch (final InvocationTargetException e
) {
324 Activator
.getDefault().logError("Error getting TmfEventsTable", e
); //$NON-NLS-1$
330 * Get the events table for an experiment.
331 * If all traces in the experiment are of the same type,
332 * use the extension point specified event table
333 * @param experiment the experiment
334 * @param parent the parent Composite
335 * @param cacheSize the event table cache size
336 * @return an events table of the appropriate type
338 private TmfEventsTable
getExperimentEventsTable(final TmfExperiment
<?
> experiment
, final Composite parent
, final int cacheSize
) {
339 TmfEventsTable eventsTable
= null;
340 String commonTraceType
= null;
342 for (final ITmfTrace
<?
> trace
: experiment
.getTraces()) {
343 final IResource resource
= trace
.getResource();
344 if (resource
== null)
346 final String traceType
= resource
.getPersistentProperty(TmfCommonConstants
.TRACETYPE
);
347 if ((commonTraceType
!= null) && !commonTraceType
.equals(traceType
))
349 commonTraceType
= traceType
;
351 if (commonTraceType
== null)
353 if (commonTraceType
.startsWith(CustomTxtTrace
.class.getCanonicalName()))
354 return new CustomEventsTable(((CustomTxtTrace
) experiment
.getTraces()[0]).getDefinition(), parent
, cacheSize
);
355 if (commonTraceType
.startsWith(CustomXmlTrace
.class.getCanonicalName()))
356 return new CustomEventsTable(((CustomXmlTrace
) experiment
.getTraces()[0]).getDefinition(), parent
, cacheSize
);
357 for (final IConfigurationElement ce
: TmfTraceType
.getTypeElements())
358 if (ce
.getAttribute(TmfTraceType
.ID_ATTR
).equals(commonTraceType
)) {
359 final IConfigurationElement
[] eventsTableTypeCE
= ce
.getChildren(TmfTraceType
.EVENTS_TABLE_TYPE_ELEM
);
360 if (eventsTableTypeCE
.length
!= 1)
362 final String eventsTableType
= eventsTableTypeCE
[0].getAttribute(TmfTraceType
.CLASS_ATTR
);
363 if ((eventsTableType
== null) || (eventsTableType
.length() == 0))
365 final Bundle bundle
= Platform
.getBundle(ce
.getContributor().getName());
366 final Class
<?
> c
= bundle
.loadClass(eventsTableType
);
367 final Class
<?
>[] constructorArgs
= new Class
[] { Composite
.class, int.class };
368 final Constructor
<?
> constructor
= c
.getConstructor(constructorArgs
);
369 final Object
[] args
= new Object
[] { parent
, cacheSize
};
370 eventsTable
= (TmfEventsTable
) constructor
.newInstance(args
);
373 } catch (final CoreException e
) {
374 Activator
.getDefault().logError("Error getting TmfEventsTable for experiment", e
); //$NON-NLS-1$
375 } catch (final InvalidRegistryObjectException e
) {
376 Activator
.getDefault().logError("Error getting TmfEventsTable for experiment", e
); //$NON-NLS-1$
377 } catch (final SecurityException e
) {
378 Activator
.getDefault().logError("Error getting TmfEventsTable for experiment", e
); //$NON-NLS-1$
379 } catch (final IllegalArgumentException e
) {
380 Activator
.getDefault().logError("Error getting TmfEventsTable for experiment", e
); //$NON-NLS-1$
381 } catch (final ClassNotFoundException e
) {
382 Activator
.getDefault().logError("Error getting TmfEventsTable for experiment", e
); //$NON-NLS-1$
383 } catch (final NoSuchMethodException e
) {
384 Activator
.getDefault().logError("Error getting TmfEventsTable for experiment", e
); //$NON-NLS-1$
385 } catch (final InstantiationException e
) {
386 Activator
.getDefault().logError("Error getting TmfEventsTable for experiment", e
); //$NON-NLS-1$
387 } catch (final IllegalAccessException e
) {
388 Activator
.getDefault().logError("Error getting TmfEventsTable for experiment", e
); //$NON-NLS-1$
389 } catch (final InvocationTargetException e
) {
390 Activator
.getDefault().logError("Error getting TmfEventsTable for experiment", e
); //$NON-NLS-1$
396 public ITmfTrace
<?
> getTrace() {
401 public IFile
getBookmarksFile() {
406 public void setFocus() {
407 fEventsTable
.setFocus();
409 broadcast(new TmfTraceSelectedSignal(this, fTrace
));
413 @SuppressWarnings("rawtypes")
414 public Object
getAdapter(final Class adapter
) {
415 if (IGotoMarker
.class.equals(adapter
))
417 return super.getAdapter(adapter
);
421 public void resourceChanged(final IResourceChangeEvent event
) {
422 for (final IMarkerDelta delta
: event
.findMarkerDeltas(IMarker
.BOOKMARK
, false))
423 if (delta
.getResource().equals(fFile
))
424 if (delta
.getKind() == IResourceDelta
.REMOVED
) {
425 final IMarker bookmark
= delta
.getMarker();
426 Display
.getDefault().asyncExec(new Runnable() {
429 fEventsTable
.removeBookmark(bookmark
);
432 } else if (delta
.getKind() == IResourceDelta
.CHANGED
)
433 Display
.getDefault().asyncExec(new Runnable() {
436 fEventsTable
.getTable().refresh();
441 // ------------------------------------------------------------------------
443 // ------------------------------------------------------------------------
445 public void addBookmark() {
446 fEventsTable
.addBookmark(fFile
);
450 // ------------------------------------------------------------------------
452 // ------------------------------------------------------------------------
454 @SuppressWarnings("unchecked")
456 public void traceParserUpdated(final TmfTraceParserUpdatedSignal signal
) {
457 if (signal
.getTraceResource().equals(fFile
)) {
458 broadcast(new TmfTraceClosedSignal(this, fTrace
));
462 final String traceTypeId
= fFile
.getPersistentProperty(TmfCommonConstants
.TRACETYPE
);
463 if (traceTypeId
!= null)
464 for (final IConfigurationElement ce
: TmfTraceType
.getTypeElements())
465 if (traceTypeId
.equals(ce
.getAttribute(TmfTraceType
.ID_ATTR
))) {
466 fTrace
= (ITmfTrace
<?
>) ce
.createExecutableExtension(TmfTraceType
.TRACE_TYPE_ATTR
);
467 final ITmfEvent event
= (TmfEvent
) ce
.createExecutableExtension(TmfTraceType
.EVENT_TYPE_ATTR
);
468 final String path
= fFile
.getLocationURI().getPath();
469 fTrace
.initTrace(null, path
, event
.getClass());
472 } catch (final InvalidRegistryObjectException e
) {
473 Activator
.getDefault().logError("Error handling signal TmfTraceParserUpdatedSignal", e
); //$NON-NLS-1$
474 } catch (final TmfTraceException e
) {
475 Activator
.getDefault().logError("Error handling signal TmfTraceParserUpdatedSignal", e
); //$NON-NLS-1$
476 } catch (final CoreException e
) {
477 Activator
.getDefault().logError("Error handling signal TmfTraceParserUpdatedSignal", e
); //$NON-NLS-1$
479 fEventsTable
.dispose();
480 if (fTrace
!= null) {
481 fEventsTable
= createEventsTable(fParent
, fTrace
.getCacheSize());
482 fEventsTable
.setTrace(fTrace
, true);
483 broadcast(new TmfTraceOpenedSignal(this, fTrace
, fFile
, fEventsTable
));
485 fEventsTable
= new TmfEventsTable(fParent
, 0);
491 public void traceSelected(final TmfTraceSelectedSignal signal
) {
492 if ((signal
.getSource() != this) && signal
.getTrace().equals(fTrace
))
493 getSite().getPage().bringToTop(this);