]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
Replace obsolete use of Callback with Consumer. 30/3330/1
authorReino Ruusu <reino.ruusu@semantum.fi>
Tue, 15 Oct 2019 10:12:14 +0000 (13:12 +0300)
committerReino Ruusu <reino.ruusu@semantum.fi>
Tue, 15 Oct 2019 10:12:14 +0000 (13:12 +0300)
Change-Id: I25ea24eadda7b7f9134083b02bed4b0e0b2205e4

org.simantics.plant3d/src/org/simantics/plant3d/property/P3DSelectionProcessor.java

index 3bef85b501ddcfb0cb4a4e99f341596af5d18fef..4970d0e961c18e01389d7f874f8fde631e85ff1b 100644 (file)
@@ -3,6 +3,7 @@ package org.simantics.plant3d.property;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.function.Consumer;
 
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.swt.widgets.Composite;
@@ -26,7 +27,6 @@ import org.simantics.selectionview.BasicPropertyTab;
 import org.simantics.selectionview.ComparableTabContributor;
 import org.simantics.selectionview.PropertyTabContributorImpl;
 import org.simantics.selectionview.SelectionProcessor;
-import org.simantics.utils.datastructures.Callback;
 import org.simantics.utils.threads.SWTThread;
 
 import vtk.vtkProp;
@@ -99,14 +99,18 @@ public class P3DSelectionProcessor implements SelectionProcessor<Object, ReadGra
                public P3DBasicPropertyTab(boolean enabled) {
                        this.enabled = enabled;
                }
-               public void updatePartName(ISelection forSelection, Callback<String> updateCallback) {
+
+               @Override
+               public void updatePartName(ISelection forSelection, Consumer<String> updateCallback) {
                        Read<String> read = getPartNameReadRequest(forSelection);
                        if (read == null) {
-                               updateCallback.run("Override to control part name (PropertyTabContributorImpl.updatePartName)");
+                               updateCallback.accept("Override to control part name (PropertyTabContributorImpl.updatePartName)");
                        } else {
                                Simantics.getSession().asyncRequest(read, new PartNameListener(updateCallback));
                        }
                }
+
+               @Override
                public Read<String> getPartNameReadRequest(ISelection forSelection) {
                        final Resource r  =  AdaptationUtils.adaptToSingle(forSelection, Resource.class);
                        if (r == null)
@@ -131,10 +135,12 @@ public class P3DSelectionProcessor implements SelectionProcessor<Object, ReadGra
 
 
        public class MultiSelectionTabContibutor extends PropertyTabContributorImpl {
+               @Override
                public void createControls(org.eclipse.swt.widgets.Composite body, org.eclipse.ui.IWorkbenchSite site, org.simantics.db.management.ISessionContext context, org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport support) {
                        //Composite composite = new Composite(body, SWT.NONE);
                }
 
+               @Override
                public Read<String> getPartNameReadRequest(ISelection forSelection) {
                        final Collection<Resource> coll =  AdaptationUtils.adaptToCollection(forSelection, Resource.class);
                        if (coll.size() == 0)
@@ -161,8 +167,9 @@ public class P3DSelectionProcessor implements SelectionProcessor<Object, ReadGra
 
                }
 
-               public void updatePartName(ISelection forSelection, Callback<String> updateCallback) {
-                       updateCallback.run("No Selection");
+               //@Override
+               public void updatePartName(ISelection forSelection, Consumer<String> updateCallback) {
+                       updateCallback.accept("No Selection");
                }
        }