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.
Related
I'm following the regression tutorial at http://www.mathworks.com/help/econ/estimate-regression-model-with-multiplicative-arima-errors.html. In particular, I am browsing the object Fit=fitlm(X,logY). I know I can double-click the object in the Workspace window, but I often don't want more windows. I might just want to list the members at the command line. According to http://www.mathworks.com/help/ident/ug/linear-model-structures.html#bq4gq_u-20, I should be able to do this with the get method. However, Matlab informs me that the Linear Model class doesn't have a get method [tried Fit.get, Fit.get(), and get(Fit)]. What am I missing?
As for browsing the properites using the GUI window, I'm finding that the Residuals property is not present. According to http://www.mathworks.com/help/stats/linearmodel-class.html, it should be present. Thanks for any light that can be shed on my misunderstanding of the class.
I've posted this at:
http://groups.google.com/forum/#!topic/comp.soft-sys.matlab/b0jHdrX6_ZY
You can list all the property names of an object using the properties function. In your case:
properties(Fit)
I have a custom toolbox with a foo element.
I would like the foo to be green on an class diagram and red on flow chart diagram by default.
Adding more than one stereotype to non- UML type is impossible (as far as I know).
Is it possible to create 2 toolboxes- one for class diagrams and one for flow charts, specifying the default diagram for each toolbox in the profile?
Not quite the way you describe it.
Toolboxes don't specify which diagram they open, it's the other way around: you create a custom diagram type and associate it with a toolbox. Different custom diagrams may use the same custom toolbox.
You can create two custom diagram types, one for class ("Logical") and one for flow chart ("Activity"), but if you're only after getting the same stereotyped element (foo) to display differently in the diagrams, you don't need to.
The solution is to create a shape script for the stereotype, which checks the diagram type and changes the color accordingly. The diagram type can be queried from the shape script using the diagram.type property (for the base UML diagram type), or diagram.mdgtype (for the custom diagram type, if you've defined one). There is no need to create an Add-In, as another answer suggests, at least not in EA 11.
Check the help file under Extending UML Models -- MDG Technology SDK -- Shape Scripts -- Write Scripts -- Display Element/Connector Properties.
A simple script might look like this:
shape main {
if (hasproperty("diagram.type", "Logical")) {
setfillcolor(0, 255, 70);
} else if (hasproperty("diagram.type", "Activity")) {
setfillcolor(255, 87, 87);
}
drawnativeshape();
};
No. You need to have two different stereotypes. The target diagram is independent of the element. If you want the element appear different on the type of the diagram where you use it you need to adapt the shape script so it calls an add-in which detects the diagram type.
Well, writing the last sentence I would not know how to detect the diagram where the element in question is in. Needs investigation. But other than that - no solution I know of.
Edit: Since the add-in just receives the element GUID it has no way to figure out the diagram from where the call is made. Probably worth a feature request. But the time where we saw those realized in the next build are gone (since more than 10 years).
A last though: template packages. I almost never used them. Maybe they offer coloring depending on diagram/element.
Edit2: Last resort EA_OnPostNewDiagramObject. Catch that and you can get all information you need to apply the color.
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.
I want to create GUI components from XSD files. The generated GUIs should be used for concrete xml instances of the corresponding schema with databinding to "interesting" elements or attributes content.
I have considered these solutions:
jaxfront. (commercial tool). This does not generate source code. This is important for me because I want communication between the generated GUIs and other components of the GUI.
Use xsd2emf and try to generate an editor from that. The generated model is to complex, as well as the generated editor and it is buggy.
Do it myself e.g. generate an xml from the xsd, load xml as dom, select the interessting parts and generate data binding using one method described at http://www.vogella.de/eclipse.html.
Has anyone another idea or already successfully solved that problem? I would prefer a free open source solution which generates a SWT GUI.
Have you looked at the Sapphire framework at eclipse?
With it you have to create a model based on a few simple java interface files with some annotations that would model your XSD. Then once you have the model defined, you create the SWT GUI with a single xml file (sdef file) that wires various property editors to your model. The property editors can be simple widgets like label, text, lists, combo boxes but also it can be complex editors like a GEF-based diagram editor. So basically if you have a few interfaces that describe your model, then can have a graphical editor for editing nodes in that model with less than 100 lines of XML.
See lines 22 to 121 of this sample file.
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.