Skip to content

Commit

Permalink
[NONE] Ensure viewer contents is cleared when Logo View is diposed.
Browse files Browse the repository at this point in the history
  • Loading branch information
nyssen committed Jul 22, 2016
1 parent 8c2f2b6 commit aece144
Showing 1 changed file with 16 additions and 9 deletions.
Expand Up @@ -106,19 +106,26 @@ public IStatus undo(IProgressMonitor monitor, IAdaptable info) {
public MvcLogoExampleView() {
super(Guice.createInjector(Modules.override(new MvcLogoExampleModule())
.with(new MvcLogoExampleUiModule())));
// set default contents (GEF logo)
FXViewer viewer = getContentViewer();
ContentModel contentModel = viewer.getAdapter(ContentModel.class);
contentModel.getContents()

// set initial contents
getContentViewer()
.getAdapter(ContentModel.class).getContents()
.setAll(MvcLogoExample.createDefaultContents());
// set palette contents
FXViewer paletteViewer = getPaletteViewer();
ContentModel paletteContentModel = paletteViewer
.getAdapter(ContentModel.class);
paletteContentModel.getContents()
getPaletteViewer()
.getAdapter(ContentModel.class).getContents()
.setAll(MvcLogoExample.createPaletteContents());
}

@Override
public void dispose() {

// clear viewer contents
getContentViewer().getAdapter(ContentModel.class).contentsProperty().clear();
getPaletteViewer().getAdapter(ContentModel.class).contentsProperty().clear();

super.dispose();
}

@SuppressWarnings("rawtypes")
@Override
public Object getAdapter(Class key) {
Expand Down

0 comments on commit aece144

Please sign in to comment.