How can I make plugin auto open specify file by internal editor in eclipse? - eclipse

I'm writting a plugin, open the abc.txt file, and when I already finish create abc.txt, I want to eclipse auto open this file using a internal editor (example ckeditor). How can I do that?
IDE.openEditor(page, input, "org.eclipse.ckeditor");
I use this code but it's not work.
Anybody help me?

To find the id of an editor you look for the org.eclipse.ui.editors extension point used to declare the editor in the plugin.xml file in the plugin jar.
In this case the editor id is org.eclipse.ckeditor.editors.CKEditor

Related

Can syntax highlighting be enabled for Groovy DSL with custom file extension in Eclipse?

We are working on creating a custom Domain Specific Language in Groovy. We plan to use a custom file name extension ( for example .xyz ) for the code written in this DSL.
I and using eclipse as my IDE.
When i change the extension of the file from .groovy to .xyz, eclipse considers this file as a text file and removes all the color codes that are associated with a groovy file.
Is there any configuration in Eclipse that will associate the .xyz file as a groovy source file?
I see that there are a .dsld file https://spring.io/blog/2011/05/09/better-dsl-support-in-groovy-eclipse but this do not seem to be a solution to my above problem.
You can associate a file extension with a editor content type in the Eclipse Preferences. Go to the 'General > Content Types' page in the preferences.
Find and select the Groovy content type in the list and click 'Add..' to add your '.xyz' extension to the list of file associations.
You can also do this in an Eclipse plugin using org.eclipse.core.contenttype.contentTypes extension point.

Eclipse find source file from library

For debugging it is often helpful to read the library's source code. When pointing at a library function which I want to inspect and opening the context menu and click on 'Open Declaration' in my own written code I will just have a look at the corresponding header file.
How do I show the corresponding source/cpp file in Eclipse?
If I just search for the file in the source folders (using OS tools) I can't use Eclipse methods like 'Open call hierarchy', so, that won't be a satisfying solution. Thanks.
You can tell the debugger where to find source files. In the Run or Debug Configurations dialog, there is a Source tab when you select a particular configuration. That's where you can specify so-called Source Containers.
For more details, see the Eclipse CDT help page.

Editing files with netbeans without setting up project

Is there a way to use netbeans as a simple text editor, without setting up a project?
I am interested in using netbeans features as a text editor, especially for making quick changes on remote servers.
Yes, of course you can use it as a text editor. Just Open Netbeans and select File > Open File and select the file to open from the file chooser dialog. Make changes and click Save.
If you want to edit files on network locations, again do File > Open File and paste the location of your remote file.

how can I make the internal editor the default editor in eclipse

I want the default edior to be the internal editor and not the system editor.
I have it configured in window->preferences->file associations to use default internal xml editor for *.xml yet eclipse always tries to open files with OS system editor. How can I prevent this?
The editor type is mapped to file type; you can do this on a per-workspace (global) or per-project basis.
It should be pretty much as simple as this:
http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.wst.xmleditor.doc.user%2Ftopics%2Ftxprefs.html
Go into "Help, Install Software, What is already installed?" and make sure you have "Eclipse XML Editors and Tools" installed. You you don't, then get it.
Finally, create a new, "clean" project, add an XML file, and verify it works correctly
I found this question but the answers didn't help me, so I continued searching and found the answer here http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftasks-51.xhtml
Basically, in the Preferences, General > Editors > File Associations, then define your file types (if not already there), and select an editor.
Right Click on File from Project,
Select Open with ....
Select your editor

Eclipse: Open JSP file on CTRL+CLICK of jsp path

I used to open a jsp file included in another jsp file by just click the path by CTRL+CLICK in eclipse. But for sometime now this is not working. Don't understand why!!!.
eg. <jsp:include page="../someFile.jsp" /> if we just hover over this path and CTRL+CLICK it used to open the file in new tab in eclipse. Help Guys!!!
Im using Eclipse Indigo.
I'll admit to grasping at straws here, but it sounds like the default editor (or the editor specified for this specific file) has changed. From the Navigator or *Explorer menu select the JSP file and right-mouse-button "Open With..." to see the available editors for JSP. The checked editor in the list is the one you're using now. Try the other editors to see if they support the CTRL-CLICK action.