While using C++ I have to deal with programs that have objects like matrices, linked lists etc
The default view of eclipse for variables while debugging is not very useful. It normally shows pointer values with value of only the first element in the array.
Below is how it is in eclipse:
As we can see the matrix object has rows and columns integers and a double 2D array. I cannot see the values of the array in user friendly manner.
My question is that, is there anyway in eclipse (using plugin etc) through which I can define custom user interfaces (popups) for each object/class of my interest.
For example I would like to have the following (Matlab's view) kind of popup when I hover over an initialized matrix object:
The JDT has a feature called detail formatters to make that possible. The corresponding implementation for the CDT seems to have stalled after a first prototype however, and did not make it into Eclipse.
Related
Using PHP Debug (Xdebug) I can hover over objects and arrays just fine to see values but this only seems to work on the 'parent' object, I was wondering if there is a way to hover over array elements or object properties to quickly see their individual values?
E.g. instead of hovering over $MyObject, I want to hover over SomeValue to see the individual value. I could do this in another IDE, it's much quicker when working with large objects/arrays.
$MyObject->SomeValue
$MyObject['SomeValue']
I create a ScrollingGraphicalViewer to show my figures, but no figure displays.
I debugged the source and it seems all object (figures, editparts, models) are created, no exceptions. Why the figures do not display?
Since the code is larege and spread many Java files, I briefly depict what I did.
creating model objects. In my model, there are two kinds of elements, directory and file. A directory may contain other directories or files.
figure objects. I create two kinds of figures, one for directory, the other for file.
the directory figure can have nested figures for nested directories and files.
editpart objects. for each kind of model elements, i.e., directory and file, to connect relation between model and figures.
an editpart factory object, for create each editpart object.
create a ScrollingGraphicalViewer object (viewer). and invoke the following methods on viewer: viewer.createControl(), viewer.setRootEditPart(), viewer.setEditPartFactory, and viewer.setContents().
Anything missing?
Any clues and comments will be appriciated.
Thanks.
Overriding refreshVisuals() in your EditParts will do the trick. This is the correct place to react to constraint changes as dictated by your model. You will have to set the figures constraint relative to the parent EditPart (and its figure's FreeformLayout) as well, so for FileEditPart (cf. cross-posting on the Eclipse GEF Forum) do something like the following in refreshVisuals().
getParent().setLayoutConstraint(this, figure, layout);
layout here will have to be a draw2d Rectangle. You can calculate that by giving it x and y values, and getFigure().getPreferredSize().width for the layout.width, and dto. for height.
For basic GEF usage - of which this is a case - I'd suggest you have a look at Rubel et al.'s GEF Book.
I am looking for a way to handle different type of data in one column of a Matlab uitable.
Usually uitable is used to set whole columns to the same data type, such as logical (gives a checkboxes), char (gives left-aligned text), numeric (gives right-aligned number) or a 1xn-cell-array (gives pop-up menus with different choices).
It is set using the columnformat property of uitable, e.g.
columnformat = {'numeric', 'logical', {'Fixed' 'Adjustable'}}; % 3 columns
You can find an example at matlab documentation.
I am looking for a way to set the format for single cells to realize something like this:
Matlab's uitable is a crippled version of an underlying JIDE table.
It is possible to get to the underlying java (see findjobj in file exchange), but that requires a lot of work. Yair Altman's undocumented matlab site is a good starting place for understanding the java side of matlab.
It sounds like you want something like a property editor, as opposed to a generic UI table -- i.e. properties listed in first column, property value editable in second column. There are a few "off the shelf" versions in the file exchange, which use JIDE:
See propertiesgui, or property-grid for mostly functional examples. The second example is easier to use -- you simply provide a class or struct, and it creates the proper field entry format. The first one offers more choices -- like color boxes, drop downs, etc, but requires you to be more involved in specifying how things behave.
I had the same problem, but in the end it worked by giving the (numeric) cell an (char) initial value. When changing the char value from the UI the format of the cell remained char, although the rest of the column was numeric.
I making a eclipse view that is working with selected elements from other views.
Let say I have opened a java file in the editor that has the following fields in it:
private String world = " world!"
private String hello = "hello" + world;
When I select "hello" in the Outline view I'm able to get IFiled selection and I have access to it's properties, but what i need is the true value of the field ("hello world!").
Any idea how can I do that?
Thanks.
There is no value information available for variables before runtime (maybe except constant values), so such expressions cannot be evaluated (except using some serious inference about the variables). And I don't think these expressions could be evaluated even in theory, because the referenced variables might gain their values even from external input (that cannot be available during compiletime).
On the other hand, it is possible to evaluate such conditions using the JDT Debugger, there is a Display view for such reasons, and or the Inspect options. This way it is possible to get the selected values, as they can be read from the JVM. On the other hand, this information is not available in the Java AST but you have to use the debugger model.
In Eclipse, I am using a TreeViewer to show a custom tree, whose contents are drawn from an ITreeContentProvider. Now I am trying to create a second view that allows me to automatically show a two-way comparisons of two such trees. I found various views for textual comparison within Eclipse, but I could not find an easy way to show the structural differences between two arbitrary trees. Any thoughts?
When the Data Model the ContentProvider is creating and the labelProvider is diplaying is the Same, you could use the same viewer in the right and the left of a view.
You could than compare the TreeItem Elements of both TreeViewer and mark the ones, which has changed.
The other solution is to compare the DataModels and add a special flag to the changed elements. The LabelProvider can check this flag and draw a special color to indicate, that this element is different.
I do not know an Editor inside Eclipse, providing this functionality.