Dynamic menu contribution with key bindings - eclipse-plugin

I've a question. I have a dynamic menu contribution (class extending the ContributionItem). But I cannot find how to connect these items with key bindings.
The main problem is, that the plugin is actually quite easy. It loads menu from XML file. Practically it is a horror, because there is just few tutorials about dynamic menus. Almost every tutorial uses plugin.xml. But I cannot do it this way. I need to load items from a XML file depending on the workspace choosen. The file contains menu structure including key bindigs. That's my problem. I've never found how to bind keys with commands dynamically.

Fortunately the menu item has a method, wich can be used to get this task done:
MenuItem menuItem = new MenuItem(menu, SWT.CHECK, index);
menuItem.setAccelerator(SWT.SHIFT | SWT.ALT | 'G');
Nevetheless to get list of the key bindings already used in current Eclipse instance is not so trivial. Most likely they must be instpected by going through list of plugins and their menu contributions.

Related

Sensenet: Pagination on Document Library

It is possible to define pagination on document library?
I have a document library with more that 10000 documents... when I open the library occurs an timeout.
Actually SenseNet already does this! They just don't deliver it in the standard list control. If you open up the PRC and navigate to /Root/IMS/BuiltIn/Portal you'll see a list control with paging. The code can be found at /Root/Global/renderers/UserExploreGrid.ascx as User Control portlet. You can copy the code and change it to meet your needs.
Our company prefers to create User Control portlets and use Datatables with calls to the SenseNet OData API using skip and top to deliver pages.
Finally, given that SenseNet Content is stored as a tree structure (in SQL!), you can move the Content after creation so that data is organized hierarchically. A common solution is to take the first letter of the DisplayName and create a sub-folder from that letter, thereby reducing the number of items at a single node.
Here's what the paging looks like:
The short answer is no. Right now there isn't a built in functionality for that.
The long answer is that you can make a pagination yourself. One of the core member of sensenet made a grid where you can use pagination. It won't work with the current free to use releases because they lack the js files she used. But the idea behind it, is using a custom view. Which you can achieve by adding a system folder named Views under a the Document library and adding your custom view there.
You can use this grid for Explore, just follow these steps:
Go to the Explore action page, and switch editor mode on the PRC.
Place a ClientContext portlet (this can find under the Portlets->Application section in the portlet picker dialog) to the Wide column. Set portlet (client context porlet) properties, Apparance to None. It is a technical portlet, which allow get the CurrentContext in javascript. This is a very important element to work with this grid. The Grid use the client context.
Place a UserControlPortlet (In the portlet picker, Portlets->Application section) to the Wide Column.
Set portlet properties:
4.1. Portlet title: <%$ Resources: PortletTitles, Items%>
4.2. User Control path: /Root/Global/renderers/UserExploreGrid.ascx
Checkin Page modification on the PRC.
Enjoy your pageable explore portlet.
Keep in mind that this grid is specifically designed for users, so they will miss actions in the top menu. These must be handwritten. Then I suggest you copy the UserControl ( /Root/Global/renderers/UserExploreGrid.ascx)
and then put the action list on it . You can read more info about action list here: http://wiki.sensenet.com/ActionList
Br,
maros

Flag module - link's position change (Drupal)

I've just installed Flags module and it looks awful when on the bottom I see "Flag this item" link. The only thing I've found in configuration is enabling it to show as normal link. Still I haven't found how to change position of this link. Is it even possible to change link's place? I have installed CCK Blocks but it doesn't give me any option to get rid of it. If someone know or suspect what's possible - please help me.
Try the Display Suite module, this module is integrated with many modules like flag, title etc...
Display Suite allows you to take full control over how your content is displayed using a drag and drop interface. Arrange your
nodes, views, comments, user data etc. the way you want without having
to work your way through dozens of template files. A predefined list
of layouts (D7 only) is available for even more drag and drop fun!
https://drupal.org/project/ds
You can move and generate custom layouts for the fields/properties on the entity display formatter: teaser, full...

Linking 2 fields in OpenERP

I'm new to OpenERP and not really getting how to do this.
What I need is a new field in the purchase requisition form called “project”. A user should be able to select to which project a quotation belongs. Then if the requisition is accepted and a quotation is formed this field should also be loaded to that form (with the correct project, that was selected on the requisition).
I’ve been reading a lot on the internet, but either can’t find the answer or I just don’t understand it.
I read some stuff about needing to create your own module to customize the forms, and found some step to step explanations. But then I still don’t get how to link the fields.
So if someone could give me an answer on how to do this, or direct me to an (easy to understand) explanation. That would be great.
yes you should make a custom module for this. you will find enough tutorials on how to do that on the internet (e.g. http://www.pixelite.co.nz/article/adding-additional-fields-using-custom-module-openerp-7).
in this custom module you have to extend the model purchase.order with one new field, call it like project_id. it will be a many2one type of field and so called other object (relation) will be either project.project or project.task.
after that you have to extend the form view (and maybe the tree view) of purchase.order (xml_id: purchase.purchase_order_form). just add your field where you want to have it ;-)
now get it done :-P i hope i could've helped you :-)
edited:
Ok, you if you got Admin rights on the OpenERP System you can try it the in-system-way. just open the models menu unter settings -> technical -> database structure
search for purchase.order and open the model form view. now edit the record and add a new field like (scroll down and click "add new item"):
now you have to create a new view, to extend the original one. go to settings -> technical -> user interface -> views.
create a new one like this:
that's it. if you open a purchase order, you will see the project field right under the supplier reference.

Add dynamic tabs in tabbed property view of eclipse

I am trying to create a tabbed property view as per given article : The Eclipse Tabbed Properties View
As per article, org.eclipse.ui.views.properties.tabbed.propertyTabs extension point can be used to add new tabs.
<extension point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
<propertyTabs contributorId="mview.views.SampleView">
<propertyTab
category="sample"
id="mview.ButtonTab"
label="Button"/>
<propertyTab
afterTab="mview.ButtonTab"
category="sample"
id="mview.AdvancedTab"
label="Advanced"/>
</propertyTabs>
</extension>
However in my case the tabs of property view vary depending on the item selected in view. So I have to add the tabs dynamically into extension depening on the item selected.
Please suggest how to do so.
Update:
One of the way to do so (I am not sure if its adviced) is using IExtensionRegistry.addContribution() method. Here I provided an inputstream object containing desired extension details. This added tabs to property view at run time. However with change in selection of item in list viewer, the property view is not updated. Please suggest if this is the right approach to do so.
Ok, I got the solution Its a two step process. Using this one can dyanamically add tabs (and their sections):
Step 1: Associate a tab descriptor provider with the view.
Add an extension point - org.eclipse.ui.views.properties.tabbed.propertyContributor to the view (if not already added). In the propertyContributor section, add a class for tabDescriptorProvider item. This class will implement ITabDescriptorProvider interface.
Step 2: Provide Tabs and Sections:
TabDescriptor provider will return array of TabDescriptors when its getTabDescriptor() method is called. Each TabDescriptor return a list of SectionDecriptors and each SectionDescriptor is linked to a Section. Finally it is the Section class that contains widgets to be displayed on screen. Each widget in Section class has a modify listner which updates the properties of selected items.
While the answer from Viral may not match the specific needs of the OP, the provided answer is likely acceptable to many.
If a tab does not have any sections to display, the default TabbedPropertySheetPage will not show that tab. Thus, if the problem domain is specified in terms of IFilter implementing classes, "dynamic" tabs may be achieved.
Tabs will be added or be removed as the selection changes depending upon whether any sections are present. A visible tab may have one or more sections present on it, and the number of sections on a visible tab may change from selection to selection.
As I came across this page with the same basic issue, I was a bit disappointed that I would need to intervene in the way the OP suggested. After some experimentation, I was able to achieve what I needed purely through the IFilter approach as suggested by Viral.
A tutorial is provided at http://www.eclipse.org/articles/Article-Tabbed-Properties/tabbed_properties_view.html
You need to define a new YourPropertySection derived fromAbstract PropertySection . Also define a filter derived from IFilter and override the select method to return true only for the desired type of selection. Then in plugin.xml write an extension point which would map your PropertySection to the required PropertyTab and will also associate your filter. So this section & tab will only show when your filter returns true.

When creating a new TFS workitem is it possible to configure a different default Iteration value?

Like many people we utilise the tree structure of each TFS project's Iteration field to organise the work items within that project. Typically we use it to track what iteration we are working in, so most of the time everyone creating a work item needs to put the same Iteration path value in new work items.
By default when you create a new work item (bug for example) this field is set to the root value of the defined tree. Given we have a tree structure in this field its fair to say that for 99% of WIs the default is never correct.
Is there a way to configure a TFS project to default the Iteration field to a specific value when creating a new work item?
Ideally this should be a per user setting, but a TFS project wide would still be better than nothing.
It's not possible to set a default value for Iteration or Area Path (at least not inside the WITD).
Two ideas come into my mind:
Create a custom control for your work items, install it on every PC and let it change the Iteration when the WI gets loaded.
Easier way: Get the power tools and create a template for your work items. There you can preselect the Iteration. Of course every user has to create their own template.
Andrei's answer lead me to some further internet research and I have found a option that fulfills my "this should be a per user setting" side of the equation;
Instal the TFS Power tools extension.
Define a new work item template
(again following my example for a bug WI) and change the iteration
path in the template to match that users current iteration path.
Save
the template.
From that point on you can add a work item using this template (team -> work item templates) and get the Iteration path default from the template.