how do i select a variable from the eclipse variables view - eclipse

I'm developsing a debugger plugin in eclipse; i'm trying to write unit tests to grep vars from the variables view and test thier values.
so far I was able to retrieve the variables view object as an IViewPart;
I've extracted the selection provider related to the variables view, by doing this:
ISelectionProvider selProvider = viewPart.getSite().getSelectionProvider();
now i would like to set a selection on the first element in the variables view
how do i get the elements list, or select any of the elements?
Thanks in advance,
Anat

Related

Drools Business Central Workbench - Test Scenario: List subproperty on object

Is there a way to populate a List property on an object being tested under the "new style" test scenario?
I see some "legacy" test cases which seem to achieve this so am wondering if the new style test scenario handles this.
I added the List model to my test case, which enabled me to expand the sub-property on the object, however there is only one field available there, "empty" (boolean). Is there a way to add an object here? If it makes any difference, the model is an external java dependency.
Update
The reason I wasn't able to add the List of objects was because I didn't explicitly import that object dependency into the test. Once you import it you can follow the steps given in the answer below.
It's definitely possible to manage a List property under the Test Scenario Editor.
Please consider the following example: A Book class with a List<String> property named topics.
Creating a new Test Scenario assets, please select the column where you need to add the List property, and in the right part of the editor select the property expanding the Book class, as shown below:
Pressing Insert Data Ojbect button will assign the selected List property to the selected column:
To fill the data in the List property, please double click on the Insert value cell, in the first scenario data row. A popup will appear. Its aim is to fill data inside a collection
To add a value, please press the Add list value link in the bottom part of the popup. Here, you'll be able to fill a single item on the list
Repeat this step for all the items you need to add to the list. When completed, simply press to Save button
The popup will close and you should see the previously selected data cell filled with a label similar to List(2), the number represents the number of the items in the list.

Access debug variables from within the code

It's about debugging in eclipse,
While debugging, I can see Variables window containing the variable names and their values, how can I access those variables and get their values from within the code or (expression) window?
For example can I write something like this:
print cash.dbname
or
x=cr.IN_MAX
or
s = _pool._serialized
(See the picture)
There's a very complex tree of variables, can I also access this variable tree reaching the branches and leaves?
Open the Display view; there you can enter code snippets that execute within the current stack frame selected in the Debug view. Code completion works, too.
You can select part or all of the contents of the Display view, right-click, and choose to Display, Inspect, or Execute it. Very powerful for exploring application state when debugging.
See also the Eclipse Help page about Display View.

Eclipse RCP - Programmatically setting a view to not be closeable

I'm trying to create an RCP view that is not closeable. I need a way to set this property programmatically because I'm creating views with secondary IDs in in the code. I can't do it through the extension editor dialogs because of this.
Is there a way to remove the x from a view programmatically?
I was finally able to figure this out.
In your perspective's createInitialLayout() function you can get the layout of the view and set its closeable property:
IViewLayout vLayout = layout.getViewLayout(View.ID);
vLayout.setCloseable(false);
This will work for views with secondary ids too. The code would be exactly the same in that case, because it will apply the closeable property to all secondary views that share the same primary id.
I've found that the following won't work:
IViewLayout vLayout = layout.getViewLayout(View.ID + ":1");
vLayout.setCloseable(false);
So you can't make individual views closeable based on their secondary ids. Either the whole group is or isn't.
You can do it easily.
Just set the closable property of view to False.
IViewLayout layout= layout.getViewLayout(View.ID);
layout.setCloseable(false);

How to set up binding for an array with Gwittir and GWT?

I have an list of checkboxes on a GWT widget using Gwittir. I want to bind these checkbox values in my view to some values in my Model so that I can tell which ones are selected. How can I set up a binding to do this?
For a single value (one not in an array), I've been doing this:
Binding binding = new Binding();
binding.getChildren().add(
new Binding(viewObj.getTextBox(),"value",modelObj,"textValue"));
But I don't know how to transition this to work for an array of items. Please help.
I ended up not using Gwittir for those parts which dealt with arrays of data. Instead I manually transferred the data from my view to my controller when the user clicked a button which would record the state of all the checkboxes in an array to an array of values in the controller.

Zend Navigation: current page

There is a method isActive() in Zend_Navigation. But it returns true for all the elements in the current path
(parent li is active and all the children too, even when the current is parent li).
Is there any method like isCurrent(), to determine whether the current menu item is the current page?
I just like to add custom class attribute to just one, current element in the whole nested tree of ul's and li's.
easier with:
$activeElement = $view->navigation()->findOneBy('active', 1);
if you're inside your view script you can use:
$activeElement = $this->navigation()->findOneBy('active', 1);
You will need to use your own navigation view script, but that's fairly simple. Then try:
$this->navigation()->findActive($this->yourNavContainer);
That will return an object, var dump it and you will see the data you need. I think the variable is simply called 'page'. Do this before you build your menu, pre/post dispatch, then in your viewscript, do an if statement to check this var against the current looped item (i guess your loop it in a foreach).