grouping toolwindows in menu - intellij-idea

I am creating several tool windows and i would like to group them all under the same designated menu or at least a submenu of view
I am able to make the tool windows using this sort of syntax in the plugin xml:
<extensions defaultExtensionNs="com.intellij">
<toolWindow id="My Sample Tool Window" secondary="true" icon="/myToolWindow/plus.png" anchor="right" factoryClass="myToolWindow.MyToolWindowFactory"/>
</extensions>
and I am able to make menus and menu items like this:
<actions>
<group id="SampleMenu" text="Sample Menu" description="Sample menu">
<action id="Textboxes" class="TextBoxes" text="Text _Boxes" description="A test menu item" />
<add-to-group group-id="MainMenu" relative-to-action="HelpMenu" anchor="before" />
</group>
</actions>
but I can't seem to figure out how to combine the two or find the relevant parts in the documentation

You can't control how toolwindows are presented under View | Tool Windows. You can define your own actions to show your toolwindows, and add those actions in any
other place of the menu, as a group or in any way that you prefer.
To activate a toolwindow programmatically, use:
ToolWindowManager.getInstance(project).getToolWindow(YOUR_ID).activate(null);

Related

Adding button in toolbar for intellij plugin

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.

Right click doesn't work in plugin.xml

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>

how to add Wizards created in New->File->others into popup menus when right click in project explorer

I have created a category in File->New->Others say "Enterprise".With some Wizards in it lets say "Instance","Component", etc.
Now what i want ,when i right click in Project Explorerand go in New those wizards should be seen their itself. Basically trying to make popup menu of those wizards.
So i created popup menus as:
<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="true"
locationURI="popup:common.new.menu?before=additions">
<command
commandId="CommandComponent"
label="Component"
style="push">
</command>
</menuContribution>
</extension>
<extension
point="org.eclipse.ui.commands">
<command
id="CommandComponent"
name="Component">
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
commandId="CommandComponent">
</handler>
</extension>
Now how could I give the same class to the handler which I gave to Wizard Component?
Or do I have to write a new class with the same functionality but as per handler format (if it is possible)?
You use the org.eclipse.ui.perspectiveExtensions extension point to define the New Wizards which are show at the top level of the New menu using the newWizardShortcut element.
Something like:
<extension
point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="org.eclipse.jdt.ui.JavaPerspective">
<newWizardShortcut
id="org.eclipse.jdt.junit.wizards.NewTestCaseCreationWizard">
</newWizardShortcut>
</perspectiveExtension>
(which is the New JUnit Test Case shortcut).
You may need to Reset the Perspective or use Customize Perspective to make the item visible as the user has control over which of these shortcuts is shown.
More info in the help
This is what I did, in order to achieve what I was asking for.
A popup menu when I right click in project explorer it shows New -> Component Wizard. Which I have added in File -> New -> Others.
<extension point="org.eclipse.ui.menus">
<menuContribution allPopups="false" locationURI="popup:common.new.menu?after=new">
<command commandId=" org.eclipse.ui.newWizard" style="push">
<visibleWhen checkEnabled="false">
<with variable="activeWorkbenchWindow.activePerspective">
<equals value="org.eclipse.ui.resourcePerspective"></equals>
</with>
</visibleWhen>
<parameter name="newWizardId" value="Component"></parameter>
</command>
</menuContribution>
</extension>
Just like greg-449 mentioned, use the "org.eclipse.ui.perspectiveExtensions" extension point to contribute your elements to the perspective that you want.
When you right click on the project explorer or package explorer and click on New, the projects shown there are dependent on the perspective you are in. If you are in a Java perspective, you will find Java Project. If you are in the PDE perspective, you will find Plugin project. So it's good to contribute your Project type in the perspective you want it.

Displaying images in Popup of ArcGIS Flexviewer

I have created a sample flex application using the ArcGIS Flex viewer and trying to access some images from web(wiki).
I have successfully configured the pop-up XML files such that it displays the images. However when I click on the feature, it is not showing the image.
I was thinking if this could be because of the fact that these images are larger to include within the pop-up window.
I have tried the following workarounds of using different tags in the Pop-up config xml.
workaround:1
<description><![CDATA[<img src="{LINK_NEW}"/>{LINK_NEW}.<br>a. ]]>
</description>
workaround:2
<medias>
<media chartfields="" type="image" imagesource="{LINK_NEW}" imagelink="{LINK_NEW}" />
</medias>
The second seems to get me near to the resolution but not able to see the images in the pop-up window.
The question here is, I wanted to know a way to resize the original image with the help of xml tags and also if possible I wanted to increase the size of the pop-up window as well as to reduce the size of image that fits the pop-up window.
My configuration file is like the below:
<?xml version="1.0" ?>
<configuration>
<title>{NAME}</title>
<medias>
<media chartfields="" type="image" imagesource="{LINK_NEW}" imagelink="{LINK_NEW}" />
</medias>
<fields>
<field name="NAME" alias="NAME" visible="true"/>
<field name="LOCID" alias="LOCID" visible="true"/>
<field name="STATE" alias="STATE" visible="true"/>
<field name="ACAIS" alias="ACAIS" visible="true"/>
<field name="LINK_NEW" alias="LINK_NEW" visible="false"/>
</fields>
<showattachments>true</showattachments>
</configuration>
Thanks in advance.
I just figured out that we cannot access larger images in the pop-up window, which might be an enhancement that needs to be done with the pop-up configuration.
And also figured out that accessing larger images is possible through FLEX API by using image control in the pop-up configuration. Below are the few links that might be helpful.
Image Control:
http://livedocs.adobe.com/flex/3/html/help.html?content=controls_16.html
PopUpRendererSkin:
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/skins/PopUpRendererSkin.html

Location URI's for action sets

I want to add menu and toolbar item in the eclispe using the commands.
I want to add menu item after the Run -> External Tools menu item and toolbar action also after the External Tools action.
I have used below Location URI's but they are not helping.
for the Menu Item : menu:org.eclipse.debug.ui.launchActionSet?after=org.eclipse.ui.externaltools.ExternalToolMenuDelegateToolbar
for the toolbar action : toolbar:org.eclipse.debug.ui.launchActionSet?after=org.eclipse.ui.externaltools.ExternalToolMenuDelegateToolbar
My plug-in.xml snippet appears as shown below.
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="toolbar:org.eclipse.debug.ui.launchActionSet?after=org.eclipse.ui.externaltools.ExternalToolMenuDelegateToolbar">
<command
commandId="com.sample.uvextensions.commands.sampleCommand"
icon="icons/sample.gif"
id="com.sample.uvextensions.toolbars.sampleCommand"
label="Debug UV Project"
style="push"
tooltip="launches keil&apos;s debug session for selected project">
</command>
</menuContribution>
<menuContribution
locationURI="menu:org.eclipse.debug.ui.launchActionSet">
<command
commandId="com.sample.uvextensions.commands.sampleCommand"
icon="icons/sample.gif"
id="com.sample.uvextensions.menus.sampleCommand"
label="Debug UV Project"
style="push"
tooltip="launches keil&apos;s debug session for selected project">
</command>
</menuContribution>
Any pointers will be greatly helpfull for me.
Thanks in Advance.
Menu contributions can't refer to action sets because actions sets are processed after menu contributions and are not visible for the former.
You can declare your own action set and add actions with the same menubarPath ("org.eclipse.ui.run/ExternalToolsGroup") and toolbarPath ("org.eclipse.debug.ui.launchActionSet/debug") as those in the external tools plugin. To get your actions placed after those from the other plugin, make sure your action set ID is greater than "org.eclipse.ui.externaltools.ExternalToolsSet".