/**********************************************************************
- * Copyright (c) 2011, 2012 Ericsson
+ * Copyright (c) 2011, 2013 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
+
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.loader;
import java.util.ArrayList;
import org.eclipse.linuxtools.tmf.core.component.TmfComponent;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
-import org.eclipse.linuxtools.tmf.core.request.ITmfRequest;
import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
import org.eclipse.linuxtools.tmf.core.signal.TmfRangeSynchSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceClosedSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceSelectedSignal;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.linuxtools.tmf.core.uml2sd.ITmfSyncSequenceDiagramEvent;
import org.eclipse.linuxtools.tmf.core.uml2sd.TmfSyncSequenceDiagramEvent;
* @version 1.0
* @author Bernd Hufmann
*/
-@SuppressWarnings("deprecation")
public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader, ISDFindProvider, ISDFilterProvider, ISDAdvancedPagingProvider, ISelectionListener {
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
+
/**
* Returns the current time if available else null.
*
* @return the current time if available else null
+ * @since 2.0
*/
public ITmfTimestamp getCurrentTime() {
fLock.lock();
@TmfSignalHandler
public void traceSelected(TmfTraceSelectedSignal signal) {
- ITmfRequest indexRequest = null;
+ ITmfEventRequest indexRequest = null;
fLock.lock();
try {
// Update the trace reference
* @see org.eclipse.linuxtools.tmf.core.request.TmfDataRequest#handleData(org.eclipse.linuxtools.tmf.core.event.ITmfEvent)
*/
@Override
- public synchronized void handleEvent(ITmfEvent event) {
- super.handleEvent(event);
+ public void handleData(ITmfEvent event) {
+ super.handleData(event);
- ITmfSyncSequenceDiagramEvent sdEvent = getSequnceDiagramEvent(event);
+ ITmfSyncSequenceDiagramEvent sdEvent = getSequenceDiagramEvent(event);
if (sdEvent != null) {
++fNbSeqEvents;
* @see org.eclipse.linuxtools.tmf.core.request.TmfDataRequest#handleCompleted()
*/
@Override
- public synchronized void handleCompleted() {
+ public void handleCompleted() {
if (fEvents.isEmpty()) {
fFrame = new Frame();
fView.setFrameSync(fFrame);
if (signal.getTrace() != fTrace) {
return;
}
- ITmfRequest indexRequest = null;
+ ITmfEventRequest indexRequest = null;
fLock.lock();
try {
indexRequest = fIndexRequest;
@Override
public void dispose() {
super.dispose();
- ITmfRequest indexRequest = null;
+ ITmfEventRequest indexRequest = null;
fLock.lock();
try {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
*/
protected void cancelOngoingRequests() {
fLock.lock();
- ITmfRequest pageRequest = null;
+ ITmfEventRequest pageRequest = null;
try {
// Cancel the search thread
if (fFindJob != null) {
private final List<ITmfSyncSequenceDiagramEvent> fSdEvent = new ArrayList<ITmfSyncSequenceDiagramEvent>();
@Override
- public synchronized void handleEvent(ITmfEvent event) {
- super.handleEvent(event);
+ public void handleData(ITmfEvent event) {
+ super.handleData(event);
- ITmfSyncSequenceDiagramEvent sdEvent = getSequnceDiagramEvent(event);
+ ITmfSyncSequenceDiagramEvent sdEvent = getSequenceDiagramEvent(event);
if (sdEvent != null) {
fSdEvent.add(sdEvent);
*
* @param time The timestamp
* @return page that contains the time
+ * @since 2.0
*/
protected int getPage(ITmfTimestamp time) {
int page;
*
* @param startTime The start time of time range.
* @return the time range
+ * @since 2.0
*/
protected TmfTimeRange getSignalTimeRange(ITmfTimestamp startTime) {
fLock.lock();
*
* @param findCriteria The search criteria
* @param window Time range to search in
+ * @since 2.0
*/
public SearchJob(Criteria findCriteria, TmfTimeRange window) {
super(Messages.TmfUml2SDSyncLoader_SearchJobDescrition);
* @see org.eclipse.linuxtools.tmf.request.TmfDataRequest#handleData(org.eclipse.linuxtools.tmf.event.TmfData)
*/
@Override
- public synchronized void handleEvent(ITmfEvent event) {
- super.handleEvent(event);
+ public void handleData(ITmfEvent event) {
+ super.handleData(event);
if ((fMonitor!= null) && fMonitor.isCanceled()) {
super.cancel();
return;
}
- ITmfSyncSequenceDiagramEvent sdEvent = getSequnceDiagramEvent(event);
+ ITmfSyncSequenceDiagramEvent sdEvent = getSequenceDiagramEvent(event);
if (sdEvent != null) {
* Returns timestamp of found time.
*
* @return timestamp of found time.
+ * @since 2.0
*/
public ITmfTimestamp getFoundTime() {
return fFoundTime;
*
* @param tmfEvent Event to parse for sequence diagram event details
* @return sequence diagram event if details are available else null
+ * @since 2.0
*/
- protected ITmfSyncSequenceDiagramEvent getSequnceDiagramEvent(ITmfEvent tmfEvent){
+ protected ITmfSyncSequenceDiagramEvent getSequenceDiagramEvent(ITmfEvent tmfEvent){
//type = .*RECEIVE.* or .*SEND.*
//content = sender:<sender name>:receiver:<receiver name>,signal:<signal name>
String eventType = tmfEvent.getType().toString();
- if (eventType.contains(Messages.TmfUml2SDSyncCloader_EventTypeSend) || eventType.contains(Messages.TmfUml2SDSyncCloader_EventTypeReceive)) {
- Object sender = tmfEvent.getContent().getField(Messages.TmfUml2SDSyncCloader_FieldSender);
- Object receiver = tmfEvent.getContent().getField(Messages.TmfUml2SDSyncCloader_FieldReceiver);
- Object name = tmfEvent.getContent().getField(Messages.TmfUml2SDSyncCloader_FieldSignal);
+ if (eventType.contains(Messages.TmfUml2SDSyncLoader_EventTypeSend) || eventType.contains(Messages.TmfUml2SDSyncLoader_EventTypeReceive)) {
+ Object sender = tmfEvent.getContent().getField(Messages.TmfUml2SDSyncLoader_FieldSender);
+ Object receiver = tmfEvent.getContent().getField(Messages.TmfUml2SDSyncLoader_FieldReceiver);
+ Object name = tmfEvent.getContent().getField(Messages.TmfUml2SDSyncLoader_FieldSignal);
if ((sender instanceof ITmfEventField) && (receiver instanceof ITmfEventField) && (name instanceof ITmfEventField)) {
ITmfSyncSequenceDiagramEvent sdEvent = new TmfSyncSequenceDiagramEvent(tmfEvent,
((ITmfEventField) sender).getValue().toString(),