My Plugin is by default display on middle bottom of Eclipse, how could I make it to display at right side of Eclipse?
My plugin.xml looks like below, any hints will be more than welcome!
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.views">
<category
name="My Plugin"
id="com.xx.plugin">
</category>
<view
name="XX my plugin View"
icon="icons/sample.gif"
category="com.xx.plugin"
class="com.xx.MyPluginView"
id="com.xx.MyPluginView">
</view>
</extension>
</plugin>
You use the view element of the org.eclipse.ui.perspectiveExtensions extension point for this. You have to do it for each perspective you want to customize.
Something like the following should show the view in the same stack as the outline view at the right in the Java Perspective.
<extension
point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="org.eclipse.jdt.ui.JavaPerspective">
<view
relative="org.eclipse.ui.views.ContentOutline"
visible="true"
id="com.xx.MyPluginView"
relationship="stack">
</view>
Note: You may have to reset the perspective to get the extension picked up.
Related
How to put two views into one tab group in eclipse plugin project
looks like two Views are separate , I want to display them as tabs
Any hints will be more than welcome!
Below is an example of plugin.xml
<plugin>
<extension
point="org.eclipse.ui.views">
<category
name="Category "
id="com.my.plugin">
</category>
<view
name="View One"
icon="icons/sample.gif"
category="com.my.plugin"
class="com.my.plugin.views.ViewOne"
id="com.my.plugin.views.ViewOne">
</view>
<view
name="Second View"
icon="icons/sample.gif"
category="com.my.plugin"
class="com.my.plugin.views.SecondView"
id="com.my.plugin.views.SecondView">
</view>
</extension>
</plugin>
I have defined an Eclipse view like this:
<extension
point="org.eclipse.ui.views">
<category
id="my.category"
name="My category">
</category>
<view
category="my.category"
class="com.my.View"
icon="icons/sample.gif"
id="my.View"
name="My View">
</view>
</extension>
The view is opened at the bottom of the workbench (next to the Console view) by default, how can I define that the view should be opened at the left side of the workbench? in the Project Explorer area.
Use the org.eclipse.ui.perspectiveExtensions extension point to define the layout of your view in a particular perspective.
The following example is how the JUnit view is positioned next to the Package Explorer view in the Java perspective:
<extension
point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="org.eclipse.jdt.ui.JavaPerspective">
<view
relative="org.eclipse.jdt.ui.PackageExplorer"
visible="false"
id="org.eclipse.jdt.junit.ResultView"
relationship="stack">
</view>
I develop an Eclipse RCP application and I don't want to use the default menu and toolbar of my Eclipse.
Here is my plugin.xml file
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
id="application"
point="org.eclipse.core.runtime.applications">
<application>
<run
class="pmetest.Application">
</run>
</application>
</extension>
<extension
point="org.eclipse.ui.perspectives">
<perspective
name="PME Perspective"
class="pmetest.ui.perspective.Perspective"
id="pmetest.perspective">
</perspective>
</extension>
<extension
point="org.eclipse.ui.views">
<view
name="My FX View From PME"
icon="icons/sample.gif"
class="pmetest.ui.view.fx.MyViewPart"
id="com.ongoladev.pmetest.MyViewPart">
</view>
<view
class="pmetest.ui.view.FormView"
id="com.ongoladev.pmetest.formview"
name="FormView from PME"
restorable="true">
</view>
</extension>
<extension
id="product"
point="org.eclipse.core.runtime.products">
<product
application="pmetest.application"
name="Hello RCP">
<property
name="windowImages"
value="icons/alt_window_16.gif,icons/alt_window_32.gif">
</property>
</product>
</extension>
<extension
point="org.eclipse.ui.commands">
<command
defaultHandler="pmetest.ui.command.CommandExit"
id="com.ongoladev.pmetest.Exit"
name="Exit">
</command>
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"
locationURI="menu:org.eclipse.ui.main.menu">
<menu
id="filemenuid"
label="File My">
<command
commandId="com.ongoladev.pmetest.Exit"
label="Exit application"
style="push"
tooltip="Exit Application">
</command>
</menu>
</menuContribution>
</extension>
</plugin>
and that is what I get
I want to remove all unnecessery manu and toolbar.
Thanks
I inherited a 12-year-old application and in trying to update it to the latest Eclipse, ran into this problem of default menu items showing up. After trying multiple solutions, including this one, I was left with the Run menu.
This brought me to this page. I used the solution by #ShahzadIftikhar above and tweaked it.
To be specific, we have a class that extends WorkbenchWindowAdvisor and that class contained a postWindowOpen method that only called super.postWindowOpen(). After that call, I added the below code to specifically block the inclusion of the "Run" menu. This menu contained the "Add V8/Chrome JavaScript Exception Breakpoint" and External Tools menu items that were definitely not needed and the client specifically said "get rid of them".
IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IContributionItem[] items = ((WorkbenchWindow) workbenchWindow).getMenuBarManager().getItems();
for (IContributionItem item : items) {
if (item.getId().equals("org.eclipse.ui.run")) {
item.setVisible(false);
}
}
Once you get this block of code in your application, you should be able to just use the item ID for whatever you want to block.
For removing all defaults options in menu, You need to add this below code in ApplicationWorkbenchWindowAdvisor.java class.
#Override
public void postWindowOpen() {
IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IContributionItem[] items = ((WorkbenchWindow)workbenchWindow).getMenuBarManager().getItems();
for (IContributionItem item : items) {
item.setVisible(false);
}
}
To get full control over the menus and tool bar your application can use its own ActionBarAdvisor derived class. When you do this you create all the items yourself.
The action bar advisor is created in WorkbenchWindowAdvisor class which in turn is created from your WorkbenchAdvisor class.
If you create a RCP plugin project using the 'RCP application with a view' example Eclipse will create examples of these classes for you.
I am new in Eclipse RCP plug in development.
I had written one plug-in with my own perspective and added perspective specific menus within it.
My question is how to hide the default menus provided within Eclipse, like Edit, Navigated, Search, Project ?
I tried with using '< extension point="org.eclipse.core.expressions.definitions" >'
and putting my view specific condition, withing menu contribution's.
Any help is appreciated.
Best regards,
Mandar Phatak.
You need activities. Example from my current project:
<extension
point="org.eclipse.ui.activities">
<activity
id="arm.activity.disabled"
name="%arm.activity.disabled.name">
<enabledWhen>
<with
variable="selection">
<count
value="-1">
</count>
</with>
</enabledWhen>
</activity>
<activityPatternBinding
activityId="arm.activity.disabled"
pattern="org\.eclipse\.m2e\..*">
</activityPatternBinding>
<activityPatternBinding
activityId="arm.activity.disabled"
pattern="org\.eclipse\.search\..*">
</activityPatternBinding>
<activityPatternBinding
activityId="arm.activity.disabled"
pattern="org\.eclipse\.team\..*">
</activityPatternBinding>
<activityPatternBinding
activityId="arm.activity.disabled"
pattern="org\.eclipse\.compare.*">
</activityPatternBinding>
<activityPatternBinding
activityId="arm.activity.disabled"
pattern="org\.eclipse\.help\.ui\.PrefPageHelp.*">
</activityPatternBinding>
<activityPatternBinding
activityId="arm.activity.disabled"
isEqualityPattern="true"
pattern="org.eclipse.ui.ide/org.eclipse.ui.preferencePages.Workspace">
</activityPatternBinding>
<activityPatternBinding
activityId="arm.activity.disabled"
isEqualityPattern="true"
pattern="org.eclipse.ui.ide/org.eclipse.ui.preferencePages.Perspectives">
</activityPatternBinding>
</extension>
One approach is in your rcp application you have a class that extends ActionBarAdvisor and in the constructor of the class you can do something like this for example to remove the edit menu
configurer.getMenuManager().remove(IWorkbenchActionConstants.M_EDIT);
All common eclipse menus like edit will have a constant defined in the class above, do that for the menu's you want to remove from your application.
This is only one approach I'm sure there might be others but hope this gets what you need.
I want to add a property page in eclipse via my plugin. This property page must be enabled only for projects of my nature. I have written the below code in plugin.xml
<extension
point="org.eclipse.ui.propertyPages">
<page
class="com.test.me.ME"
id="com.test.me.ME"
name="ME">
<and>
<instanceof
value="org.eclipse.core.resources.IProject">
</instanceof>
<adapt
type="org.eclipse.core.resources.IResource">
<test
property="org.eclipse.core.resources.projectNature"
value="com.test.me.meprojectnature">
</test>
</adapt>
</and>
</page>
The above code works fine for the projects in project explorer and navigator view. But the same doesn't work in package Explorer view.
So, how to achieve the same functionality specific for package explorer view?
You should move your instanceof check inside adapt.
I have not tried it but my opinion is that in your package explorer there aren't org.eclipse.core.resources.IProject elements, you should try whatever input you have (for example org.eclipse.jdt.core.IJavaProject)
#nitind is right, you're specifying too many constraints. You want to say "Enabled when the selection is adaptable to an IProject and it's "projectNaure" property includes "my nature."
This should do it:
<extension point="org.eclipse.ui.propertyPages">
<page
name="My Property Page"
class="some.package.MyPropertyPage"
id="some.package.MyPropertyPage">
<enabledWhen>
<adapt type="org.eclipse.core.resources.IProject">
<test
property="org.eclipse.core.resources.projectNature"
value="some.package.MyNatureID"/>
</adapt>
</enabledWhen>
</page>