new Javascript editor [message #697896] |
Mon, 18 July 2011 09:55 |
sulakshana.vasanth Messages: 11 Registered: July 2011 |
Junior Member |
|
|
Have created a new plugin project in which trying to create a JavaScript editor. In plugin.xml have specified
<extension
point="org.eclipse.ui.editors">
<editor
class="com.eclipse.ide.sourceeditors.NewCSSStructuredTextEditor"
default="false"
extensions="css"
id="com.eclipse.ide.editor1"
name="New CSS Editor">
</editor>
<editor
class="com.eclipse.ide.sourceeditors.NewJavaScriptStructuredTextEditor"
default="false"
extensions="js"
id="com.eclipse.ide.editor3"
name="New JavaScript Editor">
</editor>
</extension>
and NewCSSStructuredTextEditor and NewJavaScriptStructuredTextEditor extends StructuredTextEditor. when I launch another instance of eclipse I can open CSS files with New CSS Editor and code completion works fine.
but when tried to open a JS page with New JavaScript Editor getting an error as
"Unsupported content type in editor
To associate file extension with a supported content type,
please see content type prefernce page"
also getting the errors on console as:
!ENTRY org.eclipse.wst.sse.ui 2 2 2011-07-18 15:13:30.520
!MESSAGE StructuredTextEditor being used without StructuredDocument
!ENTRY org.eclipse.wst.sse.ui 2 2 2011-07-18 15:13:30.520
!MESSAGE Input Name: new.js
!ENTRY org.eclipse.wst.sse.ui 2 2 2011-07-18 15:13:30.520
!MESSAGE Unexpected IDocument implementation: org.eclipse.core.internal.filebuffers.SynchronizableDocument
IDocumentProvider implementation: org.eclipse.ui.editors.text.TextFileDocumentProvider
How to solve this???
[Updated on: Tue, 26 July 2011 07:44] Report message to a moderator
|
|
|
Re: new Javascript editor [message #698283 is a reply to message #697896] |
Tue, 19 July 2011 08:00 |
|
There's not much to "solve" here. A number of classes (parser, reparser, model loader, adapter factory provider, viewer configurations, etc.) have to be authored for languages WTP supports through the StructuredTextEditor, and no such implementation is provided for JavaScript. The messages you're seeing indicate that the JavaScript content type isn't one of the languages supported through the StructuredTextEditor. While it's not impossible to create such classes, the existing JavaScript support in WTP has more in common with the Java plug-ins provided in the Eclipse project than the editors built on SSE.
What is it that you're trying to do that requires subclassing StructuredTextEditor? For the most part we discourage doing so except for very specific scenarios where the input to the editor, either due to timing issues or other corner cases, can't be used to alter its behavior in the way desired. If you're just reusing the editors, you don't have to subclass them. If you're trying to inject your own template proposals from your own template context, you really want to approach it by contributing content assist computers (with the org.eclipse.wst.sse.ui.completionProposal extension point) rather than entire editors.
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
|
Re: new Javascript editor [message #756013 is a reply to message #755895] |
Thu, 10 November 2011 13:28 |
|
Usually the editor class has to return something as an adapter to fill that view, if it works the way most similar views are built. Looking at an existing editor class that does support the Templates View would help in that regard. This could end up as a nice, small patch to contribute.
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
|
|
|
Re: new Javascript editor [message #758340 is a reply to message #757731] |
Tue, 22 November 2011 20:27 |
|
On 11/21/2011 6:36 AM, sulakshana.vasanth wrote:
> thank you for your support, I could do it :p . now I can open my JS
> editor with my templates view available.
> but when try the default code completion it works but I get !ENTRY
> org.eclipse.wst.jsdt.ui 4 10001 2011-11-21 16:49:06.875
> !MESSAGE Internal Error
> !STACK 1
> JavaScript Model Exception: JavaScript Model Status [Index out of bounds]
> at
> org.eclipse.wst.jsdt.internal.core.Openable.codeComplete(Openable.java:125)
> at
> org.eclipse.wst.jsdt.internal.core.CompilationUnit.codeComplete(CompilationUnit.java:305)
>
> ......
>
> !SUBENTRY 1 org.eclipse.wst.jsdt.core 4 980 2011-11-21 16:49:06.875
> !MESSAGE Index out of bounds
>
> how to solve this?? and also got an error saying
> "org.eclipse.wst.jsdt.ui" did not complete normally. the extension took
> too long to return from "computeCompletionProposal()". to avoid this
> disable "Other JavaScript Proposal" on content assist preference page. I
> disabled the option and I don't get this error any more.
> Will this cause any problem???
>
> Waiting for your reply,
> Sulakshana
I don't know enough about the view to really say what's gone wrong here,
other than you shouldn't be requesting code completion at an offset that
apparently doesn't exist for the known content of that file.
--
---
Nitin Dahyabhai
Eclipse WTP Source Editing and JSDT
IBM Rational
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03704 seconds