Eclipse preference page with multiple arrays - java

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.

Related

Why GEF Editor Part doesn't show up?

I followed every step of this tutorial until I had to run the application for the first time, but the Graphical Editor Part doesn't show up. The only difference between the tutorial and my project is that on the Extensions tab of the plugins.xml file, the org.eclipse.ui.editor extension doesn't contain a "MyGraphicalEditor (editor)" named child.
These tutorials will give you more practice and better understanding:
http://www.vogella.de/articles/EclipseRCP/article.html
http://www.vogella.de/articles/EclipsePlugIn/article.html
http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/SWTDraw2DExample.htm
http://nyssen.blogspot.com/2010/12/draw2d-examples-hidden-treasure.html
That's the reason. Every editor should be added to org.eclipse.ui.editor extension point.

How to write an eclipse content assist?

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.

How to exchange ONLY the keybindings between eclipse instances

When I exchange the complete preferences, my customized key bindings are exported along with the other stuff, but if i select Keys Preferences from the Export->Preferences menu, only a useless small subset of the shortcuts is exported.
There is a possibility to export all the bindings from the Keys Page which is worse then useless as it suggests a feature thet isn't there.
I don't want to mess up the complete setup, so: is there a way to transfer just the key bindings and nothing else?
Thank you
btw : this post deals with the same topic but isnt helpful for the reasons above.
There is no automatic way as far as I know but the resulting file is XML, so you can export all the preferences and delete everything you don't want.
The result should still load into Eclipse.

Positioning new editors side by side

I'm working on an eclipse rcp application and want to avoid this effect when opening a new editor:
http://www.fotos-hochladen.net/stackededitorsfcpt3zoq.png
and want to achieve this effect programmatically:
http://www.fotos-hochladen.net/separareeditorsmv58nzua.png
Has anyone an idea how this can be achieved?
Thanks! :-)
As far as I can tell from reading the Eclipse Javadoc, your editors will always open as tabs. It's up to your users to drag and drop one of the editors, so the editors are side by side.
You can submit a request to the Eclipse organization for this feature, if you wish.
Yeah, it is possible, I did it once. Just take a look at the following example:
http://snippets.dzone.com/posts/show/6277
As I remember, the code will open editors, one on top of the other but the code can be easily adapted so that editors are opened side by side.
Just post here if it doesn't work and I'll help you with it :)
Oh, I almost forgot... there is no "legal" way to implement your feature so you will have to call "Discouraged access" code.
This is not available as a default behavior. It is a nice view for those of us with wide enough monitors but Eclipse leaves that choice to the user because most people who are using monitors that are < 22" do not want to see editors side-by-side.

AutoIndent in Eclipse possible?

I have been wracking my brain trying to figure this out. For the first time I used jEdit the other day and I was pleasantly surprised that it auto indented my code (meaning that I'd put in the following code:
int method () {
_ //<-- and it put me here automatically
I've tried to get the same thing working with eclipse but with no success. I got into the code formatter but I don't see how to make that happen.
Is it possible to do this? Also while I'm here, is there a such thing as a eclipse plugin that will allow you to search the methods and classes of the standard java library?
Thanks
Personally all I use for this is the format options Window->preferences under Java->Code Style ->Formatter.
I once took the time to tweek how I like my code to look like when I work and exported the whole thing. After that I just code without too much bother on what it looks like. When I find the code looks messy by pressing the combination ctrl+shift+f and the whole class becomes pretty again, comments and all.
After a while it pretty much became a reflex...
code code code
ctrl-s, ctrl-b (cause I disable auto build sometimes), ctrl-shift-f
code some more etc...
Once I got used to this I never really cared how it presented the code as i was typing because I knew it would look all pretty as soon as the loop/if/switch/method etc is finished
My clean eclipse install does this by default.
Have you changed any options? Make sure the file you are editing has the .java file extension. The preference options that control the typing automations are under Java -> Editor -> Typing in the Window -> Preferences menu.
Also, I find that the auto-indenting, and most of the other auto-complete functions of eclipse do not function well if the file I am editing has errors in it which prevent compilation. Make sure that your curly-braces are matched correctly, this is the main one that I've noticed blocks auto-indent.
Regarding searching through the standard Java libraries, use the Search -> Java.. menu option, and check the JRE libraries checkbox, then search away. You can also use the Hierarchy view to see how the classes relate. Also, in the Package and Project views you can expand the JRE System Library, and then expand rt.jar which holds pretty much all the standard Java pacakges.
Eclipse has always done this for me by default.
One really cool thing about eclipse is that you can search preference pages. Just right click and go to prefrences. Go to the "Window" menu, and click "Prefrences". Then at the top of the tree view there's a text box that says "type filter text". Replace that with "indent" and it should bring up the page where the indent option is.
Make sure that eclipse recognizes your file as a java file, that you're using the Java distribution, the latest version, etc.
Iv been trying to work around the eclipse indenting and other supposed features for years, and it seems that the bottom line is this ...
It only works for the programming style of the authors, so to use it you need to modify your style to comply.
This would be OK except that the authors of eclipse have some very strange ideas about common shortcut keys.
One horrid example is the search features, eg when did Ctrl+K become "Find Next occurrence" and why doesnt F3 or n work?
That all being said I use eclipse because if you have the time to wait around while it starts up - or never close it - and you can modify everything youve learned about using an editor - why why why - then it will certainly increase your efficiency.
Please note that there is a preference setting for indenting, it can be set for a project, a workspace, or globally, but no matter how you set it eclipse will still chuck tab characters in where you dont want them.
In fact its indent crazy, like it wants to indent everything, even if its already indented.
Like I said Iv been using it for years and it STILL drives me nuts with its random behavior.
Follow these steps for Eclipse:
Select all text: ctrl+A
Correct indentation: ctrl+I
You should check:
Hidden features/tricks for Eclipse?
What is your favorite hot-key in Eclipse?

Categories