Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » new Javascript editor(problem with creating new Javascript editor)
new Javascript editor [message #697896] Mon, 18 July 2011 09:55 Go to next message
sulakshana.vasanth is currently offline sulakshana.vasanthFriend
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 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

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 #755895 is a reply to message #698283] Thu, 10 November 2011 05:35 Go to previous messageGo to next message
sulakshana.vasanth is currently offline sulakshana.vasanthFriend
Messages: 11
Registered: July 2011
Junior Member
Sorry for late reply and thank you for your response.

Actually wanted to enable the templates view for JavaScript editor. Checked org.eclipse.ui.texteditor.templates.TemplatesView - it says "If the editor does not support a templates page, the Templates view shows a special default page which makes it clear to the user that no templates are available." When i open any .js file in JavaScript pages the template gives the same message.

I want to enable some of the JavaScript templates to be available when i open .js pages. How this can be achieved??

Waiting for response,
Sulakshana
Re: new Javascript editor [message #756013 is a reply to message #755895] Thu, 10 November 2011 13:28 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

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 #757223 is a reply to message #756013] Thu, 17 November 2011 08:24 Go to previous messageGo to next message
sulakshana.vasanth is currently offline sulakshana.vasanthFriend
Messages: 11
Registered: July 2011
Junior Member
ok... I am trying to do that, when I was searching related to that, got to know that html templates use "org.eclipse.jdt.ui.preferences.JavaTemplatePreferencePage".

what package to be use for JavaScript?? from where i can get TemplateContextRegistry, PreferenceStore, TemplateStore for JavaScript?

waiting for reply,
Sulakshana
Re: new Javascript editor [message #757358 is a reply to message #757223] Thu, 17 November 2011 22:07 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

Search for *TemplatePreferencePage and you'll find org.eclipse.wst.jsdt.internal.ui.preferences.JavaTemplatePreferencePage .

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: new Javascript editor [message #757731 is a reply to message #757358] Mon, 21 November 2011 11:36 Go to previous messageGo to next message
sulakshana.vasanth is currently offline sulakshana.vasanthFriend
Messages: 11
Registered: July 2011
Junior Member
thank you for your support, I could do it Smile . 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.
But I want "Other JavaScript Proposal" also in my editor...
How can solve this??????

Waiting for your reply,
Sulakshana

[Updated on: Mon, 21 November 2011 13:01]

Report message to a moderator

Re: new Javascript editor [message #758340 is a reply to message #757731] Tue, 22 November 2011 20:27 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

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
Re: new Javascript editor [message #758392 is a reply to message #758340] Wed, 23 November 2011 04:56 Go to previous messageGo to next message
sulakshana.vasanth is currently offline sulakshana.vasanthFriend
Messages: 11
Registered: July 2011
Junior Member
Hello,

Even if I am requesting code completion from the very first line I get the same error. I try my best to figure it out in the mean time if I get any sort of help that could be helpful.

Regards,
Sulakshana
Re: new Javascript editor [message #766053 is a reply to message #758392] Thu, 15 December 2011 06:25 Go to previous message
sulakshana.vasanth is currently offline sulakshana.vasanthFriend
Messages: 11
Registered: July 2011
Junior Member
Hi,

Using extension point "org.eclipse.ui.editors.templates" have added template view to my editor where templates have few new ContextType like html and JS. have added contextTypes using AbstractJavaContextType. I could see the templates sorted according to the context types.

Now the problem is adding new template, edit the template and remove template options are not working. after some investigation found that
getTemplateStore().save(); or getTemplateStore().delete(..); getTemplateStore().add(..);
are not working. where as getTemplateStore() returns the correct set of templates which i have inserted.

what could be the reason for this?? how can I solve this??

waiting for reply,
Sulakshana
Previous Topic:EL content assist and auto-complete in jsp editor?
Next Topic:100% CPU for long time in ASTUtils.createCompilationUnit
Goto Forum:
  


Current Time: Fri Apr 19 01:41:14 GMT 2024

Powered by FUDForum. Page generated in 0.02305 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top