diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/entry/ComponentEntryInfo.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/entry/ComponentEntryInfo.java index 5a3f8d526..bd774988b 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/entry/ComponentEntryInfo.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/entry/ComponentEntryInfo.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.core.editor.palette.model.entry; -import com.google.common.collect.ImmutableMap; - import org.eclipse.wb.core.editor.palette.model.CategoryInfo; import org.eclipse.wb.core.editor.palette.model.EntryInfo; import org.eclipse.wb.core.editor.palette.model.IPaletteSite; @@ -55,6 +53,7 @@ import java.text.MessageFormat; import java.util.ArrayList; +import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -450,7 +449,7 @@ public Object getNewObject() { private Map getTypeArguments() throws JavaModelException { Map typeParameters = m_creation.getTypeParameters(); if (typeParameters.isEmpty()) { - return ImmutableMap.of(); + return Collections.emptyMap(); } // open dialog TypeParametersDialog dialog = diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/core/eval/ExecutionFlowUtils.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/core/eval/ExecutionFlowUtils.java index 800ab4129..b238afcfb 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/core/eval/ExecutionFlowUtils.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/core/eval/ExecutionFlowUtils.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.core.eval; -import com.google.common.collect.ImmutableList; - import static org.eclipse.wb.internal.core.utils.ast.AstNodeUtils.getBinding; import static org.eclipse.wb.internal.core.utils.ast.AstNodeUtils.getConstructor; import static org.eclipse.wb.internal.core.utils.ast.AstNodeUtils.getCreationBinding; @@ -83,6 +81,7 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; @@ -638,7 +637,7 @@ private static List getVariableCachedList_notNull(ExecutionFlowDescriptio String key) { List result = (List) getVariableCachedValue(flowDescription, variable, key); if (result == null) { - return ImmutableList.of(); + return Collections.emptyList(); } else { return result; } diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/DesignPage.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/DesignPage.java index 004f4b596..bbffd3c59 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/DesignPage.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/DesignPage.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.editor; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.controls.PageBook; import org.eclipse.wb.core.editor.DesignerEditorListener; import org.eclipse.wb.core.editor.DesignerState; @@ -410,7 +408,7 @@ public void refreshGEF() { // notify listeners { List designPageListeners = - ImmutableList.copyOf(m_designerEditor.getDesignPageListeners()); + List.copyOf(m_designerEditor.getDesignPageListeners()); for (DesignerEditorListener listener : designPageListeners) { listener.reparsed(); } diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/palette/DesignerPalette.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/palette/DesignerPalette.java index 360cc66ac..3353ea374 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/palette/DesignerPalette.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/palette/DesignerPalette.java @@ -11,7 +11,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.editor.palette; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import org.eclipse.wb.core.controls.palette.ICategory; @@ -70,6 +69,7 @@ import org.eclipse.swt.widgets.Shell; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -192,7 +192,7 @@ private void reloadPalette() { * Adds given {@link Command} to the list and writes commands. */ private void commands_addWrite(Command command) { - commands_addWrite(ImmutableList.of(command)); + commands_addWrite(List.of(command)); } /** @@ -405,7 +405,7 @@ private void showPalette() { public List getCategories() { // check for skipping palette during tests if (System.getProperty(FLAG_NO_PALETTE) != null) { - return ImmutableList.of(); + return Collections.emptyList(); } // get categories for palette model final List categoryInfoList; diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/JavaInfoUtils.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/JavaInfoUtils.java index e838745fc..526454f8a 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/JavaInfoUtils.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/JavaInfoUtils.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.model; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import org.eclipse.wb.core.editor.IDesignPageSite; @@ -1002,7 +1001,8 @@ private static List getHierarchyProviders() { * Binds any not bound yet components to the given root {@link JavaInfo} or any of its children. */ public static void bindBinaryComponents(List components) throws Exception { - List reverseComponents = ImmutableList.copyOf(components).reverse(); + List reverseComponents = new ArrayList<>(components); + Collections.reverse(reverseComponents); // prepare map (object -> JavaInfo) final Map objectToModel; { @@ -2041,7 +2041,7 @@ public static JavaInfo getWrapped(JavaInfo original) throws Exception { */ public static void deleteJavaInfo(JavaInfo javaInfo, boolean removeFromParent) throws Exception { // delete children - List children = ImmutableList.copyOf(javaInfo.getChildren()); + List children = List.copyOf(javaInfo.getChildren()); for (ObjectInfo child : children) { // There are cases when children of some parent are "linked", so one deletes other on delete. // So, we should check, may be child is already deleted. diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/creation/ThisCreationSupport.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/creation/ThisCreationSupport.java index 4e16c9a42..ee2aee21d 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/creation/ThisCreationSupport.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/creation/ThisCreationSupport.java @@ -12,8 +12,6 @@ import com.google.common.base.Predicate; import com.google.common.base.Predicates; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableSet; import org.eclipse.wb.core.eval.AstEvaluationEngine; import org.eclipse.wb.core.eval.EvaluationContext; @@ -461,7 +459,7 @@ class ExcludedPackage { ExcludedPackage excludedPackage = new ExcludedPackage(); String exceptionMethodsString = entry.getValue(); String[] exceptionMethodsSignatures = StringUtils.split(exceptionMethodsString); - excludedPackage.exceptions = ImmutableSet.copyOf(exceptionMethodsSignatures); + excludedPackage.exceptions = Set.of(exceptionMethodsSignatures); excludedPackages.put(packageName, excludedPackage); } } @@ -599,7 +597,7 @@ private Object visitMethod0(Object obj, m_editorState.getTmp_visitingContext(), flowDescription, visitor, - ImmutableList.of(methodDeclaration)); + List.of(methodDeclaration)); // during execution we remember "return value", so return it here to binary return JavaInfoEvaluationHelper.getReturnValue(methodDeclaration); } diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/description/CreationDescription.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/description/CreationDescription.java index c41046f66..d387d8889 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/description/CreationDescription.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/description/CreationDescription.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.model.description; -import com.google.common.collect.ImmutableMap; - import org.eclipse.wb.internal.core.utils.StringUtilities; import org.eclipse.wb.internal.core.utils.jdt.core.CodeUtils; import org.eclipse.wb.internal.core.utils.reflect.ReflectionUtils; @@ -217,7 +215,7 @@ public String getTitle() { public Map getTypeParameters() { return m_typeArguments != null ? m_typeArguments - : ImmutableMap.of(); + : Collections.emptyMap(); } /** diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/description/helpers/ComponentDescriptionHelper.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/description/helpers/ComponentDescriptionHelper.java index f6f538199..4c43ce681 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/description/helpers/ComponentDescriptionHelper.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/description/helpers/ComponentDescriptionHelper.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.model.description.helpers; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import org.eclipse.wb.internal.core.model.description.AbstractInvocationDescription; @@ -104,6 +103,7 @@ import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.util.ArrayList; +import java.util.Collections; import java.util.LinkedList; import java.util.List; @@ -278,7 +278,7 @@ private static ComponentDescription getDescription0(AstEditor editor, Class c } // OK, get description ComponentDescriptionKey key = new ComponentDescriptionKey(componentClass); - return getDescription0(editor, key, ImmutableList.of()); + return getDescription0(editor, key, Collections.emptyList()); } /** @@ -317,7 +317,7 @@ private static ComponentDescription getKeySpecificDescription(AstEditor editor, } // OK, get key-specific description ClassResourceInfo descriptionInfo = new ClassResourceInfo(componentClass, resourceInfo); - return getDescription0(editor, key, ImmutableList.of(descriptionInfo)); + return getDescription0(editor, key, List.of(descriptionInfo)); } /** diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/description/resource/EmptyDescriptionVersionsProvider.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/description/resource/EmptyDescriptionVersionsProvider.java index c1c437a8e..af9293dfd 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/description/resource/EmptyDescriptionVersionsProvider.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/description/resource/EmptyDescriptionVersionsProvider.java @@ -10,10 +10,9 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.model.description.resource; -import com.google.common.collect.ImmutableList; - import org.eclipse.jdt.core.IJavaProject; +import java.util.Collections; import java.util.List; /** @@ -42,6 +41,6 @@ private EmptyDescriptionVersionsProvider() { //////////////////////////////////////////////////////////////////////////// @Override public List getVersions(Class componentClass) throws Exception { - return ImmutableList.of(); + return Collections.emptyList(); } } \ No newline at end of file diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/description/resource/FromListDescriptionVersionsProvider.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/description/resource/FromListDescriptionVersionsProvider.java index 5d6701872..d757224a2 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/description/resource/FromListDescriptionVersionsProvider.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/description/resource/FromListDescriptionVersionsProvider.java @@ -10,11 +10,10 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.model.description.resource; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.internal.core.utils.check.Assert; import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -57,7 +56,7 @@ public List getVersions(Class componentClass) throws Exception { if (validate(componentClass)) { return m_versions; } - return ImmutableList.of(); + return Collections.emptyList(); } protected abstract boolean validate(Class componentClass) throws Exception; diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/generation/statement/block/BlockStatementGenerator.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/generation/statement/block/BlockStatementGenerator.java index 285d01a1c..a61d93ad1 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/generation/statement/block/BlockStatementGenerator.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/generation/statement/block/BlockStatementGenerator.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.model.generation.statement.block; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.core.model.association.Association; import org.eclipse.wb.internal.core.model.generation.statement.AbstractInsideStatementGenerator; @@ -21,6 +19,8 @@ import org.eclipse.jdt.core.dom.Block; import org.eclipse.jdt.core.dom.Statement; +import java.util.List; + /** * Implementation of {@link StatementGenerator} that adds {@link Statement}'s in new {@link Block} * inside of target {@link Block}. @@ -47,7 +47,7 @@ private BlockStatementGenerator() { @Override public void add(JavaInfo child, StatementTarget target, Association association) throws Exception { // prepare block - Block block = (Block) child.getEditor().addStatement(ImmutableList.of("{", "}"), target); + Block block = (Block) child.getEditor().addStatement(List.of("{", "}"), target); // add statements in block target = new StatementTarget(block, true); add(child, target, null, association); diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/accessor/MethodInvocationAccessor.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/accessor/MethodInvocationAccessor.java index 9a43a8fc6..793d4a0ec 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/accessor/MethodInvocationAccessor.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/accessor/MethodInvocationAccessor.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.model.property.accessor; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.internal.core.model.property.table.PropertyTooltipProvider; import org.eclipse.wb.internal.core.utils.ast.AstEditor; @@ -23,6 +21,7 @@ import org.eclipse.jdt.core.dom.MethodInvocation; import java.lang.reflect.Method; +import java.util.List; /** * The implementation of {@link ExpressionAccessor} for accessing {@link MethodInvocation} of some @@ -77,7 +76,7 @@ public void run() throws Exception { ExecutionUtils.run(javaInfo, new RunnableEx() { @Override public void run() throws Exception { - editor.replaceInvocationArguments(invocation, ImmutableList.of(source)); + editor.replaceInvocationArguments(invocation, List.of(source)); } }); } diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/InnerClassPropertyEditor.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/InnerClassPropertyEditor.java index 059fb27e7..8e1364169 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/InnerClassPropertyEditor.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/InnerClassPropertyEditor.java @@ -10,9 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.model.property.editor; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; - import org.eclipse.wb.core.editor.IDesignPageSite; import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.internal.core.DesignerPlugin; @@ -45,6 +42,7 @@ import org.apache.commons.lang.StringUtils; import java.lang.reflect.Constructor; +import java.util.Collections; import java.util.List; import java.util.Locale; import java.util.Map; @@ -197,7 +195,7 @@ private void openClass(Property property) throws Exception { */ private void newClass_ANONYMOUS(GenericProperty genericProperty) throws Exception { JavaInfo javaInfo = genericProperty.getJavaInfo(); - String source = TemplateUtils.evaluate(m_source, javaInfo, ImmutableMap.of()); + String source = TemplateUtils.evaluate(m_source, javaInfo, Collections.emptyMap()); genericProperty.setExpression(source, Property.UNKNOWN_VALUE); } @@ -213,8 +211,8 @@ private void newClass_INNER(GenericProperty genericProperty) throws Exception { { newName = editor.getUniqueTypeName(m_baseName); String newSource = - TemplateUtils.evaluate(m_source, javaInfo, ImmutableMap.of("name", newName)); - newLines = ImmutableList.copyOf(StringUtils.split(newSource, "\r\n")); + TemplateUtils.evaluate(m_source, javaInfo, Map.of("name", newName)); + newLines = List.of(StringUtils.split(newSource, "\r\n")); } // add type { diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/ObjectPropertyEditor.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/ObjectPropertyEditor.java index 8f8580f36..5d389ab8d 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/ObjectPropertyEditor.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/ObjectPropertyEditor.java @@ -11,7 +11,6 @@ package org.eclipse.wb.internal.core.model.property.editor; import com.google.common.base.Predicate; -import com.google.common.collect.ImmutableList; import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.core.model.ObjectInfo; @@ -202,7 +201,7 @@ private void setComponent0(GenericProperty property, JavaInfo component) throws property.setExpression(TemplateUtils.getExpression(component), component); return; } - List allComponents = ImmutableList.of(thisComponent, component); + List allComponents = List.of(thisComponent, component); target = JavaInfoUtils.getStatementTarget_whenAllCreated(allComponents); } String source = diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/complex/InstanceObjectPropertyEditor.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/complex/InstanceObjectPropertyEditor.java index 2a68f04d5..bb7cfe0c9 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/complex/InstanceObjectPropertyEditor.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/editor/complex/InstanceObjectPropertyEditor.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.model.property.editor.complex; -import com.google.common.collect.ImmutableMap; - import org.eclipse.wb.core.editor.IDesignPageSite; import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.core.model.association.InvocationChildAssociation; @@ -56,6 +54,7 @@ import org.apache.commons.lang.StringUtils; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -276,7 +275,7 @@ public void run() throws Exception { } // evaluate new expression String evaluateSource = - TemplateUtils.evaluate(source, javaInfo, ImmutableMap.of()); + TemplateUtils.evaluate(source, javaInfo, Collections.emptyMap()); property.setExpression(evaluateSource, Property.UNKNOWN_VALUE); // create new instance info { diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/event/ListenerMethodProperty.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/event/ListenerMethodProperty.java index de3db44d9..ae80c5e3e 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/event/ListenerMethodProperty.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/property/event/ListenerMethodProperty.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.model.property.event; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.eval.ExecutionFlowDescription; import org.eclipse.wb.core.eval.ExecutionFlowUtils; import org.eclipse.wb.core.model.JavaInfo; @@ -69,6 +67,7 @@ import java.lang.reflect.Type; import java.text.MessageFormat; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.TreeMap; @@ -438,7 +437,7 @@ private TypeDeclaration addListenerInnerClassDeclaration() throws Exception { } // add inner class List lines = - ImmutableList.of("private class " + createInnerClassName() + headerSource + " {", "}"); + List.of("private class " + createInnerClassName() + headerSource + " {", "}"); return m_javaInfo.getEditor().addTypeDeclaration(lines, target); } @@ -645,10 +644,10 @@ private boolean shouldAppendOverride(TypeDeclaration type, ListenerMethodInfo me private static List getListenerMethodBody(ListenerMethodInfo methodInfo) { Class returnType = methodInfo.getMethod().getReturnType(); if (returnType == Void.TYPE) { - return ImmutableList.of(); + return Collections.emptyList(); } else { String defaultValue = AstParser.getDefaultValue(returnType.getName()); - return ImmutableList.of("return " + defaultValue + ";"); + return List.of("return " + defaultValue + ";"); } } @@ -807,7 +806,7 @@ private MethodDeclaration addStubMethod(ListenerMethodInfo methodInfo, // add stub method stubMethod = editor.addMethodDeclaration( header, - ImmutableList.of(), + Collections.emptyList(), new BodyDeclarationTarget(typeDeclaration, false)); } } @@ -822,7 +821,7 @@ private MethodDeclaration addStubMethod(ListenerMethodInfo methodInfo, if (m_preferences.getInt(P_CODE_TYPE) == V_CODE_INTERFACE) { lines = getConditionalStubInvocationSource(listenerMethod, editor, lineInvoke); } else { - lines = ImmutableList.of(lineInvoke); + lines = List.of(lineInvoke); } // add Statement that invokes stub if (lines != null) { @@ -871,7 +870,7 @@ public ComponentDescription runObject() throws Exception { parameter.getName().getIdentifier(), componentAccess, m_javaInfo); - return ImmutableList.of(lineIf, "\t" + lineInvoke, "}"); + return List.of(lineIf, "\t" + lineInvoke, "}"); } } } @@ -974,7 +973,7 @@ private MethodDeclaration findStubMethod(Statement listenerStatement) { if (listenerStatement instanceof Block) { statements = DomGenerics.statements((Block) listenerStatement); } else { - statements = ImmutableList.of(listenerStatement); + statements = List.of(listenerStatement); } // analyze statements if (statements.size() == 1) { diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/util/ExposeComponentSupport.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/util/ExposeComponentSupport.java index 62669ffbe..cb3b546b6 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/util/ExposeComponentSupport.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/util/ExposeComponentSupport.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.model.util; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.editor.IContextMenuConstants; import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.internal.core.DesignerPlugin; @@ -138,7 +136,7 @@ private static void expose(JavaInfo component, String methodName, String modifie component.getDescription().getComponentClass().getName(), methodName); String returnSource = TemplateUtils.resolve(methodTarget, "return {0};", component); - editor.addMethodDeclaration(headerSource, ImmutableList.of(returnSource), methodTarget); + editor.addMethodDeclaration(headerSource, List.of(returnSource), methodTarget); } //////////////////////////////////////////////////////////////////////////// diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/util/ExposePropertySupport.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/util/ExposePropertySupport.java index 4db228178..e94775d34 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/util/ExposePropertySupport.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/util/ExposePropertySupport.java @@ -1,7 +1,6 @@ package org.eclipse.wb.internal.core.model.util; import com.google.common.base.Predicate; -import com.google.common.collect.ImmutableList; import org.eclipse.wb.core.model.AbstractComponentInfo; import org.eclipse.wb.core.model.JavaInfo; @@ -274,7 +273,7 @@ private void expose(boolean isPublic) throws Exception { "return {0}.{1};", m_javaInfo, m_exposableAccessor.getGetterCode(m_javaInfo)); - m_editor.addMethodDeclaration(header, ImmutableList.of(body), methodTarget); + m_editor.addMethodDeclaration(header, List.of(body), methodTarget); } // setter { @@ -291,7 +290,7 @@ private void expose(boolean isPublic) throws Exception { "{0}.{1};", m_javaInfo, m_exposableAccessor.getSetterCode(m_javaInfo, m_exposedSetterParameter)); - m_editor.addMethodDeclaration(header, ImmutableList.of(body), methodTarget); + m_editor.addMethodDeclaration(header, List.of(body), methodTarget); } } diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/util/PlaceholderUtils.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/util/PlaceholderUtils.java index 87fa223ac..0541ee5b6 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/util/PlaceholderUtils.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/util/PlaceholderUtils.java @@ -10,13 +10,12 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.model.util; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.jdt.core.dom.ASTNode; import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -69,7 +68,7 @@ public static List getExceptions(JavaInfo javaInfo) { */ public static List getExceptions(ASTNode node) { List exceptions = getExceptions0(node); - return exceptions != null ? exceptions : ImmutableList.of(); + return exceptions != null ? exceptions : Collections.emptyList(); } /** diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/util/generic/LocalStaticFactoriesRootProcessor.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/util/generic/LocalStaticFactoriesRootProcessor.java index 5e91c70e6..8bfb119d9 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/util/generic/LocalStaticFactoriesRootProcessor.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/util/generic/LocalStaticFactoriesRootProcessor.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.model.util.generic; -import com.google.common.collect.ImmutableMap; - import org.eclipse.wb.core.editor.palette.PaletteEventListener; import org.eclipse.wb.core.editor.palette.model.CategoryInfo; import org.eclipse.wb.core.model.IRootProcessor; @@ -26,6 +24,7 @@ import org.eclipse.wb.internal.core.utils.execution.ExecutionUtils; import org.eclipse.wb.internal.core.utils.execution.RunnableEx; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -91,7 +90,7 @@ private static Map getLocalFactories(JavaInfo AstEditor editor = rootJavaInfo.getEditor(); // quick check if (!editor.getSource().contains("@wbp.factory")) { - return ImmutableMap.of(); + return Collections.emptyMap(); } // analyze String editorTypeName = editor.getModelUnit().findPrimaryType().getFullyQualifiedName(); @@ -113,7 +112,7 @@ private static CategoryInfo createLocalFactoriesCategory(Map properties = Lists.newArrayList(component.getProperties()); - for (Property property : ImmutableList.copyOf(properties)) { + for (Property property : List.copyOf(properties)) { PropertyEditor editor = property.getEditor(); if (editor instanceof INlsPropertyContributor) { ((INlsPropertyContributor) editor).contributeNlsProperties(property, properties); diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/parser/AbstractParseFactory.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/parser/AbstractParseFactory.java index 4d7d3638a..ddf10821c 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/parser/AbstractParseFactory.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/parser/AbstractParseFactory.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.parser; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.eval.ExecutionFlowUtils; import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.core.model.WrapperMethodInfo; @@ -788,7 +786,7 @@ protected void initializeClassLoader_parent(AstEditor editor, private static List getBundleClassLoaderNamespaces(IConfigurationElement contributorElement) { String namespacesString = contributorElement.getAttribute("namespaces"); if (namespacesString != null) { - return ImmutableList.copyOf(StringUtils.split(namespacesString)); + return List.of(StringUtils.split(namespacesString)); } return null; } diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/utils/ast/AstEditor.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/utils/ast/AstEditor.java index 6bc7e4a7a..ee6926a9c 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/utils/ast/AstEditor.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/utils/ast/AstEditor.java @@ -11,7 +11,6 @@ package org.eclipse.wb.internal.core.utils.ast; import com.google.common.base.Predicate; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import org.eclipse.wb.internal.core.utils.GenericsUtils; @@ -1460,7 +1459,7 @@ public TryStatement encloseInTryStatement(Statement statement, String catchExcep String line_3 = "}"; tryStatement = (TryStatement) addStatement( - ImmutableList.of(line_1, line_2, line_3), + List.of(line_1, line_2, line_3), new StatementTarget(statement, true)); } moveStatement(statement, new StatementTarget(tryStatement.getBody(), true)); @@ -1494,7 +1493,7 @@ public void endVisitEx(TryStatement node) throws Exception { public Block encloseInBlock(Statement statement) throws Exception { // add new Block Block block = - (Block) addStatement(ImmutableList.of("{", "}"), new StatementTarget(statement, true)); + (Block) addStatement(List.of("{", "}"), new StatementTarget(statement, true)); // move Statement into Block moveStatement(statement, new StatementTarget(block, true)); // OK, return Block @@ -2068,7 +2067,7 @@ public int getStatementEndIndex(Statement statement) { */ public FieldDeclaration addFieldDeclaration(String source, BodyDeclarationTarget target) throws Exception { - return addFieldDeclaration(ImmutableList.of(source), target); + return addFieldDeclaration(List.of(source), target); } /** @@ -2098,7 +2097,7 @@ public FieldDeclaration addFieldDeclaration(List lines, BodyDeclarationT public MethodDeclaration addMethodDeclaration(String header, List bodyLines, BodyDeclarationTarget target) throws Exception { - return addMethodDeclaration(ImmutableList.of(), header, bodyLines, target); + return addMethodDeclaration(Collections.emptyList(), header, bodyLines, target); } /** @@ -2149,7 +2148,7 @@ public MethodDeclaration addMethodDeclaration(List annotations, */ public MethodDeclaration addInterfaceMethodDeclaration(String header, BodyDeclarationTarget target) throws Exception { - List lines = ImmutableList.of(header + ";"); + List lines = List.of(header + ";"); return (MethodDeclaration) addBodyDeclaration(lines, target); } diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/utils/ast/DomGenerics.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/utils/ast/DomGenerics.java index 14c543a34..3e6a9d47b 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/utils/ast/DomGenerics.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/utils/ast/DomGenerics.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.utils.ast; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.internal.core.utils.GenericsUtils; import org.eclipse.jdt.core.dom.ASTNode; @@ -51,6 +49,7 @@ import org.eclipse.jdt.core.dom.VariableDeclarationStatement; import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -168,11 +167,11 @@ public static List statements(Block block) { public static List statements(MethodDeclaration method) { if (method == null) { - return ImmutableList.of(); + return Collections.emptyList(); } Block body = method.getBody(); if (body == null) { - return ImmutableList.of(); + return Collections.emptyList(); } return statements(body); } diff --git a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/DesignerPalette.java b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/DesignerPalette.java index bb8df2600..fa43c178b 100644 --- a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/DesignerPalette.java +++ b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/DesignerPalette.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.xml.editor.palette; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import org.eclipse.wb.core.controls.palette.ICategory; @@ -59,6 +58,7 @@ import org.eclipse.swt.widgets.Shell; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -176,7 +176,7 @@ private void reloadPalette() { * Adds given {@link Command} to the list and writes commands. */ private void commands_addWrite(Command command) { - commands_addWrite(ImmutableList.of(command)); + commands_addWrite(List.of(command)); } /** @@ -377,7 +377,7 @@ private void showPalette() { public List getCategories() { // check for skipping palette during tests if (System.getProperty(FLAG_NO_PALETTE) != null) { - return ImmutableList.of(); + return Collections.emptyList(); } // get categories for palette model final List categoryInfoList; diff --git a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/gef/EditPartFactory.java b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/gef/EditPartFactory.java index 1b48cacb9..eeedc8dab 100644 --- a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/gef/EditPartFactory.java +++ b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/gef/EditPartFactory.java @@ -10,12 +10,12 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.xml.gef; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.gef.MatchingEditPartFactory; import org.eclipse.wb.gef.core.EditPart; import org.eclipse.wb.gef.core.IEditPartFactory; +import java.util.List; + /** * {@link IEditPartFactory} for XML. * @@ -24,8 +24,8 @@ */ public final class EditPartFactory implements IEditPartFactory { private final static IEditPartFactory MATCHING_FACTORY = - new MatchingEditPartFactory(ImmutableList.of("org.eclipse.wb.internal.core.xml.model"), - ImmutableList.of("org.eclipse.wb.internal.core.xml.gef.part")); + new MatchingEditPartFactory(List.of("org.eclipse.wb.internal.core.xml.model"), + List.of("org.eclipse.wb.internal.core.xml.gef.part")); //////////////////////////////////////////////////////////////////////////// // diff --git a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/gefTree/EditPartFactory.java b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/gefTree/EditPartFactory.java index e1b1f5302..fce8c6890 100644 --- a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/gefTree/EditPartFactory.java +++ b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/gefTree/EditPartFactory.java @@ -10,12 +10,12 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.xml.gefTree; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.gef.MatchingEditPartFactory; import org.eclipse.wb.gef.core.EditPart; import org.eclipse.wb.gef.core.IEditPartFactory; +import java.util.List; + /** * {@link IEditPartFactory} for XML. * @@ -24,8 +24,8 @@ */ public final class EditPartFactory implements IEditPartFactory { private final static IEditPartFactory MATCHING_FACTORY = - new MatchingEditPartFactory(ImmutableList.of("org.eclipse.wb.internal.core.xml.model"), - ImmutableList.of("org.eclipse.wb.internal.core.xml.gefTree.part")); + new MatchingEditPartFactory(List.of("org.eclipse.wb.internal.core.xml.model"), + List.of("org.eclipse.wb.internal.core.xml.gefTree.part")); //////////////////////////////////////////////////////////////////////////// // diff --git a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/model/EditorContext.java b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/model/EditorContext.java index adb0b535b..a8cd45637 100644 --- a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/model/EditorContext.java +++ b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/model/EditorContext.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.xml.model; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.broadcast.BroadcastSupport; import org.eclipse.wb.internal.core.model.description.ToolkitDescription; import org.eclipse.wb.internal.core.model.description.helpers.DescriptionHelper; @@ -185,7 +183,7 @@ protected void addParentClassLoaders(CompositeClassLoader parentClassLoader) thr private static List getBundleClassLoaderNamespaces(IConfigurationElement contributorElement) { String namespacesString = contributorElement.getAttribute("namespaces"); if (namespacesString != null) { - return ImmutableList.copyOf(StringUtils.split(namespacesString)); + return List.of(StringUtils.split(namespacesString)); } return null; } diff --git a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/model/creation/ElementCreationSupport.java b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/model/creation/ElementCreationSupport.java index 44d3824f7..cd8c514a3 100644 --- a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/model/creation/ElementCreationSupport.java +++ b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/model/creation/ElementCreationSupport.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.xml.model.creation; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.internal.core.utils.check.Assert; import org.eclipse.wb.internal.core.utils.xml.DocumentElement; @@ -135,7 +133,7 @@ public void setObject(XmlObjectInfo object) throws Exception { @Override public void delete() throws Exception { // delete children - List children = ImmutableList.copyOf(m_object.getChildren()); + List children = List.copyOf(m_object.getChildren()); for (ObjectInfo child : children) { child.delete(); } diff --git a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/model/creation/TagCreationSupport.java b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/model/creation/TagCreationSupport.java index 2203b71ef..99dfb11eb 100644 --- a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/model/creation/TagCreationSupport.java +++ b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/model/creation/TagCreationSupport.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.xml.model.creation; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.internal.core.utils.xml.DocumentElement; import org.eclipse.wb.internal.core.xml.model.XmlObjectInfo; @@ -103,7 +101,7 @@ public String getTitle() { @Override public void delete() throws Exception { // delete children - List children = ImmutableList.copyOf(m_object.getChildren()); + List children = List.copyOf(m_object.getChildren()); for (ObjectInfo child : children) { child.delete(); } diff --git a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/model/description/ComponentDescription.java b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/model/description/ComponentDescription.java index bbb1ef630..5cf1f8c56 100644 --- a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/model/description/ComponentDescription.java +++ b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/model/description/ComponentDescription.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.xml.model.description; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.internal.core.model.description.ComponentPresentation; import org.eclipse.wb.internal.core.model.description.IComponentDescription; @@ -211,7 +209,7 @@ public void addProperty(GenericPropertyDescription property) { * @return all {@link CreationDescription}'s. */ public List getCreations() { - return ImmutableList.copyOf(m_creations.values()); + return List.copyOf(m_creations.values()); } /** diff --git a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/model/utils/GlobalStateXml.java b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/model/utils/GlobalStateXml.java index 78665c97f..2333c2848 100644 --- a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/model/utils/GlobalStateXml.java +++ b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/model/utils/GlobalStateXml.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.xml.model.utils; -import com.google.common.collect.ImmutableMap; - import org.eclipse.wb.core.gef.command.EditCommand; import org.eclipse.wb.core.model.IObjectInfo; import org.eclipse.wb.core.model.ObjectInfo; @@ -42,6 +40,7 @@ import org.eclipse.jdt.core.IJavaProject; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -139,7 +138,7 @@ public Map getParameters(Object object) { if (object instanceof ComponentDescription) { return ((ComponentDescription) object).getParameters(); } - return ImmutableMap.of(); + return Collections.emptyMap(); } @Override diff --git a/org.eclipse.wb.core/src/org/eclipse/wb/core/model/ObjectInfo.java b/org.eclipse.wb.core/src/org/eclipse/wb/core/model/ObjectInfo.java index 246174efb..161bc1417 100644 --- a/org.eclipse.wb.core/src/org/eclipse/wb/core/model/ObjectInfo.java +++ b/org.eclipse.wb.core/src/org/eclipse/wb/core/model/ObjectInfo.java @@ -10,9 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.core.model; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; - import org.eclipse.wb.core.model.broadcast.BroadcastSupport; import org.eclipse.wb.core.model.broadcast.ObjectEventListener; import org.eclipse.wb.core.model.broadcast.ObjectInfoAllProperties; @@ -622,7 +619,7 @@ protected void refresh_fetch() throws Exception { */ protected void refresh_finish() throws Exception { List children = getChildren(); - children = ImmutableList.copyOf(getChildren()); + children = List.copyOf(getChildren()); for (ObjectInfo child : children) { child.refresh_finish(); } @@ -672,7 +669,7 @@ public final Map getArbitraries() { if (m_arbitraryMap != null) { arbitraries = new HashMap<>(m_arbitraryMap); } else { - arbitraries = ImmutableMap.of(); + arbitraries = Collections.emptyMap(); } return arbitraries; } diff --git a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/gef/policy/layout/absolute/AbsoluteBasedLayoutEditPolicy.java b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/gef/policy/layout/absolute/AbsoluteBasedLayoutEditPolicy.java index e6d811fd2..e595f908e 100644 --- a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/gef/policy/layout/absolute/AbsoluteBasedLayoutEditPolicy.java +++ b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/gef/policy/layout/absolute/AbsoluteBasedLayoutEditPolicy.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.gef.policy.layout.absolute; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.gef.command.CompoundEditCommand; import org.eclipse.wb.core.gef.command.EditCommand; import org.eclipse.wb.core.gef.figure.OutlineImageFigure; @@ -437,9 +435,9 @@ private void showMoveFeedback(ChangeBoundsRequest request) { // do drag placementsSupport.drag( moveLocation, - ImmutableList.copyOf(modelList), + List.copyOf(modelList), widgetBounds, - ImmutableList.copyOf(relativeBounds)); + List.of(relativeBounds)); widgetBounds = placementsSupport.getBounds(); // Store new "model" location to be shown in TextFeedback if enabled int newX = widgetBounds.x; @@ -536,9 +534,9 @@ public void showResizeFeedback(ChangeBoundsRequest request) { // do drag getPlacementsSupport().drag( moveLocation, - ImmutableList.copyOf(modelList), + List.copyOf(modelList), widgetBounds, - ImmutableList.copyOf(relativeBounds), + List.of(relativeBounds), request.getResizeDirection()); // widgetBounds = getPlacementsSupport().getBounds(); @@ -781,9 +779,9 @@ private void showPasteFeedback(final PasteRequest request) { } placementsSupport.drag( request.getLocation(), - ImmutableList.copyOf(pastedModels), + List.copyOf(pastedModels), widgetBounds, - ImmutableList.copyOf(relativeBounds)); + List.of(relativeBounds)); widgetBounds = placementsSupport.getBounds(); m_pasteLocation = widgetBounds.getLocation(); translateModelToFeedback(widgetBounds); @@ -861,7 +859,7 @@ protected abstract void doPasteComponent(Point pasteLocation, PastedComponentInf // //////////////////////////////////////////////////////////////////////////// protected void onDelete(ObjectInfo child) throws Exception { - placementsSupport.delete(ImmutableList.of((IAbstractComponentInfo) child)); + placementsSupport.delete(List.of((IAbstractComponentInfo) child)); } @Override diff --git a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/gef/policy/snapping/PlacementsSupport.java b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/gef/policy/snapping/PlacementsSupport.java index 0d4586a14..f519c149c 100644 --- a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/gef/policy/snapping/PlacementsSupport.java +++ b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/gef/policy/snapping/PlacementsSupport.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.gef.policy.snapping; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import org.eclipse.wb.core.model.IAbstractComponentInfo; @@ -86,7 +85,7 @@ private PlacementsSupport(IAbstractComponentInfo widget, IVisualDataProvider vis IAbsoluteLayoutCommands layoutCommands, List remainingWidgets) { this(visualDataProvider, null, layoutCommands, remainingWidgets); m_bounds = PlacementUtils.getTranslatedBounds(visualDataProvider, widget); - m_operatingWidgets = ImmutableList.of(widget); + m_operatingWidgets = List.of(widget); } //////////////////////////////////////////////////////////////////////////// @@ -102,7 +101,7 @@ public void drag(Point location, IAbstractComponentInfo widget, Rectangle widget m_resizeDirection = resizeDirection; m_isCreating = widget.getModelBounds() == null; m_bounds = widgetBounds.getCopy(); - m_operatingWidgets = ImmutableList.of(widget); + m_operatingWidgets = List.of(widget); m_snapPoints.processBounds(this, location, m_operatingWidgets, resizeDirection); m_newModelBounds.put(widget, m_bounds.getCopy()); } @@ -721,7 +720,7 @@ private boolean isOverlapped(boolean isHorizontal) { } private void setOperatingWidgets(List widgets) { - m_operatingWidgets = ImmutableList.copyOf(widgets); + m_operatingWidgets = List.copyOf(widgets); } private void addWidgets() { @@ -829,7 +828,7 @@ public void replicateSize(List widgets, boolea } for (int i = 1; i < widgets.size(); i++) { IAbstractComponentInfo widget = widgets.get(i); - m_operatingWidgets = ImmutableList.of(widget); + m_operatingWidgets = List.of(widget); postprocess(); } cleanup(); @@ -856,7 +855,7 @@ private void centerWidget(IAbstractComponentInfo widget, boolean isHorizontal) t int position = (containerSize.width - widgetBounds.width) / 2; Point newPosition = new Point(position, widgetBounds.y); // - m_operatingWidgets = ImmutableList.of(widget); + m_operatingWidgets = List.of(widget); moveTo(widget, t.t(newPosition)); } @@ -903,7 +902,7 @@ public void distributeSpace(List widgets, bool for (IAbstractComponentInfo widget : widgets) { Rectangle widgetBounds = t.t(PlacementUtils.getTranslatedBounds(m_visualDataProvider, widget)); // - m_operatingWidgets = ImmutableList.of(widget); + m_operatingWidgets = List.of(widget); moveTo(widget, t.t(new Point(x, widgetBounds.y))); x += widgetBounds.width; x += space; @@ -930,7 +929,7 @@ private void moveTo(IAbstractComponentInfo widget, Point position) throws Except // //////////////////////////////////////////////////////////////////////////// public void setAlignment(IAbstractComponentInfo widget, int side) throws Exception { - setOperatingWidgets(ImmutableList.of(widget)); + setOperatingWidgets(List.of(widget)); preprocess(); // proceed boolean isHorizontal = PlacementUtils.isHorizontalSide(side); @@ -953,7 +952,7 @@ public void setAlignment(IAbstractComponentInfo widget, int side) throws Excepti } public void setResizeable(IAbstractComponentInfo widget, boolean isHorizontal) throws Exception { - setOperatingWidgets(ImmutableList.of(widget)); + setOperatingWidgets(List.of(widget)); preprocess(); // proceed int leadingSide = PlacementUtils.getSide(isHorizontal, true); diff --git a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/model/menu/IMenuPolicy.java b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/model/menu/IMenuPolicy.java index 1c1dfa5a4..69fce3047 100644 --- a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/model/menu/IMenuPolicy.java +++ b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/model/menu/IMenuPolicy.java @@ -10,8 +10,7 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.model.menu; -import com.google.common.collect.ImmutableList; - +import java.util.Collections; import java.util.List; /** @@ -131,7 +130,7 @@ public void commandMove(Object object, Object nextObject) throws Exception { @Override public List commandPaste(Object mementoObject, Object nextObject) throws Exception { - return ImmutableList.of(); + return Collections.emptyList(); } }; } diff --git a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/model/util/ScriptUtils.java b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/model/util/ScriptUtils.java index d70be4dcd..ffbe2f6c3 100644 --- a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/model/util/ScriptUtils.java +++ b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/model/util/ScriptUtils.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.model.util; -import com.google.common.collect.ImmutableMap; import com.google.common.collect.MapMaker; import com.google.common.collect.Maps; @@ -24,6 +23,7 @@ import org.mvel2.ParserContext; import java.lang.reflect.Field; +import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -43,7 +43,7 @@ public final class ScriptUtils { * Evaluates given script. */ public static Object evaluate(ClassLoader contextClassLoader, String script) { - Map variables = ImmutableMap.of(); + Map variables = Collections.emptyMap(); return evaluate(contextClassLoader, script, variables); } diff --git a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/utils/GenericsUtils.java b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/utils/GenericsUtils.java index a33a6fa3e..1da2af92e 100644 --- a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/utils/GenericsUtils.java +++ b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/utils/GenericsUtils.java @@ -11,7 +11,6 @@ package org.eclipse.wb.internal.core.utils; import com.google.common.base.Predicate; -import com.google.common.collect.ImmutableList; import org.eclipse.wb.internal.core.utils.check.Assert; @@ -23,6 +22,7 @@ import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -190,9 +190,9 @@ public static List asList(T[] elements, T element) { */ public static List singletonList(E element) { if (element == null) { - return ImmutableList.of(); + return Collections.emptyList(); } - return ImmutableList.of(element); + return List.of(element); } /** diff --git a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/utils/ui/dialogs/color/pages/NamedColorsComposite.java b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/utils/ui/dialogs/color/pages/NamedColorsComposite.java index c2e4f1f0f..064f81a57 100644 --- a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/utils/ui/dialogs/color/pages/NamedColorsComposite.java +++ b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/utils/ui/dialogs/color/pages/NamedColorsComposite.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.utils.ui.dialogs.color.pages; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.internal.core.utils.Messages; import org.eclipse.wb.internal.core.utils.ui.dialogs.color.AbstractColorDialog; import org.eclipse.wb.internal.core.utils.ui.dialogs.color.AbstractColorsGridComposite; @@ -21,6 +19,8 @@ import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Composite; +import java.util.List; + /** * Composite for selecting named color (HTML or SVG). * @@ -35,12 +35,12 @@ public final class NamedColorsComposite extends AbstractColorsGridComposite { //////////////////////////////////////////////////////////////////////////// public NamedColorsComposite(Composite parent, int style, AbstractColorDialog colorDialog) { super(parent, style, colorDialog); - createSortGroup(this, ImmutableList.of( + createSortGroup(this, List.of( Messages.NamedColorsComposite_sortTone, Messages.NamedColorsComposite_sortHue, Messages.NamedColorsComposite_sortSaturation, Messages.NamedColorsComposite_sortLightness, - Messages.NamedColorsComposite_sortName), ImmutableList.of( + Messages.NamedColorsComposite_sortName), List.of( ColorInfoComparator.TONE, ColorInfoComparator.HUE, ColorInfoComparator.SATURATION, diff --git a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/utils/ui/dialogs/color/pages/WebSafeColorsComposite.java b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/utils/ui/dialogs/color/pages/WebSafeColorsComposite.java index dd014333a..89d386839 100644 --- a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/utils/ui/dialogs/color/pages/WebSafeColorsComposite.java +++ b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/utils/ui/dialogs/color/pages/WebSafeColorsComposite.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.utils.ui.dialogs.color.pages; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.internal.core.utils.Messages; import org.eclipse.wb.internal.core.utils.ui.dialogs.color.AbstractColorDialog; import org.eclipse.wb.internal.core.utils.ui.dialogs.color.AbstractColorsGridComposite; @@ -22,6 +20,8 @@ import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Composite; +import java.util.List; + /** * Composite for selecting of of the 216 web safe colors. * @@ -36,11 +36,11 @@ public final class WebSafeColorsComposite extends AbstractColorsGridComposite { //////////////////////////////////////////////////////////////////////////// public WebSafeColorsComposite(Composite parent, int style, AbstractColorDialog colorPickerDialog) { super(parent, style, colorPickerDialog); - createSortGroup(this, ImmutableList.of( + createSortGroup(this, List.of( Messages.WebSafeColorsComposite_sortTone, Messages.WebSafeColorsComposite_sortHue, Messages.WebSafeColorsComposite_sortSaturation, - Messages.WebSafeColorsComposite_sortLightness), ImmutableList.of( + Messages.WebSafeColorsComposite_sortLightness), List.of( ColorInfoComparator.TONE, ColorInfoComparator.HUE, ColorInfoComparator.SATURATION, diff --git a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/utils/xml/DocumentElement.java b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/utils/xml/DocumentElement.java index 29b9ead37..6ef0b740e 100644 --- a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/utils/xml/DocumentElement.java +++ b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/utils/xml/DocumentElement.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.utils.xml; -import com.google.common.collect.ImmutableList; - import org.apache.commons.lang.StringUtils; import java.io.PrintWriter; @@ -298,7 +296,7 @@ public void removeChildren() { * @return the {@link DocumentElement} children. */ public List getChildren() { - return ImmutableList.copyOf(m_children); + return List.copyOf(m_children); } /** @@ -492,7 +490,7 @@ public DocumentAttribute getDocumentAttribute(String name) { * @return the {@link List} with all attributes. */ public List getDocumentAttributes() { - return ImmutableList.copyOf(m_attributes.values()); + return List.copyOf(m_attributes.values()); } /** diff --git a/org.eclipse.wb.rcp.databinding/src/org/eclipse/wb/internal/rcp/databinding/model/ControllerSupport.java b/org.eclipse.wb.rcp.databinding/src/org/eclipse/wb/internal/rcp/databinding/model/ControllerSupport.java index 54d225c4d..d87a762ac 100644 --- a/org.eclipse.wb.rcp.databinding/src/org/eclipse/wb/internal/rcp/databinding/model/ControllerSupport.java +++ b/org.eclipse.wb.rcp.databinding/src/org/eclipse/wb/internal/rcp/databinding/model/ControllerSupport.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.rcp.databinding.model; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.internal.core.DesignerPlugin; import org.eclipse.wb.internal.core.databinding.model.IBindingInfo; @@ -203,7 +201,7 @@ public static String ensureControllerReference(DatabindingsProvider provider, String header = "public " + javaInfo.getDescription().getComponentClass().getName() + " " + methodName; // prepare method lines - List methodLines = ImmutableList.of("return " + reference + ";"); + List methodLines = List.of("return " + reference + ";"); // add method javaInfo.getEditor().addMethodDeclaration(header, methodLines, target); if (commit) { diff --git a/org.eclipse.wb.rcp.nebula/src/org/eclipse/wb/internal/rcp/nebula/gef/EditPartFactory.java b/org.eclipse.wb.rcp.nebula/src/org/eclipse/wb/internal/rcp/nebula/gef/EditPartFactory.java index fa4f79e47..e64fe6d34 100644 --- a/org.eclipse.wb.rcp.nebula/src/org/eclipse/wb/internal/rcp/nebula/gef/EditPartFactory.java +++ b/org.eclipse.wb.rcp.nebula/src/org/eclipse/wb/internal/rcp/nebula/gef/EditPartFactory.java @@ -10,12 +10,12 @@ *******************************************************************************/ package org.eclipse.wb.internal.rcp.nebula.gef; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.gef.MatchingEditPartFactory; import org.eclipse.wb.gef.core.EditPart; import org.eclipse.wb.gef.core.IEditPartFactory; +import java.util.List; + /** * Implementation of {@link IEditPartFactory} for Nebula widgets. * @@ -24,8 +24,8 @@ */ public final class EditPartFactory implements IEditPartFactory { private final static IEditPartFactory MATCHING_FACTORY = - new MatchingEditPartFactory(ImmutableList.of("org.eclipse.wb.internal.rcp.nebula"), - ImmutableList.of("org.eclipse.wb.internal.rcp.nebula")); + new MatchingEditPartFactory(List.of("org.eclipse.wb.internal.rcp.nebula"), + List.of("org.eclipse.wb.internal.rcp.nebula")); //////////////////////////////////////////////////////////////////////////// // diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/RcpDescriptionVersionsProviderFactory.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/RcpDescriptionVersionsProviderFactory.java index 0050ece4f..89a395af9 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/RcpDescriptionVersionsProviderFactory.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/RcpDescriptionVersionsProviderFactory.java @@ -11,9 +11,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.rcp; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; - import org.eclipse.wb.internal.core.model.description.resource.FromListDescriptionVersionsProvider; import org.eclipse.wb.internal.core.model.description.resource.IDescriptionVersionsProvider; import org.eclipse.wb.internal.core.model.description.resource.IDescriptionVersionsProviderFactory; @@ -22,6 +19,7 @@ import org.eclipse.jdt.core.JavaModelException; import org.eclipse.swt.SWT; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -54,11 +52,11 @@ private RcpDescriptionVersionsProviderFactory() { public Map getVersions(IJavaProject javaProject, ClassLoader classLoader) throws Exception { if (!isRCP(javaProject)) { - return ImmutableMap.of(); + return Collections.emptyMap(); } // OK, RCP project String version = getSWTVersion(); - return ImmutableMap.of("rcp_version", version); + return Map.of("rcp_version", version); } @Override @@ -69,7 +67,7 @@ public IDescriptionVersionsProvider getProvider(IJavaProject javaProject, ClassL } // OK, RCP project String version = getSWTVersion(); - List allVersions = ImmutableList.of( + List allVersions = List.of( "3.7", "3.8", "4.2", diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/EditPartFactory.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/EditPartFactory.java index 41be23482..c86e782f1 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/EditPartFactory.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/EditPartFactory.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.rcp.gef; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.gef.MatchingEditPartFactory; import org.eclipse.wb.core.gef.part.menu.MenuEditPartFactory; import org.eclipse.wb.core.model.AbstractComponentInfo; @@ -28,6 +26,8 @@ import org.eclipse.wb.internal.rcp.model.jface.action.MenuManagerInfo; import org.eclipse.wb.internal.swt.model.widgets.CompositeInfo; +import java.util.List; + /** * Implementation of {@link IEditPartFactory} for RCP. * @@ -36,8 +36,8 @@ */ public final class EditPartFactory implements IEditPartFactory { private final static IEditPartFactory MATCHING_FACTORY = - new MatchingEditPartFactory(ImmutableList.of("org.eclipse.wb.internal.rcp.model"), - ImmutableList.of("org.eclipse.wb.internal.rcp.gef.part")); + new MatchingEditPartFactory(List.of("org.eclipse.wb.internal.rcp.model"), + List.of("org.eclipse.wb.internal.rcp.gef.part")); //////////////////////////////////////////////////////////////////////////// // diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/policy/rcp/perspective/AbstractPartSelectionEditPolicy.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/policy/rcp/perspective/AbstractPartSelectionEditPolicy.java index 2e3c2ccdf..f587801d6 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/policy/rcp/perspective/AbstractPartSelectionEditPolicy.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/policy/rcp/perspective/AbstractPartSelectionEditPolicy.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.rcp.gef.policy.rcp.perspective; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.gef.command.EditCommand; import org.eclipse.wb.draw2d.Figure; import org.eclipse.wb.draw2d.FigureUtils; @@ -33,6 +31,7 @@ import org.eclipse.gef.commands.Command; import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -76,7 +75,7 @@ protected List createSelectionHandles() { @Override protected List createStaticHandles() { if (m_line == null) { - return ImmutableList.of(); + return Collections.emptyList(); } // prepare handle Handle resizeHandle = new Handle(getHost(), new ILocator() { @@ -104,7 +103,7 @@ public void relocate(Figure target) { } // single static handle resizeHandle.setDragTrackerTool(new ResizeTracker(getHost(), m_line.getPosition(), REQ_RESIZE)); - return ImmutableList.of(resizeHandle); + return List.of(resizeHandle); } //////////////////////////////////////////////////////////////////////////// diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gefTree/EditPartFactory.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gefTree/EditPartFactory.java index 4279bdf91..b343c1c31 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gefTree/EditPartFactory.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gefTree/EditPartFactory.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.rcp.gefTree; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.gef.MatchingEditPartFactory; import org.eclipse.wb.gef.core.EditPart; import org.eclipse.wb.gef.core.IEditPartFactory; @@ -19,6 +17,8 @@ import org.eclipse.wb.internal.rcp.model.forms.FormInfo; import org.eclipse.wb.internal.swt.model.widgets.CompositeInfo; +import java.util.List; + /** * Implementation of {@link IEditPartFactory} for RCP. * @@ -27,8 +27,8 @@ */ public final class EditPartFactory implements IEditPartFactory { private final static IEditPartFactory MATCHING_FACTORY = - new MatchingEditPartFactory(ImmutableList.of("org.eclipse.wb.internal.rcp.model"), - ImmutableList.of("org.eclipse.wb.internal.rcp.gefTree.part")); + new MatchingEditPartFactory(List.of("org.eclipse.wb.internal.rcp.model"), + List.of("org.eclipse.wb.internal.rcp.gefTree.part")); //////////////////////////////////////////////////////////////////////////// // diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/jface/FieldEditorInfo.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/jface/FieldEditorInfo.java index 943def20a..51b6c1a67 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/jface/FieldEditorInfo.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/jface/FieldEditorInfo.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.rcp.model.jface; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.eval.EvaluationContext; import org.eclipse.wb.core.model.AbstractComponentInfo; import org.eclipse.wb.core.model.JavaInfo; @@ -50,6 +48,7 @@ import java.lang.reflect.Method; import java.util.ArrayList; +import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -204,7 +203,7 @@ public Object getComponentObject() { private final IObjectPresentation m_presentation = new DefaultJavaInfoPresentation(this) { @Override public List getChildrenGraphical() throws Exception { - return ImmutableList.of(); + return Collections.emptyList(); } }; diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/jface/WindowInfo.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/jface/WindowInfo.java index 2ae31147e..5a34d5353 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/jface/WindowInfo.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/jface/WindowInfo.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.rcp.model.jface; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.editor.IContextMenuConstants; import org.eclipse.wb.core.model.AbstractComponentInfo; import org.eclipse.wb.core.model.ObjectInfo; @@ -94,7 +92,7 @@ protected void runEx() throws Exception { TypeDeclaration typeDeclaration = JavaInfoUtils.getTypeDeclaration(WindowInfo.this); getEditor().addMethodDeclaration( "protected org.eclipse.swt.graphics.Point getInitialSize()", - ImmutableList.of("return new org.eclipse.swt.graphics.Point(545, 390);"), + List.of("return new org.eclipse.swt.graphics.Point(545, 390);"), new BodyDeclarationTarget(typeDeclaration, false)); } Dimension preferredSize = getPreferredSize(); diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/jface/action/ActionContainerInfo.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/jface/action/ActionContainerInfo.java index 1c841b362..729036e14 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/jface/action/ActionContainerInfo.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/jface/action/ActionContainerInfo.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.rcp.model.jface.action; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.core.model.association.AssociationObjects; @@ -172,7 +170,7 @@ public static void ensureInstance(JavaInfo root, final ActionInfo action) throws actionsMethod = editor.addMethodDeclaration( methodHeader, - ImmutableList.of(), + Collections.emptyList(), new BodyDeclarationTarget(rootMethod, false)); // if needed, invoke from constructor if (methodInvocation != null) { @@ -185,7 +183,7 @@ public static void ensureInstance(JavaInfo root, final ActionInfo action) throws { Block targetBlock = (Block) editor.addStatement( - ImmutableList.of("{", "}"), + List.of("{", "}"), new StatementTarget(actionsMethod, false)); actionTarget = new StatementTarget(targetBlock, true); } diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/jface/action/MenuManagerInfo.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/jface/action/MenuManagerInfo.java index 9560b1541..e43d06f83 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/jface/action/MenuManagerInfo.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/jface/action/MenuManagerInfo.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.rcp.model.jface.action; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.AbstractComponentInfo; import org.eclipse.wb.core.model.broadcast.DisplayEventListener; import org.eclipse.wb.internal.core.model.creation.CreationSupport; @@ -41,6 +39,7 @@ import org.eclipse.swt.widgets.MenuItem; import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -354,7 +353,7 @@ public void commandCreate(Object newObject, Object nextObject) throws Exception @Override public List commandPaste(Object mementoObject, Object nextObject) throws Exception { - return ImmutableList.of(); + return Collections.emptyList(); } @Override diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/rcp/PdeUtils.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/rcp/PdeUtils.java index 2bfcabc81..ef3504589 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/rcp/PdeUtils.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/rcp/PdeUtils.java @@ -11,8 +11,6 @@ package org.eclipse.wb.internal.rcp.model.rcp; import com.google.common.base.Predicate; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import org.eclipse.wb.internal.core.DesignerPlugin; @@ -506,7 +504,7 @@ private void ensurePluginXML() throws Exception { IFile pluginXML = m_project.getFile("plugin.xml"); if (!pluginXML.exists()) { List lines = - ImmutableList.of( + List.of( "", "", "", @@ -919,7 +917,7 @@ public boolean visit(IPluginElement element) { * Creates new {@link IPluginElement} for Eclipse view category. */ public IPluginElement createViewCategoryElement(String id, String name) throws Exception { - Map attributes = ImmutableMap.of("id", id, "name", name); + Map attributes = Map.of("id", id, "name", name); createExtensionElement("org.eclipse.ui.views", "category", attributes); return waitExtensionElementById("org.eclipse.ui.views", "category", id); } @@ -928,7 +926,7 @@ public IPluginElement createViewCategoryElement(String id, String name) throws E * Creates new {@link IPluginElement} for Eclipse view. */ public void createViewElement(String id, String name, String className) throws Exception { - Map attributes = ImmutableMap.of("id", id, "name", name, "class", className); + Map attributes = Map.of("id", id, "name", name, "class", className); createExtensionElement("org.eclipse.ui.views", "view", attributes); } @@ -1067,7 +1065,7 @@ public boolean visit(IPluginElement element) { * Creates new {@link IPluginElement} for Eclipse perspective. */ public void createPerspectiveElement(String id, String name, String className) throws Exception { - Map attributes = ImmutableMap.of("id", id, "name", name, "class", className); + Map attributes = Map.of("id", id, "name", name, "class", className); createExtensionElement("org.eclipse.ui.perspectives", "perspective", attributes); } @@ -1120,7 +1118,7 @@ public static PerspectiveInfo getPerspectiveInfoDefault(final String perspective * Creates new {@link IPluginElement} for Eclipse editor. */ public void createEditorElement(String id, String name, String className) throws Exception { - Map attributes = ImmutableMap.of("id", id, "name", name, "class", className); + Map attributes = Map.of("id", id, "name", name, "class", className); createExtensionElement("org.eclipse.ui.editors", "editor", attributes); } diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/rcp/perspective/shortcuts/AbstractShortcutContainerInfo.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/rcp/perspective/shortcuts/AbstractShortcutContainerInfo.java index e151e30ec..1b74a72d7 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/rcp/perspective/shortcuts/AbstractShortcutContainerInfo.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/rcp/perspective/shortcuts/AbstractShortcutContainerInfo.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.rcp.model.rcp.perspective.shortcuts; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.draw2d.IColorConstants; import org.eclipse.wb.internal.core.model.JavaInfoUtils; @@ -47,6 +45,7 @@ import org.eclipse.ui.IPageLayout; import java.lang.reflect.Constructor; +import java.util.Collections; import java.util.List; /** @@ -240,7 +239,7 @@ protected final T command_CREATE(String id, shortcutsMethod = editor.addMethodDeclaration( "private void " + shortcutsMethodName + "(org.eclipse.ui.IPageLayout layout)", - ImmutableList.of(), + Collections.emptyList(), new BodyDeclarationTarget(typeDeclaration, false)); // add shortcuts method invocation into "createInitialLayout" { diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/widgets/AbstractTabItemInfo.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/widgets/AbstractTabItemInfo.java index 02990642e..d642b4983 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/widgets/AbstractTabItemInfo.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/widgets/AbstractTabItemInfo.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.rcp.model.widgets; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.core.model.broadcast.JavaEventListener; @@ -37,6 +35,7 @@ import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.widgets.TabItem; +import java.util.Collections; import java.util.List; /** @@ -155,9 +154,9 @@ public void doSelect() { public List getChildrenTree() throws Exception { ControlInfo control = getControl(); if (control != null) { - return ImmutableList.of(control); + return List.of(control); } else { - return ImmutableList.of(); + return Collections.emptyList(); } } }; diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/widgets/CoolItemInfo.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/widgets/CoolItemInfo.java index 4007a9ed9..254f3bf50 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/widgets/CoolItemInfo.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/widgets/CoolItemInfo.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.rcp.model.widgets; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.core.model.broadcast.JavaEventListener; @@ -36,6 +34,7 @@ import org.eclipse.jdt.core.dom.MethodInvocation; import org.eclipse.swt.widgets.CoolItem; +import java.util.Collections; import java.util.List; /** @@ -128,9 +127,9 @@ public IObjectPresentation getPresentation() { public final List getSimpleContainerChildren() { ObjectInfo control = getControl(); if (control != null) { - return ImmutableList.of(control); + return List.of(control); } else { - return ImmutableList.of(); + return Collections.emptyList(); } } diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/widgets/ExpandItemInfo.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/widgets/ExpandItemInfo.java index a2a81cc29..22d4c28fd 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/widgets/ExpandItemInfo.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/widgets/ExpandItemInfo.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.rcp.model.widgets; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.core.model.broadcast.JavaEventListener; @@ -38,6 +36,7 @@ import org.eclipse.swt.widgets.ExpandBar; import org.eclipse.swt.widgets.ExpandItem; +import java.util.Collections; import java.util.List; /** @@ -121,7 +120,7 @@ public List getChildrenTree() throws Exception { @Override public List getChildrenGraphical() throws Exception { if (!isExpanded()) { - return ImmutableList.of(); + return Collections.emptyList(); } return getChildrenTree(); } diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/widgets/ToolItemInfo.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/widgets/ToolItemInfo.java index 8f71d0ba2..59af45696 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/widgets/ToolItemInfo.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/model/widgets/ToolItemInfo.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.rcp.model.widgets; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.core.model.broadcast.JavaEventListener; @@ -38,6 +36,7 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.ToolItem; +import java.util.Collections; import java.util.List; /** @@ -145,9 +144,9 @@ public boolean isSeparator() { public final List getSimpleContainerChildren() { ObjectInfo control = getControl(); if (control != null) { - return ImmutableList.of(control); + return List.of(control); } else { - return ImmutableList.of(); + return Collections.emptyList(); } } diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/parser/ParseFactory.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/parser/ParseFactory.java index dab6cc204..bea6dad89 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/parser/ParseFactory.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/parser/ParseFactory.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.rcp.parser; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import org.eclipse.wb.core.eval.ExecutionFlowDescription; @@ -161,7 +160,7 @@ public ParseRootContext getRootContext(AstEditor editor, javaInfo.setVariableSupport(new MethodParameterVariableSupport(javaInfo, pageLayoutParameter)); // prepare root context - List rootMethods = ImmutableList.of(createMethod); + List rootMethods = List.of(createMethod); return new ParseRootContext(javaInfo, new ExecutionFlowDescription(rootMethods)); } } @@ -500,7 +499,7 @@ protected String getToolkitId() { @Override protected void initializeClassLoader_parent(AstEditor editor, CompositeClassLoader parentClassLoader) throws Exception { - parentClassLoader.add(new BundleClassLoader("com.ibm.icu"), ImmutableList.of("com.ibm.icu.")); + parentClassLoader.add(new BundleClassLoader("com.ibm.icu"), List.of("com.ibm.icu.")); parentClassLoader.add(new BundleClassLoader("org.eclipse.ui"), null); parentClassLoader.add(new BundleClassLoader("org.eclipse.ui.forms"), null); parentClassLoader.add(new BundleClassLoader("org.eclipse.jdt.ui"), null); diff --git a/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/model/FormLayoutInfo.java b/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/model/FormLayoutInfo.java index 557c52817..b2b8b948a 100644 --- a/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/model/FormLayoutInfo.java +++ b/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/model/FormLayoutInfo.java @@ -12,7 +12,6 @@ import com.google.common.collect.BiMap; import com.google.common.collect.ImmutableBiMap; -import com.google.common.collect.ImmutableList; import org.eclipse.wb.core.editor.IContextMenuConstants; import org.eclipse.wb.core.editor.actions.assistant.AbstractAssistantPage; @@ -426,7 +425,7 @@ public void writeDimensions() throws Exception { // getEditor().replaceCreationArguments( creation, - ImmutableList.copyOf(CodeUtils.join(columnsSource, rowsSource))); + List.of(CodeUtils.join(columnsSource, rowsSource))); } // write groups writeDimensionsGroups("setColumnGroups", m_columns, m_columnGroups); diff --git a/org.eclipse.wb.swing.MigLayout/src/org/eclipse/wb/internal/swing/MigLayout/model/MigLayoutInfo.java b/org.eclipse.wb.swing.MigLayout/src/org/eclipse/wb/internal/swing/MigLayout/model/MigLayoutInfo.java index f1c118feb..dd47550dd 100644 --- a/org.eclipse.wb.swing.MigLayout/src/org/eclipse/wb/internal/swing/MigLayout/model/MigLayoutInfo.java +++ b/org.eclipse.wb.swing.MigLayout/src/org/eclipse/wb/internal/swing/MigLayout/model/MigLayoutInfo.java @@ -12,7 +12,6 @@ import com.google.common.collect.BiMap; import com.google.common.collect.ImmutableBiMap; -import com.google.common.collect.ImmutableList; import org.eclipse.wb.core.editor.IContextMenuConstants; import org.eclipse.wb.core.editor.actions.assistant.AbstractAssistantPage; @@ -423,7 +422,7 @@ public void writeDimensions() throws Exception { ClassInstanceCreation creation = creationSupport.getCreation(); getEditor().replaceCreationArguments( creation, - ImmutableList.of(MessageFormat.format( + List.of(MessageFormat.format( "{0}, {1}, {2}", layoutConstraintsSource, columnsSource, diff --git a/org.eclipse.wb.swing.databinding/src/org/eclipse/wb/internal/swing/databinding/model/beans/VirtualObserveInfo.java b/org.eclipse.wb.swing.databinding/src/org/eclipse/wb/internal/swing/databinding/model/beans/VirtualObserveInfo.java index e442a36e8..359e91433 100644 --- a/org.eclipse.wb.swing.databinding/src/org/eclipse/wb/internal/swing/databinding/model/beans/VirtualObserveInfo.java +++ b/org.eclipse.wb.swing.databinding/src/org/eclipse/wb/internal/swing/databinding/model/beans/VirtualObserveInfo.java @@ -10,18 +10,17 @@ *******************************************************************************/ package org.eclipse.wb.internal.swing.databinding.model.beans; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.internal.core.databinding.model.IObservePresentation; import org.eclipse.wb.internal.core.databinding.model.presentation.SimpleObservePresentation; import org.eclipse.wb.internal.core.databinding.model.reference.StringReferenceProvider; import org.eclipse.wb.internal.swing.databinding.Activator; import org.eclipse.wb.internal.swing.databinding.model.ObserveCreationType; -import org.eclipse.wb.internal.swing.databinding.model.ObserveInfo; import org.eclipse.wb.internal.swing.databinding.model.generic.ClassGenericType; import org.eclipse.jface.viewers.IDecoration; +import java.util.List; + /** * @author lobas_av * @coverage bindings.swing.model.beans @@ -39,7 +38,7 @@ public VirtualObserveInfo() { setBindingDecoration(IDecoration.TOP_LEFT); m_presentation = new SimpleObservePresentation("[Virtual]", "[Virtual]", Activator.getImageDescriptor("virtual.png")); - setProperties(ImmutableList.of(new ObjectPropertyObserveInfo(getObjectType()))); + setProperties(List.of(new ObjectPropertyObserveInfo(getObjectType()))); } //////////////////////////////////////////////////////////////////////////// diff --git a/org.eclipse.wb.swing.java6/src/org/eclipse/wb/internal/swing/java6/model/GroupLayoutInfo.java b/org.eclipse.wb.swing.java6/src/org/eclipse/wb/internal/swing/java6/model/GroupLayoutInfo.java index 5843d8c2c..10290ceaf 100644 --- a/org.eclipse.wb.swing.java6/src/org/eclipse/wb/internal/swing/java6/model/GroupLayoutInfo.java +++ b/org.eclipse.wb.swing.java6/src/org/eclipse/wb/internal/swing/java6/model/GroupLayoutInfo.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.swing.java6.model; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.IAbstractComponentInfo; import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.core.model.broadcast.JavaEventListener; @@ -180,12 +178,12 @@ private void save() throws Exception { private void saveGroup(String methodName, SpringInfo rootGroup) throws Exception { /*List childrenComponents = getContainer().getChildrenComponents(); StatementTarget statementTarget = - JavaInfoUtils.getStatementTarget_whenAllCreated(ImmutableList.copyOf(childrenComponents)); + JavaInfoUtils.getStatementTarget_whenAllCreated(List.copyOf(childrenComponents)); String referenceExpression = getVariableSupport().getReferenceExpression(new NodeTarget(statementTarget));*/ MethodInvocation invocation = getMethodInvocation(methodName); String groupCode = rootGroup.getCode(); - getEditor().replaceInvocationArguments(invocation, ImmutableList.of(groupCode)); + getEditor().replaceInvocationArguments(invocation, List.of(groupCode)); } //////////////////////////////////////////////////////////////////////////// diff --git a/org.eclipse.wb.swing.jsr296/src/org/eclipse/wb/internal/swing/jsr296/gef/EditPartFactory.java b/org.eclipse.wb.swing.jsr296/src/org/eclipse/wb/internal/swing/jsr296/gef/EditPartFactory.java index 9294a65bf..ae3de26bf 100644 --- a/org.eclipse.wb.swing.jsr296/src/org/eclipse/wb/internal/swing/jsr296/gef/EditPartFactory.java +++ b/org.eclipse.wb.swing.jsr296/src/org/eclipse/wb/internal/swing/jsr296/gef/EditPartFactory.java @@ -10,12 +10,12 @@ *******************************************************************************/ package org.eclipse.wb.internal.swing.jsr296.gef; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.gef.MatchingEditPartFactory; import org.eclipse.wb.gef.core.EditPart; import org.eclipse.wb.gef.core.IEditPartFactory; +import java.util.List; + /** * {@link IEditPartFactory} for JSR-296. * @@ -24,8 +24,8 @@ */ public final class EditPartFactory implements IEditPartFactory { private final static IEditPartFactory MATCHING_FACTORY = - new MatchingEditPartFactory(ImmutableList.of("org.eclipse.wb.internal.swing.jsr296.model"), - ImmutableList.of("org.eclipse.wb.internal.swing.jsr296.gef")); + new MatchingEditPartFactory(List.of("org.eclipse.wb.internal.swing.jsr296.model"), + List.of("org.eclipse.wb.internal.swing.jsr296.gef")); //////////////////////////////////////////////////////////////////////////// // diff --git a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/gef/EditPartFactory.java b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/gef/EditPartFactory.java index f0697c74e..9de431bc6 100644 --- a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/gef/EditPartFactory.java +++ b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/gef/EditPartFactory.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.swing.gef; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.gef.MatchingEditPartFactory; import org.eclipse.wb.core.gef.part.menu.MenuEditPartFactory; import org.eclipse.wb.gef.core.EditPart; @@ -45,6 +43,8 @@ import org.eclipse.wb.internal.swing.model.component.menu.JMenuItemInfo; import org.eclipse.wb.internal.swing.model.component.menu.JPopupMenuInfo; +import java.util.List; + import javax.swing.Box; /** @@ -169,8 +169,8 @@ private EditPart createEditPart(ComponentInfo component, String signature) { } }; private final static IEditPartFactory MATCHING_FACTORY = - new MatchingEditPartFactory(ImmutableList.of("org.eclipse.wb.internal.swing.model.component"), - ImmutableList.of("org.eclipse.wb.internal.swing.gef.part")); + new MatchingEditPartFactory(List.of("org.eclipse.wb.internal.swing.model.component"), + List.of("org.eclipse.wb.internal.swing.gef.part")); private static final IEditPartFactory GENERIC_FACTORY = new IEditPartFactory() { @Override public EditPart createEditPart(EditPart context, Object model) { diff --git a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/laf/LafSupport.java b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/laf/LafSupport.java index 1428fecd3..49253fe10 100644 --- a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/laf/LafSupport.java +++ b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/laf/LafSupport.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.swing.laf; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.eval.AstEvaluationEngine; import org.eclipse.wb.core.eval.EvaluationContext; import org.eclipse.wb.core.eval.ExecutionFlowDescription; @@ -124,7 +122,7 @@ private LafSupport() { */ public static List getLAFCategoriesList() { createLAFList(); - return ImmutableList.copyOf(m_lafList); + return List.copyOf(m_lafList); } /** diff --git a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/bean/ActionInfo.java b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/bean/ActionInfo.java index cecba6cbc..26d7b72db 100644 --- a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/bean/ActionInfo.java +++ b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/bean/ActionInfo.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.swing.model.bean; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.editor.palette.PaletteEventListener; import org.eclipse.wb.core.editor.palette.model.CategoryInfo; import org.eclipse.wb.core.editor.palette.model.EntryInfo; @@ -156,7 +154,7 @@ public static void setAction(ComponentInfo component, ActionInfo action) throws } action.addRelatedNodes(invocation); // select component - component.getBroadcastObject().select(ImmutableList.of(component)); + component.getBroadcastObject().select(List.of(component)); } } diff --git a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/component/JToolBarInfo.java b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/component/JToolBarInfo.java index f854b77ad..c2d8735b4 100644 --- a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/component/JToolBarInfo.java +++ b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/component/JToolBarInfo.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.swing.model.component; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.association.AssociationObject; import org.eclipse.wb.core.model.association.AssociationObjects; import org.eclipse.wb.internal.core.model.JavaInfoUtils; @@ -25,6 +23,8 @@ import org.eclipse.wb.internal.swing.model.bean.ActionContainerInfo; import org.eclipse.wb.internal.swing.model.bean.ActionInfo; +import java.util.List; + import javax.swing.JButton; import javax.swing.JToolBar; import javax.swing.SwingConstants; @@ -93,7 +93,7 @@ public ComponentInfo command_CREATE(ActionInfo action, ComponentInfo nextCompone ComponentInfo newButton = (ComponentInfo) JavaInfoUtils.createJavaInfo(getEditor(), JButton.class, creationSupport); JavaInfoUtils.add(newButton, AssociationObjects.invocationVoid(), this, nextComponent); - getBroadcastObject().select(ImmutableList.of(newButton)); + getBroadcastObject().select(List.of(newButton)); return newButton; } diff --git a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/component/menu/JMenuPolicyImpl.java b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/component/menu/JMenuPolicyImpl.java index e79f5b870..df949fbe1 100644 --- a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/component/menu/JMenuPolicyImpl.java +++ b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/component/menu/JMenuPolicyImpl.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.swing.model.component.menu; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.core.model.association.AssociationObject; import org.eclipse.wb.core.model.association.AssociationObjects; @@ -121,7 +119,7 @@ public void commandCreate(Object newObject, Object nextObject) throws Exception m_menu.getEditor(), JMenuItem.class, creationSupport); - m_menu.getBroadcastObject().select(ImmutableList.of(newComponent)); + m_menu.getBroadcastObject().select(List.of(newComponent)); // association is done implicitly during creation association = AssociationObjects.invocationVoid(); } else { diff --git a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/layout/gbl/AbstractGridBagLayoutInfo.java b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/layout/gbl/AbstractGridBagLayoutInfo.java index f5628234a..d76bdc506 100644 --- a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/layout/gbl/AbstractGridBagLayoutInfo.java +++ b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/layout/gbl/AbstractGridBagLayoutInfo.java @@ -12,7 +12,6 @@ import com.google.common.collect.BiMap; import com.google.common.collect.ImmutableBiMap; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import org.eclipse.wb.core.editor.actions.assistant.AbstractAssistantPage; @@ -143,7 +142,7 @@ void visitComponents(IComponentVisitor visitor) throws Exception { * Visits all {@link ComponentInfo} of this {@link ContainerInfo}. */ void visitComponents(IComponentVisitor visitor, IComponentPredicate predicate) throws Exception { - List components = ImmutableList.copyOf(getComponents()); + List components = List.copyOf(getComponents()); for (ComponentInfo component : components) { AbstractGridBagConstraintsInfo constraints = getConstraints(component); if (predicate.apply(component, constraints)) { diff --git a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/layout/spring/SpringAttachmentInfo.java b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/layout/spring/SpringAttachmentInfo.java index ab489606e..9e259bf91 100644 --- a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/layout/spring/SpringAttachmentInfo.java +++ b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/model/layout/spring/SpringAttachmentInfo.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.swing.model.layout.spring; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.controls.CCombo3; import org.eclipse.wb.draw2d.IPositionConstants; import org.eclipse.wb.internal.core.gef.policy.snapping.PlacementUtils; @@ -350,7 +348,7 @@ public void adjustAfterComponentMove() throws Exception { */ private NodeTarget getRequiredNodeTarget() throws Exception { StatementTarget statementTarget = - JavaInfoUtils.getStatementTarget_whenAllCreated(ImmutableList.of( + JavaInfoUtils.getStatementTarget_whenAllCreated(List.of( m_layout, m_component, m_anchorComponent)); diff --git a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/swingx/JXTaskPaneInfo.java b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/swingx/JXTaskPaneInfo.java index 332107fa4..5d39575f4 100644 --- a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/swingx/JXTaskPaneInfo.java +++ b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/swingx/JXTaskPaneInfo.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.swing.swingx; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.association.AssociationObjects; import org.eclipse.wb.internal.core.model.JavaInfoUtils; import org.eclipse.wb.internal.core.model.creation.CreationSupport; @@ -25,6 +23,7 @@ import org.eclipse.wb.internal.swing.model.component.JPanelInfo; import java.awt.Component; +import java.util.List; /** * Model for org.jdesktop.swingx.JXTaskPane. @@ -70,7 +69,7 @@ public ComponentInfo command_CREATE(ActionInfo action, ComponentInfo nextCompone ComponentInfo newComponent = (ComponentInfo) JavaInfoUtils.createJavaInfo(getEditor(), Component.class, creationSupport); JavaInfoUtils.add(newComponent, AssociationObjects.invocationVoid(), this, nextComponent); - getBroadcastObject().select(ImmutableList.of(newComponent)); + getBroadcastObject().select(List.of(newComponent)); return newComponent; } } diff --git a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/EditPartFactory.java b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/EditPartFactory.java index 0e3ccfae1..be31500e2 100644 --- a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/EditPartFactory.java +++ b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/EditPartFactory.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.swt.gef; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.gef.MatchingEditPartFactory; import org.eclipse.wb.core.gef.part.menu.MenuEditPartFactory; import org.eclipse.wb.gef.core.EditPart; @@ -24,6 +22,8 @@ import org.eclipse.wb.internal.swt.model.widgets.menu.MenuInfo; import org.eclipse.wb.internal.swt.model.widgets.menu.MenuItemInfo; +import java.util.List; + /** * Implementation of {@link IEditPartFactory} for SWT. * @@ -33,9 +33,9 @@ */ public final class EditPartFactory implements IEditPartFactory { private final static IEditPartFactory MATCHING_FACTORY = - new MatchingEditPartFactory(ImmutableList.of( + new MatchingEditPartFactory(List.of( "org.eclipse.wb.internal.swt.model.widgets", - "org.eclipse.wb.internal.swt.model.jface.viewer"), ImmutableList.of( + "org.eclipse.wb.internal.swt.model.jface.viewer"), List.of( "org.eclipse.wb.internal.swt.gef.part", "org.eclipse.wb.internal.swt.gef.part")); diff --git a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gefTree/EditPartFactory.java b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gefTree/EditPartFactory.java index dbb0879fb..186177a56 100644 --- a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gefTree/EditPartFactory.java +++ b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gefTree/EditPartFactory.java @@ -10,12 +10,12 @@ *******************************************************************************/ package org.eclipse.wb.internal.swt.gefTree; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.gef.MatchingEditPartFactory; import org.eclipse.wb.gef.core.EditPart; import org.eclipse.wb.gef.core.IEditPartFactory; +import java.util.List; + /** * Implementation of {@link IEditPartFactory} for SWT. * @@ -24,8 +24,8 @@ */ public final class EditPartFactory implements IEditPartFactory { private final static IEditPartFactory MATCHING_FACTORY = - new MatchingEditPartFactory(ImmutableList.of("org.eclipse.wb.internal.swt.model.widgets"), - ImmutableList.of("org.eclipse.wb.internal.swt.gefTree.part")); + new MatchingEditPartFactory(List.of("org.eclipse.wb.internal.swt.model.widgets"), + List.of("org.eclipse.wb.internal.swt.gefTree.part")); //////////////////////////////////////////////////////////////////////////// // diff --git a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/model/layout/LayoutDataInfo.java b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/model/layout/LayoutDataInfo.java index 8cce03d7d..3b7b0a872 100644 --- a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/model/layout/LayoutDataInfo.java +++ b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/model/layout/LayoutDataInfo.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.swt.model.layout; -import com.google.common.collect.ImmutableMap; - import org.eclipse.wb.core.eval.AstEvaluationEngine; import org.eclipse.wb.core.eval.EvaluationContext; import org.eclipse.wb.core.model.JavaInfo; @@ -309,7 +307,7 @@ && getFieldAssignments().isEmpty()) { private boolean isDefault(String signature, List args) throws Exception { String script = JavaInfoUtils.getParameter(m_this, "isDefault"); if (script != null) { - Map variables = ImmutableMap.of("signature", signature, "args", args); + Map variables = Map.of("signature", signature, "args", args); return (Boolean) ScriptUtils.evaluate( JavaInfoUtils.getClassLoader(m_this), script, diff --git a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/model/layout/VirtualLayoutDataStatementGenerator.java b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/model/layout/VirtualLayoutDataStatementGenerator.java index 45d609f77..848cb6332 100644 --- a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/model/layout/VirtualLayoutDataStatementGenerator.java +++ b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/model/layout/VirtualLayoutDataStatementGenerator.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.swt.model.layout; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.core.model.association.Association; import org.eclipse.wb.internal.core.model.generation.statement.AbstractInsideStatementGenerator; @@ -20,6 +18,8 @@ import org.eclipse.jdt.core.dom.Block; +import java.util.List; + /** * Implementation of {@link StatementGenerator} for virtual {@link LayoutDataInfo}. * @@ -37,7 +37,7 @@ public final class VirtualLayoutDataStatementGenerator extends AbstractInsideSta @Override public void add(JavaInfo child, StatementTarget target, Association association) throws Exception { // prepare block - Block block = (Block) child.getEditor().addStatement(ImmutableList.of("{", "}"), target); + Block block = (Block) child.getEditor().addStatement(List.of("{", "}"), target); // add statements in block target = new StatementTarget(block, true); add(child, target, null, association); diff --git a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/model/layout/form/FormAttachmentInfo.java b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/model/layout/form/FormAttachmentInfo.java index f391bd1e5..1621b7722 100644 --- a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/model/layout/form/FormAttachmentInfo.java +++ b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/model/layout/form/FormAttachmentInfo.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.swt.model.layout.form; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.core.model.broadcast.JavaEventListener; import org.eclipse.wb.internal.core.gef.policy.snapping.PlacementUtils; @@ -38,6 +36,7 @@ import org.eclipse.swt.layout.FormLayout; import java.io.Serializable; +import java.util.List; /** * SWT {@link FormAttachment} model. This is related to {@link FormLayout}. @@ -324,7 +323,7 @@ public void write() throws Exception { private String getReferenceExpression_ensureFormDataVisible(ControlInfo control) throws Exception { FormDataInfo layoutData = (FormDataInfo) getParent(); StatementTarget statementTarget = - JavaInfoUtils.getStatementTarget_whenAllCreated(ImmutableList.of(layoutData, control)); + JavaInfoUtils.getStatementTarget_whenAllCreated(List.of(layoutData, control)); String referenceExpression = control.getVariableSupport().getReferenceExpression(new NodeTarget(statementTarget)); moveStatement(this, statementTarget); @@ -341,7 +340,7 @@ private void moveStatement(JavaInfo javaInfo, StatementTarget statementTarget) t private void setConstructorArguments(final String source, ControlInfo control) throws Exception { ConstructorCreationSupport creationSupport = (ConstructorCreationSupport) getCreationSupport(); ClassInstanceCreation cic = creationSupport.getCreation(); - getEditor().replaceCreationArguments(cic, ImmutableList.of(source)); + getEditor().replaceCreationArguments(cic, List.of(source)); if (control != null) { replaceFormDataQualifier(cic, control); } @@ -354,7 +353,7 @@ private void replaceFormDataQualifier(ClassInstanceCreation cic, ControlInfo con QualifiedName formDataAssignmentLeft = (QualifiedName) formDataAssignment.getLeftHandSide(); FormDataInfo layoutData = (FormDataInfo) getParent(); StatementTarget statementTarget = - JavaInfoUtils.getStatementTarget_whenAllCreated(ImmutableList.of(layoutData, control)); + JavaInfoUtils.getStatementTarget_whenAllCreated(List.of(layoutData, control)); String referenceExpression = layoutData.getVariableSupport().getReferenceExpression(new NodeTarget(statementTarget)); getEditor().replaceExpression(formDataAssignmentLeft.getQualifier(), referenceExpression); diff --git a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/model/widgets/menu/MenuItemInfo.java b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/model/widgets/menu/MenuItemInfo.java index f1f5bf46f..a58708210 100644 --- a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/model/widgets/menu/MenuItemInfo.java +++ b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/model/widgets/menu/MenuItemInfo.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.swt.model.widgets.menu; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.core.model.association.AssociationObject; @@ -45,6 +43,7 @@ import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.jface.resource.ImageDescriptor; +import java.util.Collections; import java.util.List; import java.util.Optional; @@ -370,7 +369,7 @@ public void commandCreate(Object object, Object nextObject) throws Exception { @Override public List commandPaste(Object mementoObject, Object nextObject) throws Exception { - return ImmutableList.of(); + return Collections.emptyList(); } @Override diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/Expectations.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/Expectations.java index aea9c87cf..7733a8782 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/Expectations.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/Expectations.java @@ -10,9 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; - import org.eclipse.wb.internal.core.EnvironmentUtils; import org.eclipse.draw2d.geometry.Dimension; @@ -79,12 +76,12 @@ public static V get(Map values) { } public static V get(String key_1, V value_1, String key_2, V value_2) { - Map map = ImmutableMap.of(key_1, value_1, key_2, value_2); + Map map = Map.of(key_1, value_1, key_2, value_2); return get(map); } public static V get(String key_1, V value_1, String key_2, V value_2, String key_3, V value_3) { - Map map = ImmutableMap.of(key_1, value_1, key_2, value_2, key_3, value_3); + Map map = Map.of(key_1, value_1, key_2, value_2, key_3, value_3); return get(map); } @@ -94,7 +91,7 @@ public static V get(String key_1, V value_1, String key_2, V value_2, String // //////////////////////////////////////////////////////////////////////////// public static int get(String key_1, int value_1, String key_2, int value_2) { - Map map = ImmutableMap.of(key_1, value_1, key_2, value_2); + Map map = Map.of(key_1, value_1, key_2, value_2); return get(map); } @@ -104,7 +101,7 @@ public static int get(String key_1, int value_2, String key_3, int value_3) { - Map map = ImmutableMap.of(key_1, value_1, key_2, value_2, key_3, value_3); + Map map = Map.of(key_1, value_1, key_2, value_2, key_3, value_3); return get(map); } @@ -114,7 +111,7 @@ public static int get(String key_1, // //////////////////////////////////////////////////////////////////////////// public static double get(String key_1, double value_1, String key_2, double value_2) { - Map map = ImmutableMap.of(key_1, value_1, key_2, value_2); + Map map = Map.of(key_1, value_1, key_2, value_2); return get(map); } @@ -124,7 +121,7 @@ public static double get(String key_1, double value_2, String key_3, double value_3) { - Map map = ImmutableMap.of(key_1, value_1, key_2, value_2, key_3, value_3); + Map map = Map.of(key_1, value_1, key_2, value_2, key_3, value_3); return get(map); } @@ -138,7 +135,7 @@ private static List getKeys() { String keyHost = m_hostName; String keyOS = m_OSName; String timeZone = Calendar.getInstance().getTimeZone().getID(); - return ImmutableList.of( + return List.of( keyHostOS, keyHost, keyHost.toLowerCase(Locale.ENGLISH), diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/AbstractXmlObjectTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/AbstractXmlObjectTest.java index fd842b162..112039e51 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/AbstractXmlObjectTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/AbstractXmlObjectTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.XML; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.controls.CCombo3; import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.internal.core.model.ObjectInfoVisitor; @@ -49,6 +47,7 @@ import org.junit.Before; import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -596,7 +595,7 @@ protected static void setComboPropertyValue(Property property, int index) { */ public static IMenuManager getContextMenu(ObjectInfo... objectsArray) throws Exception { IMenuManager manager = getDesignerMenuManager(); - List objects = ImmutableList.copyOf(objectsArray); + List objects = List.of(objectsArray); ObjectInfo object = objectsArray[0]; object.getBroadcastObject().addContextMenu(objects, object, manager); return manager; @@ -607,7 +606,7 @@ public static IMenuManager getContextMenu(ObjectInfo... objectsArray) throws Exc */ public static List getSelectionActions_noSelection(ObjectInfo root) throws Exception { List actions = new ArrayList<>(); - ImmutableList objects = ImmutableList.of(); + List objects = Collections.emptyList(); root.getBroadcastObject().addSelectionActions(objects, actions); return actions; } @@ -619,7 +618,7 @@ public static List getSelectionActions(ObjectInfo... objectsArray) throw List actions = new ArrayList<>(); if (objectsArray.length != 0) { ObjectInfo object = objectsArray[0]; - List objects = ImmutableList.copyOf(objectsArray); + List objects = List.of(objectsArray); object.getBroadcastObject().addSelectionActions(objects, actions); } return actions; diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/model/association/IntermediateAssociationTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/model/association/IntermediateAssociationTest.java index 98d3bd6bf..9a535c25b 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/model/association/IntermediateAssociationTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/model/association/IntermediateAssociationTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.XML.model.association; -import com.google.common.collect.ImmutableMap; - import org.eclipse.wb.internal.core.xml.model.XmlObjectInfo; import org.eclipse.wb.internal.core.xml.model.association.Association; import org.eclipse.wb.internal.core.xml.model.association.Associations; @@ -22,6 +20,9 @@ import org.junit.Test; +import java.util.Map; +import java.util.TreeMap; + /** * Test for {@link IntermediateAssociation}. * @@ -51,7 +52,7 @@ public void test_toString() throws Exception { @Test public void test_toString_withAttributes() throws Exception { Association association = - Associations.intermediate("foo", ImmutableMap.of("attrA", "a", "attrB", "b")); + Associations.intermediate("foo", new TreeMap<>(Map.of("attrA", "a", "attrB", "b"))); assertEquals("inter foo {attrA=a, attrB=b}", association.toString()); } @@ -123,7 +124,7 @@ public void test_add_attributes() throws Exception { // add XmlObjectInfo newObject = createButton(); Association association = - Associations.intermediate("foo", ImmutableMap.of("attrA", "a", "attrB", "b")); + Associations.intermediate("foo", new TreeMap<>(Map.of("attrA", "a", "attrB", "b"))); XmlObjectUtils.add(newObject, association, container, null); assertXML( "// filler filler filler filler filler", diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/model/generic/SimpleContainerModelTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/model/generic/SimpleContainerModelTest.java index f0e25c023..05b70f8fb 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/model/generic/SimpleContainerModelTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/model/generic/SimpleContainerModelTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.XML.model.generic; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.internal.core.model.generic.ContainerObjectValidator; import org.eclipse.wb.internal.core.model.generic.ContainerObjectValidators; @@ -44,6 +42,7 @@ import org.mockito.InOrder; import java.text.MessageFormat; +import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -339,7 +338,7 @@ public MySimpleContainer(EditorContext context, } public List getSimpleContainerChildren() { - return ImmutableList.of(); + return Collections.emptyList(); } public void command_CREATE(Object component) { @@ -368,7 +367,7 @@ public void test_duckTyping() throws Exception { simpleContainer = new SimpleContainerConfigurable(container, configuration); } // isEmpty() == true, because no existing children - when(container.getSimpleContainerChildren()).thenReturn(ImmutableList.of()); + when(container.getSimpleContainerChildren()).thenReturn(Collections.emptyList()); // assertTrue(simpleContainer.isEmpty()); // @@ -378,7 +377,7 @@ public void test_duckTyping() throws Exception { clearInvocations(container); // TestObjectInfo existingChild = new TestObjectInfo(); - when(container.getSimpleContainerChildren()).thenReturn(ImmutableList.of(existingChild)); + when(container.getSimpleContainerChildren()).thenReturn(List.of(existingChild)); // assertFalse(simpleContainer.isEmpty()); // @@ -387,7 +386,7 @@ public void test_duckTyping() throws Exception { // getChild() == null, because no existing children clearInvocations(container); // - when(container.getSimpleContainerChildren()).thenReturn(ImmutableList.of()); + when(container.getSimpleContainerChildren()).thenReturn(Collections.emptyList()); // assertSame(null, simpleContainer.getChild()); // @@ -396,7 +395,7 @@ public void test_duckTyping() throws Exception { // getChild() != null, because return existing child clearInvocations(container); // - when(container.getSimpleContainerChildren()).thenReturn(ImmutableList.of(existingChild)); + when(container.getSimpleContainerChildren()).thenReturn(List.of(existingChild)); // assertSame(existingChild, simpleContainer.getChild()); // diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/palette/AttributesProvidersTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/palette/AttributesProvidersTest.java index 25a3f8327..ffda50ce2 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/palette/AttributesProvidersTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/palette/AttributesProvidersTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.XML.palette; -import com.google.common.collect.ImmutableMap; - import org.eclipse.wb.internal.core.utils.external.ExternalFactoriesHelper; import org.eclipse.wb.internal.core.xml.editor.palette.model.AttributesProvider; import org.eclipse.wb.internal.core.xml.editor.palette.model.AttributesProviders; @@ -97,7 +95,7 @@ public void startElement(String uri, String localName, String name, Attributes a */ @Test public void test_getMap() throws Exception { - Map attributes = ImmutableMap.of("attr", "someValue"); + Map attributes = Map.of("attr", "someValue"); AttributesProvider provider = AttributesProviders.get(attributes); assertEquals("someValue", provider.getAttribute("attr")); assertNull(provider.getAttribute("noSuchAttribute")); diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/palette/PaletteManagerTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/palette/PaletteManagerTest.java index 04fa63e6b..4fec51057 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/palette/PaletteManagerTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/palette/PaletteManagerTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.XML.palette; -import com.google.common.collect.ImmutableMap; - import org.eclipse.wb.internal.core.DesignerPlugin; import org.eclipse.wb.internal.core.utils.jdt.core.ProjectUtils; import org.eclipse.wb.internal.core.utils.state.EditorWarning; @@ -39,6 +37,7 @@ import java.io.File; import java.util.List; +import java.util.Map; /** * Tests for {@link PaletteManager}. @@ -819,7 +818,7 @@ public void test_componentCondition_true() throws Exception { ""}); // parse and configure EditorState XmlObjectInfo panel = parseEmptyPanel(); - m_lastContext.addVersions(ImmutableMap.of("version", "3.5")); + m_lastContext.addVersions(Map.of("version", "3.5")); // PaletteInfo palette = loadPalette(panel); assertNoErrors(); @@ -835,7 +834,7 @@ public void test_componentCondition_false() throws Exception { ""}); // parse and configure EditorState XmlObjectInfo panel = parseEmptyPanel(); - m_lastContext.addVersions(ImmutableMap.of("version", "2.1")); + m_lastContext.addVersions(Map.of("version", "2.1")); // PaletteInfo palette = loadPalette(panel); assertNoErrors(); @@ -851,7 +850,7 @@ public void test_componentCondition_notBoolean() throws Exception { ""}); // parse and configure EditorState XmlObjectInfo panel = parseEmptyPanel(); - m_lastContext.addVersions(ImmutableMap.of("version", "2.1")); + m_lastContext.addVersions(Map.of("version", "2.1")); // PaletteInfo palette = loadPalette(panel); assertNoErrors(); diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XWT/model/XwtModelTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XWT/model/XwtModelTest.java index 294924d9b..af2aa0e19 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XWT/model/XwtModelTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XWT/model/XwtModelTest.java @@ -10,11 +10,8 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.XWT.model; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.internal.core.model.description.ToolkitDescription; import org.eclipse.wb.internal.core.model.variable.NamesManager; -import org.eclipse.wb.internal.core.model.variable.NamesManager.ComponentNameDescription; import org.eclipse.wb.internal.core.utils.jdt.core.CodeUtils; import org.eclipse.wb.internal.core.xml.model.XmlObjectInfo; import org.eclipse.wb.internal.core.xml.model.description.ComponentDescription; @@ -36,6 +33,8 @@ import org.junit.After; import org.junit.Before; +import java.util.Collections; + /** * Abstract super class for XWT tests. * @@ -99,7 +98,7 @@ protected void configureDefaultPreferences(ToolkitDescription toolkit) { IPreferenceStore preferences = toolkit.getPreferences(); preferences.setToDefault(org.eclipse.wb.internal.swt.preferences.IPreferenceConstants.P_LAYOUT_DATA_NAME_TEMPLATE); preferences.setToDefault(org.eclipse.wb.internal.swt.preferences.IPreferenceConstants.P_LAYOUT_NAME_TEMPLATE); - NamesManager.setNameDescriptions(toolkit, ImmutableList.of()); + NamesManager.setNameDescriptions(toolkit, Collections.emptyList()); } //////////////////////////////////////////////////////////////////////////// diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/description/DescriptionVersionsProvidersTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/description/DescriptionVersionsProvidersTest.java index ff27c4e52..1d6b1a899 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/description/DescriptionVersionsProvidersTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/description/DescriptionVersionsProvidersTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.core.model.description; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.internal.core.model.description.ComponentDescription; import org.eclipse.wb.internal.core.model.description.factory.FactoryMethodDescription; import org.eclipse.wb.internal.core.model.description.helpers.ComponentDescriptionHelper; @@ -70,7 +68,7 @@ public void test_providerEmpty() throws Exception { @Test public void test_providerFromList_noCurrentInList() throws Exception { try { - new FromListDescriptionVersionsProvider(ImmutableList.of("1.0", "2.0", "3.0"), "2.1") { + new FromListDescriptionVersionsProvider(List.of("1.0", "2.0", "3.0"), "2.1") { @Override protected boolean validate(Class componentClass) throws Exception { return false; @@ -86,7 +84,7 @@ protected boolean validate(Class componentClass) throws Exception { */ @Test public void test_providerFromList_getVersions_middleVersion() throws Exception { - List allVersions = ImmutableList.of("1.0", "2.0", "3.0"); + List allVersions = List.of("1.0", "2.0", "3.0"); String currentVersion = "2.0"; FromListDescriptionVersionsProvider provider = new FromListDescriptionVersionsProvider(allVersions, currentVersion) { @@ -103,7 +101,7 @@ protected boolean validate(Class componentClass) throws Exception { // valid Class, "1.0" and "2.0" expected { List versions = provider.getVersions(JButton.class); - Assertions.assertThat(versions).isEqualTo(ImmutableList.of("2.0", "1.0")); + Assertions.assertThat(versions).isEqualTo(List.of("2.0", "1.0")); } } @@ -112,7 +110,7 @@ protected boolean validate(Class componentClass) throws Exception { */ @Test public void test_providerFromList_getVersions_latestVersion() throws Exception { - List allVersions = ImmutableList.of("1.0", "2.0", "3.0"); + List allVersions = List.of("1.0", "2.0", "3.0"); String currentVersion = "3.0"; FromListDescriptionVersionsProvider provider = new FromListDescriptionVersionsProvider(allVersions, currentVersion) { @@ -123,7 +121,7 @@ protected boolean validate(Class componentClass) throws Exception { }; // List versions = provider.getVersions(JButton.class); - Assertions.assertThat(versions).isEqualTo(ImmutableList.of("3.0", "2.0", "1.0")); + Assertions.assertThat(versions).isEqualTo(List.of("3.0", "2.0", "1.0")); } //////////////////////////////////////////////////////////////////////////// diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/generic/SimpleContainerModelTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/generic/SimpleContainerModelTest.java index a34e99ff7..89137a13a 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/generic/SimpleContainerModelTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/generic/SimpleContainerModelTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.core.model.generic; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.core.model.association.Association; @@ -45,6 +43,7 @@ import org.mockito.InOrder; import java.text.MessageFormat; +import java.util.Collections; import java.util.List; /** @@ -380,7 +379,7 @@ public MySimpleContainer(AstEditor editor, } public List getSimpleContainerChildren() { - return ImmutableList.of(); + return Collections.emptyList(); } public void command_CREATE(Object component) { @@ -409,7 +408,7 @@ public void test_duckTyping() throws Exception { } // isEmpty() == true, because no existing children { - when(container.getSimpleContainerChildren()).thenReturn(ImmutableList.of()); + when(container.getSimpleContainerChildren()).thenReturn(Collections.emptyList()); // assertTrue(simpleContainer.isEmpty()); // @@ -421,7 +420,7 @@ public void test_duckTyping() throws Exception { clearInvocations(container); // final TestObjectInfo existingChild = new TestObjectInfo(); - when(container.getSimpleContainerChildren()).thenReturn(ImmutableList.of(existingChild)); + when(container.getSimpleContainerChildren()).thenReturn(List.of(existingChild)); // assertFalse(simpleContainer.isEmpty()); // @@ -432,7 +431,7 @@ public void test_duckTyping() throws Exception { { clearInvocations(container); // - when(container.getSimpleContainerChildren()).thenReturn(ImmutableList.of()); + when(container.getSimpleContainerChildren()).thenReturn(Collections.emptyList()); // assertSame(null, simpleContainer.getChild()); // @@ -444,7 +443,7 @@ public void test_duckTyping() throws Exception { clearInvocations(container); // final TestObjectInfo existingChild = new TestObjectInfo(); - when(container.getSimpleContainerChildren()).thenReturn(ImmutableList.of(existingChild)); + when(container.getSimpleContainerChildren()).thenReturn(List.of(existingChild)); // assertSame(existingChild, simpleContainer.getChild()); // diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/parser/AbstractJavaInfoRelatedTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/parser/AbstractJavaInfoRelatedTest.java index 2712dfbd9..9d8835702 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/parser/AbstractJavaInfoRelatedTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/parser/AbstractJavaInfoRelatedTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.core.model.parser; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.controls.CCombo3; import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.core.model.ObjectInfo; @@ -37,7 +35,6 @@ import org.eclipse.wb.internal.core.model.property.table.PropertyTooltipTextProvider; import org.eclipse.wb.internal.core.model.variable.FieldUniqueVariableSupport; import org.eclipse.wb.internal.core.model.variable.NamesManager; -import org.eclipse.wb.internal.core.model.variable.NamesManager.ComponentNameDescription; import org.eclipse.wb.internal.core.model.variable.VariableSupport; import org.eclipse.wb.internal.core.model.variable.description.LocalUniqueVariableDescription; import org.eclipse.wb.internal.core.preferences.IPreferenceConstants; @@ -65,6 +62,7 @@ import org.apache.commons.lang.StringUtils; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.concurrent.atomic.AtomicReference; @@ -92,7 +90,7 @@ public static void configureDefaults(ToolkitDescriptionJava toolkit) { preferences.setToDefault(IPreferenceConstants.P_VARIABLE_TEXT_TEMPLATE); preferences.setToDefault(IPreferenceConstants.P_VARIABLE_TEXT_WORDS_LIMIT); preferences.setToDefault(IPreferenceConstants.P_VARIABLE_IN_COMPONENT); - NamesManager.setNameDescriptions(toolkit, ImmutableList.of()); + NamesManager.setNameDescriptions(toolkit, Collections.emptyList()); // please, always use in tests default settings { GenerationSettings generationSettings = toolkit.getGenerationSettings(); diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/parser/ExecuteOnParseTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/parser/ExecuteOnParseTest.java index 52dacf2d7..5e7a3f098 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/parser/ExecuteOnParseTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/parser/ExecuteOnParseTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.core.model.parser; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.eval.AstEvaluationEngine; import org.eclipse.wb.core.eval.EvaluationContext; import org.eclipse.wb.core.eval.ExecutionFlowDescription; @@ -1967,8 +1965,8 @@ public void test_evaluateBroadcast() throws Exception { " }", "}"); // listen for ASTNode evaluation - List expectedNodes_before = ImmutableList.of("setEnabled(false)", "setEnabled(false);"); - List expectedNodes_after = ImmutableList.of("setEnabled(false)", "setEnabled(false);"); + List expectedNodes_before = List.of("setEnabled(false)", "setEnabled(false);"); + List expectedNodes_after = List.of("setEnabled(false)", "setEnabled(false);"); final Iterator expectedIterator_before = expectedNodes_before.iterator(); final Iterator expectedIterator_after = expectedNodes_after.iterator(); panel.addBroadcastListener(new EvaluationEventListener() { diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/property/TabOrderPropertyTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/property/TabOrderPropertyTest.java index d2d393114..bba85d969 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/property/TabOrderPropertyTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/property/TabOrderPropertyTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.core.model.property; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.AbstractComponentInfo; import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.internal.core.model.property.Property; @@ -34,6 +32,7 @@ import org.junit.Test; import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -236,7 +235,7 @@ public TestTabOrderProperty(JavaInfo container, ArrayInitializer initializer, String tooltip) { super(container); - m_allInfos = allInfos != null ? allInfos : ImmutableList.of(); + m_allInfos = allInfos != null ? allInfos : Collections.emptyList(); m_defaultInfos = defaultInfos; m_initializer = initializer; m_tooltip = tooltip; diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/property/editor/StaticFieldPropertyEditorTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/property/editor/StaticFieldPropertyEditorTest.java index 57b046769..ac469aad7 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/property/editor/StaticFieldPropertyEditorTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/property/editor/StaticFieldPropertyEditorTest.java @@ -10,9 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.core.model.property.editor; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; - import org.eclipse.wb.internal.core.model.property.GenericProperty; import org.eclipse.wb.internal.core.model.property.Property; import org.eclipse.wb.internal.core.model.property.editor.StaticFieldPropertyEditor; @@ -31,6 +28,7 @@ import org.junit.Test; import java.util.List; +import java.util.Map; import javax.swing.SwingConstants; @@ -156,7 +154,7 @@ public void test_configure_6() throws Exception { "}"); // create StaticFieldPropertyEditor StaticFieldPropertyEditor editor = new StaticFieldPropertyEditor(); - editor.configure(m_lastState, ImmutableMap.of( + editor.configure(m_lastState, Map.of( "class", "javax.swing.SwingConstants", "fields", @@ -184,11 +182,11 @@ public void test_configure_7() throws Exception { "}"); // create StaticFieldPropertyEditor StaticFieldPropertyEditor editor = new StaticFieldPropertyEditor(); - editor.configure(m_lastState, ImmutableMap.of( + editor.configure(m_lastState, Map.of( "class", "javax.swing.SwingConstants", "field", - ImmutableList.of("LEFT", "RIGHT"))); + List.of("LEFT", "RIGHT"))); // check state Class e_class = SwingConstants.class; String m_classSourceName = "javax.swing.SwingConstants"; @@ -215,7 +213,7 @@ public void test_configure_8() throws Exception { StaticFieldPropertyEditor editor = new StaticFieldPropertyEditor(); editor.configure( m_lastState, - ImmutableMap.of("class", "javax.swing.SwingConstants")); + Map.of("class", "javax.swing.SwingConstants")); fail(); } catch (DesignerException e) { } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/FactoryActionsSupportTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/FactoryActionsSupportTest.java index 401d6a53e..4d7994d05 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/FactoryActionsSupportTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/FactoryActionsSupportTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.core.model.util; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.internal.core.model.util.factory.FactoryActionsSupport; import org.eclipse.wb.internal.core.utils.reflect.ReflectionUtils; @@ -26,6 +24,7 @@ import org.junit.Test; import java.util.Arrays; +import java.util.List; /** * Tests for {@link FactoryActionsSupport}. @@ -242,7 +241,7 @@ public void test_actions_onlyCompatibleTypes() throws Exception { private IMenuManager getFactoryManager(ComponentInfo component) throws Exception { MenuManager menuManager = getDesignerMenuManager(); component.getBroadcastObject().addContextMenu( - ImmutableList.of(component), + List.of(component), component, menuManager); return findChildMenuManager(menuManager, "Factory"); diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/JavaInfoUtilsTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/JavaInfoUtilsTest.java index 8f6538001..f55c9edce 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/JavaInfoUtilsTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/JavaInfoUtilsTest.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.core.model.util; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import org.eclipse.wb.core.editor.IDesignPageSite; @@ -82,6 +81,7 @@ import java.awt.FlowLayout; import java.lang.reflect.Method; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -3312,13 +3312,13 @@ public void test_getStatementTarget_whenAllCreated() throws Exception { ComponentInfo button_2 = panel.getChildrenComponents().get(1); // fail if no components try { - JavaInfoUtils.getStatementTarget_whenAllCreated(ImmutableList.of()); + JavaInfoUtils.getStatementTarget_whenAllCreated(Collections.emptyList()); fail(); } catch (AssertionFailedException e) { } // ask for "button_1" and "button_2" { - List components = ImmutableList.of(button_1, button_2); + List components = List.of(button_1, button_2); StatementTarget target = JavaInfoUtils.getStatementTarget_whenAllCreated(components); assertTarget(target, null, getStatement(panel, 2), false); } @@ -3344,7 +3344,7 @@ public void test_getStatementTarget_whenAllCreated_fieldInitializer_this() throw ComponentInfo button_2 = panel.getChildrenComponents().get(1); // ask for "button_1" and "button_2" { - List components = ImmutableList.of(button_1, button_2); + List components = List.of(button_1, button_2); StatementTarget target = JavaInfoUtils.getStatementTarget_whenAllCreated(components); assertTarget(target, null, getStatement(panel, 0), false); } @@ -3370,7 +3370,7 @@ public void test_getStatementTarget_whenAllCreated_fieldInitializer_main() throw ComponentInfo button_2 = panel.getChildrenComponents().get(1); // ask for "button_1" and "button_2" { - List components = ImmutableList.of(button_1, button_2); + List components = List.of(button_1, button_2); StatementTarget target = JavaInfoUtils.getStatementTarget_whenAllCreated(components); assertTarget(target, getBlock(panel), null, true); } @@ -3401,7 +3401,7 @@ public void test_getStatementTarget_whenAllCreated_lazy() throws Exception { ComponentInfo button_2 = panel.getChildrenComponents().get(1); // ask for "button_1" and "button_2" { - List components = ImmutableList.of(button_1, button_2); + List components = List.of(button_1, button_2); StatementTarget target = JavaInfoUtils.getStatementTarget_whenAllCreated(components); assertTarget(target, null, getStatement(button_2, 0), false); } @@ -3611,7 +3611,7 @@ public void test_addChildExposedByMethod_exposedInstanceFactory() throws Excepti " {implicit-layout: java.awt.FlowLayout} {implicit-layout} {}", " {method: public test.MyFactory test.MyContainer.getFactory()} {property} {}"); // send broadcast to move "getFactory()" into InstanceFactoryContainerInfo - InstanceFactoryRootProcessor.INSTANCE.process(panel, ImmutableList.of(exposedFactory)); + InstanceFactoryRootProcessor.INSTANCE.process(panel, List.of(exposedFactory)); assertHierarchy( "{this: javax.swing.JPanel} {this} {/add(new MyContainer())/}", " {implicit-layout: java.awt.FlowLayout} {implicit-layout} {}", diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/MorphingSupportTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/MorphingSupportTest.java index a20d66da6..d68b0f7dd 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/MorphingSupportTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/MorphingSupportTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.core.model.util; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.core.model.association.ConstructorParentAssociation; import org.eclipse.wb.core.model.association.FactoryParentAssociation; @@ -933,7 +931,7 @@ public void test_actions_run() throws Exception { private static IMenuManager getMorphManager(JavaInfo component) throws Exception { MenuManager menuManager = getDesignerMenuManager(); component.getBroadcastObject().addContextMenu( - ImmutableList.of(component), + List.of(component), component, menuManager); return findChildMenuManager(menuManager, "Morph"); diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/PropertyUtilsTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/PropertyUtilsTest.java index 321521277..e103042e6 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/PropertyUtilsTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/PropertyUtilsTest.java @@ -11,7 +11,6 @@ package org.eclipse.wb.tests.designer.core.model.util; import com.google.common.base.Predicate; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import org.eclipse.wb.core.model.JavaInfo; @@ -82,8 +81,8 @@ public void test_getTitles_asArray() throws Exception { public void test_getTitles_asList() throws Exception { Property property_1 = new PropertyWithTitle("a"); Property property_2 = new PropertyWithTitle("b"); - List properties = ImmutableList.of(property_1, property_2); - List expectedTitles = ImmutableList.of("a", "b"); + List properties = List.of(property_1, property_2); + List expectedTitles = List.of("a", "b"); Assertions.assertThat(PropertyUtils.getTitles(properties)).isEqualTo(expectedTitles); } @@ -126,7 +125,7 @@ public void test_getByTitle_2() throws Exception { " }", "}"); ComponentInfo button = panel.getChildrenComponents().get(0); - List properties = ImmutableList.copyOf(button.getProperties()); + List properties = List.of(button.getProperties()); // assertNotNull(PropertyUtils.getByTitle(properties, "enabled")); assertNull(PropertyUtils.getByTitle(properties, "noSuchProperty")); diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/RenameConvertSupportTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/RenameConvertSupportTest.java index c8d9159c1..156522736 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/RenameConvertSupportTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/RenameConvertSupportTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.core.model.util; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.core.model.broadcast.ObjectEventListener; @@ -92,7 +90,7 @@ public void test_action_zeroOrOne() throws Exception { // ask action using broadcast (good) { MenuManager manager = getDesignerMenuManager(); - button.getBroadcastObject().addContextMenu(ImmutableList.of(button), button, manager); + button.getBroadcastObject().addContextMenu(List.of(button), button, manager); assertNotNull(findChildAction(manager, "Rename...")); } } @@ -141,7 +139,7 @@ public void test_action_multiSelect() throws Exception { assertNotNull(getRenameAction(button, textField)); // ask using broadcast { - List objects = ImmutableList.of(button, textField); + List objects = List.of(button, textField); { MenuManager manager = getDesignerMenuManager(); button.getBroadcastObject().addContextMenu(objects, button, manager); @@ -178,7 +176,7 @@ public void test_animateUI_openDialog() throws Exception { new UiContext().executeAndCheck(new UIRunnable() { @Override public void run(UiContext context) throws Exception { - RenameConvertSupport.rename(ImmutableList.of(button)); + RenameConvertSupport.rename(List.of(button)); } }, new UIRunnable() { @Override @@ -616,7 +614,7 @@ public void test_validate_invalidIdentifier() throws Exception { */ private RenameConvertSupport getRenameSupport(ObjectInfo... objects) throws Exception { return ReflectionUtils.getConstructor(RenameConvertSupport.class, Iterable.class).newInstance( - ImmutableList.copyOf(objects)); + List.of(objects)); } /** @@ -641,7 +639,7 @@ private IAction getRenameAction(ObjectInfo... objects) { // prepare manager MenuManager menuManager = getDesignerMenuManager(); // add action - RenameConvertSupport.contribute(ImmutableList.copyOf(objects), menuManager); + RenameConvertSupport.contribute(List.of(objects), menuManager); return findChildAction(menuManager, "Rename..."); } } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/ScriptUtilsTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/ScriptUtilsTest.java index 05a84ff89..cfe157caa 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/ScriptUtilsTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/ScriptUtilsTest.java @@ -10,9 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.core.model.util; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; - import org.eclipse.wb.internal.core.model.JavaInfoUtils; import org.eclipse.wb.internal.core.model.util.ScriptUtils; import org.eclipse.wb.internal.core.utils.reflect.ReflectionUtils; @@ -22,6 +19,7 @@ import org.assertj.core.api.Assertions; import org.junit.Test; +import java.util.List; import java.util.Map; /** @@ -67,7 +65,7 @@ public void test_evaluate_ReflectionUtils() throws Exception { */ @Test public void test_evaluate_withContext() throws Exception { - assertEquals(3, ScriptUtils.evaluate("size()", ImmutableList.of(1, 2, 3))); + assertEquals(3, ScriptUtils.evaluate("size()", List.of(1, 2, 3))); } /** @@ -75,7 +73,7 @@ public void test_evaluate_withContext() throws Exception { */ @Test public void test_evaluate_withVariables() throws Exception { - Map variables = ImmutableMap.of("a", 2, "b", 3); + Map variables = Map.of("a", 2, "b", 3); assertEquals(6, ScriptUtils.evaluate("a * b", variables)); assertEquals(6, ScriptUtils.evaluate("c = a * b; return c;", variables)); // variables should not be changed @@ -189,7 +187,7 @@ public void test_evaluate_useDesignerClassLoader_withVariables() throws Exceptio ScriptUtils.evaluate( m_lastLoader, "a + (com.jgoodies.forms.layout.Sizes.DLUX1).value", - ImmutableMap.of("a", 5.0)); + Map.of("a", 5.0)); assertEquals(6.0, ((Double) actual).doubleValue(), 0.001); } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/TemplateUtilsTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/TemplateUtilsTest.java index ea680cb7a..e4d7fa59b 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/TemplateUtilsTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/util/TemplateUtilsTest.java @@ -11,7 +11,6 @@ package org.eclipse.wb.tests.designer.core.model.util; import com.google.common.collect.ImmutableBiMap; -import com.google.common.collect.ImmutableList; import static org.eclipse.wb.internal.core.model.util.TemplateUtils.addStatement; import static org.eclipse.wb.internal.core.model.util.TemplateUtils.evaluate; @@ -203,8 +202,8 @@ public void test_resolve_StringList() throws Exception { "}"); NodeTarget nodeTarget = getNodeStatementTarget(panel, false, 0); // do resolve - List lines = ImmutableList.of(getExpression(panel) + " a", getExpression(panel) + " b"); - List result = ImmutableList.of("this a", "this b"); + List lines = List.of(getExpression(panel) + " a", getExpression(panel) + " b"); + List result = List.of("this a", "this b"); Assertions.assertThat(resolve(nodeTarget, lines)).isEqualTo(result); } @@ -266,7 +265,7 @@ public void test_addStatement() throws Exception { "}"); StatementTarget target = getBlockTarget(panel, true); // do resolve - addStatement(panel, target, ImmutableList.of(TemplateUtils.format("{0}", panel), "\t.setEnabled(false);")); + addStatement(panel, target, List.of(TemplateUtils.format("{0}", panel), "\t.setEnabled(false);")); assertEditor( "// filler filler filler", "public class Test extends JPanel {", diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/variables/AbstractNamedTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/variables/AbstractNamedTest.java index 2767e6cc7..f9b0c336e 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/variables/AbstractNamedTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/model/variables/AbstractNamedTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.core.model.variables; -import com.google.common.collect.ImmutableMap; - import org.eclipse.wb.internal.core.model.variable.AbstractNamedVariableSupport; import org.eclipse.wb.internal.core.model.variable.AbstractSimpleVariableSupport; import org.eclipse.wb.internal.core.model.variable.LocalUniqueVariableSupport; @@ -33,6 +31,7 @@ import org.junit.Test; +import java.util.Collections; import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -296,13 +295,13 @@ public void test_validateVariables_singleVariable() throws Exception { // invalid identifier { Map variablesNames = - ImmutableMap.of((AbstractNamedVariableSupport) button.getVariableSupport(), "in-valid"); + Map.of((AbstractNamedVariableSupport) button.getVariableSupport(), "in-valid"); assertTrue(validateVariables(variablesNames).contains("identifier")); } // valid identifier { Map variablesNames = - ImmutableMap.of((AbstractNamedVariableSupport) button.getVariableSupport(), "myButton"); + Map.of((AbstractNamedVariableSupport) button.getVariableSupport(), "myButton"); validateVariables(true, variablesNames); } } @@ -332,35 +331,35 @@ public void test_validateVariables_twoVariables_plain() throws Exception { (AbstractNamedVariableSupport) button2.getVariableSupport(); // no conflict: no modifications { - Map variablesNames = ImmutableMap.of(); + Map variablesNames = Collections.emptyMap(); validateVariables(true, variablesNames); } // visible conflict: button2 -> button1 { - validateVariables(false, ImmutableMap.of(variable2, "button1")); + validateVariables(false, Map.of(variable2, "button1")); } // no visible conflict: button2 -> button1, button1 -> button_1 { Map variablesNames = - ImmutableMap.of(variable2, "button1", variable1, "button_1"); + Map.of(variable2, "button1", variable1, "button_1"); validateVariables(true, variablesNames); } // no visible conflict: button2 -> button1, button1 -> button2 { Map variablesNames = - ImmutableMap.of(variable2, "button1", variable1, "button2"); + Map.of(variable2, "button1", variable1, "button2"); validateVariables(true, variablesNames); } // shadow conflict: button1 -> button2 { Map variablesNames = - ImmutableMap.of(variable1, "button2"); + Map.of(variable1, "button2"); validateVariables(false, variablesNames); } // no shadow conflict: button1 -> button2, button2 -> button_2 { Map variablesNames = - ImmutableMap.of(variable1, "button2", variable2, "button_2"); + Map.of(variable1, "button2", variable2, "button_2"); validateVariables(true, variablesNames); } } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/nls/NlsSupportTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/nls/NlsSupportTest.java index 3e1b57734..03e3df42e 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/nls/NlsSupportTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/nls/NlsSupportTest.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.core.nls; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import org.eclipse.wb.core.model.JavaInfo; @@ -302,7 +301,7 @@ public void test_NLSSource_getLocales_alwaysVisibleLocales() throws Exception { preferencesRepairer.setValue(IPreferenceConstants.P_NLS_ALWAYS_VISIBLE_LOCALES, "de, ru_RU"); LocaleInfo[] locales = m_support.getLocales(); List localeNames = - Lists.transform(ImmutableList.copyOf(locales), from -> from.toString()); + Lists.transform(List.of(locales), from -> from.toString()); Assertions.assertThat(localeNames).hasSize(4).containsOnly("(default)", "it", "de", "ru_RU"); } finally { preferencesRepairer.restore(); diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/palette/AttributesProvidersTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/palette/AttributesProvidersTest.java index 3203b6eb9..0f23ced28 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/palette/AttributesProvidersTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/palette/AttributesProvidersTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.core.palette; -import com.google.common.collect.ImmutableMap; - import org.eclipse.wb.internal.core.editor.palette.model.entry.AttributesProvider; import org.eclipse.wb.internal.core.editor.palette.model.entry.AttributesProviders; import org.eclipse.wb.internal.core.utils.external.ExternalFactoriesHelper; @@ -97,7 +95,7 @@ public void startElement(String uri, String localName, String name, Attributes a */ @Test public void test_getMap() throws Exception { - Map attributes = ImmutableMap.of("attr", "someValue"); + Map attributes = Map.of("attr", "someValue"); AttributesProvider provider = AttributesProviders.get(attributes); assertEquals("someValue", provider.getAttribute("attr")); assertNull(provider.getAttribute("noSuchAttribute")); diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/palette/PaletteManagerTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/palette/PaletteManagerTest.java index 8fe0a90cf..1bcc42470 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/palette/PaletteManagerTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/palette/PaletteManagerTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.core.palette; -import com.google.common.collect.ImmutableMap; - import org.eclipse.wb.core.editor.palette.model.CategoryInfo; import org.eclipse.wb.core.editor.palette.model.PaletteInfo; import org.eclipse.wb.core.editor.palette.model.entry.ComponentEntryInfo; @@ -39,6 +37,7 @@ import org.junit.Test; import java.util.List; +import java.util.Map; /** * Tests for {@link PaletteInfo}. @@ -957,7 +956,7 @@ public void test_condition_true() throws Exception { ""}); // parse and configure EditorState JavaInfo panel = parseEmptyPanel(); - m_lastState.addVersions(ImmutableMap.of("version", "3.5")); + m_lastState.addVersions(Map.of("version", "3.5")); // PaletteInfo palette = loadPalette(panel); assertNoErrors(panel); @@ -973,7 +972,7 @@ public void test_condition_false() throws Exception { ""}); // parse and configure EditorState JavaInfo panel = parseEmptyPanel(); - m_lastState.addVersions(ImmutableMap.of("version", "2.1")); + m_lastState.addVersions(Map.of("version", "2.1")); // PaletteInfo palette = loadPalette(panel); assertNoErrors(panel); @@ -989,7 +988,7 @@ public void test_condition_notBoolean() throws Exception { ""}); // parse and configure EditorState JavaInfo panel = parseEmptyPanel(); - m_lastState.addVersions(ImmutableMap.of("version", "2.1")); + m_lastState.addVersions(Map.of("version", "2.1")); // PaletteInfo palette = loadPalette(panel); assertNoErrors(panel); diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/palette/TabOrderToolEntryInfoTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/palette/TabOrderToolEntryInfoTest.java index 83ca0ff18..93c2a1a97 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/palette/TabOrderToolEntryInfoTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/palette/TabOrderToolEntryInfoTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.core.palette; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.editor.palette.model.entry.TabOrderToolEntryInfo; import org.eclipse.wb.core.gef.policy.TabOrderContainerEditPolicy; import org.eclipse.wb.core.model.JavaInfo; @@ -30,6 +28,9 @@ import org.mockito.ArgumentMatchers; import org.mockito.InOrder; +import java.util.Collections; +import java.util.List; + /** * Test for {@link TabOrderToolEntryInfo}. * @@ -55,7 +56,7 @@ public void test_noSelection() throws Exception { IEditPartViewer viewer; { viewer = mock(IEditPartViewer.class); - when(viewer.getSelectedEditParts()).thenReturn(ImmutableList.of()); + when(viewer.getSelectedEditParts()).thenReturn(Collections.emptyList()); } // check tool assertTrue(entry.initialize(viewer, panel)); @@ -88,7 +89,7 @@ public void test_singleSelection() throws Exception { // when(selectedEditPart.getViewer()).thenReturn(viewer); when(selectedEditPart.getEditPolicy(TabOrderContainerEditPolicy.TAB_CONTAINER_ROLE)).thenReturn(tabContainerRole); - when(viewer.getSelectedEditParts()).thenReturn(ImmutableList.of(selectedEditPart)); + when(viewer.getSelectedEditParts()).thenReturn(List.of(selectedEditPart)); } // check tool assertTrue(entry.initialize(viewer, panel)); diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/util/GenericsUtilsTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/util/GenericsUtilsTest.java index 884327dbd..bd680d031 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/util/GenericsUtilsTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/util/GenericsUtilsTest.java @@ -11,7 +11,6 @@ package org.eclipse.wb.tests.designer.core.util; import com.google.common.base.Predicate; -import com.google.common.collect.ImmutableList; import org.eclipse.wb.internal.core.utils.GenericTypeError; import org.eclipse.wb.internal.core.utils.GenericTypeResolver; @@ -31,6 +30,7 @@ import java.lang.reflect.Type; import java.lang.reflect.TypeVariable; import java.util.ArrayList; +import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -176,7 +176,7 @@ public void test_get() throws Exception { */ @Test public void test_get_fromList() throws Exception { - List objects = ImmutableList.of("0", 1, 2.2); + List objects = List.of("0", 1, 2.2); assertEquals("0", GenericsUtils.get(String.class, objects)); assertEquals(Integer.valueOf(1), GenericsUtils.get(Integer.class, objects)); assertEquals(Double.valueOf(2.2), GenericsUtils.get(Double.class, objects)); @@ -287,7 +287,7 @@ public void test_singletonList_2() throws Exception { */ @Test public void test_getPrevOrNull_index() throws Exception { - List elements = ImmutableList.of("000", "111", "222"); + List elements = List.of("000", "111", "222"); assertSame(null, GenericsUtils.getPrevOrNull(elements, 0)); assertSame("000", GenericsUtils.getPrevOrNull(elements, 1)); assertSame("111", GenericsUtils.getPrevOrNull(elements, 2)); @@ -298,7 +298,7 @@ public void test_getPrevOrNull_index() throws Exception { */ @Test public void test_getPrevOrNull_element() throws Exception { - List elements = ImmutableList.of("000", "111", "222"); + List elements = List.of("000", "111", "222"); // use element assertSame("000", GenericsUtils.getPrevOrNull(elements, "111")); assertSame("111", GenericsUtils.getPrevOrNull(elements, "222")); @@ -311,9 +311,9 @@ public void test_getPrevOrNull_element() throws Exception { */ @Test public void test_getPrevOrLast_element() throws Exception { - List elements = ImmutableList.of("000", "111", "222"); + List elements = List.of("000", "111", "222"); // no elements - assertNull(GenericsUtils.getPrevOrLast(ImmutableList.of(), "no matter")); + assertNull(GenericsUtils.getPrevOrLast(Collections.emptyList(), "no matter")); // use element assertSame("111", GenericsUtils.getPrevOrLast(elements, "222")); assertSame("000", GenericsUtils.getPrevOrLast(elements, "111")); @@ -331,7 +331,7 @@ public void test_getPrevOrLast_element() throws Exception { */ @Test public void test_getNextOrNull_index() throws Exception { - List elements = ImmutableList.of("000", "111", "222"); + List elements = List.of("000", "111", "222"); // use index assertSame("111", GenericsUtils.getNextOrNull(elements, 0)); assertSame("222", GenericsUtils.getNextOrNull(elements, 1)); @@ -343,7 +343,7 @@ public void test_getNextOrNull_index() throws Exception { */ @Test public void test_getNextOrNull_element() throws Exception { - List elements = ImmutableList.of("000", "111", "222"); + List elements = List.of("000", "111", "222"); // use element assertSame("111", GenericsUtils.getNextOrNull(elements, "000")); assertSame("222", GenericsUtils.getNextOrNull(elements, "111")); @@ -356,9 +356,9 @@ public void test_getNextOrNull_element() throws Exception { */ @Test public void test_getNextOrFirst_element() throws Exception { - List elements = ImmutableList.of("000", "111", "222"); + List elements = List.of("000", "111", "222"); // no elements - assertNull(GenericsUtils.getNextOrFirst(ImmutableList.of(), "no matter")); + assertNull(GenericsUtils.getNextOrFirst(Collections.emptyList(), "no matter")); // use element assertSame("111", GenericsUtils.getNextOrFirst(elements, "000")); assertSame("222", GenericsUtils.getNextOrFirst(elements, "111")); @@ -371,8 +371,8 @@ public void test_getNextOrFirst_element() throws Exception { */ @Test public void test_getFirstOrNull() throws Exception { - assertNull(GenericsUtils.getFirstOrNull(ImmutableList.of())); - assertSame("000", GenericsUtils.getFirstOrNull(ImmutableList.of("000", "111", "222"))); + assertNull(GenericsUtils.getFirstOrNull(Collections.emptyList())); + assertSame("000", GenericsUtils.getFirstOrNull(List.of("000", "111", "222"))); } /** @@ -380,8 +380,8 @@ public void test_getFirstOrNull() throws Exception { */ @Test public void test_getLastOrNull() throws Exception { - assertNull(GenericsUtils.getLastOrNull(ImmutableList.of())); - assertSame("222", GenericsUtils.getLastOrNull(ImmutableList.of("000", "111", "222"))); + assertNull(GenericsUtils.getLastOrNull(Collections.emptyList())); + assertSame("222", GenericsUtils.getLastOrNull(List.of("000", "111", "222"))); } /** @@ -390,11 +390,11 @@ public void test_getLastOrNull() throws Exception { @Test public void test_getLast() throws Exception { try { - assertNull(GenericsUtils.getLast(ImmutableList.of())); + assertNull(GenericsUtils.getLast(Collections.emptyList())); fail(); } catch (IndexOutOfBoundsException e) { } - assertSame("222", GenericsUtils.getLast(ImmutableList.of("000", "111", "222"))); + assertSame("222", GenericsUtils.getLast(List.of("000", "111", "222"))); } //////////////////////////////////////////////////////////////////////////// @@ -407,18 +407,18 @@ public void test_getLast() throws Exception { */ @Test public void test_areAdjacent() throws Exception { - assertTrue(GenericsUtils.areAdjacent(ImmutableList.of(), ImmutableList.of())); - assertTrue(GenericsUtils.areAdjacent(ImmutableList.of("a"), ImmutableList.of("a"))); - assertTrue(GenericsUtils.areAdjacent(ImmutableList.of("a", "b", "c"), ImmutableList.of("a"))); + assertTrue(GenericsUtils.areAdjacent(Collections.emptyList(), Collections.emptyList())); + assertTrue(GenericsUtils.areAdjacent(List.of("a"), List.of("a"))); + assertTrue(GenericsUtils.areAdjacent(List.of("a", "b", "c"), List.of("a"))); assertTrue(GenericsUtils.areAdjacent( - ImmutableList.of("a", "b", "c"), - ImmutableList.of("a", "b"))); + List.of("a", "b", "c"), + List.of("a", "b"))); assertTrue(GenericsUtils.areAdjacent( - ImmutableList.of("a", "b", "c"), - ImmutableList.of("b", "c"))); + List.of("a", "b", "c"), + List.of("b", "c"))); assertFalse(GenericsUtils.areAdjacent( - ImmutableList.of("a", "b", "c"), - ImmutableList.of("a", "c"))); + List.of("a", "b", "c"), + List.of("a", "c"))); } //////////////////////////////////////////////////////////////////////////// diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/util/ast/AstEditorTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/util/ast/AstEditorTest.java index 0882c2801..4a7592498 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/util/ast/AstEditorTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/util/ast/AstEditorTest.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.core.util.ast; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import org.eclipse.wb.core.eval.ExecutionFlowDescription; @@ -91,6 +90,7 @@ import org.junit.Before; import org.junit.Test; +import java.util.Collections; import java.util.List; import java.util.function.Function; @@ -1841,7 +1841,7 @@ public void test_addMethodDeclaration_0() throws Exception { // BodyDeclarationTarget target = new BodyDeclarationTarget(null, targetField, true); MethodDeclaration newMethod = - m_lastEditor.addMethodDeclaration("int foo()", ImmutableList.of("return 0;"), target); + m_lastEditor.addMethodDeclaration("int foo()", List.of("return 0;"), target); assertAST(m_lastEditor); assertNotNull(newMethod); assertEquals(0, typeDeclaration.bodyDeclarations().indexOf(newMethod)); @@ -1871,7 +1871,7 @@ public void test_addMethodDeclaration_danglingJavadoc() throws Exception { "}"); BodyDeclarationTarget target = new BodyDeclarationTarget(typeDeclaration, null, false); // - m_lastEditor.addMethodDeclaration("int foo()", ImmutableList.of("return 0;"), target); + m_lastEditor.addMethodDeclaration("int foo()", List.of("return 0;"), target); assertEditor( getSource( "package test;", @@ -1898,7 +1898,7 @@ public void test_addMethodDeclaration_withEmptyLine() throws Exception { // BodyDeclarationTarget target = new BodyDeclarationTarget(null, targetField, true); MethodDeclaration newMethod = - m_lastEditor.addMethodDeclaration("int foo()", ImmutableList.of("\t", "return 0;"), target); + m_lastEditor.addMethodDeclaration("int foo()", List.of("\t", "return 0;"), target); assertAST(m_lastEditor); assertNotNull(newMethod); assertEquals(0, typeDeclaration.bodyDeclarations().indexOf(newMethod)); @@ -1929,7 +1929,7 @@ public void test_addMethodDeclaration_withParameters() throws Exception { MethodDeclaration newMethod = m_lastEditor.addMethodDeclaration( "void foo(int a, String b, String[] c)", - ImmutableList.of(), + Collections.emptyList(), target); assertAST(m_lastEditor); assertNotNull(newMethod); @@ -1960,9 +1960,9 @@ public void test_addMethodDeclaration_withAnnotations() throws Exception { BodyDeclarationTarget target = new BodyDeclarationTarget(typeDeclaration, true); MethodDeclaration newMethod = m_lastEditor.addMethodDeclaration( - ImmutableList.of("@Override"), + List.of("@Override"), "public void fooBar()", - ImmutableList.of(), + Collections.emptyList(), target); assertNotNull(newMethod); assertEquals(0, typeDeclaration.bodyDeclarations().indexOf(newMethod)); @@ -2021,7 +2021,7 @@ public void test_ASTParser_addMethodDeclaration_innerTypeStatic() throws Excepti "}"); m_lastEditor.addMethodDeclaration( "void testMethod()", - ImmutableList.of(), + Collections.emptyList(), new BodyDeclarationTarget(typeDeclaration, false)); } @@ -2127,7 +2127,7 @@ public void test_ASTParser_addMethodDeclaration_Enums_declared() throws Exceptio "}"); m_lastEditor.addMethodDeclaration( "void someTestMethod2(TestEnum testEnum)", - ImmutableList.of(), + Collections.emptyList(), new BodyDeclarationTarget(typeDeclaration, false)); } @@ -2152,7 +2152,7 @@ public void test_ASTParser_parseBodyDeclaration_parseError() throws Exception { try { m_lastEditor.addMethodDeclaration( "void foo()", - ImmutableList.of("somethingBadA();", "somethingBadB();"), + List.of("somethingBadA();", "somethingBadB();"), new BodyDeclarationTarget(typeDeclaration, false)); fail(); } catch (Throwable e) { @@ -2380,7 +2380,7 @@ public void test_addTypeDeclaration() throws Exception { // BodyDeclarationTarget target = new BodyDeclarationTarget(typeDeclaration, null, true); TypeDeclaration newType = - m_lastEditor.addTypeDeclaration(ImmutableList.of( + m_lastEditor.addTypeDeclaration(List.of( "private class Inner {", "\tint a;", "\tint getA() {", @@ -2426,7 +2426,7 @@ public void test_addTypeDeclaration_superCI_binding() throws Exception { // BodyDeclarationTarget target = new BodyDeclarationTarget(typeDeclaration, null, true); TypeDeclaration newType = - m_lastEditor.addTypeDeclaration(ImmutableList.of( + m_lastEditor.addTypeDeclaration(List.of( "private class Inner extends ArrayList {", "\tInner() {", "\t\tsuper(5);", @@ -4110,7 +4110,7 @@ private void check_replaceCreationArguments(String[] newArgumentsLines, (VariableDeclarationFragment) statement.fragments().get(0); ClassInstanceCreation creation = (ClassInstanceCreation) fragment.getInitializer(); // do replace - m_lastEditor.replaceCreationArguments(creation, ImmutableList.copyOf(newArgumentsLines)); + m_lastEditor.replaceCreationArguments(creation, List.of(newArgumentsLines)); // check source assertEditor(getSource(expectedSourceLines), m_lastEditor); // check signature @@ -4146,7 +4146,7 @@ public void test_replaceInvocationArguments() throws Exception { "}"); MethodInvocation invocation = (MethodInvocation) m_lastEditor.getEnclosingNode(", "); // do replace - m_lastEditor.replaceInvocationArguments(invocation, ImmutableList.of("2, true")); + m_lastEditor.replaceInvocationArguments(invocation, List.of("2, true")); assertEditor( getSourceDQ( "public class Test {", @@ -4177,7 +4177,7 @@ public void test_replaceInvocationArguments_whenChained() throws Exception { "}"); MethodInvocation invocation = (MethodInvocation) m_lastEditor.getEnclosingNode(", "); // do replace - m_lastEditor.replaceInvocationArguments(invocation, ImmutableList.of("2, true")); + m_lastEditor.replaceInvocationArguments(invocation, List.of("2, true")); assertEditor( getSourceDQ( "public class Test {", @@ -4583,7 +4583,7 @@ public void test_addStatement_6() throws Exception { Statement targetStatement = (Statement) targetMethod.getBody().statements().get(1); // m_lastEditor.addStatement( - ImmutableList.of("// first comment", "// second comment", "setVisible(false);"), + List.of("// first comment", "// second comment", "setVisible(false);"), new StatementTarget(targetStatement, true)); assertEquals( getSourceDQ( @@ -7273,7 +7273,7 @@ public void test_replaceExpression_lines() throws Exception { Expression newExpression = m_lastEditor.replaceExpression( fragment.getInitializer(), - ImmutableList.of("new", "\tjava.util.ArrayList()")); + List.of("new", "\tjava.util.ArrayList()")); assertSame(newExpression, fragment.getInitializer()); assertEditor( getSourceDQ( @@ -7399,7 +7399,7 @@ public void test_resolveImports_forInnerClass() throws Exception { Expression expression = (Expression) getNode("new Object()"); m_lastEditor.replaceExpression( expression, - ImmutableList.of("test2.Style.Orientation.HORIZONTAL")); + List.of("test2.Style.Orientation.HORIZONTAL")); assertEditor( getSource( "// filler filler filler filler filler", diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/util/ast/AstNodeUtilsTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/util/ast/AstNodeUtilsTest.java index 4c862059a..c11e00423 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/util/ast/AstNodeUtilsTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/util/ast/AstNodeUtilsTest.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.core.util.ast; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import static org.eclipse.wb.internal.core.utils.ast.AstNodeUtils.getMethodDeclarationSignature; @@ -68,6 +67,7 @@ import java.lang.reflect.TypeVariable; import java.util.Arrays; +import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.Set; @@ -2365,7 +2365,7 @@ public void test_getLocalMethodDeclaration_cachingBug() throws Exception { MethodDeclaration newMethod = m_lastEditor.addMethodDeclaration( "void bar()", - ImmutableList.of(), + Collections.emptyList(), new BodyDeclarationTarget(typeDeclaration, false)); // now new method assertSame(newMethod, AstNodeUtils.getLocalMethodDeclaration(invocation)); @@ -3327,9 +3327,9 @@ public void test_getMethodSignatures() throws Exception { MethodDeclaration[] methods = typeDeclaration.getMethods(); // List signatures = - AstNodeUtils.getMethodSignatures(ImmutableList.of(methods[0], methods[1])); + AstNodeUtils.getMethodSignatures(List.of(methods[0], methods[1])); Assertions.assertThat(signatures).hasSize(2).isEqualTo( - ImmutableList.of("foo()", "bar(int,java.lang.String)")); + List.of("foo()", "bar(int,java.lang.String)")); } //////////////////////////////////////////////////////////////////////////// @@ -3844,9 +3844,9 @@ public void test_isLiteral_simple() throws Exception { assertTrue(AstNodeUtils.isLiteral(qualifiedName)); assertFalse(AstNodeUtils.isLiteral(varNode)); // List checks - assertTrue(AstNodeUtils.areLiterals(ImmutableList.of())); - assertTrue(AstNodeUtils.areLiterals(ImmutableList.of(booleanLiteral, numberLiteral))); - assertFalse(AstNodeUtils.areLiterals(ImmutableList.of(booleanLiteral, varNode))); + assertTrue(AstNodeUtils.areLiterals(Collections.emptyList())); + assertTrue(AstNodeUtils.areLiterals(List.of(booleanLiteral, numberLiteral))); + assertFalse(AstNodeUtils.areLiterals(List.of(booleanLiteral, varNode))); } /** diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/util/jdt/core/CodeUtilsTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/util/jdt/core/CodeUtilsTest.java index 3becd31d5..dee4837df 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/util/jdt/core/CodeUtilsTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/util/jdt/core/CodeUtilsTest.java @@ -12,7 +12,6 @@ import com.google.common.base.Predicate; import com.google.common.base.Predicates; -import com.google.common.collect.ImmutableList; import org.eclipse.wb.internal.core.utils.ast.AstNodeUtils; import org.eclipse.wb.internal.core.utils.ast.DomGenerics; @@ -1097,7 +1096,7 @@ public void test_findMethods_List() throws Exception { IType aType = aUnit.getTypes()[0]; // List methods = - CodeUtils.findMethods(aType, ImmutableList.of("foo()", "bar()", "baz()")); + CodeUtils.findMethods(aType, List.of("foo()", "bar()", "baz()")); Assertions.assertThat(methods).hasSize(3); assertEquals("foo", methods.get(0).getElementName()); assertEquals("bar", methods.get(1).getElementName()); diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/util/reflect/ReflectionUtilsTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/util/reflect/ReflectionUtilsTest.java index 47d0cc456..c281925ba 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/util/reflect/ReflectionUtilsTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/util/reflect/ReflectionUtilsTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.core.util.reflect; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.internal.core.EnvironmentUtils; import org.eclipse.wb.internal.core.utils.check.AssertionFailedException; import org.eclipse.wb.internal.core.utils.exception.DesignerExceptionUtils; @@ -796,10 +794,10 @@ void bar(String a) { Method base = ReflectionUtils.getMethodBySignature(A.class, "foo(java.lang.Object)"); Method specific = ReflectionUtils.getMethodBySignature(A.class, "foo(java.lang.String)"); Method bar = ReflectionUtils.getMethodBySignature(A.class, "bar(java.lang.String)"); - assertSame(specific, ReflectionUtils.getMostSpecific(ImmutableList.of(base, specific, bar))); + assertSame(specific, ReflectionUtils.getMostSpecific(List.of(base, specific, bar))); } { - assertSame(null, ReflectionUtils.getMostSpecific(ImmutableList.of())); + assertSame(null, ReflectionUtils.getMostSpecific(Collections.emptyList())); } } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/util/ui/MenuIntersectorTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/util/ui/MenuIntersectorTest.java index 0d7cc8c6a..8f5cbe88e 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/util/ui/MenuIntersectorTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/util/ui/MenuIntersectorTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.core.util.ui; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.internal.core.utils.ui.IActionSingleton; import org.eclipse.wb.internal.core.utils.ui.MenuIntersector; import org.eclipse.wb.tests.designer.tests.DesignerTestCase; @@ -157,7 +155,7 @@ public void run() { manager_2.add(action_2); // merge IMenuManager main = new MenuManager(); - MenuIntersector.merge(main, ImmutableList.of(manager_1, manager_2)); + MenuIntersector.merge(main, List.of(manager_1, manager_2)); // prepare single IAction that wraps two IAction's IAction wrapperAction; { @@ -213,7 +211,7 @@ public void run() { manager_2.add(action_2); // merge IMenuManager main = new MenuManager(); - MenuIntersector.merge(main, ImmutableList.of(manager_1, manager_2)); + MenuIntersector.merge(main, List.of(manager_1, manager_2)); // prepare single IAction that wraps two IAction's IAction wrapperAction; { diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/editor/ComponentsTreePageTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/editor/ComponentsTreePageTest.java index ed0a4eb9a..a50656eba 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/editor/ComponentsTreePageTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/editor/ComponentsTreePageTest.java @@ -10,9 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.editor; -import com.google.common.collect.ImmutableList; - -import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.core.model.broadcast.ObjectEventListener; import org.eclipse.wb.gef.core.EditPart; import org.eclipse.wb.internal.core.DesignerPlugin; @@ -32,6 +29,9 @@ import org.junit.Test; +import java.util.Collections; +import java.util.List; + import javax.swing.JButton; /** @@ -74,11 +74,11 @@ public void test_ObjectEventListener_select_existingComponent() throws Exception assertTreeSelectionModels(); assertSelectionModels(); // use broadcast to select - panel.getBroadcastObject().select(ImmutableList.of(button)); + panel.getBroadcastObject().select(List.of(button)); assertTreeSelectionModels(button); assertSelectionModels(button); // set empty selection - panel.getBroadcastObject().select(ImmutableList.of()); + panel.getBroadcastObject().select(Collections.emptyList()); assertTreeSelectionModels(); assertSelectionModels(); } @@ -106,14 +106,14 @@ public void run() throws Exception { // add new JButton ((FlowLayoutInfo) panel.getLayout()).add(newButton, null); // use broadcast to select - panel.getBroadcastObject().select(ImmutableList.of(newButton)); + panel.getBroadcastObject().select(List.of(newButton)); } }); // assert selection assertTreeSelectionModels(newButton); assertSelectionModels(newButton); // set empty selection - panel.getBroadcastObject().select(ImmutableList.of()); + panel.getBroadcastObject().select(Collections.emptyList()); assertTreeSelectionModels(); assertSelectionModels(); } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/editor/validator/AbstractLayoutRequestValidatorTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/editor/validator/AbstractLayoutRequestValidatorTest.java index 93e0b2d6e..1277234ef 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/editor/validator/AbstractLayoutRequestValidatorTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/editor/validator/AbstractLayoutRequestValidatorTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.editor.validator; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.gef.core.EditPart; import org.eclipse.wb.gef.core.policies.ILayoutRequestValidator; @@ -26,6 +24,8 @@ import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; +import java.util.List; + /** * Abstract tests for {@link ILayoutRequestValidator}. * @@ -101,7 +101,7 @@ protected static void assert_validatePasteRequest(ILayoutRequestValidator valida EditPart host, JavaInfo child) throws Exception { JavaInfoMemento memento = JavaInfoMemento.createMemento(child); - PasteRequest request = new PasteRequest(ImmutableList.of(memento)); + PasteRequest request = new PasteRequest(List.of(memento)); assertEquals(expected, validator.validatePasteRequest(host, request)); } @@ -112,7 +112,7 @@ protected static void assert_validateMoveRequest(final ILayoutRequestValidator v EditPart editPart = createHost(child); ChangeBoundsRequest request = new ChangeBoundsRequest(); - request.setEditParts(ImmutableList.of(editPart)); + request.setEditParts(List.of(editPart)); // assertEquals(expected, validator.validateMoveRequest(host, request)); // @@ -127,7 +127,7 @@ protected static void assert_validateAddRequest(final ILayoutRequestValidator va EditPart editPart = createHost(child); ChangeBoundsRequest request = new ChangeBoundsRequest(); - request.setEditParts(ImmutableList.of(editPart)); + request.setEditParts(List.of(editPart)); // assertEquals(expected, validator.validateAddRequest(host, request)); // diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/forms/FormTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/forms/FormTest.java index 7968b0d16..29c31a422 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/forms/FormTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/forms/FormTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.rcp.model.forms; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.internal.core.model.menu.IMenuPopupInfo; import org.eclipse.wb.internal.rcp.model.forms.FormInfo; import org.eclipse.wb.internal.rcp.model.jface.action.ActionContainerInfo; @@ -425,7 +423,7 @@ public void test_FormToolkit_decorateFormHeading() throws Exception { private IAction getDecorateAction(FormInfo form) throws Exception { IMenuManager manager = getDesignerMenuManager(); - form.getBroadcastObject().addContextMenu(ImmutableList.of(form), form, manager); + form.getBroadcastObject().addContextMenu(List.of(form), form, manager); IAction decorateAction = findChildAction(manager, "Decorate heading"); assertNotNull(decorateAction); return decorateAction; diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/forms/table/TableWrapLayoutSelectionActionsTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/forms/table/TableWrapLayoutSelectionActionsTest.java index 5dddacfef..10f8406f0 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/forms/table/TableWrapLayoutSelectionActionsTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/forms/table/TableWrapLayoutSelectionActionsTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.rcp.model.forms.table; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.internal.rcp.model.forms.layout.table.TableWrapLayoutInfo; import org.eclipse.wb.internal.swt.model.widgets.CompositeInfo; @@ -24,6 +22,7 @@ import org.junit.Test; import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -73,7 +72,7 @@ public void test_selectionActions_emptySelection() throws Exception { List actions; { actions = new ArrayList<>(); - List selectedObjects = ImmutableList.of(); + List selectedObjects = Collections.emptyList(); shell.getBroadcastObject().addSelectionActions(selectedObjects, actions); } // no actions @@ -101,7 +100,7 @@ public void test_selectionActions_invalidSelection() throws Exception { List actions; { actions = new ArrayList<>(); - List selectedObjects = ImmutableList.of(button, shell); + List selectedObjects = List.of(button, shell); shell.getBroadcastObject().addSelectionActions(selectedObjects, actions); } // no actions @@ -139,7 +138,7 @@ public void test_selectionActions_state() throws Exception { // actions for "button" { List actions = new ArrayList<>(); - List selectedObjects = ImmutableList.of(button); + List selectedObjects = List.of(button); shell.getBroadcastObject().addSelectionActions(selectedObjects, actions); // check actions hasAction(actions, "Left", true); @@ -156,7 +155,7 @@ public void test_selectionActions_state() throws Exception { // actions for "label", "button" { List actions = new ArrayList<>(); - List selectedObjects = ImmutableList.of(label, button); + List selectedObjects = List.of(label, button); shell.getBroadcastObject().addSelectionActions(selectedObjects, actions); // check actions hasAction(actions, "Left", true); @@ -194,7 +193,7 @@ public void test_grabAction() throws Exception { List actions; { actions = new ArrayList<>(); - List selectedObjects = ImmutableList.of(button); + List selectedObjects = List.of(button); shell.getBroadcastObject().addSelectionActions(selectedObjects, actions); } // use "vertical grab" action @@ -283,7 +282,7 @@ public void test_alignmentAction() throws Exception { List actions; { actions = new ArrayList<>(); - List selectedObjects = ImmutableList.of(button); + List selectedObjects = List.of(button); shell.getBroadcastObject().addSelectionActions(selectedObjects, actions); } // set "right" alignment diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/jface/ActionTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/jface/ActionTest.java index a86cc3a97..cba59f130 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/jface/ActionTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/jface/ActionTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.rcp.model.jface; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.editor.palette.PaletteEventListener; import org.eclipse.wb.core.editor.palette.model.CategoryInfo; import org.eclipse.wb.core.editor.palette.model.EntryInfo; @@ -215,7 +213,7 @@ public void test_iconImage_1() throws Exception { ClassInstanceCreation actionCreation = (ClassInstanceCreation) action.getCreationSupport().getNode(); Expression imageDescriptionExpression = (Expression) actionCreation.arguments().get(1); - m_lastEditor.replaceExpression(imageDescriptionExpression, ImmutableList.of( + m_lastEditor.replaceExpression(imageDescriptionExpression, List.of( "org.eclipse.jface.resource.ImageDescriptor.createFromURL(", "org.eclipse.core.runtime.Platform.getBundle(\"org.eclipse.ui\").getResource(\"/icons/full/etool16/delete_edit.png\"))")); } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/layout/form/FormLayoutMoveSingleResizableTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/layout/form/FormLayoutMoveSingleResizableTest.java index 5786d1344..9cd18e306 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/layout/form/FormLayoutMoveSingleResizableTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/layout/form/FormLayoutMoveSingleResizableTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.rcp.model.layout.form; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.internal.core.gef.policy.snapping.PlacementInfo; import org.eclipse.wb.internal.swt.model.layout.form.FormLayoutInfo; import org.eclipse.wb.internal.swt.model.layout.form.FormLayoutInfoImplAutomatic; @@ -26,6 +24,8 @@ import org.junit.Ignore; import org.junit.Test; +import java.util.List; + /** * Tests for {@link FormLayoutInfoImplAutomatic}. * @@ -289,7 +289,7 @@ private void moveTo(CompositeInfo shell, ControlInfo control, int x, int directi Rectangle controlBounds = control.getModelBounds(); impl.command_moveFreely( new Rectangle(x, 0, controlBounds.width, controlBounds.height), - ImmutableList.of(control), + List.of(control), control, direction, true); diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/layout/form/FormLayoutMoveSingleWithBothSidesTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/layout/form/FormLayoutMoveSingleWithBothSidesTest.java index 28956dd40..2352f011b 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/layout/form/FormLayoutMoveSingleWithBothSidesTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/layout/form/FormLayoutMoveSingleWithBothSidesTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.rcp.model.layout.form; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.internal.core.gef.policy.snapping.PlacementInfo; import org.eclipse.wb.internal.swt.model.layout.form.FormLayoutInfo; import org.eclipse.wb.internal.swt.model.layout.form.FormLayoutInfoImplAutomatic; @@ -24,6 +22,8 @@ import org.junit.Ignore; import org.junit.Test; +import java.util.List; + /** * Tests for {@link FormLayoutInfoImplAutomatic}. * @@ -496,7 +496,7 @@ private void moveTo(CompositeInfo shell, ControlInfo control, int x, int directi Rectangle controlBounds = control.getModelBounds(); impl.command_moveFreely( new Rectangle(x, 0, controlBounds.width, controlBounds.height), - ImmutableList.of(control), + List.of(control), control, direction, true); diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/layout/form/FormLayoutMoveSingleWithSingleSideTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/layout/form/FormLayoutMoveSingleWithSingleSideTest.java index ddf89df63..c5d3b2a9d 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/layout/form/FormLayoutMoveSingleWithSingleSideTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/layout/form/FormLayoutMoveSingleWithSingleSideTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.rcp.model.layout.form; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.internal.core.gef.policy.snapping.PlacementInfo; import org.eclipse.wb.internal.swt.model.layout.form.FormLayoutInfo; import org.eclipse.wb.internal.swt.model.layout.form.FormLayoutInfoImplAutomatic; @@ -24,6 +22,8 @@ import org.junit.Ignore; import org.junit.Test; +import java.util.List; + /** * Tests for {@link FormLayoutInfoImplAutomatic}. * @@ -576,7 +576,7 @@ private void moveTo(CompositeInfo shell, ControlInfo control, int x, int directi Rectangle controlBounds = control.getModelBounds(); impl.command_moveFreely( new Rectangle(x, 0, controlBounds.width, controlBounds.height), - ImmutableList.of(control), + List.of(control), control, direction, true); diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/layout/form/gef/FormLayoutAlignmentTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/layout/form/gef/FormLayoutAlignmentTest.java index 24fe9672c..d31e26f9f 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/layout/form/gef/FormLayoutAlignmentTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/layout/form/gef/FormLayoutAlignmentTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.rcp.model.layout.form.gef; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.internal.swt.model.widgets.CompositeInfo; import org.eclipse.wb.internal.swt.model.widgets.ControlInfo; @@ -452,7 +450,7 @@ private void runAlignmentAction(String actionText, ControlInfo... controls) thro List actions; { actions = new ArrayList<>(); - List selectedObjects = ImmutableList.copyOf(controls); + List selectedObjects = List.of(controls); shell.getBroadcastObject().addSelectionActions(selectedObjects, actions); } // run action diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/rcp/PdeUtilsTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/rcp/PdeUtilsTest.java index bcb5afb87..256574b9b 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/rcp/PdeUtilsTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/rcp/PdeUtilsTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.rcp.model.rcp; -import com.google.common.collect.ImmutableMap; - import org.eclipse.wb.internal.core.DesignerPlugin; import org.eclipse.wb.internal.core.utils.jdt.core.ProjectUtils; import org.eclipse.wb.internal.rcp.Activator; @@ -438,7 +436,7 @@ public void test_createExtensionElement_1() throws Exception { m_utils.createExtensionElement( pointId, "view", - ImmutableMap.of("id", "id_2", "name", "name 2", "class", "C_2")); + Map.of("id", "id_2", "name", "name 2", "class", "C_2")); element = m_utils.getExtensionElementById(pointId, "view", "id_2"); } assertEquals("id_2", PdeUtils.getAttribute(element, "id")); @@ -473,7 +471,7 @@ public void test_createExtensionElement_2() throws Exception { m_utils.createExtensionElement( pointId, "view", - ImmutableMap.of("id", "id_2", "name", "name 2", "class", "C_2")); + Map.of("id", "id_2", "name", "name 2", "class", "C_2")); element = m_utils.waitExtensionElementById(pointId, "view", "id_2"); assertNotNull(element); } @@ -510,7 +508,7 @@ public void test_createExtensionElement_3() throws Exception { m_utils.createExtensionElement( pointId, "view", - ImmutableMap.of("id", "id_2", "name", "name 2", "class", "C_2")); + Map.of("id", "id_2", "name", "name 2", "class", "C_2")); element = m_utils.waitExtensionElementById(pointId, "view", "id_2"); } assertEquals("id_2", PdeUtils.getAttribute(element, "id")); @@ -554,7 +552,7 @@ public void run() { m_utils.createExtensionElement( pointId, "view", - ImmutableMap.of("id", "id_2", "name", "name 2", "class", "C_2")); + Map.of("id", "id_2", "name", "name 2", "class", "C_2")); } catch (Throwable e) { DesignerPlugin.log(e); } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/util/SurroundSupportTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/util/SurroundSupportTest.java index fb7a22812..5e87ee831 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/util/SurroundSupportTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/util/SurroundSupportTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.rcp.model.util; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.gef.policy.layout.grid.IGridInfo; import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.internal.core.utils.reflect.ReflectionUtils; @@ -45,6 +43,7 @@ import org.junit.Test; import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -81,7 +80,7 @@ public void test_emptySelection() throws Exception { "}"); shell.refresh(); // - assertNoSurroundManager(shell, ImmutableList.of()); + assertNoSurroundManager(shell, Collections.emptyList()); } /** @@ -99,7 +98,7 @@ public void test_notControl() throws Exception { shell.refresh(); LayoutInfo layout = shell.getLayout(); // - assertNoSurroundManager(shell, ImmutableList.of(layout)); + assertNoSurroundManager(shell, List.of(layout)); } /** @@ -120,7 +119,7 @@ public void test_notSameParent() throws Exception { shell.refresh(); ControlInfo button = shell.getChildrenControls().get(0); // - assertNoSurroundManager(shell, ImmutableList.of(shell, button)); + assertNoSurroundManager(shell, List.of(shell, button)); } //////////////////////////////////////////////////////////////////////////// @@ -234,7 +233,7 @@ public void test_flow_notAdjacentControls() throws Exception { ControlInfo button_1 = shell.getChildrenControls().get(0); ControlInfo button_3 = shell.getChildrenControls().get(2); // can not surround - assertNoSurroundManager(button_3, ImmutableList.of(button_1, button_3)); + assertNoSurroundManager(button_3, List.of(button_1, button_3)); } //////////////////////////////////////////////////////////////////////////// @@ -662,7 +661,7 @@ public void test_GridLayout_disableWhenExposed() throws Exception { ControlInfo button = getJavaInfoByName("getButton()"); assertNotNull(button); // no surround - assertNoSurroundManager(button, ImmutableList.of(button)); + assertNoSurroundManager(button, List.of(button)); } /** @@ -692,7 +691,7 @@ public void test_GridLayout_0() throws Exception { ControlInfo button_1 = buttons.get(0); ControlInfo button_2 = buttons.get(2); // no surround - assertNoSurroundManager(shell, ImmutableList.of(button_1, button_2)); + assertNoSurroundManager(shell, List.of(button_1, button_2)); } /** @@ -1094,7 +1093,7 @@ private static void assertNoSurroundManager(ObjectInfo object, List graphical = presentation.getChildrenGraphical(); - Assertions.assertThat(graphical).isEqualTo(ImmutableList.of(button_2, button_3, button_1)); + Assertions.assertThat(graphical).isEqualTo(List.of(button_2, button_3, button_1)); } } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/component/JTableTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/component/JTableTest.java index df5d0a210..f8ddcbeea 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/component/JTableTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/component/JTableTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.swing.model.component; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.internal.core.model.property.Property; import org.eclipse.wb.internal.swing.model.component.ContainerInfo; import org.eclipse.wb.internal.swing.model.component.JTableInfo; @@ -584,7 +582,7 @@ public boolean isCellEditable(int row, int column) { { List invocations = modelDescription.getColumnModelInvocations(); Assertions.assertThat(invocations).isEqualTo( - ImmutableList.of( + List.of( "getColumnModel().getColumn(0).setResizable(false)", "getColumnModel().getColumn(0).setPreferredWidth(100)", "getColumnModel().getColumn(0).setMinWidth(50)", diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/component/menu/JMenuBarTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/component/menu/JMenuBarTest.java index 055a6749b..7d20ce5cc 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/component/menu/JMenuBarTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/component/menu/JMenuBarTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.swing.model.component.menu; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.core.model.association.RootAssociation; import org.eclipse.wb.internal.core.model.clipboard.JavaInfoMemento; @@ -426,7 +424,7 @@ public void test_IMenuInfo_PASTE() throws Exception { // paste copy of "existingMenu" { JavaInfoMemento memento = JavaInfoMemento.createMemento(existingMenuInfo); - List mementos = ImmutableList.of(memento); + List mementos = List.of(memento); assertTrue(policy.validatePaste(mementos)); policy.commandPaste(mementos, null); } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/component/menu/JMenuTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/component/menu/JMenuTest.java index 35b617635..6b81c04ab 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/component/menu/JMenuTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/component/menu/JMenuTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.swing.model.component.menu; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.core.model.association.InvocationVoidAssociation; import org.eclipse.wb.internal.core.model.JavaInfoUtils; @@ -557,7 +555,7 @@ public void test_IMenuInfo_PASTE() throws Exception { // paste copy of "existingItemInfo" { JavaInfoMemento memento = JavaInfoMemento.createMemento(existingItemInfo); - List mementos = ImmutableList.of(memento); + List mementos = List.of(memento); assertTrue(policy.validatePaste(mementos)); policy.commandPaste(mementos, null); } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/FormLayout/FormLayoutTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/FormLayout/FormLayoutTest.java index 84949879d..ddd06b3fb 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/FormLayout/FormLayoutTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/FormLayout/FormLayoutTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.swing.model.layout.FormLayout; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.gef.policy.layout.grid.IGridInfo; import org.eclipse.wb.core.model.association.InvocationChildAssociation; import org.eclipse.wb.internal.core.model.clipboard.JavaInfoMemento; @@ -245,7 +243,7 @@ public void test_editColumnsRowsActions() throws Exception { "}"); // check for actions MenuManager menuManager = getDesignerMenuManager(); - panel.getBroadcastObject().addContextMenu(ImmutableList.of(panel), panel, menuManager); + panel.getBroadcastObject().addContextMenu(List.of(panel), panel, menuManager); assertNotNull(findChildAction(menuManager, "Edit c&olumns...")); assertNotNull(findChildAction(menuManager, "Edit &rows...")); } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/MigLayout/MigLayoutConstraintsTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/MigLayout/MigLayoutConstraintsTest.java index d23e2d981..8e6a00869 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/MigLayout/MigLayoutConstraintsTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/MigLayout/MigLayoutConstraintsTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.swing.model.layout.MigLayout; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.association.InvocationChildAssociation; import org.eclipse.wb.internal.core.utils.ast.DomGenerics; import org.eclipse.wb.internal.core.utils.state.GlobalState; @@ -1128,7 +1126,7 @@ private void check_contextMenu_alignment(String managerText, IMenuManager alignmentManager; { MenuManager contextMenu = getDesignerMenuManager(); - panel.getBroadcastObject().addContextMenu(ImmutableList.of(button), button, contextMenu); + panel.getBroadcastObject().addContextMenu(List.of(button), button, contextMenu); alignmentManager = findChildMenuManager(contextMenu, managerText); assertNotNull(alignmentManager); } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/MigLayout/MigLayoutSelectionActionsTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/MigLayout/MigLayoutSelectionActionsTest.java index 2a192910f..2a986b449 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/MigLayout/MigLayoutSelectionActionsTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/MigLayout/MigLayoutSelectionActionsTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.swing.model.layout.MigLayout; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.internal.swing.FormLayout.model.FormLayoutInfo; import org.eclipse.wb.internal.swing.model.component.ComponentInfo; @@ -23,6 +21,7 @@ import org.junit.Test; import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -59,7 +58,7 @@ public void test_selectionActions_ALL() throws Exception { ComponentInfo button = panel.getChildrenComponents().get(0); // prepare actions List actions = new ArrayList<>(); - panel.getBroadcastObject().addSelectionActions(ImmutableList.of(button), actions); + panel.getBroadcastObject().addSelectionActions(List.of(button), actions); // check actions: 13 action's, 2 separator's assertEquals(15, actions.size()); assertNotNull(findAction(actions, "Default")); @@ -86,7 +85,7 @@ public void test_selectionActions_noSelection() throws Exception { panel.refresh(); // prepare actions List actions = new ArrayList<>(); - panel.getBroadcastObject().addSelectionActions(ImmutableList.of(), actions); + panel.getBroadcastObject().addSelectionActions(Collections.emptyList(), actions); // no selection, so no actions Assertions.assertThat(actions).isEmpty(); } @@ -103,7 +102,7 @@ public void test_selectionActions_invalidSelection() throws Exception { panel.refresh(); // prepare actions List actions = new ArrayList<>(); - List selectedObjects = ImmutableList.of(panel.getLayout()); + List selectedObjects = List.of(panel.getLayout()); panel.getBroadcastObject().addSelectionActions(selectedObjects, actions); // not Component on MigLayout selected, so no actions Assertions.assertThat(actions).isEmpty(); @@ -123,7 +122,7 @@ public void test_horizontalAlignment() throws Exception { ComponentInfo button = panel.getChildrenComponents().get(0); // prepare actions List actions = new ArrayList<>(); - panel.getBroadcastObject().addSelectionActions(ImmutableList.of(button), actions); + panel.getBroadcastObject().addSelectionActions(List.of(button), actions); // "Leading" should be checked { IAction leadingAction = findAction(actions, "Leading"); @@ -158,7 +157,7 @@ public void test_verticalAlignment() throws Exception { ComponentInfo button = panel.getChildrenComponents().get(0); // prepare actions List actions = new ArrayList<>(); - panel.getBroadcastObject().addSelectionActions(ImmutableList.of(button), actions); + panel.getBroadcastObject().addSelectionActions(List.of(button), actions); // "Top" should be checked { IAction topAction = findAction(actions, "Top"); diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/MigLayout/MigLayoutSurroundSupportTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/MigLayout/MigLayoutSurroundSupportTest.java index 6f14ef98c..27be7f05c 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/MigLayout/MigLayoutSurroundSupportTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/MigLayout/MigLayoutSurroundSupportTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.swing.model.layout.MigLayout; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.internal.core.utils.ui.MenuIntersector; import org.eclipse.wb.internal.swing.MigLayout.model.MigLayoutSurroundProcessor; @@ -81,7 +79,7 @@ public void test_0() throws Exception { ComponentInfo button_00 = getButtons(panel).get(0); ComponentInfo button_11 = getButtons(panel).get(2); // no surround - assertNoSurroundManager(panel, ImmutableList.of(button_00, button_11)); + assertNoSurroundManager(panel, List.of(button_00, button_11)); } /** @@ -321,7 +319,7 @@ private static IMenuManager createSurroundManager(ObjectInfo object, private static IAction getSurroundAction(String actionText, ObjectInfo... objects) throws Exception { assertFalse(objects.length == 0); - IMenuManager surroundManager = createSurroundManager(objects[0], ImmutableList.copyOf(objects)); + IMenuManager surroundManager = createSurroundManager(objects[0], List.of(objects)); assertNotNull(surroundManager); return findChildAction(surroundManager, actionText); } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/MigLayout/MigLayoutTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/MigLayout/MigLayoutTest.java index 1f249ecc8..fbc9fca0e 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/MigLayout/MigLayoutTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/MigLayout/MigLayoutTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.swing.model.layout.MigLayout; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.gef.policy.layout.grid.IGridInfo; import org.eclipse.wb.internal.core.model.creation.ConstructorCreationSupport; import org.eclipse.wb.internal.core.model.property.Property; @@ -103,7 +101,7 @@ public void test_setLayoutFromContextMenu() throws Exception { IMenuManager layoutManager; { MenuManager menuManager = getDesignerMenuManager(); - panel.getBroadcastObject().addContextMenu(ImmutableList.of(panel), panel, menuManager); + panel.getBroadcastObject().addContextMenu(List.of(panel), panel, menuManager); layoutManager = findChildMenuManager(menuManager, "Set layout"); assertNotNull(layoutManager); } @@ -1972,11 +1970,11 @@ public void test_getCellComponents() throws Exception { ComponentInfo button_4 = panel.getChildrenComponents().get(3); ComponentInfo button_5 = panel.getChildrenComponents().get(4); // - Assertions.assertThat(layout.getCellComponents(0, 0)).isEqualTo(ImmutableList.of(button_1, button_2)); - Assertions.assertThat(layout.getCellComponents(1, 0)).isEqualTo(ImmutableList.of(button_3)); - Assertions.assertThat(layout.getCellComponents(1, 1)).isEqualTo(ImmutableList.of(button_4)); - Assertions.assertThat(layout.getCellComponents(0, 2)).isEqualTo(ImmutableList.of(button_5)); - Assertions.assertThat(layout.getCellComponents(1, 2)).isEqualTo(ImmutableList.of(button_5)); + Assertions.assertThat(layout.getCellComponents(0, 0)).isEqualTo(List.of(button_1, button_2)); + Assertions.assertThat(layout.getCellComponents(1, 0)).isEqualTo(List.of(button_3)); + Assertions.assertThat(layout.getCellComponents(1, 1)).isEqualTo(List.of(button_4)); + Assertions.assertThat(layout.getCellComponents(0, 2)).isEqualTo(List.of(button_5)); + Assertions.assertThat(layout.getCellComponents(1, 2)).isEqualTo(List.of(button_5)); Assertions.assertThat(layout.getCellComponents(2, 2)).isEmpty(); } @@ -3093,7 +3091,7 @@ public void test_editColumnsRowsActions() throws Exception { "}"); // check for actions MenuManager menuManager = getDesignerMenuManager(); - panel.getBroadcastObject().addContextMenu(ImmutableList.of(panel), panel, menuManager); + panel.getBroadcastObject().addContextMenu(List.of(panel), panel, menuManager); assertNotNull(findChildAction(menuManager, "Edit c&olumns...")); assertNotNull(findChildAction(menuManager, "Edit &rows...")); } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/gbl/GridBagConstraintsTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/gbl/GridBagConstraintsTest.java index d262567f6..2771fe777 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/gbl/GridBagConstraintsTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/gbl/GridBagConstraintsTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.swing.model.layout.gbl; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.gef.policy.layout.grid.IGridInfo; import org.eclipse.wb.core.model.association.Association; import org.eclipse.wb.core.model.association.EmptyAssociation; @@ -52,6 +50,7 @@ import java.awt.GridBagConstraints; import java.awt.GridBagLayout; +import java.util.List; /** * Test for {@link GridBagConstraintsInfo}. @@ -1212,7 +1211,7 @@ private void check_contextMenu_alignment(String managerText, IMenuManager alignmentManager; { MenuManager contextMenu = getDesignerMenuManager(); - panel.getBroadcastObject().addContextMenu(ImmutableList.of(button), button, contextMenu); + panel.getBroadcastObject().addContextMenu(List.of(button), button, contextMenu); alignmentManager = findChildMenuManager(contextMenu, managerText); assertNotNull(alignmentManager); } @@ -1275,7 +1274,7 @@ public void test_contextMenu_grow() throws Exception { IMenuManager alignmentManager; { MenuManager contextMenu = getDesignerMenuManager(); - panel.getBroadcastObject().addContextMenu(ImmutableList.of(button), button, contextMenu); + panel.getBroadcastObject().addContextMenu(List.of(button), button, contextMenu); alignmentManager = findChildMenuManager(contextMenu, "Horizontal alignment"); assertNotNull(alignmentManager); } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/gbl/GridBagLayoutSurroundSupportTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/gbl/GridBagLayoutSurroundSupportTest.java index daaf13a0d..a9e8bd6f5 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/gbl/GridBagLayoutSurroundSupportTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/layout/gbl/GridBagLayoutSurroundSupportTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.swing.model.layout.gbl; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.internal.swing.model.component.ComponentInfo; import org.eclipse.wb.internal.swing.model.component.ContainerInfo; import org.eclipse.wb.internal.swing.model.layout.gbl.GridBagConstraintsInfo; @@ -20,6 +18,8 @@ import org.junit.Test; +import java.util.List; + import javax.swing.JScrollPane; import javax.swing.JTable; @@ -81,7 +81,7 @@ public void test_GridBagLayout_0() throws Exception { ComponentInfo button_00 = getJavaInfoByName("button_00"); ComponentInfo button_11 = getJavaInfoByName("button_11"); // no surround - SurroundSupportTest.assertNoSurroundManager(panel, ImmutableList.of(button_00, button_11)); + SurroundSupportTest.assertNoSurroundManager(panel, List.of(button_00, button_11)); } /** diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/util/SurroundSupportTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/util/SurroundSupportTest.java index 2fe444d2c..aa71f04d8 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/util/SurroundSupportTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swing/model/util/SurroundSupportTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.swing.model.util; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.internal.core.utils.jdt.core.CodeUtils; import org.eclipse.wb.internal.core.utils.ui.MenuIntersector; @@ -36,6 +34,7 @@ import org.osgi.framework.Bundle; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import javax.swing.JButton; @@ -79,7 +78,7 @@ public void test_emptySelection() throws Exception { "}"); panel.refresh(); // - assertNoSurroundManager(panel, ImmutableList.of()); + assertNoSurroundManager(panel, Collections.emptyList()); } /** @@ -97,7 +96,7 @@ public void test_notComponent() throws Exception { panel.refresh(); LayoutInfo layout = panel.getLayout(); // - assertNoSurroundManager(panel, ImmutableList.of(layout)); + assertNoSurroundManager(panel, List.of(layout)); } /** @@ -119,7 +118,7 @@ public void test_notSameParent() throws Exception { panel.refresh(); ComponentInfo button = panel.getChildrenComponents().get(0); // - assertNoSurroundManager(panel, ImmutableList.of(panel, button)); + assertNoSurroundManager(panel, List.of(panel, button)); } //////////////////////////////////////////////////////////////////////////// @@ -274,7 +273,7 @@ public void test_flow_notAdjacentComponents() throws Exception { ComponentInfo button_1 = panel.getChildrenComponents().get(0); ComponentInfo button_3 = panel.getChildrenComponents().get(2); // can not surround - assertNoSurroundManager(button_3, ImmutableList.of(button_1, button_3)); + assertNoSurroundManager(button_3, List.of(button_1, button_3)); } //////////////////////////////////////////////////////////////////////////// @@ -732,7 +731,7 @@ public void test_FormLayout_0() throws Exception { ComponentInfo button_22 = getButtons(panel).get(0); ComponentInfo button_44 = getButtons(panel).get(2); // no surround - assertNoSurroundManager(panel, ImmutableList.of(button_22, button_44)); + assertNoSurroundManager(panel, List.of(button_22, button_44)); } /** @@ -1070,7 +1069,7 @@ private static IMenuManager createSurroundManager(ObjectInfo object, private static IAction getSurroundAction(String actionText, ObjectInfo... objects) throws Exception { assertFalse(objects.length == 0); - IMenuManager surroundManager = createSurroundManager(objects[0], ImmutableList.copyOf(objects)); + IMenuManager surroundManager = createSurroundManager(objects[0], List.of(objects)); assertNotNull(surroundManager); return findChildAction(surroundManager, actionText); } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swt/model/menu/MenuBarPopupTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swt/model/menu/MenuBarPopupTest.java index 112574982..1e1138566 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swt/model/menu/MenuBarPopupTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swt/model/menu/MenuBarPopupTest.java @@ -11,7 +11,6 @@ package org.eclipse.wb.tests.designer.swt.model.menu; import com.google.common.base.Predicate; -import com.google.common.collect.ImmutableList; import org.eclipse.wb.draw2d.Figure; import org.eclipse.wb.gef.core.tools.PasteTool; @@ -25,6 +24,8 @@ import org.junit.Ignore; import org.junit.Test; +import java.util.List; + /** * Tests for "bar" and "popup" menu, create/move them. * @@ -231,7 +232,7 @@ public void test_popupPaste() throws Exception { // load "paste" tool { JavaInfoMemento memento = JavaInfoMemento.createMemento(popupInfo); - PasteTool pasteTool = new PasteTool(ImmutableList.of(memento)); + PasteTool pasteTool = new PasteTool(List.of(memento)); m_viewerCanvas.getEditDomain().setActiveTool(pasteTool); } // move on "button_2": target feedback diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swt/model/menu/MenuComplexTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swt/model/menu/MenuComplexTest.java index 96765f712..3f38cf325 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swt/model/menu/MenuComplexTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swt/model/menu/MenuComplexTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.swt.model.menu; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.JavaInfo; import org.eclipse.wb.draw2d.IPositionConstants; import org.eclipse.wb.gef.core.EditPart; @@ -29,6 +27,8 @@ import org.junit.Ignore; import org.junit.Test; +import java.util.List; + /** * Tests for "popup" with several item's, sub-menu's, etc. * @@ -794,7 +794,7 @@ public void test_PASTE_item() throws Exception { // load "paste" tool { JavaInfoMemento memento = JavaInfoMemento.createMemento(itemInfo); - PasteTool pasteTool = new PasteTool(ImmutableList.of(memento)); + PasteTool pasteTool = new PasteTool(List.of(memento)); m_viewerCanvas.getEditDomain().setActiveTool(pasteTool); } // move before "item": add before feedback @@ -843,7 +843,7 @@ public void test_PASTE_notItem() throws Exception { // load "paste" tool { JavaInfoMemento memento = JavaInfoMemento.createMemento(buttonInfo); - PasteTool pasteTool = new PasteTool(ImmutableList.of(memento)); + PasteTool pasteTool = new PasteTool(List.of(memento)); m_viewerCanvas.getEditDomain().setActiveTool(pasteTool); } // move on "bar" @@ -890,7 +890,7 @@ public void test_PASTE_notItem2() throws Exception { // load "paste" tool { JavaInfoMemento memento = JavaInfoMemento.createMemento(buttonInfo); - PasteTool pasteTool = new PasteTool(ImmutableList.of(memento)); + PasteTool pasteTool = new PasteTool(List.of(memento)); m_viewerCanvas.getEditDomain().setActiveTool(pasteTool); } // initially "popup" has no drop-down diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swt/model/menu/MenuObjectInfoUtilsTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swt/model/menu/MenuObjectInfoUtilsTest.java index 141c31c9d..620fa0e42 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swt/model/menu/MenuObjectInfoUtilsTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swt/model/menu/MenuObjectInfoUtilsTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.swt.model.menu; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.internal.core.model.menu.IMenuInfo; import org.eclipse.wb.internal.core.model.menu.IMenuItemInfo; import org.eclipse.wb.internal.core.model.menu.IMenuObjectInfo; @@ -444,7 +442,7 @@ public void test_isParentChild_menuWithItems() throws Exception { IMenuItemInfo item_1 = mock(IMenuItemInfo.class); IMenuItemInfo item_2 = mock(IMenuItemInfo.class); IMenuItemInfo item_3 = mock(IMenuItemInfo.class); - List items = ImmutableList.of(item_1, item_2, item_3); + List items = List.of(item_1, item_2, item_3); // prepare scenario when(menu.getItems()).thenReturn(items); when(item_1.getMenu()).thenReturn(null); diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/tests/DesignerTestCase.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/tests/DesignerTestCase.java index d60b6ade6..f663757dc 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/tests/DesignerTestCase.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/tests/DesignerTestCase.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.tests; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.internal.core.DesignerPlugin; import org.eclipse.wb.internal.core.EnvironmentUtils; @@ -66,6 +64,7 @@ import java.lang.reflect.Modifier; import java.net.URL; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.logging.Logger; @@ -598,7 +597,7 @@ protected static IAction findAction(List actions, String text) { */ public static IMenuManager getContextMenu(ObjectInfo... objectsArray) throws Exception { IMenuManager manager = getDesignerMenuManager(); - List objects = ImmutableList.copyOf(objectsArray); + List objects = List.of(objectsArray); ObjectInfo object = objectsArray[0]; object.getBroadcastObject().addContextMenu(objects, object, manager); return manager; @@ -609,7 +608,7 @@ public static IMenuManager getContextMenu(ObjectInfo... objectsArray) throws Exc */ public static List getSelectionActions_noSelection(ObjectInfo root) throws Exception { List actions = new ArrayList<>(); - ImmutableList objects = ImmutableList.of(); + List objects = Collections.emptyList(); root.getBroadcastObject().addSelectionActions(objects, actions); return actions; } @@ -621,7 +620,7 @@ public static List getSelectionActions(ObjectInfo... objectsArray) throw List actions = new ArrayList<>(); if (objectsArray.length != 0) { ObjectInfo object = objectsArray[0]; - List objects = ImmutableList.copyOf(objectsArray); + List objects = List.of(objectsArray); object.getBroadcastObject().addSelectionActions(objects, actions); } return actions; diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/GraphicalRobot.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/GraphicalRobot.java index f18ac21de..c56b05828 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/GraphicalRobot.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/GraphicalRobot.java @@ -11,7 +11,6 @@ package org.eclipse.wb.tests.gef; import com.google.common.base.Predicate; -import com.google.common.collect.ImmutableList; import org.eclipse.wb.draw2d.Figure; import org.eclipse.wb.draw2d.FigureUtils; @@ -134,7 +133,7 @@ public void deselectAll() { */ public void select(Object... models) { EditPart[] editParts = getEditParts(models); - m_viewer.setSelection(ImmutableList.copyOf(editParts)); + m_viewer.setSelection(List.of(editParts)); } //////////////////////////////////////////////////////////////////////////// diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/TreeRobot.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/TreeRobot.java index 19269960c..003cd6477 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/TreeRobot.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/TreeRobot.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.tests.gef; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.gef.core.EditPart; import org.eclipse.wb.gef.core.tools.Tool; @@ -224,7 +222,7 @@ private void notifyDropTarget(int eventType, Event event) { public TreeRobot select(Object... models) { TreeEditPart[] editParts = getEditParts(models); m_justSelectedEditParts = editParts; - m_viewer.setSelection(ImmutableList.copyOf(editParts)); + m_viewer.setSelection(List.of(editParts)); DesignerTestCase.waitEventLoop(100, 0); return this; } diff --git a/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/gef/EditPartFactory.java b/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/gef/EditPartFactory.java index 3ee25128c..91484d248 100644 --- a/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/gef/EditPartFactory.java +++ b/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/gef/EditPartFactory.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.xwt.gef; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.gef.MatchingEditPartFactory; import org.eclipse.wb.core.gef.part.menu.MenuEditPartFactory; import org.eclipse.wb.gef.core.EditPart; @@ -24,6 +22,8 @@ import org.eclipse.wb.internal.xwt.model.widgets.menu.MenuInfo; import org.eclipse.wb.internal.xwt.model.widgets.menu.MenuItemInfo; +import java.util.List; + /** * {@link IEditPartFactory} for XWT. * @@ -32,11 +32,11 @@ */ public final class EditPartFactory implements IEditPartFactory { private final static IEditPartFactory MATCHING_FACTORY = - new MatchingEditPartFactory(ImmutableList.of( + new MatchingEditPartFactory(List.of( "org.eclipse.wb.internal.xwt.model.widgets", "org.eclipse.wb.internal.xwt.model.widgets", "org.eclipse.wb.internal.xwt.model.jface", - "org.eclipse.wb.internal.xwt.model.forms"), ImmutableList.of( + "org.eclipse.wb.internal.xwt.model.forms"), List.of( "org.eclipse.wb.internal.xwt.gef.part", "org.eclipse.wb.internal.rcp.gef.part.widgets", "org.eclipse.wb.internal.xwt.gef.part", diff --git a/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/gefTree/EditPartFactory.java b/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/gefTree/EditPartFactory.java index ab9303932..0b319bb43 100644 --- a/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/gefTree/EditPartFactory.java +++ b/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/gefTree/EditPartFactory.java @@ -10,12 +10,12 @@ *******************************************************************************/ package org.eclipse.wb.internal.xwt.gefTree; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.gef.MatchingEditPartFactory; import org.eclipse.wb.gef.core.EditPart; import org.eclipse.wb.gef.core.IEditPartFactory; +import java.util.List; + /** * {@link IEditPartFactory} for XWT. * @@ -24,8 +24,8 @@ */ public final class EditPartFactory implements IEditPartFactory { private final static IEditPartFactory MATCHING_FACTORY = - new MatchingEditPartFactory(ImmutableList.of("org.eclipse.wb.internal.xwt.model.widgets"), - ImmutableList.of("org.eclipse.wb.internal.xwt.gefTree.part")); + new MatchingEditPartFactory(List.of("org.eclipse.wb.internal.xwt.model.widgets"), + List.of("org.eclipse.wb.internal.xwt.gefTree.part")); //////////////////////////////////////////////////////////////////////////// // diff --git a/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/model/property/event/XwtListenerProperty.java b/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/model/property/event/XwtListenerProperty.java index 016830571..067902902 100644 --- a/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/model/property/event/XwtListenerProperty.java +++ b/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/model/property/event/XwtListenerProperty.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.xwt.model.property.event; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.editor.IContextMenuConstants; import org.eclipse.wb.internal.core.DesignerPlugin; import org.eclipse.wb.internal.core.model.property.Property; @@ -42,6 +40,8 @@ import org.apache.commons.lang.StringUtils; +import java.util.Collections; + /** * {@link Property} for single XML event. * @@ -275,7 +275,7 @@ private MethodDeclaration getMethodDeclaration0(boolean addNew) throws Exception MethodDeclaration method = m_editor.addMethodDeclaration( "public void " + methodName + "(org.eclipse.swt.widgets.Event event)", - ImmutableList.of(), + Collections.emptyList(), new BodyDeclarationTarget(m_typeDeclaration, false)); saveAST(); // set method in XML diff --git a/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/model/widgets/CTabItemInfo.java b/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/model/widgets/CTabItemInfo.java index f8f0fbc44..bc9d86353 100644 --- a/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/model/widgets/CTabItemInfo.java +++ b/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/model/widgets/CTabItemInfo.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.xwt.model.widgets; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.internal.core.model.presentation.IObjectPresentation; import org.eclipse.wb.internal.core.utils.GenericsUtils; @@ -23,6 +21,7 @@ import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.swt.custom.CTabItem; +import java.util.Collections; import java.util.List; /** @@ -70,7 +69,7 @@ public void doSelect() { private final IObjectPresentation m_presentation = new XmlObjectPresentation(this) { @Override public List getChildrenGraphical() throws Exception { - return ImmutableList.of(); + return Collections.emptyList(); } }; diff --git a/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/model/widgets/ExpandItemInfo.java b/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/model/widgets/ExpandItemInfo.java index d67ccf93c..9bd16aff4 100644 --- a/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/model/widgets/ExpandItemInfo.java +++ b/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/model/widgets/ExpandItemInfo.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.xwt.model.widgets; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.internal.core.model.presentation.IObjectPresentation; import org.eclipse.wb.internal.core.utils.GenericsUtils; @@ -27,6 +25,7 @@ import org.eclipse.swt.widgets.ExpandBar; import org.eclipse.swt.widgets.ExpandItem; +import java.util.Collections; import java.util.List; /** @@ -72,7 +71,7 @@ private boolean isExpanded() throws Exception { @Override public List getChildrenGraphical() throws Exception { if (!isExpanded()) { - return ImmutableList.of(); + return Collections.emptyList(); } return getChildrenTree(); } diff --git a/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/model/widgets/TabItemInfo.java b/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/model/widgets/TabItemInfo.java index 0b7f5c14e..06b96f133 100644 --- a/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/model/widgets/TabItemInfo.java +++ b/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/model/widgets/TabItemInfo.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.xwt.model.widgets; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.internal.core.model.presentation.IObjectPresentation; import org.eclipse.wb.internal.core.utils.GenericsUtils; @@ -24,6 +22,7 @@ import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.swt.widgets.TabItem; +import java.util.Collections; import java.util.List; /** @@ -71,7 +70,7 @@ public void doSelect() { private final IObjectPresentation m_presentation = new XmlObjectPresentation(this) { @Override public List getChildrenGraphical() throws Exception { - return ImmutableList.of(); + return Collections.emptyList(); } }; diff --git a/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/model/widgets/menu/MenuItemInfo.java b/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/model/widgets/menu/MenuItemInfo.java index e9c4f078a..0406885ac 100644 --- a/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/model/widgets/menu/MenuItemInfo.java +++ b/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/model/widgets/menu/MenuItemInfo.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.xwt.model.widgets.menu; -import com.google.common.collect.ImmutableList; - import org.eclipse.wb.core.model.ObjectInfo; import org.eclipse.wb.core.model.broadcast.ObjectEventListener; import org.eclipse.wb.core.model.broadcast.ObjectInfoChildAddBefore; @@ -49,6 +47,7 @@ import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.MenuItem; +import java.util.Collections; import java.util.List; import java.util.Optional; @@ -386,7 +385,7 @@ public void commandCreate(Object object, Object nextObject) throws Exception { @Override public List commandPaste(Object mementoObject, Object nextObject) throws Exception { - return ImmutableList.of(); + return Collections.emptyList(); } @Override diff --git a/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/parser/XwtEditorContext.java b/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/parser/XwtEditorContext.java index 0d16ec0f3..5b32dda9d 100644 --- a/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/parser/XwtEditorContext.java +++ b/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/parser/XwtEditorContext.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.internal.xwt.parser; -import com.google.common.collect.ImmutableMap; - import org.eclipse.wb.internal.core.model.description.resource.IDescriptionVersionsProvider; import org.eclipse.wb.internal.core.model.description.resource.IDescriptionVersionsProviderFactory; import org.eclipse.wb.internal.core.utils.external.ExternalFactoriesHelper; @@ -31,6 +29,7 @@ import java.security.AccessController; import java.security.PrivilegedExceptionAction; import java.util.List; +import java.util.Map; /** * {@link EditorContext} for XWT. @@ -47,7 +46,7 @@ public final class XwtEditorContext extends EditorContext { public XwtEditorContext(IFile file, IDocument document) throws Exception { super(RcpToolkitDescription.INSTANCE, file, document); configureDescriptionVersionsProviders(); - addVersions(ImmutableMap.of("isXWT", "true")); + addVersions(Map.of("isXWT", "true")); } ////////////////////////////////////////////////////////////////////////////