开发者

How to update GEF editor if file renamed?

How to update GEF editor if file renamed?

This works fine for text editors. For example in Eclipse go to Navigator, open file HelloWorld.java in editor, rename HelloWorld.java to HelloWorld2.java in Navigator. Note that editor is now updated and it titled "HelloWorld2.java".

To do that Eclipse creates listener and adds it to ITextEditor: IElementStateListener fElementStateListener= new ElementStateListener() (handles elementMoved and calles setInput((IEditorInput) movedElement)) IText开发者_StackOverflow社区Editor.getDocumentProvider().addElementStateListener(fElementStateListener);

I guess I need to do the same thing for in org.eclipse.gef.ui.parts.GraphicalEditor but I don't know how cause graphicalEditor, doesn't have documentProvider.

upd:

There are three examples provided with GEF. One of them is Logic example: http://wiki.eclipse.org/GEF_Developer_FAQ#How_do_I_Run_the_Logic_Example.3F

In the LogicEditor class, there is inner class ResourceTracker which is the key.


You need to add a resource listener and update your editor properties (i.e. title, tooltip) when you detect your resource was moved.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜