I'm working with Collibra java APIs in eclipse (which leverages the flowable workflow engine).
There are pre-instantiated classes in the engine, which eclipse (obviously) does not know about.
Is it possible to configure eclipse to automatically instantiate classes in order to provide autocomplete support?
i.e. to configure eclipse to perform the following code automatically?
import com.company.module.package.MyClass
MyClass myClass = new MyClass()
This way, the myClass variable would always be available for autocomplete without having to declare it every single time.
Edit: Even better, is there any way to configure eclipse to include variables loaded into the execution environment of flowable?
For example we would load one variable in one file, would the eclipse autocomplete be able to have access to that variable in another file?
In flowable, the syntax is:
execution.setVariable("myVariable", myVariable)
Thanks to emilles for putting me on the right track.
Here's the solution. This works when the Groovy developer tools plugin is installed.
open a new groovy script and type the name of the variable you want to add to content assist
press ctrl + 1 to bring the quick assist menu and press "Add inferencing suggestion"
Fill the information as described below
This will create an entry in a file located under your project root as .groovy/suggestions.xdsl
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<projectSuggestions>
<declaringtype type="groovy.lang.Script">
<property isActive="true" isStatic="false" name="execution" type="org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl">
<doc/>
</property>
</declaringtype>
</projectSuggestions>
From then on, the "execution" variable will be automatically recognized by eclipse as an instance of org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl
Related
I am a bit new to eclipse plugin development. My requirement:
I want to show warning signs(like screenshot attached) in the import statements Java files and effective pom files of Java projects based on some parameters.
Assuming eclipse already has some classes and functions for this, I would like to know what dependencies I could add in my Manifest file of my Eclipse Plugin and which class I could extend and functions I could use to implement my requirement?
Any help would be very much appreciated. Thank you.
If you're willing this to happen at same time as compilation, you can add an extension to the org.eclipse.jdt.core.compilationParticipant extension point ( https://help.eclipse.org/2019-12/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%2Freference%2Fextension-points%2Forg_eclipse_jdt_core_compilationParticipant.html ) and implement the CompilationParticipant.reconcile() method to look at the content of the file and use putProblems() to add problems.
You can also put it in a separate builder ( https://help.eclipse.org/2019-12/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Freference%2Fref-5.htm ), or resource listener, or document listener, that would invoke file.createMarker(...) to add the error markers.
All that depends on which layer you prefer to hook onto.
I am learning Java on Visual Studio Code. I have installed the "Microsoft extension for Java" in it. My basic Java programs runs fine without package declaration. But I would like to package my program. How ?
Earlier I used "IntelliJ IDEA". I used to start a New Project and declare "package com.java.learn". In Visual Studio Code there is no option to create New java Project. There is an option to create Workspace but I still have the same issue.
I have two java class. "Index.java" & "InputHelper.java". Index.java is the main java file. InputHelper is a seperate class which I use in Index.java. I want to make a project and package both ( or more ) files.
Error Message:
The declared package "com.java.learn" does not match the expected package
A package is a path of subdirectories. Say your java sources are in (subdirectory of) a directory src. All sources immediately under src have the "default" package = no package declaration.
In src/com/java/learn (4 nested directories) the package com.java.learn; is expected for java sources.
In your case create a path of 3 directories: com, java, and learn the latter containing your java source.
For the rest, try to follow the coding conventions of java: class names starting with a capital like Index, variable and method names with a small letter.
In fact though Microsoft is often underestimated, I would chose a more mainstream IDE for learning java. IntelliJ IDEA (Community edition) is fine; NetBeans IDE is a clean an nice IDE too; eclipse is used very often - though a bit overdone IMHO.
I faced a similar issue, coming from Eclipse/IDEA background you find it difficult to not have a feature in your java IDE to create a new package.
Although, Joop Eggen's answer is correct that package is a path of subdirectories but you might find it tedious to create subdirectories when the number of sub packages is greater and name of sub packages is long.
You can use the below VSCode extension :
https://github.com/jiangdequan/vscode-java-saber
It is a very handy extension.It provides support for:
New: Java files(annotation/class/interface/enum/package/JSP/HTML)
Generate Getters and Getters
Copy Qualified Name
Sort Project By Name
Run Maven Goals
Generate Docs
You can try this extension.
You can use Java Projects panel to create a new project, package, class.
Also I think there's an issue in VSC 1.63.2, because a new item is created but it's not displayed in project structure until I reload VSC window.
Another option is to put right package declaration on the first line of a class file and use inline 💡light bulb button to move that class to the package it belongs.
P. S. I'm learning Java now so I could be missing something
I have an Eclipse (Kepler Service Release 2) workspace with several projects which can be divided into two parts. The first part contains all projects except one.
They depend on each other and one of these projects is the prior entry point for execution. Let's call it "project A".
Now I created "project B" which forms the second part. I need to start project A from project B, get some calculation results from it and do some further work on these results (including user input and manipulation of files).
Since project A is an IApplication I have no idea how to start it. (It doesn't contain a main method, just a XMLFile with "some" parameters is contained in the project.)
At first I created a normal Eclipse project and added project A as dependency, which allowed me to instantiate the needed class from project A, but I am not able to run the public Object start(IApplicationContext context) method since it needs an IApplicationContext. Intuitive I tried to include the necessary class and create a context on my own.
After recognizing that this approach won't work, I searched around for Information about the IApplication(Context) and now I assume that these classes are only available in Eclipse-Plugin Development.
Since I never created an Eclipse-PlugIn I am not sure if it would be capable to fulfill all my described needs. Moreover I tried to create an test plugin with this tutorial but I am failing at the point of "Launch an Eclipse Application" right inside the first instruction.
So, can anyone give me an advice on starting the IApplication?
In case it matters here is an extract of the XML configuration file I mentioned earlier. It is called "ClassIWantToStart".launch
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.pde.ui.EquinoxLauncher">
<booleanAttribute key="append.args" value="true"/>
<booleanAttribute key="automaticAdd" value="false"/>
<booleanAttribute key="automaticValidate" value="false"/>
<stringAttribute key="bootstrap" value=""/>
...
</launchConfiguration>
It also contains StringAttributes like target_bundles and org.eclipse.jdt.launching.VM_ARGUMENTS which contain an enormous number of attributes.
PS: project A seems to be an Eclipse-PlugIn itself
I am thankful for every advice.
I solved the problem by reversing the dependencies. Now the RCP loads all the plugins.
I am somewhat new to RubyMine but here is my problem. I have a JRUBY Class that I want to extend from a Java class. My Java class is part of a submodule I have imported using git. This is my project structure:
src --> Submodule --> <Directories> --> ClassIWantToExtend.java
--> Ruby Code --> <Directories> --> JRubyClassThatExtendsJava.rb
However, when using RubyMine I have been unable to figure out how to extend this Java class. It can't seem to find it. My current class is blank. This is all I have:
require 'java'
class JRubyClassThatExtendsJava
end
I have tried using '<' and 'include' but when autofilling RubyMine can't seem to find my Java Class. I did just add the submodule using a CLI Git Command. Is it possible I have to add something for RubyMine to see it?
Thanks for any help in advance.
RubyMine, as far as I know (bought a license but never actually used it due this) does not include support for .java (not even a syntax highlighter) - the motivation seems to be that they have a separate product that is a Java IDE. thus this answer is not going to be RubyMine specific :
first you'll need to compile the .java sources and either pack them in a .jar or simply keep in mind what directory the .class files are (javac -d OUT_DIR)
than in your .rb you can either require 'path/to/packed.jar' or simply $CLASSPATH << 'path/to/classes/OUT_DIR'
... than you should be able to load the Java class and extend it in Ruby
I am working under Mac OS X 10.7. I got javacomplete working with the help of pathogen, but it only completes JDK classes, not the classes I've created. When trying to omni-complete one of my objects I'm getting 'Pattern not found'. Is this really limited to JDK classes? If not, can anybody describe their config.
BTW, I've tried created ctags but it didn't work with javacomplete either. However, ctrl-x ctrl-] works fine with ctags created.
You need to set up the class path for your sources.
From the javacomplete documentation:
3. Set classpath using the following function: >
javacomplete#AddClassPath('jarfile_or_classes_path')
javacomplete#DelClassPath('jarfile_or_classes_path')
javacomplete#SetClassPath('semicolon_separated_string')
Another two variables will be used if they are existing:
|g:java_classpath| global classpath
|b:classpath| associated with current buffer
I have added the following to my .vimrc to auto-complete android projects:
if filereadable('AndroidManifest.xml')
call javacomplete#SetClassPath('/home/tidbeck/android/sdk/android-sdk-linux_x86/platforms/android-17/android.jar:libs/android-support-v4.jar:bin/classes')
call javacomplete#SetSourcePath('src')
endif
Two things that I noticed:
javacomplete#AddClassPath does not support jar files even though the docs say so
I had to remove my tags file to get completion to working
I've used javacomplete plugin along with supertab and i found that the easiet way to enable method completion is by using another plugin called easytags.vim that automatically creates tags as you compile your classes. From memory it did provide user defined Class and method completion.
After installing the vim plugin you have to add these lines into .vimrc:
" Only do this part when compiled with support for autocommands.
if has("autocmd")
autocmd Filetype java setlocal omnifunc=javacomplete#Complete
endif
I am, too, was unable to get it working with an existing tags file (created by ctags). As mentioned, one workaround is to unset the vim option tags inside .vimrc. But this was not an option for me.
I just manipulated javacomplete.vim to "ignore" the tags file.
Patch follows:
--- autoload/javacomplete.vim 2011-01-30 21:33:46.000000000 +0100
+++ /home/kndl/.vim/autoload/javacomplete.vim 2015-02-12 20:46:48.227465321 +0100
## -2510,7 +2510,8 ##
fu! s:GetClassInfoFromSource(class, filename)
let ci = {}
if len(tagfiles()) > 0
- let ci = s:DoGetClassInfoFromTags(a:class)
+ " kndl: Deactivate ctags feature as this does not work. It seems that I am unable to build an accepted tags file.
+ "let ci = s:DoGetClassInfoFromTags(a:class)
endif
if empty(ci)