+ private static IDiagram getDiagram(IAdaptable editor) {
+ DiagramViewer viewer = editor.getAdapter(DiagramViewer.class);
+ return viewer != null ? viewer.getAdapter(IDiagram.class) : null;
+ }
+
+ private static Set<String> getDiagramMappedCompositeTypes(IDiagram diagram) {
+ Set<String> result = diagram != null ? diagram.getHint(DiagramModelHints.KEY_MAPPED_COMPOSITE_RESOURCE_TYPE_URIS) : null;
+ return result != null ? result : Collections.emptySet();
+ }
+
+ private static Set<String> getDiagramMappedCompositeTypes(IAdaptable editor) {
+ return getDiagramMappedCompositeTypes( getDiagram(editor) );
+ }
+
+ public static boolean isTypicalMasterEditor(IAdaptable editor) {
+ Set<String> types = getDiagramMappedCompositeTypes(editor);
+ return types.contains(ModelingResources.URIs.MasterTypicalCompositeType);
+ }
+
+ private static boolean hasDiagramSource(IDiagram diagram) {
+ return diagram.getHint(DiagramModelHints.KEY_HAS_DIAGRAM_SOURCE) != null;
+ }
+
+ public static boolean isTypicalInstanceEditor(IAdaptable editor) {
+ IDiagram diagram = getDiagram(editor);
+ if (diagram == null)
+ return false;
+ Set<String> types = getDiagramMappedCompositeTypes(diagram);
+ return !types.contains(ModelingResources.URIs.MasterTypicalCompositeType)
+ && types.contains(ModelingResources.URIs.TypicalComposite)
+ && hasDiagramSource(diagram);
+ }
+
+ private static boolean timeoutingRead(RequestProcessor processor, Read<Boolean> read) throws DatabaseException, InterruptedException {