use of com.archimatetool.editor.diagram.IArchimateDiagramEditor in project archi by archimatetool.
the class TreeViewpointFilterProvider method partActivated.
@Override
public void partActivated(IWorkbenchPart part) {
/*
* Refresh Tree only if an IEditorPart is activated.
*
* If we call refresh() when a ViewPart is activated then a problem occurs when:
* 1. User adds a new Diagram View to the Tree
* 2. Element is added to model - refresh() is called on Tree
* 3. Diagram Editor is opened and activated
* 4. This is notified of Diagram Editor Part activation and calls refresh() on Tree
* 5. NewDiagramCommand.execute() calls TreeModelViewer.editElement() to edit the cell name
* 6. The Tree is then activated and This is notified of Diagram Editor Part activation and calls refresh() on Tree
* 7. TreeModelViewer.refresh(element) then cancels editing
*/
if (part instanceof IEditorPart) {
IArchimateDiagramModel previous = fActiveDiagramModel;
// Archimate editor
if (part instanceof IArchimateDiagramEditor) {
IArchimateDiagramModel dm = (IArchimateDiagramModel) ((IArchimateDiagramEditor) part).getModel();
if (previous == dm) {
return;
}
fActiveDiagramModel = dm;
} else // Other type of editor (sketch, canvas)
{
fActiveDiagramModel = null;
}
// Refresh previous model
refreshTreeModel(previous);
// Refresh selected model
refreshTreeModel(fActiveDiagramModel);
}
}
Aggregations