Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dynamic Languages Toolkit (DLTK) » Reindex and refresh a file on tab switch(DLTK reindex and refresh the editor when tab switch)
icon4.gif  Reindex and refresh a file on tab switch [message #1691992] Sat, 11 April 2015 16:10 Go to next message
saroj padhy is currently offline saroj padhyFriend
Messages: 8
Registered: August 2012
Junior Member
How can I manually re-index a file and refresh the editor when I switch between tabs?

Because what happens now is if a file is reopened that time it gets reindexed and error markers are updated, but while switching it doesn't update the error markers as dependent files are changed in other tabs.

I tried as below: It's indexing but not refreshing the editor.

I added a IPartListener2 and in partBroughtToTop() method i have following code for indexing and refreshing.

IModelElement model = EditorUtility.getEditorInputModelElement(partRef.getPage().getActiveEditor(), true);

if (model instanceof ISourceModule) {
	ProblemCollector prob = new ProblemCollector();
	SourceParserUtil.clearCache();
	// get cache entry
	final ISourceModuleInfo cacheEntry = ModelManager.getModelManager().getSourceModuleInfoCache().get((ISourceModule)model);
	ModuleDeclaration mod = (ModuleDeclaration)SourceParserUtil.parse((ISourceModule)model, prob);
	SourceParserUtil.putModuleToCache(cacheEntry, mod, prob);
	SourceParserUtil.enableCache();

	IEditorPart editor = partRef.getPage().getActiveEditor();
	IEditorInput input = editor.getEditorInput();
	try {
	((ScriptEditor)editor).getDocumentProvider().resetDocument(input);
        }
	catch (CoreException e) {
	}
}


Thanks,
Saroj
Re: Reindex and refresh a file on tab switch [message #1693154 is a reply to message #1691992] Wed, 22 April 2015 06:50 Go to previous messageGo to next message
saroj padhy is currently offline saroj padhyFriend
Messages: 8
Registered: August 2012
Junior Member
Is there anyway we can invoke DLTK indexing and refreshing the editor from the program?
Re: Reindex and refresh a file on tab switch [message #1693939 is a reply to message #1693154] Wed, 29 April 2015 12:08 Go to previous message
saroj padhy is currently offline saroj padhyFriend
Messages: 8
Registered: August 2012
Junior Member
Any DLTK developer can help me out from this issue? I need it on urgent.

To be clear in my question:

I have a language where there are different types of files. For example, in C++ program, we have .cpp and .h files. If i change a variable in the dependent .h file it doesn't reflect in the cpp file when I switch tab. But it reflects the changes if I re-open the cpp file. So, I want to do a manual refresh from code when I switch tab in Eclipse.

I also posted this question in the following forum:
http://stackoverflow.com/questions/29608537/dltk-indexing-and-refreshing-editor

[Updated on: Wed, 29 April 2015 12:32]

Report message to a moderator

Previous Topic:DLTK Multiple Language Initiative
Next Topic:Ruby and RVM gemsets
Goto Forum:
  


Current Time: Fri Apr 19 00:03:35 GMT 2024

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

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

Back to the top