Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Eclipse Web Tools Platform Project (WTP) » Every time I edit in JavaScript Editor, it triggers IResourceChangeEvent(Trouble with editing JS file with wst JavaScript Editor)
Every time I edit in JavaScript Editor, it triggers IResourceChangeEvent [message #1817937] Tue, 03 December 2019 11:20 Go to next message
Yue Yang is currently offline Yue YangFriend
Messages: 5
Registered: December 2019
Junior Member
Hey guys, I've come across a very scratchy bug.

The background is that I have developed an Eclipse plugin which listens to file change with org.eclipse.core.resources.IResourceChangeListener and refreshes the org.eclipse.swt.browser.Browser.

Everything works fine except that when I am editing JS file using org.eclipse.wst.jsdt.internal.ui.javaeditor.CompilationUnitEditor (JavaScript Editor for short), once the content assist is activated, every character I type in the editor can trigger the IResourceChangeEvent and refresh the browser. Annoying, isn't it?

I have tried in vain several times googling and fixing the bug, utilizing every API I can think of to distinguish between these two events, including

  • IResourceChangeEvent.getType() (their outputs are the same)
  • IResourceChangeEvent.getDelta().getFlags() (outputs are the same, too)
  • IResourceChangeEvent.getDelta().getMarkerDeltas() (delta length is always 0)
  • IResourceChangeEvent.getResource() (get null)

They just can't be differentiated!

Any idea on tackling with the bug elegantly? Your solution is appreciated!

[Updated on: Tue, 03 December 2019 23:43]

Report message to a moderator

Re: Every time I edit in JavaScript Editor, it triggers IResourceChangeEvent [message #1817956 is a reply to message #1817937] Tue, 03 December 2019 15:17 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 3830
Registered: July 2009
Senior Member

What are the types and flags you're getting?

Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Every time I edit in JavaScript Editor, it triggers IResourceChangeEvent [message #1817964 is a reply to message #1817956] Tue, 03 December 2019 16:44 Go to previous messageGo to next message
Yue Yang is currently offline Yue YangFriend
Messages: 5
Registered: December 2019
Junior Member
type: (int) 1
flag: (int) 0
Both are the case.
Re: Every time I edit in JavaScript Editor, it triggers IResourceChangeEvent [message #1818088 is a reply to message #1817956] Thu, 05 December 2019 12:18 Go to previous message
Yue Yang is currently offline Yue YangFriend
Messages: 5
Registered: December 2019
Junior Member
Hi Nitin,

To compromise I have added a "lock" switch to stop unwanted auto-refresh while I'm editing in JS Editor.

But after all, is there any other API apart from IResourceChangeEvent I can utilize to listen to file changes while not interfering with the content assist mechanism of JS Editor?

Otherwise, is Eclipse team looking into the mechanism of JS Editor content assist to find out what has gotten in the way of IResourceChangeEvent?

Thanks ahead :D
Previous Topic:RESTful Service in Java using JAX-RS and Jersey - Blank page and HTTP Status 404 error
Next Topic:Facet Project Problem - OpenJDK13.0.1 & Tomcat 9.0.30 - Dynamic Web Project
Goto Forum:
  


Current Time: Sun Sep 20 06:03:00 GMT 2020

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

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

Back to the top