diff --git a/plugins/org.eclipse.sirius.editor.diagram/META-INF/MANIFEST.MF b/plugins/org.eclipse.sirius.editor.diagram/META-INF/MANIFEST.MF index 253e80998b..8c0723a645 100644 --- a/plugins/org.eclipse.sirius.editor.diagram/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.sirius.editor.diagram/META-INF/MANIFEST.MF @@ -4,8 +4,7 @@ Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.sirius.editor.diagram;singleton:=true Bundle-Version: 7.4.3.qualifier Bundle-Vendor: %providerName -Require-Bundle: com.google.guava;bundle-version="27.0", - org.eclipse.core.runtime;bundle-version="3.8.0", +Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0", org.eclipse.emf.edit.ui;bundle-version="2.3.1", org.eclipse.sirius.common;bundle-version="7.4.3", org.eclipse.sirius.common.ui;bundle-version="7.4.3", diff --git a/plugins/org.eclipse.sirius.editor.diagram/src-gen/org/eclipse/sirius/diagram/editor/properties/sections/style/edgestyledescription/EdgeStyleDescriptionCenteredSourceMappingsPropertySection.java b/plugins/org.eclipse.sirius.editor.diagram/src-gen/org/eclipse/sirius/diagram/editor/properties/sections/style/edgestyledescription/EdgeStyleDescriptionCenteredSourceMappingsPropertySection.java index 89fd93445c..fc1fd7bc0a 100644 --- a/plugins/org.eclipse.sirius.editor.diagram/src-gen/org/eclipse/sirius/diagram/editor/properties/sections/style/edgestyledescription/EdgeStyleDescriptionCenteredSourceMappingsPropertySection.java +++ b/plugins/org.eclipse.sirius.editor.diagram/src-gen/org/eclipse/sirius/diagram/editor/properties/sections/style/edgestyledescription/EdgeStyleDescriptionCenteredSourceMappingsPropertySection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2018 THALES GLOBAL SERVICES. + * Copyright (c) 2007, 2024 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -15,9 +15,9 @@ // Start of user code imports import java.util.ArrayList; -import java.util.Collection; import java.util.Iterator; import java.util.List; +import java.util.stream.Collectors; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; @@ -36,9 +36,6 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; -import com.google.common.base.Predicates; -import com.google.common.collect.Collections2; - // End of user code imports /** @@ -153,8 +150,7 @@ private boolean isActivated() { protected List getChoiceOfValues(List currentValues) { List choiceOfValues = super.getChoiceOfValues(currentValues); removeUnrelatedMappings(choiceOfValues); - Collection collection = Collections2.filter(choiceOfValues, Predicates.instanceOf(AbstractNodeMapping.class)); - return new ArrayList(collection); + return choiceOfValues.stream().filter(AbstractNodeMapping.class::isInstance).collect(Collectors.toCollection(ArrayList::new)); } private void removeUnrelatedMappings(List choiceOfValues) { diff --git a/plugins/org.eclipse.sirius.editor.diagram/src-gen/org/eclipse/sirius/diagram/editor/properties/sections/style/edgestyledescription/EdgeStyleDescriptionCenteredTargetMappingsPropertySection.java b/plugins/org.eclipse.sirius.editor.diagram/src-gen/org/eclipse/sirius/diagram/editor/properties/sections/style/edgestyledescription/EdgeStyleDescriptionCenteredTargetMappingsPropertySection.java index e5db5f2b00..e560d14542 100644 --- a/plugins/org.eclipse.sirius.editor.diagram/src-gen/org/eclipse/sirius/diagram/editor/properties/sections/style/edgestyledescription/EdgeStyleDescriptionCenteredTargetMappingsPropertySection.java +++ b/plugins/org.eclipse.sirius.editor.diagram/src-gen/org/eclipse/sirius/diagram/editor/properties/sections/style/edgestyledescription/EdgeStyleDescriptionCenteredTargetMappingsPropertySection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2018 THALES GLOBAL SERVICES. + * Copyright (c) 2007, 2024 THALES GLOBAL SERVICES. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -15,9 +15,9 @@ // Start of user code imports import java.util.ArrayList; -import java.util.Collection; import java.util.Iterator; import java.util.List; +import java.util.stream.Collectors; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; @@ -36,9 +36,6 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; -import com.google.common.base.Predicates; -import com.google.common.collect.Collections2; - // End of user code imports /** @@ -153,8 +150,7 @@ private boolean isActivated() { protected List getChoiceOfValues(List currentValues) { List choiceOfValues = super.getChoiceOfValues(currentValues); removeUnrelatedMappings(choiceOfValues); - Collection collection = Collections2.filter(choiceOfValues, Predicates.instanceOf(AbstractNodeMapping.class)); - return new ArrayList(collection); + return choiceOfValues.stream().filter(AbstractNodeMapping.class::isInstance).collect(Collectors.toCollection(ArrayList::new)); } private void removeUnrelatedMappings(List choiceOfValues) { diff --git a/plugins/org.eclipse.sirius.editor.diagram/src-gen/org/eclipse/sirius/diagram/editor/properties/sections/tool/createview/CreateViewMappingPropertySection.java b/plugins/org.eclipse.sirius.editor.diagram/src-gen/org/eclipse/sirius/diagram/editor/properties/sections/tool/createview/CreateViewMappingPropertySection.java index 07963ff645..fc4c9850c2 100644 --- a/plugins/org.eclipse.sirius.editor.diagram/src-gen/org/eclipse/sirius/diagram/editor/properties/sections/tool/createview/CreateViewMappingPropertySection.java +++ b/plugins/org.eclipse.sirius.editor.diagram/src-gen/org/eclipse/sirius/diagram/editor/properties/sections/tool/createview/CreateViewMappingPropertySection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2018 THALES GLOBAL SERVICES. + * Copyright (c) 2007, 2024 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -17,6 +17,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.function.Predicate; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.EStructuralFeature; @@ -35,11 +36,6 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; -import com.google.common.base.Predicate; -import com.google.common.base.Predicates; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; - // End of user code imports /** @@ -129,11 +125,11 @@ protected List getChoiceOfValues() { // Start of user code choice of values if (!values.isEmpty()) { - Predicate predicate = Predicates.or(Predicates.instanceOf(EdgeMapping.class), Predicates.instanceOf(EdgeMappingImport.class)); + Predicate predicate = object -> object instanceof EdgeMapping || object instanceof EdgeMappingImport; if (eObject instanceof CreateEdgeView) { - values = Lists.newArrayList(Iterables.filter(values, predicate)); + values = values.stream().filter(predicate).toList(); } else if (eObject instanceof CreateView) { - values = Lists.newArrayList(Iterables.filter(values, Predicates.not(predicate))); + values = values.stream().filter(Predicate.not(predicate)).toList(); } } // End of user code choice of values diff --git a/plugins/org.eclipse.sirius.editor.diagram/src/org/eclipse/sirius/diagram/editor/properties/sections/tool/containerdropdescription/ContainerDropDescriptionContainersPropertySection.java b/plugins/org.eclipse.sirius.editor.diagram/src/org/eclipse/sirius/diagram/editor/properties/sections/tool/containerdropdescription/ContainerDropDescriptionContainersPropertySection.java index 2149facac6..92b400bb92 100644 --- a/plugins/org.eclipse.sirius.editor.diagram/src/org/eclipse/sirius/diagram/editor/properties/sections/tool/containerdropdescription/ContainerDropDescriptionContainersPropertySection.java +++ b/plugins/org.eclipse.sirius.editor.diagram/src/org/eclipse/sirius/diagram/editor/properties/sections/tool/containerdropdescription/ContainerDropDescriptionContainersPropertySection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 - 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2007, 2024 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -12,6 +12,8 @@ *******************************************************************************/ package org.eclipse.sirius.diagram.editor.properties.sections.tool.containerdropdescription; +import java.util.ArrayList; + // Start of user code imports import java.util.Iterator; @@ -35,10 +37,6 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; -import com.google.common.collect.Iterators; -import com.google.common.collect.Lists; -import com.google.common.collect.UnmodifiableIterator; - // End of user code imports /** @@ -106,9 +104,13 @@ protected boolean getSortChoice() { */ @Override protected List getChoiceOfValues() { - UnmodifiableIterator filter = Iterators.filter(eObject.eResource().getResourceSet().getAllContents(), - DragAndDropTargetDescription.class); - return Lists.newArrayList(filter); + List result = new ArrayList<>(); + eObject.eResource().getResourceSet().getAllContents().forEachRemaining(notifier -> { + if (notifier instanceof DragAndDropTargetDescription dndTarget) { + result.add(dndTarget); + } + }); + return result; } /** diff --git a/plugins/org.eclipse.sirius.editor.diagram/src/org/eclipse/sirius/diagram/editor/properties/sections/tool/deleteelementdescription/DeleteElementDescriptionMappingsPropertySection.java b/plugins/org.eclipse.sirius.editor.diagram/src/org/eclipse/sirius/diagram/editor/properties/sections/tool/deleteelementdescription/DeleteElementDescriptionMappingsPropertySection.java index 360d064e3e..400684fa3b 100644 --- a/plugins/org.eclipse.sirius.editor.diagram/src/org/eclipse/sirius/diagram/editor/properties/sections/tool/deleteelementdescription/DeleteElementDescriptionMappingsPropertySection.java +++ b/plugins/org.eclipse.sirius.editor.diagram/src/org/eclipse/sirius/diagram/editor/properties/sections/tool/deleteelementdescription/DeleteElementDescriptionMappingsPropertySection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 - 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2007, 2024 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -12,6 +12,8 @@ *******************************************************************************/ package org.eclipse.sirius.diagram.editor.properties.sections.tool.deleteelementdescription; +import java.util.ArrayList; + // Start of user code imports import java.util.Iterator; @@ -25,6 +27,7 @@ import org.eclipse.emf.edit.domain.IEditingDomainProvider; import org.eclipse.sirius.diagram.description.DescriptionPackage; import org.eclipse.sirius.diagram.description.DiagramElementMapping; +import org.eclipse.sirius.diagram.description.DragAndDropTargetDescription; import org.eclipse.sirius.diagram.description.tool.DeleteElementDescription; import org.eclipse.sirius.editor.editorPlugin.SiriusEditor; import org.eclipse.sirius.editor.properties.sections.common.AbstractEditorDialogWithListPropertySection; @@ -35,10 +38,6 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; -import com.google.common.collect.Iterators; -import com.google.common.collect.Lists; -import com.google.common.collect.UnmodifiableIterator; - // End of user code imports /** @@ -106,8 +105,13 @@ protected boolean getSortChoice() { */ @Override protected List getChoiceOfValues() { - UnmodifiableIterator filter = Iterators.filter(eObject.eResource().getResourceSet().getAllContents(), DiagramElementMapping.class); - return Lists.newArrayList(filter); + List result = new ArrayList<>(); + eObject.eResource().getResourceSet().getAllContents().forEachRemaining(notifier -> { + if (notifier instanceof DiagramElementMapping mapping) { + result.add(mapping); + } + }); + return result; } /** diff --git a/plugins/org.eclipse.sirius.editor.diagram/src/org/eclipse/sirius/diagram/editor/properties/sections/tool/directeditlabel/DirectEditLabelMappingPropertySection.java b/plugins/org.eclipse.sirius.editor.diagram/src/org/eclipse/sirius/diagram/editor/properties/sections/tool/directeditlabel/DirectEditLabelMappingPropertySection.java index 4e2ce40b6c..9a565fce77 100644 --- a/plugins/org.eclipse.sirius.editor.diagram/src/org/eclipse/sirius/diagram/editor/properties/sections/tool/directeditlabel/DirectEditLabelMappingPropertySection.java +++ b/plugins/org.eclipse.sirius.editor.diagram/src/org/eclipse/sirius/diagram/editor/properties/sections/tool/directeditlabel/DirectEditLabelMappingPropertySection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 - 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2007, 2024 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -12,6 +12,8 @@ *******************************************************************************/ package org.eclipse.sirius.diagram.editor.properties.sections.tool.directeditlabel; +import java.util.ArrayList; + // Start of user code imports import java.util.Iterator; @@ -35,10 +37,6 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; -import com.google.common.collect.Iterators; -import com.google.common.collect.Lists; -import com.google.common.collect.UnmodifiableIterator; - // End of user code imports /** @@ -135,8 +133,13 @@ protected boolean getSortChoice() { */ @Override protected List getChoiceOfValues() { - UnmodifiableIterator filter = Iterators.filter(eObject.eResource().getResourceSet().getAllContents(), DiagramElementMapping.class); - return Lists.newArrayList(filter); + List result = new ArrayList<>(); + eObject.eResource().getResourceSet().getAllContents().forEachRemaining(notifier -> { + if (notifier instanceof DiagramElementMapping mapping) { + result.add(mapping); + } + }); + return result; } /** diff --git a/plugins/org.eclipse.sirius.editor.diagram/src/org/eclipse/sirius/diagram/editor/properties/sections/tool/reconnectedgedescription/ReconnectEdgeDescriptionMappingsPropertySection.java b/plugins/org.eclipse.sirius.editor.diagram/src/org/eclipse/sirius/diagram/editor/properties/sections/tool/reconnectedgedescription/ReconnectEdgeDescriptionMappingsPropertySection.java index 380743822e..d7f898c5f0 100644 --- a/plugins/org.eclipse.sirius.editor.diagram/src/org/eclipse/sirius/diagram/editor/properties/sections/tool/reconnectedgedescription/ReconnectEdgeDescriptionMappingsPropertySection.java +++ b/plugins/org.eclipse.sirius.editor.diagram/src/org/eclipse/sirius/diagram/editor/properties/sections/tool/reconnectedgedescription/ReconnectEdgeDescriptionMappingsPropertySection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 - 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2007, 2024 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -12,6 +12,8 @@ *******************************************************************************/ package org.eclipse.sirius.diagram.editor.properties.sections.tool.reconnectedgedescription; +import java.util.ArrayList; + // Start of user code imports import java.util.Iterator; @@ -26,6 +28,7 @@ import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; import org.eclipse.sirius.diagram.description.DescriptionPackage; +import org.eclipse.sirius.diagram.description.DiagramElementMapping; import org.eclipse.sirius.diagram.description.EdgeMapping; import org.eclipse.sirius.diagram.description.tool.ReconnectEdgeDescription; import org.eclipse.sirius.editor.editorPlugin.SiriusEditor; @@ -37,10 +40,6 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; -import com.google.common.collect.Iterators; -import com.google.common.collect.Lists; -import com.google.common.collect.UnmodifiableIterator; - // End of user code imports /** @@ -108,8 +107,13 @@ protected boolean getSortChoice() { */ @Override protected List getChoiceOfValues() { - UnmodifiableIterator filter = Iterators.filter(eObject.eResource().getResourceSet().getAllContents(), EdgeMapping.class); - return Lists.newArrayList(filter); + List result = new ArrayList<>(); + eObject.eResource().getResourceSet().getAllContents().forEachRemaining(notifier -> { + if (notifier instanceof EdgeMapping mapping) { + result.add(mapping); + } + }); + return result; } /** diff --git a/plugins/org.eclipse.sirius.editor.diagram/src/org/eclipse/sirius/diagram/editor/tools/internal/menu/refactoring/DiagramRefactoringMenu.java b/plugins/org.eclipse.sirius.editor.diagram/src/org/eclipse/sirius/diagram/editor/tools/internal/menu/refactoring/DiagramRefactoringMenu.java index efadfcb463..01a68a8084 100644 --- a/plugins/org.eclipse.sirius.editor.diagram/src/org/eclipse/sirius/diagram/editor/tools/internal/menu/refactoring/DiagramRefactoringMenu.java +++ b/plugins/org.eclipse.sirius.editor.diagram/src/org/eclipse/sirius/diagram/editor/tools/internal/menu/refactoring/DiagramRefactoringMenu.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2009, 2024 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -15,6 +15,7 @@ import java.util.Collection; import java.util.LinkedHashSet; import java.util.Set; +import java.util.stream.Collectors; import org.eclipse.emf.edit.command.CommandParameter; import org.eclipse.jface.viewers.ISelection; @@ -24,14 +25,10 @@ import org.eclipse.sirius.editor.tools.internal.menu.refactoring.RefactoringMenu; import org.eclipse.ui.IEditorPart; -import com.google.common.base.Predicate; -import com.google.common.collect.Sets; - /** * The menu for the refactoring actions. * * @author cbrun - * */ public class DiagramRefactoringMenu extends AbstractMenuBuilder { @Override @@ -58,12 +55,7 @@ private Collection generateRefactoringActions(final ISelection selection, final allActions.add(new EdgeMappingRefactoringAction(editor, selection)); // We only add to the menu the actions that have a valid selection - return Sets.filter(allActions, new Predicate() { - - public boolean apply(AbstractEObjectRefactoringAction candidateAction) { - return candidateAction.isSelectionValid(); - } - }); + return allActions.stream().filter(AbstractEObjectRefactoringAction::isSelectionValid).collect(Collectors.toSet()); } @Override