Lambda conversion in m2e.core.ui.

Change-Id: Id8830b0a73e81e5d18ff24a05fcdbd1425e73100
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/AddDependencyAction.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/AddDependencyAction.java
index 750f056..2c20030 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/AddDependencyAction.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/AddDependencyAction.java
@@ -28,7 +28,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
 import org.eclipse.core.resources.IFile;
@@ -89,36 +88,34 @@
           if(indexedArtifactFile.version == null) {
             dependency.setVersion(null);
           }
-          performOnDOMDocument(new OperationTuple(file, new Operation() {
-            public void process(Document document) {
-              Element depsEl = getChild(document.getDocumentElement(), DEPENDENCIES);
-              Element dep = findChild(depsEl, DEPENDENCY, childEquals(GROUP_ID, dependency.getGroupId()),
-                  childEquals(ARTIFACT_ID, dependency.getArtifactId()));
-              if(dep == null) {
-                dep = PomHelper.createDependency(depsEl, dependency.getGroupId(), dependency.getArtifactId(),
-                    dependency.getVersion());
-              } else {
-                //only set version if already exists
-                if(dependency.getVersion() != null) {
-                  setText(getChild(dep, VERSION), dependency.getVersion());
-                }
+          performOnDOMDocument(new OperationTuple(file, (Operation) document -> {
+            Element depsEl = getChild(document.getDocumentElement(), DEPENDENCIES);
+            Element dep = findChild(depsEl, DEPENDENCY, childEquals(GROUP_ID, dependency.getGroupId()),
+                childEquals(ARTIFACT_ID, dependency.getArtifactId()));
+            if(dep == null) {
+              dep = PomHelper.createDependency(depsEl, dependency.getGroupId(), dependency.getArtifactId(),
+                  dependency.getVersion());
+            } else {
+              //only set version if already exists
+              if(dependency.getVersion() != null) {
+                setText(getChild(dep, VERSION), dependency.getVersion());
               }
-              if(dependency.getType() != null //
-                  && !"jar".equals(dependency.getType()) // //$NON-NLS-1$
-                  && !"null".equals(dependency.getType())) { // guard against MNGECLIPSE-622 //$NON-NLS-1$
-
-                setText(getChild(dep, TYPE), dependency.getType());
-              }
-
-              if(dependency.getClassifier() != null) {
-                setText(getChild(dep, CLASSIFIER), dependency.getClassifier());
-              }
-
-              if(dependency.getScope() != null && !"compile".equals(dependency.getScope())) { //$NON-NLS-1$
-                setText(getChild(dep, SCOPE), dependency.getScope());
-              }
-
             }
+            if(dependency.getType() != null //
+                && !"jar".equals(dependency.getType()) // //$NON-NLS-1$
+                && !"null".equals(dependency.getType())) { // guard against MNGECLIPSE-622 //$NON-NLS-1$
+
+              setText(getChild(dep, TYPE), dependency.getType());
+            }
+
+            if(dependency.getClassifier() != null) {
+              setText(getChild(dep, CLASSIFIER), dependency.getClassifier());
+            }
+
+            if(dependency.getScope() != null && !"compile".equals(dependency.getScope())) { //$NON-NLS-1$
+              setText(getChild(dep, SCOPE), dependency.getScope());
+            }
+
           }));
         } catch(Exception ex) {
           String msg = NLS.bind(Messages.AddDependencyAction_error_msg, file);
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/AddPluginAction.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/AddPluginAction.java
index 5c4bf69..2243d3b 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/AddPluginAction.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/AddPluginAction.java
@@ -19,7 +19,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
 import org.eclipse.core.resources.IFile;
@@ -68,12 +67,10 @@
       final IndexedArtifactFile indexedArtifactFile = (IndexedArtifactFile) dialog.getFirstResult();
       if(indexedArtifactFile != null) {
         try {
-          performOnDOMDocument(new OperationTuple(file, new Operation() {
-            public void process(Document document) {
-              Element pluginsEl = getChild(document.getDocumentElement(), BUILD, PLUGINS);
-              PomHelper.createPlugin(pluginsEl, indexedArtifactFile.group, indexedArtifactFile.artifact,
-                  indexedArtifactFile.version);
-            }
+          performOnDOMDocument(new OperationTuple(file, (Operation) document -> {
+            Element pluginsEl = getChild(document.getDocumentElement(), BUILD, PLUGINS);
+            PomHelper.createPlugin(pluginsEl, indexedArtifactFile.group, indexedArtifactFile.artifact,
+                indexedArtifactFile.version);
           }));
         } catch(Exception ex) {
           log.error("Can't add plugin to " + file, ex); //$NON-NLS-1$
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/SelectionUtil.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/SelectionUtil.java
index ba65bfb..88f99d0 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/SelectionUtil.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/SelectionUtil.java
@@ -57,7 +57,6 @@
 
 import org.eclipse.m2e.core.MavenPlugin;
 import org.eclipse.m2e.core.embedder.ArtifactKey;
-import org.eclipse.m2e.core.embedder.ICallable;
 import org.eclipse.m2e.core.embedder.IMaven;
 import org.eclipse.m2e.core.embedder.IMavenExecutionContext;
 import org.eclipse.m2e.core.internal.IMavenConstants;
@@ -308,11 +307,7 @@
     request.setUpdateSnapshots(false);
     request.setRecursive(false);
 
-    MavenExecutionResult result = context.execute(new ICallable<MavenExecutionResult>() {
-      public MavenExecutionResult call(IMavenExecutionContext context, IProgressMonitor monitor) throws CoreException {
-        return maven.readMavenProject(pomFile, context.newProjectBuildingRequest());
-      }
-    }, monitor);
+    MavenExecutionResult result = context.execute((context1, monitor1) -> maven.readMavenProject(pomFile, context1.newProjectBuildingRequest()), monitor);
 
     MavenProject project = result.getProject();
     if(project != null) {
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/components/PomHierarchyComposite.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/components/PomHierarchyComposite.java
index 9fac2d2..5bdf095 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/components/PomHierarchyComposite.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/components/PomHierarchyComposite.java
@@ -22,7 +22,6 @@
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.jface.viewers.IColorProvider;
 import org.eclipse.jface.viewers.IDecoration;
 import org.eclipse.jface.viewers.IInputSelectionProvider;
@@ -79,13 +78,11 @@
       if(context == null) {
         context = PlatformUI.getWorkbench().getProgressService();
       }
-      context.run(false, true, new IRunnableWithProgress() {
-        public void run(IProgressMonitor monitor) throws InvocationTargetException {
-          try {
-            computeHeirarchy(project, monitor);
-          } catch(CoreException e) {
-            throw new InvocationTargetException(e);
-          }
+      context.run(false, true, monitor -> {
+        try {
+          computeHeirarchy(project, monitor);
+        } catch(CoreException e) {
+          throw new InvocationTargetException(e);
         }
       });
     } catch(Exception e) {
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/dialogs/EditDependencyDialog.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/dialogs/EditDependencyDialog.java
index 74a0820..9538a6f 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/dialogs/EditDependencyDialog.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/dialogs/EditDependencyDialog.java
@@ -29,7 +29,6 @@
 import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.setText;
 import static org.eclipse.m2e.core.ui.internal.util.Util.nvl;
 
-import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
 import org.eclipse.core.resources.IProject;
@@ -219,53 +218,51 @@
     final String classifier = valueOrNull(classifierText.getText());
     final String system = valueOrNull(systemPathText.getText());
     final boolean optional = optionalButton.getSelection();
-    resultOperation = new Operation() {
-      public void process(Document document) {
-        Element depsEl = dependencyManagement ? getChild(document.getDocumentElement(), DEPENDENCY_MANAGEMENT,
-            DEPENDENCIES) : getChild(document.getDocumentElement(), DEPENDENCIES);
-        Element dep = findChild(depsEl, DEPENDENCY, childEquals(GROUP_ID, oldGroupId),
-            childEquals(ARTIFACT_ID, oldArtifactId));
-        if(dep != null) {
-          if(artifactId != null && !artifactId.equals(oldArtifactId)) {
-            setText(getChild(dep, ARTIFACT_ID), artifactId);
-          }
-          if(groupId != null && !groupId.equals(oldGroupId)) {
-            setText(getChild(dep, GROUP_ID), groupId);
-          }
-          //only set version if already exists
-          if(version != null) {
-            setText(getChild(dep, VERSION), version);
-          } else {
-            removeChild(dep, findChild(dep, VERSION));
-          }
-          if(type != null //
-              && !"jar".equals(type) // //$NON-NLS-1$
-              && !"null".equals(type)) { // guard against MNGECLIPSE-622 //$NON-NLS-1$
+    resultOperation = document -> {
+      Element depsEl = dependencyManagement ? getChild(document.getDocumentElement(), DEPENDENCY_MANAGEMENT,
+          DEPENDENCIES) : getChild(document.getDocumentElement(), DEPENDENCIES);
+      Element dep = findChild(depsEl, DEPENDENCY, childEquals(GROUP_ID, oldGroupId),
+          childEquals(ARTIFACT_ID, oldArtifactId));
+      if(dep != null) {
+        if(artifactId != null && !artifactId.equals(oldArtifactId)) {
+          setText(getChild(dep, ARTIFACT_ID), artifactId);
+        }
+        if(groupId != null && !groupId.equals(oldGroupId)) {
+          setText(getChild(dep, GROUP_ID), groupId);
+        }
+        //only set version if already exists
+        if(version != null) {
+          setText(getChild(dep, VERSION), version);
+        } else {
+          removeChild(dep, findChild(dep, VERSION));
+        }
+        if(type != null //
+            && !"jar".equals(type) // //$NON-NLS-1$
+            && !"null".equals(type)) { // guard against MNGECLIPSE-622 //$NON-NLS-1$
 
-            setText(getChild(dep, TYPE), type);
-          } else {
-            removeChild(dep, findChild(dep, TYPE));
-          }
-          if(classifier != null) {
-            setText(getChild(dep, CLASSIFIER), classifier);
-          } else {
-            removeChild(dep, findChild(dep, CLASSIFIER));
-          }
-          if(scope != null && !"compile".equals(scope)) { //$NON-NLS-1$
-            setText(getChild(dep, SCOPE), scope);
-          } else {
-            removeChild(dep, findChild(dep, SCOPE));
-          }
-          if(system != null) {
-            setText(getChild(dep, SYSTEM_PATH), system);
-          } else {
-            removeChild(dep, findChild(dep, SYSTEM_PATH));
-          }
-          if(optional) {
-            setText(getChild(dep, OPTIONAL), Boolean.toString(optional));
-          } else {
-            removeChild(dep, findChild(dep, OPTIONAL));
-          }
+          setText(getChild(dep, TYPE), type);
+        } else {
+          removeChild(dep, findChild(dep, TYPE));
+        }
+        if(classifier != null) {
+          setText(getChild(dep, CLASSIFIER), classifier);
+        } else {
+          removeChild(dep, findChild(dep, CLASSIFIER));
+        }
+        if(scope != null && !"compile".equals(scope)) { //$NON-NLS-1$
+          setText(getChild(dep, SCOPE), scope);
+        } else {
+          removeChild(dep, findChild(dep, SCOPE));
+        }
+        if(system != null) {
+          setText(getChild(dep, SYSTEM_PATH), system);
+        } else {
+          removeChild(dep, findChild(dep, SYSTEM_PATH));
+        }
+        if(optional) {
+          setText(getChild(dep, OPTIONAL), Boolean.toString(optional));
+        } else {
+          removeChild(dep, findChild(dep, OPTIONAL));
         }
       }
     };
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/editing/PomEdits.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/editing/PomEdits.java
index c00d24a..f3f74d8 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/editing/PomEdits.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/editing/PomEdits.java
@@ -686,33 +686,27 @@
   }
 
   public static Matcher childEquals(final String elementName, final String matchingValue) {
-    return new Matcher() {
-      public boolean matches(Element child) {
-        String toMatch = PomEdits.getTextValue(PomEdits.findChild(child, elementName));
-        return toMatch != null && toMatch.trim().equals(matchingValue);
-      }
+    return child -> {
+      String toMatch = PomEdits.getTextValue(PomEdits.findChild(child, elementName));
+      return toMatch != null && toMatch.trim().equals(matchingValue);
     };
   }
 
   public static Matcher textEquals(final String matchingValue) {
-    return new Matcher() {
-      public boolean matches(Element child) {
-        String toMatch = PomEdits.getTextValue(child);
-        return toMatch != null && toMatch.trim().equals(matchingValue);
-      }
+    return child -> {
+      String toMatch = PomEdits.getTextValue(child);
+      return toMatch != null && toMatch.trim().equals(matchingValue);
     };
   }
 
   public static Matcher childMissingOrEqual(final String elementName, final String matchingValue) {
-    return new Matcher() {
-      public boolean matches(Element child) {
-        Element match = PomEdits.findChild(child, elementName);
-        if(match == null) {
-          return true;
-        }
-        String toMatch = PomEdits.getTextValue(match);
-        return toMatch != null && toMatch.trim().equals(matchingValue);
+    return child -> {
+      Element match = PomEdits.findChild(child, elementName);
+      if(match == null) {
+        return true;
       }
+      String toMatch = PomEdits.getTextValue(match);
+      return toMatch != null && toMatch.trim().equals(matchingValue);
     };
   }
 
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/LifecycleMappingsViewer.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/LifecycleMappingsViewer.java
index 5374b76..ecdab8a 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/LifecycleMappingsViewer.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/LifecycleMappingsViewer.java
@@ -29,10 +29,8 @@
 
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.jface.viewers.AbstractTreeViewer;
 import org.eclipse.jface.viewers.ILabelProviderListener;
 import org.eclipse.jface.viewers.ITableLabelProvider;
@@ -65,8 +63,6 @@
 import org.apache.maven.project.MavenProject;
 
 import org.eclipse.m2e.core.MavenPlugin;
-import org.eclipse.m2e.core.embedder.ICallable;
-import org.eclipse.m2e.core.embedder.IMavenExecutionContext;
 import org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingFactory;
 import org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingResult;
 import org.eclipse.m2e.core.internal.lifecyclemapping.model.LifecycleMappingMetadata;
@@ -530,27 +526,23 @@
       // TODO FIXADE find the mojo execution mapping for the workspace...How do I do this?
     } else {
       try {
-        PlatformUI.getWorkbench().getProgressService().run(false, false, new IRunnableWithProgress() {
-          public void run(final IProgressMonitor monitor) throws InvocationTargetException {
-            final IMavenProjectRegistry projectRegistry = MavenPlugin.getMavenProjectRegistry();
-            final IMavenProjectFacade facade = projectRegistry.getProject(project);
-            if(facade == null) {
-              return;
-            }
-            try {
-              projectRegistry.execute(facade, new ICallable<Void>() {
-                public Void call(IMavenExecutionContext context, IProgressMonitor monitor) throws CoreException {
-                  MavenProject mavenProject = facade.getMavenProject(monitor);
-                  List<MojoExecution> mojoExecutions = ((MavenProjectFacade) facade).getMojoExecutions(monitor);
-                  LifecycleMappingResult mappingResult = LifecycleMappingFactory.calculateLifecycleMapping(mavenProject,
-                      mojoExecutions, facade.getResolverConfiguration().getLifecycleMappingId(), monitor);
-                  mappings = mappingResult.getMojoExecutionMapping();
-                  return null;
-                }
-              }, monitor);
-            } catch(CoreException ex) {
-              throw new InvocationTargetException(ex);
-            }
+        PlatformUI.getWorkbench().getProgressService().run(false, false, monitor -> {
+          final IMavenProjectRegistry projectRegistry = MavenPlugin.getMavenProjectRegistry();
+          final IMavenProjectFacade facade = projectRegistry.getProject(project);
+          if(facade == null) {
+            return;
+          }
+          try {
+            projectRegistry.execute(facade, (context, monitor1) -> {
+              MavenProject mavenProject = facade.getMavenProject(monitor1);
+              List<MojoExecution> mojoExecutions = ((MavenProjectFacade) facade).getMojoExecutions(monitor1);
+              LifecycleMappingResult mappingResult = LifecycleMappingFactory.calculateLifecycleMapping(mavenProject,
+                  mojoExecutions, facade.getResolverConfiguration().getLifecycleMappingId(), monitor1);
+              mappings = mappingResult.getMojoExecutionMapping();
+              return null;
+            }, monitor);
+          } catch(CoreException ex) {
+            throw new InvocationTargetException(ex);
           }
         });
       } catch(InvocationTargetException ex) {
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/ParentGatherer.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/ParentGatherer.java
index 1764423..838a6a0 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/ParentGatherer.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/ParentGatherer.java
@@ -21,9 +21,7 @@
 import org.apache.maven.project.MavenProject;
 
 import org.eclipse.m2e.core.MavenPlugin;
-import org.eclipse.m2e.core.embedder.ICallable;
 import org.eclipse.m2e.core.embedder.IMaven;
-import org.eclipse.m2e.core.embedder.IMavenExecutionContext;
 import org.eclipse.m2e.core.internal.M2EUtils;
 import org.eclipse.m2e.core.project.IMavenProjectFacade;
 import org.eclipse.m2e.core.project.IMavenProjectRegistry;
@@ -58,21 +56,19 @@
 
     hierarchy.add(new ParentHierarchyEntry(mavenProject, projectFacade));
 
-    projectManager.execute(projectFacade, new ICallable<Void>() {
-      public Void call(IMavenExecutionContext context, IProgressMonitor monitor) throws CoreException {
-        MavenProject project = mavenProject;
-        while(project.getModel().getParent() != null) {
-          if(monitor.isCanceled()) {
-            return null;
-          }
-          project = maven.resolveParentProject(project, monitor);
-          IFile resource = M2EUtils.getPomFile(project); // resource is null if parent is not coming from workspace
-          IMavenProjectFacade facade = resource != null ? MavenPlugin.getMavenProjectRegistry().getProject(
-              resource.getProject()) : null;
-          hierarchy.add(new ParentHierarchyEntry(project, facade));
+    projectManager.execute(projectFacade, (context, monitor1) -> {
+      MavenProject project = mavenProject;
+      while(project.getModel().getParent() != null) {
+        if(monitor1.isCanceled()) {
+          return null;
         }
-        return null;
+        project = maven.resolveParentProject(project, monitor1);
+        IFile resource = M2EUtils.getPomFile(project); // resource is null if parent is not coming from workspace
+        IMavenProjectFacade facade = resource != null ? MavenPlugin.getMavenProjectRegistry().getProject(
+            resource.getProject()) : null;
+        hierarchy.add(new ParentHierarchyEntry(project, facade));
       }
+      return null;
     }, monitor);
 
     return hierarchy;
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/ProposalUtil.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/ProposalUtil.java
index 54fa901..3a014d7 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/ProposalUtil.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/ProposalUtil.java
@@ -88,21 +88,19 @@
     decoration.setDescriptionText(fieldDecoration.getDescription());
     decoration.setImage(fieldDecoration.getImage());
 
-    IContentProposalProvider proposalProvider = new IContentProposalProvider() {
-      public IContentProposal[] getProposals(String contents, int position) {
-        final String start = contents.length() > position ? contents.substring(0, position) : contents;
-        ArrayList<IContentProposal> proposals = new ArrayList<IContentProposal>();
-        try {
-          for(final String text : searcher.search()) {
-            if(text.startsWith(start)) {
-              proposals.add(new TextProposal(text));
-            }
+    IContentProposalProvider proposalProvider = (contents, position) -> {
+      final String start = contents.length() > position ? contents.substring(0, position) : contents;
+      ArrayList<IContentProposal> proposals = new ArrayList<IContentProposal>();
+      try {
+        for(final String text : searcher.search()) {
+          if(text.startsWith(start)) {
+            proposals.add(new TextProposal(text));
           }
-        } catch(CoreException e) {
-          log.error(e.getMessage(), e);
         }
-        return proposals.toArray(new IContentProposal[proposals.size()]);
+      } catch(CoreException e) {
+        log.error(e.getMessage(), e);
       }
+      return proposals.toArray(new IContentProposal[proposals.size()]);
     };
 
     IControlContentAdapter contentAdapter;
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/Util.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/Util.java
index e3beb7d..a6e4206 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/Util.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/Util.java
@@ -30,14 +30,12 @@
   public static <T> T proxy(final Object o, Class<T> type) {
     return (T) Proxy.newProxyInstance(type.getClassLoader(), //
         new Class[] {type}, //
-        new InvocationHandler() {
-          public Object invoke(Object proxy, Method m, Object[] args) throws Throwable {
-            try {
-              Method mm = o.getClass().getMethod(m.getName(), m.getParameterTypes());
-              return mm.invoke(o, args);
-            } catch(final NoSuchMethodException e) {
-              return null;
-            }
+        (InvocationHandler) (proxy, m, args) -> {
+          try {
+            Method mm = o.getClass().getMethod(m.getName(), m.getParameterTypes());
+            return mm.invoke(o, args);
+          } catch(final NoSuchMethodException e) {
+            return null;
           }
         });
   }