I want to write a plugin which will give me content assist support and work in JSF. I want it to work like the sample below :
I'll type "p:button action="#{
Then I'll press "Ctrl+Shift+Space" (for example)
It'll read the classes in my project and show them as a list in a pop-up window
Then I'll select one class. It'll be like below
h:button action="#{MyClass
When I type "." , It'll read the methods in my selected class and show them as a list in a pop-up window.
Then I'll select a method
Finally, It'll end like this "h:button action="#{MyClass.MyMethod}
Do you have any idea, how can i do this? Any suggestions?
One place to look for an example of content assist is to look at XText which already has this feature for DSL-like languages.
See the XText sources in its Git repository: by looking work the log message 'assist', you will have a list of commits all related to content assist implementation, like the XbaseProposalProvider.java class.
The following are both screenshots from the Web Page Editor which comes with the Java EE edition of Eclipse.
You can install it by adding the following mirror to your Eclipse repository. Change the name depending on what version you use. For Helios it is http://download.eclipse.org/webtools/repository/helios.
Related
I've recently moved from Eclipse to Intellij IDEA for java development,
I have some code as shown in the screenshot, and as you can see there is no package called test2, Eclipse used to give suggestion if I want to create/move such a package, what is the IDEA equivalent shortcut for that option ?
Context specific actions can be brought up by alt+enter while having your cursor on the underlined part.
May I also suggest ctrl+shift+a. This brings up a search field for all kinds of menu items and settings.
Edit
Two more tips I always give IntelliJ newcomers:
Regularily check out Help/Productivity Guide. It tells you which features you don't use yet.
Install the Key promoter plugin. It tells you which shortcuts you could have used when you use an IntelliJ-Feature.
Background:
I have a plugin which should give out links to helpfiles of other, currently installed, eclipse plugins.
At first I thought that I include those html files in my plugin, but I couldn't open them unless I copy them into the current workspace of the user. Since this is not an option, the most elegant way would be to use the eclipse-built-in help system.
So I need to access the eclipse help system programmatically to include the files into my code.
Does anyone know a workaround for this?
Edit: I guess I missed a central point: I generate an HTML-File, in which the links to the help system should be embedded.
When I open the helpfile to a given plugin, there is a link like this at the bottom:
http://127.0.0.1:11925/help/topic/plugin/help/html/maintopic.html?cp=5_1_2
The problem is: I can't access this document but I would need to.
From the Eclipse Platform API Specification, implement the IWorkbenchHelpSystem interface and call the displayHelp() method without an argument to programmatically open the Help window, or call the displayHelp() method with the context ID string as the single argument to programmatically open context-sensitive help for a specific context ID. Read the API for further information.
I've been using Html.fromHtml to display html text into a TextView but am not completely happy primarily because it doesn't support bullet points (li, ol).
I've run across HTMLSpanner (at https://github.com/NightWhistler/HtmlSpanner) and it looks like something worthwhile exploring.
Trouble is, I'm using Eclipse and, being somewhat new to this world of java, am not clear as to how to incorporate that code into my project.
I have incorporated other private libraries (like sqliteassethelper & photozoom), but HTMLSpanner is confusing me.
Can anybody help?
Right, after getting help from the author of HtmlSpanner (Alex Kuiper), here's what needs to be done:
Retrieve Jars. You need HtmlSpanner and HtmlCleaner. These can be acquired from the Pagecleaner repo (use the latest version) and here (note: HtmlCleaner versions above 2.2 will NOT work)
Add them into your project as "External jars" (Properties -> Java Build Path -> Libraries -> Add External Jars). Also check them in "Order and Export"
Modify code. Replace Html.fromHtml() with new HtmlSpanner().fromHtml() as in tv_question.setText(new HtmlSpanner().fromHtml(mtext));
I needed HtmlSpanner primarily for the additional "list" functionality, so I've been focusing on that ... and found a few minor issues:
Nested lists. Need to add a break at the start of the child, as in <ol><li>This is part of the parent list <br><ul><li>First child list item"
Regular text following list. Need to add a paragraph break plus a regular break to get the single-line gap. As in ...list ended.</li></ul><p><br>Regular paragraph started...
The numbered list. Does not provide a blank after the "number.". As in, <ol><li>Apples (and all subsequent list items) will show up as "1.Apples", not "1. Apples". I have not found a workaround for this.
Underline. <u>...</u> does not work.
My environment: Ubuntu 12.04, Eclipse 4.2.1 (Juno), Android API 20
Overall, a fantastic set of classes that I am thrilled to have access to. Many thanks, again, to Alex.
I just discovered that my NetBeans suddenly stops importing classes that are found in the Java API but can still import classes from my external libraries. Take a look at the image below:
As you can see, List and ArrayList are classes from the java.util package but the usual suggestions for importing them are not shown here, instead it is asking me to create class. I know that I can type import java.util.List; on the top of the code but life was better before! Please I need help thanks.
I had the same problem a couple minutes ago... Terrible. The same problem has been reported here:
Bug 235712
The solution which I've found there was sufficient - simply delete the Netbeans cache...
In order to do this, go to Help ==> About . Then go to the directory with cache and delete all you find in the "index" catalog.
After restarting the NB, everything was cool.
Today I came across the same problem. It happens that it actually is very easy to exclude a class from code completion if you click in the wrong place while working.
To solve it (netbeans 8.2) go to
Tools - Options -> Editor tab
Then select Code Completion Tab
In the drop Down select JAVA (in my case it was Java)
You will find a box bellow titled Package/Classes
In the EXCLUDE tab you probably will find the packages marked to be excluded from code completion. Just remove the ones you want back.
Check under Preferences->Editor->Code Completion to make sure auto complete is on, though by your screen shot I assume that it is.
Also try Preferences->Editor->Formatting and set your Language to Java
In my case, NetBeans was refusing to suggest Scanner. As it turned out, all I had to do was remove java.util.Scanner from Options » Editor » Code Completion » Packages/classes: » Exclude. Then the autocompletion for Scanner returned.
I tried to search the internet for examples for doing that, but can not find a good one. Also I checking eclipse IDE source code, but it's a bit too big to filter out what I need for an example.
What I would need is something similar to Eclipse File Association page below.
My plan is later to replace File types list with a combo and add more values/controls per combo selection.
I would be very thankful for an example or a link to an example that does that or has a same concept with working preference store.
Thank you!
You can take a look at the Google Eclipse plugin source code. I had to achieve something similar to your needs, and inspired myself from there. It is properly designed. You can take a look at the repository right here.
In my case, I needed checkboxes instead of combos, and used a CheckboxTableViewer from the JFace library, there are plenty of example onlines (e.g: JFace snippets).
As Alex said, first, works on Eclipse preferences concept... when you got it, it will just stay some pure UI tasks.
Well, I think that it is nothing more then simple preferences page with two Lists which just represents conformity between file types and editors.
The example how to implement your own preferences page is here: Eclipse Preferences - Tutorial
If you want to have Combo - there is no problem - you just replace upper ListEditor woth your ComboFieldEditor and proceed with adding more conrols. The file associations are stored in Eclipse preferences and you can access them whenever you try to open some file to retrieve corresponding editor.