IntelliJ plugin localization - intellij-idea

I'm creating a plugin for Intellij IDEA. Following found tutorial now I have pretty simple working plugin. But my problem is the fact I don't know how to maintain localization for my actions.
Now I've got plugin.xml file with following actions tag:
<actions>
<group id="MyPlugin.TopMenu"
text="_MyPlugin"
description="My plugin toolbar menu">
<add-to-group group-id="MainMenu" anchor="last"/>
<action id="MyAction"
class="actions.MyAction"
text="_MyAction"
description="MyAction"/>
</group>
</actions>
This code means that my group and action will be shown as "_MyPlugin" and "_MyAction" regardless localization.
I found how to create resouces bundle and did it. Now I have strings.xml (as I used to for Android) with following content:
<properties>
<entry key="ActionName">_MyAction</entry>
</properties>
Another resource file called strings_ru.xml is combined with it into Resource Bundle, so I don't think I did something wrong with it.
I want to use resource reference to set text tag for my group and its actions. Is it even possible? If not should I create and register actions in runtime?

Related

DevOps Build with localization resources

I'm trying to build a solution using Azure DevOps and publish the result as a nuGet package in a private repository.
A project in the solution contains a localized resource Language.resx containing the English texts.
The localized versions are:
Language.da.resx, Language.se.resx and Language.no.resx yet none of these are included in the resulting nuget package.
I tried adding /target:Resource,Compile to the MSBuild arguments property of the Build Solution task in DevOps, but it just resulted in an error saying no 'Resource' target was found.
I'm sure I'm just missing something obvious, but I just can't see it.
I must be close, the nuGet package gets published after all, and works, except for the localization resources.
I inspected the resulting nuGet Package and extracted the DLL from the project in question. Opening the DLL in .Net Reflector 10 shows me that it does indeed contain the text strings in English, but no other languages.
It appears the localized ressources were indeed built by default, though not visible in .Net Reflector 10.
The reason is that they weren't included in the nuGet package in the Packaging task.
A bit of research lead me to add a .nuspec file to the project.
In this file, I specified the relevant files etc. and they are now included in the nuGet package.
Not ideal though, since the list of files and dependencies now have to be maintained manually. But I was unable to find a way of making it dynamic.
Most of the details in the .nuspec file was possible to be made dynamic though, using variables referring to the AssemblyInfo.cs file.
I ended up with the following content in the .nuspec file (some details cleaned though, since this is displayed in public)
Note: The word Release in the src attribute of the files section is the name of my build profile. Your solution might use a different name.
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<!-- The identifier that must be unique within the hosting gallery -->
<id>$id$</id>
<!-- The package version number that is used when resolving dependencies -->
<version>$version$</version>
<!-- Authors contain text that appears directly on the gallery -->
<authors>$author$</authors>
<!--
Owners are typically nuget.org identities that allow gallery
users to easily find other packages by the same owners.
-->
<owners>$author$</owners>
<!-- License and project URLs provide links for the gallery -->
<!--<licenseUrl></licenseUrl>-->
<!--<projectUrl></projectUrl>-->
<!-- The icon is used in Visual Studio's package manager UI -->
<!--<iconUrl></iconUrl>-->
<!--
If true, this value prompts the user to accept the license when
installing the package.
-->
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<!-- Any details about this particular release -->
<!--<releaseNotes></releaseNotes>-->
<!--
The description can be used in package manager UI. Note that the
nuget.org gallery uses information you add in the portal.
Must be included, and must never be empty.
-->
<description>$description$</description>
<!-- Copyright information -->
<copyright>$copyright$</copyright>
<!-- Tags appear in the gallery and can be used for tag searches -->
<!--<tags></tags>-->
<!-- Dependencies are automatically installed when the package is installed -->
<dependencies>
<dependency id="MicrosoftOfficeCore" version="15.0.0" />
<dependency id="Microsoft.Office.Interop.Word" version="15.0.4797.1003" />
</dependencies>
</metadata>
<!-- Files to include in the package -->
<files>
<file src="bin\Release\$id$.dll" target="lib\net462\$id$.dll" />
<file src="bin\Release\da\$id$.resources.dll" target="lib\net462\da\$id$.resources.dll" />
<file src="bin\Release\no\$id$.resources.dll" target="lib\net462\no\$id$.resources.dll" />
<file src="bin\Release\sv\$id$.resources.dll" target="lib\net462\sv\$id$.resources.dll" />
</files>
</package>

Error when uploading plugin to JetBrains Plugin Repository

I am trying to deploy my plugin to the JetBrains Plugin Repository, But getting the following error-
ID of edited plugin is null, but uploaded plugin has
ID="package_name". You can not change id of plugin!
However I have ensured the <id>package id </id> has not changed.
And also I am uploading this for first time.
Thanks in advance for the help.
Here is the plugin.xml-
<idea-plugin version="3">
<id>my package name</id>
<name>My Plugin Name</name>
<version>2.0</version>
<vendor email="support#skedsoft.com" url="http://www.skedsoft.com">SkedSoft</vendor>
<description><![CDATA[
plugin description
]]></description>
<change-notes><![CDATA[
plgin change details
]]>
</change-notes>
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description -->
<idea-version since-build="141.0"/>
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
on how to target different products -->
<!-- uncomment to enable plugin in all products
-->
<depends>com.intellij.modules.androidstudio</depends>
<extensions defaultExtensionNs="com.intellij">
<!-- Add your extensions here -->
</extensions>
<actions>
my action classes and details
</actions>
</idea-plugin>
There was a problem with plugin repository. You can upload your plugin now.

How to send SHChangeNotify in Wix

In my Wix project, I need to set an external application as the default program for a new file type, so I add some file associations in registry keys(weird I know, but I'm developing a plugin and I don't find a native way to deal with external programs).
MSDN says we should call SHChangeNotify if we change file associations. If not, the new association will not work until the system restarts. Here is my problem, how can I do this in Wix? I find a tool which implements this feature but what I need is hard code this in Wix Installer.
[solution] At first I add ProgId element the way #BdN3504 shows. Then I use Custom Action to send SHChangeNotify. Cheers~
Have you had a look at this answer?
You have to first locate the target application in a FileSearch and then reference that in an Extension element.
<Property Id="TARGETEXE">
<DirectorySearch Path="C:\Program Files (x86)\App"
Depth="0"
AssignToProperty="no"
Id="NppSearch">
<FileSearch Name="Target.exe"
Id="targetExeFileSearch" />
</DirectorySearch>
</Property>
<ProgId Id='Fileassoc.assoc' Description='File extension description'>
<Extension Id='assoc' ContentType='application/assoc'>
<Verb Id='open' Command='Open' TargetProperty='TARGETEXE' Argument='"%1"' />
</Extension>
</ProgId>
See the documentation for the
DirectorySearch Element
FileSearch Element
ProgId Element
Extension Element
and the Verb Element

Eclipse Plugin Development : How to add option in Right Click Menu

I have created an eclipse plugin. I am able to add a menu and submenu.
However, I am not able to add an option in the Right Click menu. Does anyone have any idea how to do that?
Here's an example (this code has filled with your preferences and classes and to be added to the plugin.xml):
<extension point="org.eclipse.ui.popupMenus">
<objectContribution
adaptable="true"
id=""
nameFilter=""
objectClass="org.eclipse.core.resources.IFile">
<action
id="org.eclipse.ui.articles.action.contribution.object.action1"
label=""
icon=""
menubarPath="additions"
class="">
</action>
</objectContribution>
</extension>
The provided solution using org.eclipse.ui.popupMenus is deprecated.
One should use the org.eclipse.ui.menus extension point.
In general you can configure a menuContribution using the plugin GUI, which will generate the plugin.xml for you. As you requested the menu to be available in the "Right Click menu" you can use popup:org.eclipse.ui.popup.any as locationURI. With additional configuration you can control under which circumstances the menu should be visible.
You can also edit the plugin.xml directly in the plugin.xml tab.
The generated plugin.xml will look similar to this:
<extension
id="menuid"
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"
locationURI="popup:org.eclipse.ui.popup.any">
.
.
.
</menuContribution>
</extension>
See Custom Popup menu in eclipse plugin for a similar problem.

Better Ways to Maintain Continuous Integration?

I find that I am always tuning and tweaking our CI setup as we add new projects. While there is NO question that the benefits are awesome for existing code that seldom changes, new projects or volitile ones seem to require more work as I have to configure each project to be "intergrated" as well as maintain an ever-growing CCNET.config file. Is there a better strategy short of building an utility to manage adding and modifying a CI setup?
I do a few things to try keep it under control:
1) Split the config file into two. I have one file that mostly stays the same and contains a set of constants e.g.
<?xml version="1.0" encoding="utf-8"?>
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<!-- Constant definition used by the projecct config to prevent changes being required for each iteration -->
<cb:define branch="branch name for source control"/>
<cb:define ciserver="Server name in here"/>
<cb:define devenv="Path to DEVENV"/>
<cb:define nunit="Path to NUNIT"/>
<cb:define cruisecontrol="Cruisecontrol Path"/>
<!-- Include file to the standard CI project definitions. This file is kept under source control -->
<cb:include href="config\CCProjects.config"/>
</cruisecontrol>
The use of constants allows you to make a single change and have it propagate through each task in the config file.
See docs
2) Keep the file with the projects in under source control. The project file gets updated as part of the SVN checkout. This helps track changes that get made and let you rollback without too much hassle.
Maybe it has got to the point where CC.Net is working against you rather than for you. I've heard good things about the ease of configuration of other CI servers, like Hudson, but it may not be a good fit with your build environment.
1/ Split your config file as you want
For example, I have a constants section, and each project is an include, so I can update each project quite independently and use constants across projects.
ccnet.config
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<!-- Shared constants -->
<cb:define WorkingFolderBase="D:\dev\ContinuousIntegration\WC" />
<cb:define ArtifactFolderBase="D:\dev\ContinuousIntegration\Artifact" />
<cb:define ConfigFolder="projects" />
<cb:define SvnBasePath="http://myserver.com/svn" />
<cb:define SvnUsername="Myusername" />
<cb:define SvnPassword="MyPassword" />
<!-- MyProject1 -->
<cb:include href="projects/MyProject1.config"/>
<!-- MyProject2 -->
<cb:include href="projects/MyProject2.config"/>
</cruisecontrol>
MyProject1.config
<project name="MyProject1" queue="Q1" queuePriority="1">
<artifactDirectory>$(ArtifactFolderBase)\MyProject1</artifactDirectory>
<workingDirectory>$(WorkingFolderBase)\MyProject1</workingDirectory>
<!-- SVN implementation -->
<sourcecontrol type="svn" username="$(SvnUsername)" password="$(SvnPassword)">
<trunkUrl>$(SvnBasePath)/MyProject1/trunk/</trunkUrl>
<workingDirectory>$(WorkingFolderBase)\MyProject1</workingDirectory>
</sourcecontrol>
[...]
</project>
2/ Use version control on CC.NET (I recommand on the whole installation) or on config files.
3/ Keep it simple! have all actions executed by a batch file (Compile applciation, compile tests, run tests, get coverage, static analyser, generate reports ...).