Reindex and refresh a file on tab switch [message #1691992] |
Sat, 11 April 2015 16:10 |
|
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
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04520 seconds