How to turn on the java smart editor? - eclipse

Well I did something, but I do not know what. In one java file in my project, but not the others, when I bring it up in the editor it looks like a plane text editor. It compiles when I save, but that is it. How can I turn it back to the normal java smart editor? And what did I do? I am using the default eclipse editor.
Thanks Cliff

Right-click the file, choose Open With -> Java Editor.
Eclipse remembers the last editor you used, and will use that if you simply double click the file.

Related

How can I use a non-IFileEditorInput as the default EditorInput in my plugin?

I am in the middle of creating an Eclipse plugin that will open an editor. Everything is mapped out well - my plugin.xml is set up correctly to open the editor for anything with the .xyz extension. The only thing holding me back is the IEditorInput.
I have a subclass of IEditorInput that I created for use with my editor. When I open the editor programmatically, I can create that EditorInput and open the editor correctly. However, when I open the editor using Project Explorer (Right click > Open With > My Editor), it is opened with a FileEditorInput.
How can I change the default behavior of Project Explorer to create the correct IEditorInput? Is there something in plugin.xml that I'm missing?
Thanks!
The editor doesn't get to choose the kind of editor input object it's given. It can use a IDocumentProvider to support different kinds of IEditorInput, but you should never artificially limit your editor to working with one kind of input, even if you do manage to change how the Project Explorer works.

Eclipse File Associations: displaying images

I am developing some help documentation in a Java project in Eclipse. In the resources folder there are my HTML pages and a couple of GIF and PNG images that will be displayed inside the HTML.
Now for my convenience I want to preview the images in the file structure of the project, to see what they show and which one to include in the HTML page. If I double-click an image, the default action that Eclipse does is: it opens it in Internet Explorer. Since I don't like IE, I want to change this default action. What I would prefer actually is that it opens some image viewer of some kind inside Eclipse.
I know this is a matter of file associations. However I was not able to get it working.
What I tried to do so far:
As an example I did it for *.gif.
I went to Preferences -> General -> Editors -> File Associations. There I pressed "Add..." and added *.gif.
Then I pressed "Add..." at the Associated Editors section and added an external gif viewer:
I expected this to open the default image viewing program from my Windows system, but for some reason it still opens it in Internet Explorer.
So what can I do to change this? Does Eclipse have an internal image viewer of some kind?
Why not just install plugin for viewing images
http://marketplace.eclipse.org/content/quickimage -> http://psnet.nu/c/quickimage
Sources https://github.com/persal/quickimage
There was nothing wrong with Eclipse, and the described solution is fine.
In fact the problem was with the Windows system. The system's default file association with images was the Internet Explorer. Changing that solved the problem.
right click on the file -> open With.. and then select -> System Editor (it should remain selected as a checkbox does)
After that you should be able to double click on a file and open it with the right app.
My environment is eclipse indigo build 1857 on gentoo linux
EDIT:
When you associate some external software with an extension, you should see on the menu "open With.." all application associated with the extension(On the top).
Then you can see : Text Editor - System Editor - Default Editor - Other...
Text Editor: open your file with the text editor
System Editor: open your file with the app associated with extension in the operating system
Default Editor: open your file with the (default) app associated by you under Preferences ->General -> EDitor -> File Associaton etc...
You should have something like this picture, without "In-Place Editor" option
Eclipse Oxygen (4.7)
Eclipse Oxygen (4.7) added the following feature - Images are opened in the Eclipse IDE.
You just need to double click the file name in the Package Explorer.
The file URI looks like this file:/// + absolute path:
Now there is a bug related to the URI shown on the right side.
If you rename the file, it won't be updated without reopening the file.

Open sublime text editor into eclipse

Is there a way to open the Sublime Text Editor into Eclipse to edit HTML, JavaScript and CSS?
The idea is to use only the Text Editor without project explorer.
If this isn't possible, is there a plugin that does what I said?
I would have just left this as a comment but I can't. First off, why is using the project explorer a problem?
Next, I know with Sublime Text 2 & 3 you have the ability to view/edit a file in two places simultaneously, just go File > New View into File. In Eclipse you can go Window > New Window. Alternatively you can import a project/file into eclipse or sublime. Either of these will bring in the project explorer (unless you import one file or something).
You might want to have a look at Subclim + Eclim.
I had to open the files via "Project Explorer -> Open With -> External -> sublime" to get the files refreshed right away (e.g. for a running webapp). But other from that, it's quite nice.

Eclipse comes with windowbuilder, which wizard should I start with?

I just find out that windowbuilder comes with the original Eclipse package. There are project palette, application window, japplet, jdialog, jdialog, jframe, jinternalframe, jpanel, swing automatic databinding. Which one should I start with and how to learn more?
For Eclipse IDE, Window Builder is one more Editor for handling java source files.
So you should be able to open all java classes with it. Right click on any java class and select open with menu option. You should see "WindowBuilder Editor" as an option there.
Note that this editor may not show any content in Design or Bindings tab for any non-GUI classes (e.g. interfaces).

Getting Eclipse to open .html in text-editor by default?

Eclipse Juno keeps opening my HTML files in a embedded web-browser, rather than in an embedded syntax-highlighting editor.
I have installed:
Web Page Editor
Eclipse Web Developer Tools
PyDev for Eclipse
Specifically see the screenshot of my install applications.
I need it to work with Django templates + any other Python templates with HTML + normal HTML+JS files.
How do I find this editor, and select it as default?
Select Window -> Preferences from the main Eclipse menu.
Select General -> Editors -> File Associations from the Preferences menu.
For .htm and .html, left click on the extension in the upper view. Left click on the Add button to the right of the lower view to add one or more HTML editors. Left click on your favorite HTML editor and left click on the Default button to make it the default editor.
If the extension you want is missing, left click on the Add button to the right of the upper view to add the extension.
If you want to add an HTML editor to Eclipse:
Go to Help -> Install New Software
Choose the site http://download.eclipse.org/releases/your_eclipse_version
Type the filter text Web Page Editor
There should be one result. Check off the box and press the Finish button.
Now you should have the option to choose the HTML editor when opening files by right-clicking, Open With -> HTML Editor.
If you want to always use the HTML editor to open HTML files then go to the Eclipse preferences -> General -> Editors -> File Associations. Select the extension up top (e.g. *.htm, *.html) then select the HTML editor in the bottom pane and press the Default button.
I had a similar problem.
Once I installed the html editor (thanks to CgodLEY), still my html files wouldnt show up with that editor.
Solution? Right click on the html/htm file, go to "open with" and select "HTML editor". Fortunately that solve everything...
For those still finding their way here, yes, do add an HTML editor to Eclipse as CgodLEY suggests, if you're having this problem. However, even if you already have an HTML editor in your Eclipse installation, consider installing CodeMix for a superlative HTML editing experience - take a look at the differences here.
Now, there's a Django-aware template editor available for free:
http://eclipse.kacprzak.org/
I installed it in Eclipse Kepler / Django 1.6, it's working fine for me.
Note: if you previously opened a specific .HTML file with some other editor, you need to go back to the project view, right click on the .HTML file, select 'open with...' and explicitly select Django editor.
To answer the opening of your question: Note that Eclipse will use the built-in web-browser to view html files if you are opening them outside of a project, as in "File->Open File ...", when that file isn't part of a project.
I just created a dummy project, and now the html files are correctly opened with the editor selected in my preferences. Success!
Nothing worked and I had begun getting an unrelated error on startup with a troubleshooting step requiring reinstall.
This time I downloaded Eclipse for Mobile Developers, and since then I have added my other packages and it's all working fine =).
None of the editors work the way I want them to though, however I have ended up with Django-Editor (which is slightly better than Aptana's one).