Modify the icon of an eclipse template plugin - eclipse-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

Related

What is required to run a hello world in kotlin with IntellJ

I have a Mac (Catalina OS) with Java 15 and IntelliJ 2020.2 (community edition) installed. The kotlin plugin is also installed. When I create a new Kotlin Project, add a main function, then there is way to run it, there is no 'Start' Button next to the main function. The problem is obviously that it doesn't find the runtime. The iml file looks as follows
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
</component>
</module>
When I click on 'add framework support', I can add a new KotlinJavaRuntime which then just appends an <orderEntry> to the iml file with the name KotlinJavaRuntime (2).
I don't want to use maven or gradle here. I know that gradle can resolve the dependencies for me. I just want a plain vanilla Kotlin hello world project. The documentation has a 'Getting Started with IntelliJ IDEA' section which just mentions the Kotlin plugin for IntelliJ. There seems to be no requirement to have gradle or maven installed, the plugin should do it.
I know that you can use brew install kotlin to install the SDK manually, but then the documentation is wrong and the plugin alone cannot run Kotlin with a prior manual installation of the SDK or the usage of maven/gradle.
I think I know what happened in this case.
The Kotlin Code was loaded as an 'IntelliJ' Module inside a Java project that was using maven. In IntelliJ there's a hidden folder .idea/libraries/ which was missing the description of the Kotlin Runtime (this makes sense, since the dependencies were managed via maven). I have restarted and created a new project from scratch. This time you'll see the file .idea/libraries/KotlinJavaRuntime.xml, which is exactly what is referenced from the iml file. The .idea folder is very magic. For me the confusion is that modules in IntelliJ are not really isolated from the project, they share - like in this case - the .idea folder.
I hope this helps also other users.
If you created the kotlin-file yourself, you have to tell IntelliJ that it should run this file.
Normally shows a run icon next to your main method.
run button/icon
Option 2: Right Click on the file containing the main method and see if there is a run this file option.
Option 3: add run config manually
Click add config which should be on the left of the run button (don't mind that it is disabled)
Click + and choose Kotlin.
Set main class to MainKt which is the default for kotlin

eclipse rcp perspectiveExtension showInPart not visible

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.

Intellij is not showing "External Libraries" in Project Tab

There is nothing on left. It is a maven project. Why?
I've had the same problem and narrowed it down to the following configuration that might have been messed up during the upgrade.
File (on Mac): ~/Library/Preferences/IntelliJIdea2018.1/options/projectView.xml
<application>
<component name="ProjectViewSharedSettings">
<option name="showLibraryContents" value="false" />
<option name="showMembers" value="true" />
</component>
</application>
Change/remove the showLibraryContents entry. This setting is no longer available in the UI, "External Libraries" are always shown.
I solved this by selecting "Project" as view (by default i had "Project Files"). Hope this helped.
Project View VS. Project Files view
I was facing the same issue on windows, i solved it by
right click on pom.xml > maven > reimport
Then reopen the project, It worked for me.
Hmmm, it seems I have seen this same kind of thing recently. Check your module settings (right click on highest level folder - open module settings, or Command-;). Make sure you have one module if it is a single-POM project, and check the sources, paths, dependencies tabs and make sure they look right. I think I've seen this once when I created a module manually rather than letting intellij create one for the Maven module automatically.
That "recycle/refresh" icon on the far right pane you show - the Maven project pane - can also sometimes get it to fix things it didn't get right when you initially check out project.
If maven re-import does nothing, check your pom.xml for errors and try commenting out the offending ones (marked in red).
In Intellij: Ctrl + Alt + Shift + S -> Select Modules and ensure that there is only one module. Delete the other ones.
If all else fails:
In Intellij, Select "Invalidate caches/Restart" -> Close Intellij -> Go to the project folder and delete .idea folder -> Reopen Intellij and "mvn clean install"
Deleting ./idea directory and re-importing the project worked for it.

JavaFX - (IntelliJ) FXML loader (NullPointerException: Location is required)

I get a NullPointerException for FXML loader when I execute the below in IntelliJ, but not in Eclipse IDE
Parent root = FXMLLoader.load(getClass().getResource("/view/MainView.fxml"));
Please note, the project is the same (not copy) opened in the 2 IDE's simultaneously, since it is the same project opened, the file / folder structure is the same. My search in this forum & on google for this specific issue so far has drawn blanks.
Seek guidance as to what settings I need to check / change in the IntelliJ to get it working?
Managed to resolve this finally.
I re-imported the project to IntelliJ as a Gradle project & added the steps in Gradle Build file as mentioned in the link earlier.
The same error occured to me. My project used to be a Maven project, but I tried to remove all of those components. It appears I didn't quite succeed in doing so.
I noticed that the fxml files were not properly copied into the target directory.
In .idea/compiler.xml I changed the following line:
<profile name="Maven default annotation processors profile" enabled="true">
to now read:
<profile name="Maven default annotation processors profile" enabled="false">
This fixed the problem and allowed the FXMLLoader to find the fxml file.

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 :-)