Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smart completion for values - Find list of existing beans #22

Closed
davsclaus opened this issue Dec 27, 2016 · 15 comments
Closed

Smart completion for values - Find list of existing beans #22

davsclaus opened this issue Dec 27, 2016 · 15 comments
Assignees

Comments

@davsclaus
Copy link
Collaborator

Wonder if we can hook into spring / cdi / etc and get a list of beans, which the endpoints options that refer to beans, can use in the smart completion list.

eg if you have or spring boot beans or cdi beans or whatever.

@davsclaus
Copy link
Collaborator Author

davsclaus commented Dec 31, 2016

And we should use #beanName style to refer to the bean by its name for the smart completion values, eg ...filter=#myFilter

@adrianbumbas adrianbumbas self-assigned this Feb 23, 2017
@adrianbumbas
Copy link
Member

@davsclaus what would be the search scope of the beans?

For XML I can easily search in the current XML file and all of the XML imports but for Java I have no idea.

Do we need to prevent importing something that will fail to be resolved at runtime or not? I'm thinking about OSGI containers that can complicate the things.

@davsclaus
Copy link
Collaborator Author

Yeah at first its fine for XML - lets focus on that as its easier as you say, its in both spring and blueprint xml files.

For Java lets create another ticket and discuss there.

@adrianbumbas
Copy link
Member

This is how it looks:
screen shot 2017-02-24 at 19 54 01

In the completion popup it shows all the beans that inherit the wanted class or interface located in the Intellij application context (if the Spring facet is configured). Thus the search scope can be at maximum the IntelliJ module.

@davsclaus is this ok?

@davsclaus
Copy link
Collaborator Author

davsclaus commented Feb 25, 2017

@adrianbumbas yeah that looks great. Mind that when the value is inserted, it should use # syntax in Camel to refer to beans: eg

"cxf:bean:soapMessageEndpoint?bus=#blueprintBus"

Notice how the # is prefixed before the bean id.

There is a section about referring beans in the docs: http://camel.apache.org/how-do-i-configure-endpoints.html

@adrianbumbas
Copy link
Member

@davsclaus ok,done that.

Now i'm struggling to fix the existing unit test. The Spring Intellij plugin depends on the java-i18n plugin. That plugin registers his own reference contribuitor which interferes with the PropertyEndpointSmartCompletionTestIT unit test. I'm currently having fun debugging the paltform.

@adrianbumbas
Copy link
Member

Figured out the issue:

The com.intellij.lang.properties.PropertiesReferenceContributor from the com.intellij.java-i18n plugin is registered in place of CamelPropertiesOrYamlFileReferenceContributor.

This can be solved in the plugin.xml file by adding order="FIRST" to the CamelPropertiesOrYamlFileReferenceContributor.

adrianbumbas added a commit to adrianbumbas/camel-idea-plugin that referenced this issue Feb 27, 2017
@adrianbumbas
Copy link
Member

I now realize that the Spring plugin works only with the Ultimate version.

http://www.jetbrains.org/intellij/sdk/docs/reference_guide/frameworks_and_external_apis/spring_api.html

The Travis build is using the Community edition.

@fharms
Copy link
Collaborator

fharms commented Feb 27, 2017

@adrianbumbas bommer, do you need any specific IDEA spring artifacts or can you depend on the spring artifacts from maven?

@adrianbumbas
Copy link
Member

I need the Spring plugin to be enabled in IDEA, it would not even run on the Community edition. I develop everything on the Ultimate edition and I never thought that it will not work on the Community. Lesson learned.

@fharms
Copy link
Collaborator

fharms commented Feb 27, 2017

Well I guess you need to make it a optional dependency. I'm not sure if it possible but you might be able to install as part of the testing.

I describe an issue with other language support in #285 and testing we to look into.

@adrianbumbas
Copy link
Member

If I understand this correctly the optional dependency allows some feature to be enabled in your plugin only if a certain plugin is present. This should do the trick, but the Spring IDEA jars must be in classpath so that the unit test passes, for that the Travis build must be changed to use the IDEA Ultimate edition.

Do I have any other alternative?

@fharms
Copy link
Collaborator

fharms commented Feb 28, 2017

If you can't find it in the plugins browser I guess there is no way of installing the Spring IDEA jars in the community edition. If we change the Travis build to use the Ultimate version we properly need a license for this, since the Ultimate license is personally

@davsclaus
Copy link
Collaborator Author

Yeah they have some plugins that are private and only in the ultimate (paid) version - sadly spring is one of them.

@adrianbumbas
Copy link
Member

Unfortunately this feature cannot be implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants