I've created an eclipse plugin which extends JSDT. When editing a JavaScript file, pressing Ctrl-Space shows "Default Proposals", consisting of general JavaScript Suggestions. Pressing Ctrl-Space again shows "Template Proposals", but the list is empty. How do I add content to the "Template Proposals" list?
You can use the org.eclipse.ui.editors.templates extension point for this. Something like this:
<extension
point="org.eclipse.ui.editors.templates">
<template
autoinsert="true"
contextTypeId="javaScript"
description="Do something"
id="com.foo.mytemplate"
name="A silly template">
<pattern>
fafdsds fafdsda fdadsa
</pattern>
</template>
</extension>
Related
I am writing a Plugin for intelliJ IDEA and I have been trying to add a button in the main toolbar, besides the run button:
I have been looking for guides to help me do it, but I haven't found any. It has to be possible, this is just my first plugin and I lack the necessary experience. Any help is greatly appreciated.
It's simple. You have to create an action (descendant of AnAction) and put it in Actions tag within your plugin.xml:
<actions>
<action id="your.action.id" class="your.Action"
text="Some label" description="Action description" icon="AllIcons.General.AddJdk">
<add-to-group group-id="ToolbarRunGroup" anchor="first" />
</action>
</actions>
The "add-to-group" tag will tell IDEA to put it together with other execution related buttons.
I am following this tutorial http://www.vogella.com/tutorials/EclipsePlugin/article.html#exercise-adding-e4view-based-parts-to-3-x-based-applications . When I'm trying to right click in extension tab to add a new e4View as shown in a tutorial, nothing happens, the popup menu doesn't appear. Is it possible to create this view in different way?
You can always edit the plugin.xml directly by clicking on the 'plugin.xml' tab.
A basic e4view would look something like:
<extension
point="org.eclipse.ui.views">
<e4view
class="testview.E4view1"
id="TestView.e4view1"
name="name"
restorable="true">
</e4view>
</extension>
I am using Selenium IDE Record function to create test cases.
I would like to take screenshot at some part of application that I am testing.
Using UI of Selenium IDE it is easy:
Command: captureEntirePageScreenshot,
Target: *path for screenshot*
But it is not convenient to manually type this (or copy paste) every time I want to take a screenshot, so I decided to make a plug-in (a button on the Selenium IDE toolbar) that will add this screenshot command to the testcase, once I click on it.
I created my button, which is visible on the toolbar, but right now it does nothing:
<?xml version="1.0"?>
<?xml-stylesheet href="toolbar.css" type="text/css"?>
<overlay id="toolbar_overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<toolbar id="toolbar2">
<toolbarseparator id="screenshot-separator" insertafter="record-button"/>
<toolbarbutton id="screenshot-button" insertafter="screenshot-separator" label="Take a screenshot" class="icon" tooltiptext="Take a screenshot" command="*problem_is_here*"/>
</toolbar>
</overlay>
I was digging through Selenium IDE source code, but didn't find method that can be used to add new command to the test case...
Did more digging through source code and find required method:
Editor.addCommand(command, target, value, window, insertBeforeLastCommand)
So my final .xul file looks like this:
<?xml version="1.0"?>
<?xml-stylesheet href="toolbar.css" type="text/css"?>
<overlay id="toolbar_overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<toolbar id="toolbar2">
<toolbarseparator id="screenshot-separator" insertafter="record-button"/>
<toolbarbutton id="screenshot-button" insertafter="screenshot-separator" label="Take a screenshot" class="icon" tooltiptext="Take a screenshot" oncommand="window.editor.addCommand('captureEntirePageScreenshot', 'C:/Users/username/screenshot'+window.FileUtils.getTimeStamp()+'.png', '', window.editor.window);"/>
</toolbar>
</overlay>
Look inter user-extensions.js. This is an easy way to add javascript functionality.
To me, it seems silly to reproduce a command that already exists.
With the IDE's autocomplete, I'm not sure why it's complicated to add in this step, unless you want to use it like the right-click menus?
I try to set an icon to menuitem, So I find that the attribute icon is supported, but No change happen when I change its value.
I want to know if it is still supported by menuitem in odoo v7/8. If not, how to add an icon to a menu item?
Edit:
I try to customize the view of the menu in odoo. So I override the template that render the menu in "webClient_templates.xml" from web module like this:
<template id="my_menu_link" inherit_id="web.menu_link">
<span position="replace">
<span class="oe_menu_text">
<i class="fa fa-check"></i>
<t t-esc="menu['name']"/>
</span>
</span>
</template>
Likely, all the menu items will have the same icon (i.e. fa-check) from font-awesome lib.
Now, I try to add a specific icon for each menu item, that I can define it somehow in the xml description of menuitem as a kind of attribute or anything else, and retrieve it like this:
<i t-attrs-class="menu['icon']"></i>
I tried to use icon attribute of menuitem, even if it's deprecated, but menu['icon'] is not recognized in the template level.
Please any suggestions ?
AFAIK displaying icons in menu items is deprecated and does not work on the web client. Probably the to achieve you would need to create a module for the web client extending it with that capability.
I'm using odoo v12 now, and there is also an unused field for icons on ir.ui.menu model.
I managed to show icons on backend's menus, here are the difference with your code:
The icon field is named web_icon, it may be specific to v10+ , I don't have a v8 to verify this.
The templating syntax to set attributes is t-att-<name> and not t-attrs-<name>
And most important: the menus in backend are generated using javascript, so the templates to modify are to find in web/static/src/xml/menu.xml
There are 3 places to add an <i> markup in 2 templates:
<t t-name="Menu.link">
Line 47: <span><i t-att-class="menu.web_icon"></i> <t t-esc="menu.name"/></span>
Line 59: <span><i t-att-class="menu.web_icon"></i> <t t-esc="menu.name"/></span>
<t t-name="Menu.sections">
Line 81: <i t-att-class="second_level_menu.web_icon"></i> <t t-esc="second_level_menu.name"/>
The data to set in menu's icon field is the whole font-awesome CSS classes:
fa fa-check
This is good if you add more icons sets, you won't need to modify again the templates.
But if you want to force the usage of font-awesome, or want to use another icon set like font-awesome solid (using fas class), you can use this markup in templates:
<i t-attf-class="fas fa-#{menu.web_icon}"></i>
(note t-attf-<name> to use "attribute function")
And so the data in the field will be only check...
And finally, the best should be to create a module to inherit the templates and make this modification against modifying it directly as I did...
And also add some more CSS styling to align icon and text correctly (here icons are not the same sized).
I want to create my own Welcome page like eclipse.I have search for but it shows for RCP Application but i want to create it inside Eclipse IDE So that when i click on menu, it should open Intro(help) page.
eclipse.ui.intro extension point
All you need to do is to extend org.eclipse.ui.intro.configExtension and provide your implementation.
<extension point="org.eclipse.ui.intro.configExtension">
<configExtension configId="org.eclipse.ui.intro.universalConfig"
content="intro/eclipse-tips.xml" />
</extension>
You have the whole tutorial here
http://eclipse.dzone.com/articles/short-tutorial-introwelcome