Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [linuxtools-dev] TMF : createExecutableExtension in instantiateTrace() of TmfTraceElement.java

Hi Ran-How,

The reason we can't use the ITmfTrace instance owned by the trace type helper is that we need a different instance for each opened trace (they have different resources, paths, indexers, etc.).

The instance in the trace type helper is a dummy trace instance that is only used for trace type validation. It's not sure that these instances will remain in the future, if for example we implement a validator class that is separate from the trace class.

Patrick


On Fri, Apr 4, 2014 at 1:17 PM, Chen RanHow <ranhow.chen@xxxxxxxxx> wrote:

Hi TMF advances

Thank you team for the powerful framework, I have a question bellow

In  TmfTraceElement.java

I saw createExecutableExtension() in instantiateTrace() to get an instance from the extension points like bellow

                IConfigurationElement ce = sfTraceTypeAttributes.get(fTraceTypeId);
               
                .......

                ITmfTrace trace = (ITmfTrace) ce.createExecutableExtension(TmfTraceType.TRACE_TYPE_ATTR);

               ......

               return trace;
 
I wonder why not just use TmfTraceType.getInstance() to do it ?

Since the init() in TmfTraceType constructor call populateCategoriesAndTraceTypes()

The instance of createExecutableExtension is created

Could it be replaced with

            TraceTypeHelper tth = TmfTraceType.getInstance().getTraceType(fTraceTypeId);

            ITmfTrace trace = tth.getTrace();

            return trace;

Or I misunderstand it ?

Please kindly to reply

Ran-How


_______________________________________________
linuxtools-dev mailing list
linuxtools-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/linuxtools-dev



Back to the top