eclipse rcp perspectiveExtension showInPart not visible - eclipse-plugin

I want my ViewPart add to Show In group. I added perspectiveExtension and add showInPart under it, when I run/debug my plugin, my view not appears in Show In context menu group.
Here is my extension point in plugin.xml
<extension
point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="org.eclipse.jdt.ui.JavaPerspective">
<showInPart
id="com.ex.views.DebugView">
</showInPart>
</perspectiveExtension>
<perspectiveExtension
targetID="org.eclipse.ui.resourcePerspective">
<showInPart
id="com.ex.views.DebugView">
</showInPart>
</perspectiveExtension>
</extension>

Using Eclipse 4.15 (though likely also any 4.x), I had to start in a new workspace for such changes to have an effect. When debugging Eclipse (in a non-clean/old workspace), the changes had no effect.

Related

Modify the icon of an eclipse template plugin

Followed the steps here and created an eclipse plugin based on the Hello World, Command template - exported it, dropped in the plugins folder of my eclipse install and I saw the menu and toolbar entries alright.
Then I had the idea to modify the icon it showed in the toolbar item. Modified the plugin.xml as in (git diff):
<menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
<toolbar id="gr.uoa.di.regas.eclipse.poc.toolbars.sampleToolbar">
<command
commandId="gr.uoa.di.regas.eclipse.poc.commands.sampleCommand"
- icon="icons/sample.gif"
+ icon="icons/my_icon.gif"
tooltip="Say hello world"
id="gr.uoa.di.regas.eclipse.poc.toolbars.sampleCommand">
</command>
</toolbar>
</menuContribution>
</extension>
and of course added my_icon.gif into the icons directory. Initially eclipse just kept loading the old icon till I deleted it and reexported just to see the little square that means 'icon not found'
So how do I change the icon ? Also where are the specifications for the icon - can't find any ?
EDIT: renamed the icon to icon.gif thinking the underscores might be the issue - nothing changed - of note that eclipse went ahead and renamed the icon in the plugin.xml (I renamed through the package explorer) - so the setup seems correct - eclipse knows about icon.gif.
EDIT2: the repo for the plugin: https://github.com/Utumno/eclipse_poc

how to load intellij settings on startup

In eclipse we have to extend AbstractPreferenceInitializer, and define the below lines in plugin xml, to load preference details on eclipse startup.
<extension
point="org.eclipse.core.runtime.preferences">
<initializer
class="org.example.preferences.PreferenceInitializer">
</initializer>
</extension>
How do we do the same thing in intellij?
Persisting State of Components

popup:org.eclipse.jdt.ui.PackageExplorer not visible for Java projects

I'm writing a plugin for Eclipse to help me with some custom errors and warnings. Started by creating a new plugin project using the wizard, chose the option with the nature and markers in it.
This automatically added a menu item in the project's context menu (popup:org.eclipse.jdt.ui.PackageExplorer?after=additions)
This seemed to work for most projects. Except the projects i needed it for. The menu item simply does not show up for Java projects in the Package Explorer.
I only changed the default ?after to be ?before, so the menu-item is in a location that suited me better (for the projects that it does work on).
Screenshot if what i've got now
That shows it's working on a non-java project in the Package Explorer.
I also added the same menu-item to the Project Explorer, all works fine there.
Here is a link to the plugin.xml i currently have.
The project it DOES NOT work on, is a simple java project freshly generated from the Eclipse "New -> Java Project" wizard. Any other java project doesn't work either.
The project it DOES work on, is freshly generated from the "Plug-in Development -> Update Site Project" wizard.
Stuff i tried:
I know it is not the same as popup:org.eclipse.jdt.ui.PackageExplorer not visible, i'm adding the menu-item to the context menu of a project, not files or directories.
However, i did try using:
<adapt type="org.eclipse.core.resources.IResource">
<test property="org.eclipse.core.resources.contentTypeId" value="org.eclipse.jdt.core.IJavaProject" />
</adapt>
instead of the <instanceof> tags, which also did not work. in fact, removing the whole <instanceof> tag does not even work.
I know it is not the same as Eclipse plugin menu item is not visible, the generated plugin.xml used selection, which i later changed to activeMenuSelection because that matched the documentation, and what the Plug-in Selection Spy says it actually is. Again, no change.
I think it is not the same as How create popup menu item in PackageExplorer only for directories, but i did try to use the suggested code and toyed around with it, no luck.
So, to summarize:
This is my first Eclipse plugin, most of the GUI stuff is generated from the Plug-in Developent wizard. Now i hope a real wizard can lead me to the answers i seek.
The <adapt> tag gave me an idea to adapt the project to an IResource. Then check for natures from inside the <adapt> tag. And that seemed to work!
The Platform Expression Framework page at eclipse.org also helped me understand what each of the tags exactly do.
So, i think my problem was actually similar to the one i linked first (popup:org.eclipse.jdt.ui.PackageExplorer not visible). Feel pretty dumb about that now...
Relevant part of my current plugin.xml:
<visibleWhen checkEnabled="false">
<with variable="activeMenuSelection">
<count value="1" />
<iterate operator="and">
<adapt type="org.eclipse.core.resources.IResource">
<and>
<not>
<test property="org.eclipse.core.resources.projectNature" value="com.mycompany.converterhelper.javaFileNature" />
</not>
<test property="org.eclipse.core.resources.projectNature" value="org.eclipse.jdt.core.javanature" />
</and>
</adapt>
</iterate>
</with>
</visibleWhen>
And a link to the entire plugin.xml
I want to thank Calon for his time and effort :-)

My plugin doesn't show up in Eclipse "Show view"

I created my first Eclipse plugin.
Plugin has one view.
When I ran my plugin project(Overview>Testing section>Launch an Eclipse application), it shows in Eclipse workbench and "Show view" menu.
Then I copy & paste exported plugin jar file to Eclipse's plugins folder.
Unfortunately I can't found my plugin view in Show view menu.
I also paste dropins and dropins/plugins folder.
But it doesn't works.
OS : Windows 7
Eclipse : Eclipse Java EE IDE for Web Developers [Kepler Service Release 2]
plugin.xml
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.views">
<category
name="String Table"
id="com.andcontinue.stringtable">
</category>
<view
name="String Table"
icon="icons/sample.gif"
category="com.andcontinue.stringtable"
class="com.andcontinue.stringtable.views.StringTable"
id="com.andcontinue.stringtable.views.StringTable">
</view>
</extension>
<extension
point="org.eclipse.help.contexts">
<contexts
file="contexts.xml">
</contexts>
</extension>
</plugin>
I don't know why plugin be not displayed in Show view.
Other references
build.properties
source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
.,\
contexts.xml,\
icons/,\
META-INF/,\
.classpath,\
src/,\
MANIFEST.MF
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: String Table
Bundle-SymbolicName: (MyPackage);singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: (MyPackage).Activator
Bundle-Vendor: Vendor
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources;bundle-version="3.8.101",
org.eclipse.jdt.core;bundle-version="3.9.2"
Bundle-ActivationPolicy: lazy
Export-Package: (MyPackage),
(MyPackage).views
Import-Package: org.eclipse.jface.text
Bundle-ClassPath: .
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Please help me.
Thank you.
Some Clues:
Check after installation of plugin whether is it appearing in Running Platform. Go to Window > Preferences> Plugin Development > Target Platform select Running Platform click on Edit and check your plugin. The presence shows that Platform detected your plugin but there may be some issues in your code.
Note: I am assuming you used the Running platform as your target.
Instead of directly copying the jar into folder. Install this plugin via GUI.
Export your plugin to an external folder or to an archive file. Go to Help > Install New Software... Click on Add button then select a local folder or archive file. If there were some problems exists while exporting then this installer displays this.
This may also happen if the plugin you are using expects latest version of some library or compiler in your system. In my case, I was trying to install SonarLint plugin and although installation was successful, I could not see it in View because it only supported Java11 or above. You can check out further details of it in my answer here

Cannot contribute extension from a fragment

I am working on a set of plugins and fragments on eclipse 4.3 (Kepler) but using the 3.x model.
One plugin contains part of the application model and has a fragment which contributes some model editors. (This seems right to me - tell me if it's unnecessarily complicated)
In the main app these editor contributions are not listed. I changed the fragment to a plugin and the editors became visible.
I could change the fragment to a plugin but this would mean that I have to expose more of the model.
I could move the fragment to the host plugin but this would mean mixing model and view (perhaps not a big deal)
Is it generally not possible to contribute from a fragment or have I done something wrong?
Here is the fragment:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<fragment>
<extension
point="org.eclipse.ui.editors">
<editor
class="com.acme.atf.device.ui.editors.NullConfigEditor"
default="false"
id="827299e9-6039-4a76-bfa6-08ef2d7f8724"
name="VariableEditor">
</editor>
<editor
class="com.acme.atf.device.ui.editors.SerialConfigEditor"
default="false"
id="cbaba4b2-8380-4ae5-9896-542cf97ca8cc"
name="SerialEditor">
</editor>
</extension>
Further information
The plugin hierarchy looks like this: (P=plugin, F=fragment)
com.acme.atf.app (P)
com.acme.atf.device (P)
com.acme.atf.device.help (F)
com.acme.atf.device.ui (F)
com.acme.atf.model (P)
com.acme.atf.core.ui (P)
An action in com.acme.atf.app attempts to load an editor (which happens to be in device.ui) which cannot be found. If I change device.uito a plugin then the editor is found.
Just managed to solve very similar problem with Eclipse 4.4.1. Unfortunately, the solution was to use clean workspace (I've imported my projects from Git).
Before that, I tried "playing" with version numbers of host and fragment, singleton flags, recreating fragment project, cleaning all projects and configuration of my RCP app. Also, I used OSGI console trying to get some additional info, but it reported only that:
Host plug-in org.aaa.bbb is in ACTIVE state (with no fragments)
Fragment bundle is in INSTALLED state (reporting "Unresolved requirement: Fragment-Host: org.aaa.bbb")
I think this is a bug and garbaged workspace (launch) configuration may be the cause. Hope this helps someone.