use of org.yakindu.base.gmf.runtime.editparts.TextAwareLabelEditPart in project statecharts by Yakindu.
the class StatechartMarkerNavigationProvider method doGotoMarker.
@Override
@SuppressWarnings("rawtypes")
protected void doGotoMarker(IMarker marker) {
String elementId = marker.getAttribute(SCTMarkerType.SEMANTIC_ELEMENT_ID, null);
if (elementId == null || !(getEditor() instanceof DiagramEditor)) {
return;
}
DiagramEditor editor = (DiagramEditor) getEditor();
EObject targetElement = (EObject) editor.getDiagram().eResource().getEObject(elementId);
if (targetElement == null) {
return;
}
View view = DiagramPartitioningUtil.findNotationView(targetElement);
if (view == null) {
return;
}
Diagram element = DiagramPartitioningUtil.getDiagramContaining(view.getElement());
editor = (DiagramEditor) DiagramPartitioningUtil.openEditor(element);
Map editPartRegistry = editor.getDiagramGraphicalViewer().getEditPartRegistry();
EditPart targetEditPart = (EditPart) editPartRegistry.get(view);
if (targetEditPart != null) {
if (!targetEditPart.isSelectable())
return;
DiagramPartitioningUtil.selectElementsInDiagram(editor, Arrays.asList(new EditPart[] { targetEditPart }));
}
try {
if (marker.isSubtypeOf(SCTMarkerType.SUPERTYPE)) {
final DirectEditRequest request = new DirectEditRequest();
request.setDirectEditFeature(getEditFeature(targetElement, marker));
List<IGraphicalEditPart> allEditParts = getEditParts(editPartRegistry, EcoreUtil2.eAllContentsAsList(view));
for (IGraphicalEditPart editPart : allEditParts) {
if (editPart instanceof IXtextAwareEditPart || (editPart instanceof TextAwareLabelEditPart) && ((TextAwareLabelEditPart) editPart).getFeature().equals(request.getDirectEditFeature())) {
editPart.performRequest(request);
break;
}
}
}
} catch (CoreException e) {
e.printStackTrace();
}
}
Aggregations