Where is com.intellij.modules.lang defined - intellij-idea

This should be an easy one, but it's driving me mad. I'm new to implementing plugins, and one that I'm looking at has the following dependency:
<depends>com.intellij.modules.lang</depends>
I cloned the intellij-community project and was expecting to see this defined as an extensionPoint in one of the many plugin.xml files in the project, but either I can't search correctly or it is somewhere else.
Anybody knows where I can find this definition?
Thanks,
a

I'm still no expert in plugin development, but I think I figured out parts of my problem.
First, I was wrong about com.intellij.modules.lang having to be defined as an extension point. Name of extensions need to have corresponding extension points, not dependencies.
Then com.intellij.modules.lang is defined in a
<module>
tag in a few xml files in the intellij source code, which is part of the SDK used by this project. One such file is platform/platform-resources/src/META-INF/PlatformLangPlugin.xml. Now I need to familiarize myself with the concept of modules, but the original question is not moot.
Thanks to anyone who spent a few seconds thinking about this problem.

Related

Intellij - Find path to src directory

I am creating an IntelliJ plugin and I am using JavaParser for one of my features. My plugin will allow users to click a gutter icon next to a method and automatically navigate to the tests associated with that method.
To achieve this, temporerily I have used the line:
typeSolver.add(new JavaParserTypeSolver(new File("/home/webby/IdeaProjects/project00/src/")));
My problem is that I need to pass the source folder of the given module into this type solver. Is there any way I can find the source folder programmatically? Perhaps from an actionEvent?
I have tried things along the lines of the following:
actionEvent.getData(PlatformDataKeys.PROJECT).getBasePath()
This gives me: '/home/webby/IdeaProjects/project00/' but I'm struggling to see how I can get the source folder? I feel there should be a fairly straight forward way of doing this using IntelliJ's SDK but I have not found anything in the documentation or anywhere else online.
Any and all solutions welcome!
Many Thanks,
James
You can use
ModuleRootManager.getInstance(module).getSourceRoots()
to access sources roots of a module. Refer to IntelliJ SDK Docs for details.
BTW IntelliJ IDEA provides special API to syntax trees of Java files, it works more efficiently and better integrates with other IDE features than external JavaParsers.
And it's better to ask questions about IntelliJ IDEA API on a special forum.

Xcode Preprocessed File Troubleshooting Circular Import Loop

I am using Xcode 4.6.2 and i believe i am facing circular import issue in my project which i am unable to troubleshoot. Due to which i am not able to access few methods from another class using the class method. See my earlier question here.
Although i am using #class instead of #import in my header files, still i am unable to fine where exactly the problem is. Members of the StackOverflow have suggested me to use Xcode's built in functionality found under Product > Generate Output > Preprocessed File.
I have used this functionality and it generated a file that is too long to follow and i don't know what to do with it.
I have tried searching how to use it to troubleshoot the issue but couldn't find much help. Can anyone help me point out how to use "Preprocessed File" to troubleshoot my issue. Thanks!
I also went through your earlier question you have mentioned inside the question. You have said that you are using #class instead of #import in your header files, the methods that you are trying to access are declared in the header files and there are no typos of any kind.
In such cases, usually no body points this issue but i am going to do it anyway because i have faced such issues many times. You have probably created many copies of your project to work on each functionality and also keeping a working project.
When you do this, sometimes Xcode is still using the older copies of few files. That means it is still using the older copy of the TheFeedStore.h when the methods you are trying to access were not declared by you.
How to solve this problem is very simple. Go to the file from which you are trying to access the methods and the files in which these methods are declared.
In the Utilities section on the right hand side, check the location and full path under "Identity and Type" area.
First check the names of the project, if it is different from the project name that you are working on, that means Xcode is still pulling the old copies of the files from the previous revision of your project. See the blue arrows where the project name is 13SampleMoreRequests in my case.
If this name is same as your project name, then my answer does not solve your problem. If its different, you should use the new copies of the file by browsing the new location using the sign that is pointed out by red arrow.
Once you browse and use the new files, your problem will be solved and you will be able to access the methods. If you still can't, copy these files, delete from the project and then add them again and you won't face this problem.
Hope this helps!

Make IntelliJ aware of links to Java elements in XML files

I have a custom XML format that links to Java resources. For the sake of simplicity let's assume my XML file would look like this:
<root>
<java-class>my.fully.qualified.class.name</java-class>
</root>
Eventually my references will be somewhat more complicated. It will not contain the fully qualified class name directly and I will need some logic to resolve the correct class, but I want to keep the example as simple as possible here.
Now I want it to be possible to Strg+Click on the element's text and want IntelliJ to carry me to the .java file, just like it is possible in Spring-XML files. In the IDEA Plugin Development FAQ there is a link called "How do I add custom references to Java elements in XML files?" which so much sounds like exactly what I need. Unfortunately it links to a discussion where someone is more or less done implementing something like this, having some minor problems. Nevertheless I understood that I probably need to write an implementation of the interface com.intellij.psi.PsiReference. Googling for "PsiReference" and "IntelliJ" or "IDEA" unfortunately did not bring up any tutorials on how to use it, but I found the class XmlValueReference which sounds useful. Yet again googling for "XmlValueReference" did not turn up anything useful on how to use the class. At least the PSI Cookbook tells me that I can find the Java class by using JavaPsiFacade.findClass(). I'd be thankful for any tutorials, hints and the like, that tell the correct usage.
The above linked discussion mentions that I need to call registry.registerReferenceProvider(XmlTag.class, provider) in order to register my provider once I eventually managed to implement it, but of which type is "registry" and where do I get it from?
First of all, here's a nice tutorial that came up a few days ago, which explains the basics of IntelliJ plugin development (you should take a look at the section Reference Contributor).
You will likely have to define your own PsiReferenceContributor, which will be referenced in your plugin.xml like this:
<psi.referenceContributor implementation="com.yourplugin.YourReferenceContributor"/>
In your reference contributor, there's a method registerReferenceProviders(PsiReferenceRegistrar) where you will be able to call registry.registerReferenceProvider(XmlTag.class, provider).
Finally, in your instance of PsiReferenceProvider, you will have to test the tag name to filter out tags which don't contain class references, then find the right Java class using JavaPsiFacade.findClass().
From my experience, the best place to get help regarding IntelliJ plugin development is JetBrains' forums.

Problem getting version number from assembly file with msbuild

I'm working on msbuild to get version info from assembly file. But i got a problem that the value $(MaxAssemblyVersion) is always empty. The only difference here is that i got a .Net solution including several projects. So i have a GlobalAssemblyInfo.cs at the root folder and Assemblyinfo.cs inside every included project. Anyone has any suggestion for my situation? Is there any way to work with GlobalAssemblyinfo.cs?
Look forward to your reply!
Every comment will be very helpful and appropriated.
Many thanks,
Depending on what point during the build you need the assembly version, you could extract it from your outputs using the GetAssemblyIdentity Task.

Is AssemblyInfo.cpp necessary?

I want to remove AssemblyInfo.cpp, because of some metadata errors that sometimes come up.
Is AssemblyInfo.cpp useful for anything? Or can it be removed without any problem?
I've discovered one distinction for this file: it has to do with values reported under calls to Assembly.GetReferencedAssemblies. I was working on tracking version numbers of our binaries from our SVN repository by embedding the revision numbers into them. Initially I too was updating AssemblyInfo.cpp and found nothing reported in the file property details tab for the binary. It seemed this file did nothing for me in terms of updating those details, which was not the case with similar updates to a csproj's AssemblyInfo.cs. Why the difference right?
Now in one such csproj we happen to reference a vcxproj and that csproj dumps to a log the versions of all its referenced assemblies using the .NET Assembly.GetReferencedAssemblies method. What I discovered was that the number that was being reported in that log was not the vcxproj's version as given by the VS_VERSIONINFO resource I added (which does get the version details into the file properties details tab). Instead the number reported was actually matching that defined in the AssemblyInfo.cpp.
So for vcxproj files it looks like VS_VERSIONINFO is capable of updating the contents you find under the file properties details tab but AssemblyInfo.cpp is capable of exposing the version to GetReferencedAssemblies. In C# these two areas of reporting seem to be unified. Maybe there's a way to direct AssemblyInfo.cpp to propagate into the file details in some fashion, but what I'm going to wind up doing is duplicating the build info to both locations in a prebuild step. Maybe someone can find a better approach.
So far I never had the AssemblyInfo.cpp in my managed c++ dlls, so I don't think it is necessary.
(I just added the file to have version information for my c++ dlls).
Why not just fix the errors? On that note, what errors are you getting?
This file provides information such as a version number which is definitely needed in order to use the assembly you have built.