Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » problem extending structured text editor ...
problem extending structured text editor ... [message #233881] Mon, 20 July 2009 11:51 Go to next message
Carmelo  is currently offline Carmelo Friend
Messages: 224
Registered: July 2009
Senior Member
Hi guys
I have another problem in my rcp application :( - USING ECLIPSE GALILEO (I
don't have this problem in eclipse 3.3.2)

Just as recap . I read files in an external DB . and I have extended
Structured text Editor to display the content.

The point is . when I try to open a file that is already locked in my db I
set the property read only to true.

I don't understand why I have this different behavior .


---- storage ----
EomStorageISO implements IStorageEditorInput, IStorage, IEomStorage


---- action ----
page.openEditor(new EomStorageISO(treeItem, viewer),
"EomUtils.EomXmlEditor");



---- editor ----
public class EomStructuredTextEditor extends StructuredTextEditor



---- extension ----

<extension
point="org.eclipse.ui.editors">
<editor
class="com.eomutils.editors.EomStructuredTextEditor"
contributorClass=" org.eclipse.wst.xml.ui.internal.actions.ActionContributorXML "
default="false"
icon="icons/file.xml.gif"
id="EomUtils.EomXmlEditor"
name="EomXmlEditor">
<contentTypeBinding
contentTypeId="eomxml-type" />
</editor>

..


everything works fine if the file is not locked (this means that the
property of read-only = false).

If the file is in read-only mode I get the following error .

[NOTE: Problem solved if the editor input implements the IEncodedStorage
interface as well]

java.lang.NullPointerException
at
org.eclipse.wst.sse.ui.internal.StorageModelProvider.getPers istedEncoding(StorageModelProvider.java:606)
at
org.eclipse.ui.editors.text.StorageDocumentProvider.createEl ementInfo(StorageDocumentProvider.java:269)
at
org.eclipse.wst.sse.ui.internal.StorageModelProvider.createE lementInfo(StorageModelProvider.java:447)
at
org.eclipse.ui.texteditor.AbstractDocumentProvider.connect(A bstractDocumentProvider.java:398)
at
org.eclipse.ui.texteditor.AbstractTextEditor.doSetInput(Abst ractTextEditor.java:4134)
at
org.eclipse.ui.texteditor.StatusTextEditor.doSetInput(Status TextEditor.java:203)
at
org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.doSetI nput(AbstractDecoratedTextEditor.java:1413)
at org.eclipse.ui.editors.text.TextEditor.doSetInput(TextEditor .java:166)
at
org.eclipse.wst.sse.ui.StructuredTextEditor.doSetInput(Struc turedTextEditor.java:1712)
at
org.eclipse.ui.texteditor.AbstractTextEditor$19.run(Abstract TextEditor.java:3115)
at
org.eclipse.jface.operation.ModalContext.runInCurrentThread( ModalContext.java:464)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.ja va:372)
at
org.eclipse.jface.window.ApplicationWindow$1.run(Application Window.java:759)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:70)
at
org.eclipse.jface.window.ApplicationWindow.run(ApplicationWi ndow.java:756)
at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow. java:2578)
at
org.eclipse.ui.texteditor.AbstractTextEditor.internalInit(Ab stractTextEditor.java:3133)
at
org.eclipse.ui.texteditor.AbstractTextEditor.init(AbstractTe xtEditor.java:3160)
at
org.eclipse.wst.sse.ui.StructuredTextEditor.init(StructuredT extEditor.java:2321)




THANKS
KAR
Re: problem extending structured text editor ... [message #233898 is a reply to message #233881] Mon, 20 July 2009 12:53 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 2341
Registered: July 2009
Senior Member
Looks like the result of
org.eclipse.core.runtime.content.IContentTypeMatcher.getDesc riptionFor(InputStream,
String, QualifiedName[]) wasn't being properly checked for null.
Please open a bug report so it can be fixed for 3.1.1.

--
---
Nitin Dahyabhai
Eclipse WTP Source Editing
IBM Rational


---
Nitin Dahyabhai
Eclipse WTP, IBM
Re: problem extending structured text editor ... [message #233905 is a reply to message #233881] Mon, 20 July 2009 12:55 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 2341
Registered: July 2009
Senior Member
Kar wrote:
> Hi guys
> I have another problem in my rcp application :( - USING ECLIPSE GALILEO
> (I don't have this problem in eclipse 3.3.2)
>
> Just as recap . I read files in an external DB . and I have extended
> Structured text Editor to display the content.
....
> public class EomStructuredTextEditor extends StructuredTextEditor

Out of curiosity, what made you subclass the editor class? We
discourage it.

--
---
Nitin Dahyabhai
Eclipse WTP Source Editing
IBM Rational


---
Nitin Dahyabhai
Eclipse WTP, IBM
Re: problem extending structured text editor ... [message #233930 is a reply to message #233905] Tue, 21 July 2009 07:55 Go to previous messageGo to next message
Carmelo  is currently offline Carmelo Friend
Messages: 224
Registered: July 2009
Senior Member
Hi Nitin
I have read everywhere that it is not a good idea extending the Structured
Text Editor … the problem is that I could not find any reasonable way to
solve my problem without extending it …

As I was saying in my first email I do use the editor to display content of
files in my db …
The set of operations that I had to perform are:

- Lock the object on opening (I can do this on the Storage during the init
step)
- “Check out” / “keep check in” the file on following save (this will give
the user the possibility to create sub version) – this can only be achieve
if I have control of the doSave method
- Last when the editor is closed I need to submit changes and release the
object (dispose method)

Probably I could have achieved the same result using listener on resource
changes ... but I found this time easier

Let me know if I could have done this in a better way.


Thanks
Kar

Ps I will post the previous mail as bug asap



"Nitin Dahyabhai" <nitind@us.ibm.com> wrote in message
news:h41pg9$t5j$2@build.eclipse.org...
> Kar wrote:
>> Hi guys
>> I have another problem in my rcp application :( - USING ECLIPSE GALILEO
>> (I don't have this problem in eclipse 3.3.2)
>>
>> Just as recap . I read files in an external DB . and I have extended
>> Structured text Editor to display the content.
> ...
>> public class EomStructuredTextEditor extends StructuredTextEditor
>
> Out of curiosity, what made you subclass the editor class? We discourage
> it.
>
> --
> ---
> Nitin Dahyabhai
> Eclipse WTP Source Editing
> IBM Rational
Re: problem extending structured text editor ... [message #234036 is a reply to message #233930] Wed, 22 July 2009 17:40 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 2341
Registered: July 2009
Senior Member
Kar wrote:
> Hi Nitin
> I have read everywhere that it is not a good idea extending the
> Structured Text Editor … the problem is that I could not find any
> reasonable way to solve my problem without extending it …
>
> As I was saying in my first email I do use the editor to display content
> of files in my db …
> The set of operations that I had to perform are:
>
> - Lock the object on opening (I can do this on the Storage during the
> init step)
> - “Check out” / “keep check in” the file on following save (this will
> give the user the possibility to create sub version) – this can only be
> achieve if I have control of the doSave method
> - Last when the editor is closed I need to submit changes and release
> the object (dispose method)
>
> Probably I could have achieved the same result using listener on
> resource changes ... but I found this time easier
>
> Let me know if I could have done this in a better way.

Can't say that something better comes to mind. And while
discouraged, there's a reason we don't make the class final--we've
had to ignore that recommendation in a couple of cases ourselves.

--
---
Nitin Dahyabhai
Eclipse WTP Source Editing
IBM Rational


---
Nitin Dahyabhai
Eclipse WTP, IBM
Previous Topic:Different publishing behaviour
Next Topic:Update site for WTP 3.0.5
Goto Forum:
  


Current Time: Thu Dec 18 08:47:00 GMT 2014

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

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