DESCRIPTION

TMF: Introduce the XML state system view for data driven outputs

Change-Id: I3ecf738e918be7b52075706f85c3f842c737b712
Signed-off-by: Aryana Jones xxx@xxx.xxx
Signed-off-by: Ayanna Reed xxx@xxx.xxx


COMMENTS

author: Annalise Jimenez
date: 2014-03-24 13:55:31.000000000

Uploaded patch set 5.

-------------------------------------
author: Brenden Conley
date: 2014-03-24 15:21:23.000000000

Patch Set 5:

Build Started https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/6078/

-------------------------------------
author: Brenden Conley
date: 2014-03-24 16:05:48.000000000

Patch Set 5: Verified+1

Build Successful 

https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/6078/ : SUCCESS

-------------------------------------
author: Luciana Barry
date: 2014-03-24 19:13:42.000000000

Patch Set 5: Code-Review-1

(8 comments)

Line:17, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/plugin.properties -> This should be more descriptive, XML file is too vague

Line:87, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> The second part of the comment is from the abstract class, does not apply here.

Line:88, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> This should be a constant (final). Also, default of 25% given to the tree part seems low as there can be a lot of info in the table.

Line:21, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/plugin.xml -> I don't think this should be the very first item of the popup menu. I would see it in the same group as Manage Custom Parsers, for example.

Line:58, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/plugin.xml -> I know it's already committed, but this handler should give some kind of feedback detailing what was successfully imported.

Line:93, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/plugin.xml -> I get a FileNotFoundException for resources_view.gif when I open the view. Could it be an old cached value in my Eclipse's inner gut from a previous version? In any case should we define an icon for this view?

Line:78, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlPresentationProvider.java -> Is it safe to let the else case fall through? Perhaps the entry display type should be the first thing checked in the method and return immediately if it's not DISPLAY.

Line:81, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlPresentationProvider.java -> NullTimeEvent are being drawn as TRANSPARENT. They should be INVISIBLE. Note that NullTimeEvent is also a TimeEvent that has no value.

-------------------------------------
author: Braxton Mccarthy
date: 2014-04-02 22:59:05.000000000

Patch Set 5: Code-Review-1

(32 comments)

Line:59, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlEntry.java -> for fields you can put the annotations on the same line, it's a bit more readable and there's usually plenty of room

Line:114, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlEntry.java -> you can do !nameFromSS.isEmpty()  which ends up to the same thing anyway

Line:271, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlEntry.java -> you can use Collections.EMPTY_LIST

Line:17, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/plugin.properties -> This functionality (importing, de-importing, etc.) will all be managed by its own view eventually.

Line:27, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/internal/tmf/analysis/xml/ui/TmfXmlUiStrings.java -> this is temporary, right? The name of the view should be defined in the XML file, right?

Line:197, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> If the locale is changed at run-time, then the names won't match anymore. There should be constants indicating "this is the column for the parent ID" etc. that are independent from the displayed localized name.

On top of that, you'll be able to use a switch case!

Line:247, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> extracting mutable fields to local variables before accessing them! wow, so good practice, much reentrancy

Line:266, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> warning, only iterations, more LinkedList, danger to touch, nobel dog, will bark

Line:287, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> Since you want the entries to be sorted, here you could use a TreeSet, passing the Comparator at the constructor. That way you wouldn't need to sort it further down.

Line:293, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> and here again, LinkedList seems more appropriate.

Line:354, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> path.isEmpty()

Line:366, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> you can also use .isEmpty() here.

Line:377, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> You put only one element in the list, then reassign it to something else. You could use Collections.singletonList(baseQuark);

Line:381, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> LinkedList

Line:396, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> guess what I was gonna say ;)

Line:397, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> you can do if (!displayElements.isEmpty())

Line:421, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> wrap this line

Line:429, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> wrap before String.format

Line:451, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> wrap

Line:481, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> Oh that's a good one here!

You already built the map previously. You could now iterate on map.entrySet() to iterate on the Map.Entry<String, XmlEntry> objects. These would give you direct access to the key and value, without having to do a map lookup (entryMap.get()).

I'm not sure if the order of elements is important though. If it is, you can use a LinkedHashMap, it iterates on the entries on same order they were inserted.

Line:484, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> isEmpty()

Line:502, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> Collections.EMPTY_LIST (assuming the caller won't try to modify the list afterwards)

Line:515, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> If getType() returns null this will throw a NPE. You can compare enums with == to avoid this risk.

Line:534, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> Don't do this!! This is what adds those weird black lines to the resulting time graph view.

Line:548, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> Collections.EMPTY_LIST

Line:49, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlPresentationProvider.java -> constants should be in ALL CAPS (DEFAULT_SIZE = 256)

Line:50, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlPresentationProvider.java -> declaration should use List<...>

Line:61, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlPresentationProvider.java -> as mentioned below, if you use a Map for stateValues instead, this becomes unneeded. On the getter, just check if the matching value is null, instead return new StateItem(calcColor(int));

Line:93, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlPresentationProvider.java -> when doing toArray, give the array the size it will have:

  stateValues.toArray(new StateItem[stateValues.size()]);

That way (according to the Javadoc at least), it will not have to do a separate allocation to put the items in.

Line:119, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlPresentationProvider.java -> you can use Collections.EMPTY_MAP for a static empty immutable map.

Line:169, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlPresentationProvider.java -> .set(pos, element) will offset the elements currently in the array so they will not have the same position anymore.

Since the values come from the XML file, you are not garanteed to have contiguous values. If some bozo defines values 1, 2, 3, and 5000, you will instantiate an array of 5000 elements, with most of them empty!

It sounds like a Map (TreeMap<Integer, StateItem> ?) is more what you want.

Line:180, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlPresentationProvider.java -> Now, imagine for a moment, if you could replace all this snippet with:

  Display.getDefault().asyncExec( () -> fireColorSettingsChanged() );

GET HYPE!

-------------------------------------
author: Annalise Jimenez
date: 2014-04-03 20:54:41.000000000

Patch Set 5:

(10 comments)

I'll work on this patch again, but here are some answers to comments.

Line:59, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlEntry.java -> Unfortunately Ctrl-shift-f puts it back in 2 lines :(

Line:17, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/plugin.properties -> Indeed, but in the meantime, I'll do a patch that will put it way down in the menu and change this text.

Line:27, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/internal/tmf/analysis/xml/ui/TmfXmlUiStrings.java -> It's not the name of the view, it's the element name in the XML (see the XSD). So it is not temporary, so if you have anything to comment on it, go ahead.

Line:197, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> That could be something to put in the abstract time graph combo, because it also applies to control flow view and all other such views. Besides, even the index... we may at some point support moving the columns around, and that will fail terribly as well.

Line:247, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> Thanks to java warnings! :D  You don't have the choice anymore

Line:534, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> As Patrick mentioned, I'll update the presentation provider so that it displays correctly.

Line:58, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/plugin.xml -> I'll keep that and previous comment in mind for a patch dedicated to this menu item.

Line:93, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/plugin.xml -> I get that too, actually for all of the views I make, partly (actually fully) in the hope that someone will notice and do the icon because I'm really bad at it

Line:61, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlPresentationProvider.java -> I'll review this whole thing in the next patch series. Every displayed entry will want to have its own list of state item and colors (now there is one global list for the view, but different entries may have the same values (eg 1) mean different states). So I'd leave it for now.

Line:169, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlPresentationProvider.java -> Will be refactored in coming patches

-------------------------------------
author: Annalise Jimenez
date: 2014-04-04 14:17:06.000000000

Patch Set 5:

(2 comments)

Line:59, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlEntry.java -> I saw you yesterday do a ctfl-shift-f with private xxx@xxx.xxx ITmfStateSystem fSs; and it kept it on one line. It doesn't work here, I'm using Eclipse 4.4M6. What are you using?

Line:481, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> I'll stick with the list. I don't need the key of the entry itself, I only use the map to get the parent.

-------------------------------------
author: Braxton Mccarthy
date: 2014-04-22 16:02:36.000000000

Patch Set 5:

(7 comments)

Line:59, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlEntry.java -> 4.4 integration build. Perhaps this plugin doesn't have the formatter settings set up correctly? Try running the script in https://git.eclipse.org/r/#/c/25092/

Line:88, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> final here only means you cannot reassign the array. But the values (1,2) can still be modified.

If you want to be bulletproof, you can now use a final ImmutableList, defined statically. Up to you ;)

Line:293, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> any reason this wasn't changed, or talked about?

Line:481, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> Storing elements in two separate structures is bad practice in general. I'm very guilty of that myself... If needed you can implement your own class wrapping two or more data structures underneath, but most of the time (and now with Guava collections) it's not even needed.

If the order of the elements is important here, you could do away with only a LinkedHashMap. Iterate on the *entries*, so you do not need to do a map lookup for potentially every element.

Line:502, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> See previous comment

Line:534, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlStateSystemView.java -> Ok, that works too.

But then, what is the point of even add this TimeEvent here?

Line:169, lttng/org.eclipse.linuxtools.tmf.analysis.xml.ui/src/org/eclipse/linuxtools/tmf/analysis/xml/ui/views/statesystem/XmlPresentationProvider.java -> Well it's not just a refactor, it's a behavioral change. Unless offsetting all the elements in the array is what you want. But from what I can tell, it's not.

-------------------------------------
