Source:
public boolean provides(IOperation operation) { Boolean provides = false; if (operation instanceof ContributeToPaletteOperation) { ContributeToPaletteOperation o = (ContributeToPaletteOperation) operation; IEditorPart part = o.getEditor(); if (part instanceof DiagramEditorWithFlyOutPalette) { String diagramName = getDiagram().getName(); if (null != diagramName) { Diagram diagramPalette = ((DiagramEditorWithFlyOutPalette) part).getDiagram(); String implementationID = getDiagram().getImplementationID(); PapyrusDiagramStyle papyrusDiagramStyle = org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils.getPapyrusDiagramStyle(diagramPalette); boolean match = false; if (null != papyrusDiagramStyle) { if (diagramName.equals(papyrusDiagramStyle.getDiagramKind().getName())) { match = true; } } else if (null != implementationID) { if (null != diagramPalette && implementationID.equals(diagramPalette.getType())) { match = true; } } if (match && !isHidden(o)) { ModelSet modelSet = null; try { modelSet = ServiceUtils.getInstance().getModelSet(part.getAdapter(ServicesRegistry.class)); List<?> collect = new ArchitectureDescriptionUtils(modelSet).getArchitectureViewpoints().stream() .flatMap(p -> p.getRepresentationKinds().stream()) .filter(PapyrusDiagram.class::isInstance).map(PapyrusDiagram.class::cast) .filter(p -> getDiagram().getQualifiedName().equals(p.getQualifiedName())) .flatMap(p -> p.getPalettes().stream()).distinct() .collect(Collectors.toList()); provides = !collect.isEmpty(); } catch (ServiceException e) { Activator.log.error("Can't get model set", e); } } } } } return provides; }

Target:
public boolean provides(IOperation operation) { Boolean provides = false; if (operation instanceof ContributeToPaletteOperation) { ContributeToPaletteOperation o = (ContributeToPaletteOperation) operation; IEditorPart part = o.getEditor(); if (part instanceof DiagramEditorWithFlyOutPalette) { String diagramName = getDiagram().getName(); if (null != diagramName) { Diagram diagramPalette = ((DiagramEditorWithFlyOutPalette) part).getDiagram(); String implementationID = getDiagram().getImplementationID(); PapyrusDiagramStyle papyrusDiagramStyle = org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils.getPapyrusDiagramStyle(diagramPalette); boolean match = false; if (null != papyrusDiagramStyle) { match = diagramName.equals(papyrusDiagramStyle.getDiagramKind().getName()); } else if (null != implementationID) { match = null != diagramPalette && implementationID.equals(diagramPalette.getType()); } if (match && !isHidden(o)) { ModelSet modelSet = null; try { modelSet = ServiceUtils.getInstance().getModelSet(part.getAdapter(ServicesRegistry.class)); List<?> collect = new ArchitectureDescriptionUtils(modelSet).getArchitectureViewpoints().stream() .flatMap(p -> p.getRepresentationKinds().stream()) .filter(PapyrusDiagram.class::isInstance).map(PapyrusDiagram.class::cast) .filter(p -> getDiagram().getQualifiedName().equals(p.getQualifiedName())) .flatMap(p -> p.getPalettes().stream()).distinct() .collect(Collectors.toList()); provides = !collect.isEmpty(); } catch (ServiceException e) { Activator.log.error("Can't get model set", e); } } } } } return provides; }