Are the contents of a fragment visible outside the host plugin? - eclipse-plugin

I have never worked with plug-in fragments before. I thought that by creating a new class within a fragment and exporting the package that contains it in the fragment's manifest, I'd be able to access that class from another plug-in that already has a dependency on the host plug-in. However, I cannot seem to make this work. Are the contents of a fragment ever visible to any plug-in besides the host plug-in? If so, is there something special I have to do to allow this?

The problem is not, that the contents of the fragment aren't visible to another plugin: They are - just try loading e.g. a properties file from the classpath, it still works if that properties file is provided by the fragment.
But what you don't have, is compile-time information about the fragment's contents. That's the principle of a fragment: You can't have a dependency on it. And you don't know, if somebody has fragments installed or not.
It's also not only a problem that just "any plug-in besides the host plug-in" has. It's a problem, that even the host-plugin itself has. It doesn't know about the fragment's existence at compile-time.
You also can't reliably use a fragment to override parts of the host plug-in's classes: FAQ Can fragments be used to patch a plug-in? , if that's what you want to do. The page also describes, how it can be done.
Hope this helps.

Related

Intellij issue with "Command" groovy class

I have a grails domain class called "Command.groovy", which isn't being picked up by intellij as a domain class, for any and all purposes (such as highlighting that class or importing it in files, it says it's not found).
However, my code still compiles and works.
I tried looking online about this issue but haven't found anything about this.
Thanks #CrazyCoder, I found the answer where you mentioned.
The problem was the file was mapped to auto detect file type by content for some reason. (Found in settings->file types->Auto-detect file by content)

What is the origin of $generalUtil in my atlassian-plugin.xml?

I'm studying the code of a custom Confluence plugin, which contains an atlassian-plugin.xml file that includes references to two variables $generalUtil and $helper, but I find no definitions of them whatsoever in the entire project. They simply work and it appears to me that they are magically instantiated out of thin air.
<web-item key="configtab" name="configtab" section="system.space.tools/addons">
<label key="myplugin.space.tools.addons.tab.label" />
<link>/spaces/myplugin-config.action?spaceKey=$generalUtil.urlEncode($helper.spaceKey)</link>
</web-item>
The $generalUtil must be an instance of com.atlassian.confluence.util.GeneralUtil, which also has a method urlEncode(). But where does this variable originate from?
What puzzles me even more is the $helper, which has a spaceKey field/method that I find in the code, but without any relationship to any kind of Helper class. The $helper also appears in a velocity template, but also without any definition of it. Any ideas where this stuff is documented?
generalUtil is documented here: https://docs.atlassian.com/ConfluenceServer/javadoc/7.11.6/
I think helper is https://docs.atlassian.com/ConfluenceServer/javadoc/7.11.6/com/atlassian/confluence/themes/GlobalHelper.html
They are injected into the Velocity context used to render that link.

Intellisense - deduce right Class by its methods

I'm used to work with NetBeans and now I'm trying IntelliJ. So my question is: Does IntelliJ has a way to get right class by its methods?
For example, in NetBeans if I write:
glGenBu // Intellisense will kick in and will suggest me
to use GL15.glGenBuffers() method from GL15 class
This will automatically import the right library.
This is very handy because I'm working with LWJGL and it has a bad way to manage OpenGL methods ('GLXX' where XX is the version of OpenGL and all methods that appeared in that version are stored in that class) and I never remember the right class where my desired method is.
Thank you.
Pressing Ctrl+Space when you already see completion list will show more suggestions, with static methods from the entire project among them. See https://www.jetbrains.com/help/idea/auto-completing-code.html for more details.

Javafx dynamically fxml load at Runtime

I have an application that cover a wide number of use cases each with completely independent workflows but workflows are pretty static after installation.
I have therefore created an HBox placeholder that will load the workflow for an installation.
Is there a way to dynamically load a section of the fxml from a database or a separate file archive? This fpml will have to have its own set of images and resources needed to achieve the workflows functionality.
TBH, I don't know where to start on this one.
Regards
I do not quite understand your problem. You can modify the scene graph at any time you want. So, of course it is possible to load a part of the scene graph from an FXML file at any time and hook it up to the already existing part. In your controller you have access to your HBox placeholder and when you have loaded the second part of the scene graph you can just add it via hbox.getChildren().add(newpart), were newpart is the root node of your second scene graph part. Of course you have to make sure that the layout works correctly for your constellation.
Your question seems nonsense because the FXML is always loaded dynamically. My guess is you are confused because most of the examples use FXML in the same bundle as the classes and so are loaded trough the getResource method. But the FXML loader takes any kind of InputStream, so you can just open a database blob or a file as an InputStream and give that InputStream as an argument to the loader. Be sure to catch the runtime exceptions though :)
Hope this helps.

Metro Style App MFT "Class Not Registered" Error

I am currently designing an app with the Metro app framework which includes a live video chat feature. I am using the GrayscaleTransform MFT included in the MediaCapture sample (at this point simply copy-and-pasted from the sample).
However, when I try to add the grayscale effect to the camera's image stream, I get a "class not registered" fatal error. I understand this is because I must 'activate and register' the media extension, but I do not know how. How do I register the media extension?
All help is greatly appreciated and I always accept an answer!
UPDATE: My GrayScale IDL file is shown below:
import "Windows.Media.idl";
#include <sdkddkver.h>
namespace GrayscaleTransform
{
[version(NTDDI_WIN8), activatable(NTDDI_WIN8)]
runtimeclass GrayscaleEffect
{
[default] interface Windows.Media.IMediaExtension;
}
}
The media extension is specified as an <Extension> (or extensibility point) in the package manifest's Extensions section, but you need to insert it manually (i.e. open the appxmanifest as code instead of double-clicking.)
Using the GrayscaleTransform example, in the Media extensions sample, open the MediaExtensions project's package.appxmanifest (as code) and look for this in the <Extensions> section:
<Extension Category="windows.activatableClass.inProcessServer">
<InProcessServer>
<Path>GrayscaleTransform.dll</Path>
<ActivatableClass ActivatableClassId="GrayscaleTransform.GrayscaleEffect" ThreadingModel="both" />
</InProcessServer>
</Extension>
There's a bit more general info on extensions in App contracts and extensions.
As Chris Bowen explains in his answer, your application's AppXManifest is missing the required Extension elements for the activatable classes in the media extensions modules. All (non-Windows-provided) activatable classes need to be listed in the AppXManifest. The solution of adding the Extension nodes to the AppXManifest yourself will work, and this is what the MediaExtensions sample applications appear to have done.
However, you should not normally need to hand-edit the list of extensions. If you add a reference to a Windows Runtime Component project, a loose WinMD file, or an extension SDK, the build should automatically generate Extension elements for each of the activatable classes in the referenced components.
The reason this is not happening is that the media extensions are not annotated with the [activatable] attribute in IDL, so they are not attributed with the ActivatableAttribute in the WinMD that is generated. Instead of hand-editing the AppXManifest, you can declare the type as activatable in its IDL definition.
For example, to update GeometricSource.GeometricSchemeHandler, you can change its definition in IDL from:
[version(NTDDI_WIN8)]
runtimeclass GeometricSchemeHandler
{
}
to:
[version(NTDDI_WIN8), activatable(NTDDI_WIN8)]
runtimeclass GeometricSchemeHandler
{
[default] interface Windows.Media.IMediaExtension;
}
Note the added activatable attribute and the added [default] interface. If you make these changes to each of the extensions and clean/rebuild, you should not need to explicitly specify the activatable types in your AppXManifest: the build system will add them automatically.