/** @was-generated */ @Override public void activate() { if (viewId == null) { return; } // add self to global decorators registry List list = (List) allDecorators.get(viewId); if (list == null) { list = new ArrayList(2); list.add(this); allDecorators.put(viewId, list); } else if (!list.contains(this)) { list.add(this); } // start listening to changes in resources View view = (View) getDecoratorTarget().getAdapter(View.class); if (view == null) { return; } Diagram diagramView = view.getDiagram(); if (diagramView == null) { return; } if (fileObserver == null) { FileChangeManager.getInstance() .addFileObserver(fileObserver = new MarkerObserver(diagramView)); } }
/** @generated */ public void deactivate() { if (viewId == null) { return; } // remove self from global decorators registry List list = (List) allDecorators.get(viewId); if (list != null) { list.remove(this); if (list.isEmpty()) { allDecorators.remove(viewId); } } // stop listening to changes in resources if there are no more decorators if (fileObserver != null && allDecorators.isEmpty()) { FileChangeManager.getInstance().removeFileObserver(fileObserver); fileObserver = null; } super.deactivate(); }