Eclipse IDE: Add/change default filetypes? - eclipse

When I create a new file in Eclipse, there's a wide selection of different alternatives appearing in Eclipse.
However I am missing a couple of file which I need to open the "file create wizard" to create - JS files included.
How can I add my own file types as a default choice to appear in the "new files" menu?
Screenshot of the menu I am referring to:

Puuh - just when I had given up I accidentally found this:
Try this: Right click on Eclipse's
toolbar and choose "Customize this
perspective" option. You will see a
dialog box, and on "Shortcuts" tab
choose "New" from "Submenus:"
droplist.
Find "PHP" in the left pane and check
the checkbox next to it. It will
enable both "PHP File" and "PHP
Project" in "New" menu of your
perspective. You can do the same to
other file editors as well. (HTML,
CSS,....
http://dev.eclipse.org/newslists/news.eclipse.tools.pdt/msg00228.html

Yes, from the Eclipse's toolbar, right click > Customize perspective... > Menu Visibility > File > New > check and uncheck file types.

Related

How to edit the "New" submenu of the right-click menu in Eclipse IDE?

Is it possible to edit the "New" submenu when I use the right-clik on a project in the Project Explorer ? "Customize perspective" settings don't seem to have any effect on it. In my Eclipse on Ubuntu I have directly the wizards that I want in this submenu, but in my Eclipse on Windows I have to click on "Other..." to find the right wizard. Thanks.
open eclipse, then go to Window menu, select Customize perspective...
a windows appears. it has for tabs.
Tool bar visiblity
Menu visiblity
Command Groups Availablity
Shortcuts
select Menu visiblity tab, it will shows all menus with tree view.
then expand tree view of File then do same for the New which is sub tree of File.
now select All of those project types that you want, then click Ok.

Edit SVG in Eclipse

I want to edit SVG files in Eclipse. I don't know why it doesn't work, but Eclipse opens Sublime when I double click an SVG file. I tried to install the Docfacto plugin, but Eclipse stalls when I open or create an SVG file.
I remember that elsewhere it has worked. I don't need a graphical editor, just something compareble to XML or HTML, so with color coding and maybe matching tags.
How can I open and edit SVG files in Eclipse?
Go to Window->Preferences
Select General->Editors->File Associations
Look for *.svg in the top list.
You should be able to modify the default editor(s) in the bottom pane. Mine is set to "XML Editor".
It can be a little tricky if you don't know:
first define svg as an xml content type:
Preferences > General > Content Types
Select XML in the upper right box
Click the Add... button next to the bottom right box
Add *.svg and click OK
Then do what #Paul LeBeau proposed:
Preferences > General > Editors > File Associations
Select *.svg or add it if it is not yet in the list
Mark XML Editor as default in the bottom box
Apply and Close
Finally open a fresh svg file to test the default file association, if you open the same file as before eclipse will remember the previous (text) editor and you will see no syntax colouring. Or right click on a file and choose Open With > XML Editor to test if the colour coding works.

How to associate an Eclipse perspective to a file type?

How to associate an Eclipse perspective to a file type independent from the Eclipse project?
For example, if I open a *.frm file I want the following view.:
If I open a *.js file I want to have this:
Is that possible?
How is the Debug perspective initiated? Is the Debug perspective project independent, because in a lot of project types there is a Debug perspective?
Since you asked for an implementation, you could check the extension of the file you've just opened, then change perspectives programmatically:
try
{
PlatformUI.getWorkbench().showPerspective("perspective.id", PlatformUI.getWorkbench().getActiveWorkbenchWindow());
}
catch (WorkbenchException e)
{
e.printStackTrace();
}
Edit:
Oh, and for the Eclipse project settings, go to Preferences -> General -> Perspectives.
1.Click on “Window” in the top-menu.
2.Expand the section “General” under preferences.
3.Then, expand the section “Editors”.
4. Now, click on “File Associations”.
5. You should see “File Type” and “Associated Editors” in right panel.
6. In “File Type” – you can add (click on a button with name Add should be seen next to this panel) any file-type or file extension
7. you want make sure you add it with wild-card entry (ex: *.tpl).
8. Select the above newly added file-type and you should see no editors for this under “Associated Editors” panel – because this is
newly added.
9. Now click on Add button next to “Associated Editors” panel to add the editors, it should show the list of available editors,
choose the one you like.
10. Click OK and choose this as your default editor by clicking a button “Default” appears next to this panel.

How to view design of JSP In eclipse

I have configured a J2EE project into Eclipse. The source code is consisting of JSP as well as Java Files.
Is there any way so that we can view the design of the JSP?
I am using Eclipse 3.1.
goto window - preferences - general - editors - file associations
choose *.jsp
and in associated editors choose "web page editor" as the first default
You right click on the jsp file and then highlight "Open With" .You will get options like JSP Editor, Text editor, Web Page Editor. Please Select "Web Page Editor" option.
Right click to the empty area in code page > go to Open With section > select WindowBuilder Editor.
The Design Page will appear left-down. I solve it on Eclipse Neon.

How to set default editor tab in Eclipse?

I'm using the HTML editor resp. the Structured Text Editor in Eclipse. It always opens in the tab Visual/Source:
Is it possible to tell Eclipse it should always open this editor in the Source tab?
You seem to use a plugin which associates with HTML files. For example Eclipse normally loads XML files for the first time with Design tab, and once you switch to source tab, it remembers the next time to open any document associated with XML Editor in Source tab. I don't know remembering is up to Eclipse or up to the plugin associated with the file, but a quick workaround would be:
to right click on the HTML file in package explorer > Open With > choose another editor (e.g. text editor). This only associates with current file. If you want to change file association for all HTMLs:
goto Preferences (under menu Window) > General > Editor > File Associations and change HTML file association there.
In Eclipse goto Windows-->Preferences-->Type Editors change the associated editors for File Types after that click on OK
You didn't say what version of Eclipse you're using. My HTML / Structured Text editors didn't have the tabs the same as yours. I'm using 3.4.2.
You can extend that editor by writing your own plug-in for Eclipse. Outside of the 'create a plug-in project' stuff, start by finding the extension points for the target editor. Then your plug-in can just register as an extension and add a new property instead of writing a whole editor. The property should show up on a preference page and then your code can take care of switching the active view of the editor to the 'Source' tab based on that property.
Right click the file and then "open with" and open it in another HTML or texteditor.
And then map this editor as the default editor for this filetype by right clicking the document and setting the file extension.
I always do this to get rid of the memory greedy WYSIWYG editors.