0

I try to refresh my Sirius Project programmatically like it refreshs if I'm press F5. project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()) doesn't refresh the project the way I want, so I checked out what the org.eclipse.ui.actions.RefreshAction does. I found out that org.eclipse.ui.actions.RefreshAction use the following code snippet

shell.getDisplay().asyncExec(new Runnable() {

     @Override
     public void run() {
        StructuredViewer viewer = getActionSite().getStructuredViewer();
            if (viewer != null && viewer.getControl() != null && !viewer.getControl().isDisposed()) {
                viewer.refresh();
            }
        }
});

to refresh the modelexplorer view like i want to. My problem right now is that I got the modelexplorer view, but don't know how I access the viewer from it, to refresh the view. Does anyone got any clue how to do it?

greg-449
  • 109,219
  • 232
  • 102
  • 145
seb2704
  • 390
  • 1
  • 5
  • 17
  • That code is only valid for an action defined on a view using the common navigator framework and extending `CommonActionProvider`. There is no general way to get the viewer, you will have to look at the explorer to see what it uses. – greg-449 Jul 10 '20 at 07:38
  • what exactly do u mean with look at the explorer, should I look for away to refresh the `ModelExplorerView` without a viewer? – seb2704 Jul 10 '20 at 09:14
  • I mean you will have to look at the documentation and perhaps even the source code of the viewer to see if it provides a way to do this (it may not provide a way). – greg-449 Jul 10 '20 at 09:17
  • ok i will do that thank you for your advice :D – seb2704 Jul 10 '20 at 09:27

0 Answers0