From 440c2b11fd49be2feb9edd39b931306b824b8aba Mon Sep 17 00:00:00 2001 From: Reino Ruusu Date: Mon, 8 Apr 2019 10:45:05 +0300 Subject: [PATCH] Elimination of compiler warnings. Change-Id: I115eca19e5750b8a60f312a537a9355082d45220 --- .../district/imports/ui/CSVImportWizardPage.java | 1 - .../district/imports/ui/ComponentMappingPage.java | 1 - .../imports/ui/controls/DynamicComboFieldEditor.java | 1 + .../district/imports/DistrictImportUtils.java | 1 - .../src/org/simantics/maps/sg/MapAttributionNode.java | 2 -- .../org/simantics/maps/sg/MapLocationZoomInfoNode.java | 2 -- .../src/org/simantics/maps/sg/MapNode.java | 4 ++-- .../src/org/simantics/maps/sg/MapScaleNode.java | 2 +- .../simantics/district/network/ui/DNEdgeBuilder.java | 4 ++-- .../district/network/ui/DistrictDiagramViewer.java | 3 ++- .../network/ui/DistrictPanZoomRotateHandler.java | 2 -- .../ui/contributions/ChangeMappingTypeHandler.java | 6 ------ .../network/ui/nodes/DistrictNetworkNodeUtils.java | 1 - .../network/changeset/DistrictChangeListener.java | 4 ++-- .../district/network/profile/DNElementColorStyle.java | 1 - .../district/network/profile/ThrottledStyleBase.java | 2 +- .../district/region/ui/DiagramRegionsTableUI.java | 3 ++- .../region/ui/handlers/RemoveRegionHandler.java | 3 ++- .../selection/ui/handlers/DeleteElementSelector.java | 1 + .../maps/server/ui/prefs/MapsServerPreferencePage.java | 2 -- .../district/maps/server/TileserverMapnik.java | 10 +++++----- 21 files changed, 21 insertions(+), 35 deletions(-) diff --git a/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/CSVImportWizardPage.java b/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/CSVImportWizardPage.java index 6c852dab..3d121e7a 100644 --- a/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/CSVImportWizardPage.java +++ b/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/CSVImportWizardPage.java @@ -52,7 +52,6 @@ public class CSVImportWizardPage extends WizardPage { // Common for vertex and edge private DynamicComboFieldEditor componentMappingSelector; private DynamicComboFieldEditor idSelector; - private DynamicComboFieldEditor labelSelector; // For vertex import private DynamicComboFieldEditor xCoordSelector; diff --git a/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/ComponentMappingPage.java b/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/ComponentMappingPage.java index c74603be..8bdf26dc 100644 --- a/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/ComponentMappingPage.java +++ b/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/ComponentMappingPage.java @@ -32,7 +32,6 @@ public class ComponentMappingPage extends WizardPage { private Composite composite; private Composite childComposite; protected Map componentMappings; - private Collection distinctMappingIvalues; private Collection distinctMappingIndexColumnValues; public ComponentMappingPage(CSVImportModel model) { diff --git a/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/controls/DynamicComboFieldEditor.java b/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/controls/DynamicComboFieldEditor.java index 5fc8cad3..f3bb8c72 100644 --- a/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/controls/DynamicComboFieldEditor.java +++ b/org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/controls/DynamicComboFieldEditor.java @@ -66,6 +66,7 @@ public class DynamicComboFieldEditor extends FieldEditor { * * @return true if it is ok, and false otherwise */ + @SuppressWarnings("unused") private boolean checkArray(String[][] table) { if (table == null) { return false; diff --git a/org.simantics.district.imports/src/org/simantics/district/imports/DistrictImportUtils.java b/org.simantics.district.imports/src/org/simantics/district/imports/DistrictImportUtils.java index ca3f4be5..ef000d75 100644 --- a/org.simantics.district.imports/src/org/simantics/district/imports/DistrictImportUtils.java +++ b/org.simantics.district.imports/src/org/simantics/district/imports/DistrictImportUtils.java @@ -12,7 +12,6 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.Consumer; import java.util.function.Function; import org.apache.commons.csv.CSVFormat; diff --git a/org.simantics.district.maps/src/org/simantics/maps/sg/MapAttributionNode.java b/org.simantics.district.maps/src/org/simantics/maps/sg/MapAttributionNode.java index d97d22eb..b2d28c0b 100644 --- a/org.simantics.district.maps/src/org/simantics/maps/sg/MapAttributionNode.java +++ b/org.simantics.district.maps/src/org/simantics/maps/sg/MapAttributionNode.java @@ -29,8 +29,6 @@ public class MapAttributionNode extends G2DNode { Color originalColor = g2d.getColor(); g2d.transform(transform); - AffineTransform tr = g2d.getTransform(); - g2d.setTransform(new AffineTransform()); // do the rendering magic diff --git a/org.simantics.district.maps/src/org/simantics/maps/sg/MapLocationZoomInfoNode.java b/org.simantics.district.maps/src/org/simantics/maps/sg/MapLocationZoomInfoNode.java index 9e027ecb..c081c923 100644 --- a/org.simantics.district.maps/src/org/simantics/maps/sg/MapLocationZoomInfoNode.java +++ b/org.simantics.district.maps/src/org/simantics/maps/sg/MapLocationZoomInfoNode.java @@ -36,8 +36,6 @@ public class MapLocationZoomInfoNode extends G2DNode { Color originalColor = g2d.getColor(); g2d.transform(transform); - AffineTransform tr = g2d.getTransform(); - g2d.setTransform(new AffineTransform()); // do the rendering magic diff --git a/org.simantics.district.maps/src/org/simantics/maps/sg/MapNode.java b/org.simantics.district.maps/src/org/simantics/maps/sg/MapNode.java index 7ca092cf..ae418de4 100644 --- a/org.simantics.district.maps/src/org/simantics/maps/sg/MapNode.java +++ b/org.simantics.district.maps/src/org/simantics/maps/sg/MapNode.java @@ -61,8 +61,8 @@ public class MapNode extends G2DNode implements ITileListener { private static final Logger LOGGER = LoggerFactory.getLogger(MapNode.class); - private final double MAP_SCALE = 1; - private final int MAX_TILE_LEVEL = 19; + //private final double MAP_SCALE = 1; + //private final int MAX_TILE_LEVEL = 19; private final int TILE_PIXEL_SIZE = 256; private final int VIEWBOX_QUIET_TIME = 500; diff --git a/org.simantics.district.maps/src/org/simantics/maps/sg/MapScaleNode.java b/org.simantics.district.maps/src/org/simantics/maps/sg/MapScaleNode.java index dc6b393d..c2139955 100644 --- a/org.simantics.district.maps/src/org/simantics/maps/sg/MapScaleNode.java +++ b/org.simantics.district.maps/src/org/simantics/maps/sg/MapScaleNode.java @@ -141,7 +141,7 @@ public class MapScaleNode extends G2DNode { private static final transient int MAX_DIGITS = 0; private static final transient double EPSILON = 0.01; private static final transient double TRIM_THRESHOLD_MAX_VALUE = Math.pow(10, 2); - private static final transient String[] SI_UNIT_LARGE_PREFIXES = { "m", "km" }; + //private static final transient String[] SI_UNIT_LARGE_PREFIXES = { "m", "km" }; private static final transient double[] SCALE_VALUES = { 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 100000, 200000, 500000, 1000000, 2000000, 50000000 }; diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DNEdgeBuilder.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DNEdgeBuilder.java index 7ed99c36..e47e9a87 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DNEdgeBuilder.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DNEdgeBuilder.java @@ -1,7 +1,6 @@ package org.simantics.district.network.ui; import java.awt.geom.Rectangle2D; -import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Optional; @@ -135,7 +134,8 @@ public class DNEdgeBuilder { double y2= coords[1] + halfPadding; Envelope e = new Envelope(x1, x2, y1, y2); - List result = qtree.query(e); + List result = qtree.query(e); + @SuppressWarnings("unchecked") List vertices = (List) result; for (ResourceVertex vertx : vertices) { Rectangle2D existing = new Rectangle2D.Double(vertx.coords[0] - halfPadding, vertx.coords[1] - halfPadding, padding, padding); diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DistrictDiagramViewer.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DistrictDiagramViewer.java index 6175ace7..3bd0bfda 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DistrictDiagramViewer.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DistrictDiagramViewer.java @@ -41,7 +41,8 @@ import org.slf4j.LoggerFactory; public class DistrictDiagramViewer extends DiagramViewer { - private static final Logger LOGGER = LoggerFactory.getLogger(DistrictDiagramViewer.class); + @SuppressWarnings("unused") + private static final Logger LOGGER = LoggerFactory.getLogger(DistrictDiagramViewer.class); @Override protected void addDiagramParticipants(ICanvasContext ctx) { diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DistrictPanZoomRotateHandler.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DistrictPanZoomRotateHandler.java index 05866bda..ac0d22e3 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DistrictPanZoomRotateHandler.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/DistrictPanZoomRotateHandler.java @@ -114,8 +114,6 @@ public class DistrictPanZoomRotateHandler extends PanZoomRotateHandler { } private boolean zoomToPage() { - int currentZoomLevel = MapScalingTransform.zoomLevel(util.getTransform()); - util.setTransform(new AffineTransform(2,0,0,2,270,270)); return true; } diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/contributions/ChangeMappingTypeHandler.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/contributions/ChangeMappingTypeHandler.java index 1047dc13..a2c02532 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/contributions/ChangeMappingTypeHandler.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/contributions/ChangeMappingTypeHandler.java @@ -183,18 +183,12 @@ public class ChangeMappingTypeHandler { private Map> possibleMappings = new HashMap<>(); - private Resource defaultVertexMapping; - protected SelectMappingDialog(Shell parentShell, CompletableFuture>> elements) { super(parentShell); this.elements = elements; setTitle("Change mappings"); } - public Resource getDefaultVertexMapping() { - return defaultVertexMapping; - } - @Override protected Control createDialogArea(Composite parent) { composite = (Composite) super.createDialogArea(parent); diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkNodeUtils.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkNodeUtils.java index 08253bb2..20479a78 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkNodeUtils.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkNodeUtils.java @@ -6,7 +6,6 @@ import java.awt.geom.Rectangle2D; import org.simantics.district.network.ModelledCRS; import org.simantics.maps.MapScalingTransform; -import org.simantics.scenegraph.utils.GeometryUtils; public class DistrictNetworkNodeUtils { diff --git a/org.simantics.district.network/src/org/simantics/district/network/changeset/DistrictChangeListener.java b/org.simantics.district.network/src/org/simantics/district/network/changeset/DistrictChangeListener.java index 39227a87..7cdb9c7d 100644 --- a/org.simantics.district.network/src/org/simantics/district/network/changeset/DistrictChangeListener.java +++ b/org.simantics.district.network/src/org/simantics/district/network/changeset/DistrictChangeListener.java @@ -1,6 +1,5 @@ package org.simantics.district.network.changeset; -import java.util.Arrays; import java.util.Map; import org.simantics.db.MetadataI; @@ -23,7 +22,8 @@ import org.slf4j.LoggerFactory; public class DistrictChangeListener extends GenericChangeListener { - private static final Logger LOGGER = LoggerFactory.getLogger(DistrictChangeListener.class); + @SuppressWarnings("unused") + private static final Logger LOGGER = LoggerFactory.getLogger(DistrictChangeListener.class); @Override public void onEvent(ReadGraph graph, MetadataI metadata, DependencyChanges event) throws DatabaseException { diff --git a/org.simantics.district.network/src/org/simantics/district/network/profile/DNElementColorStyle.java b/org.simantics.district.network/src/org/simantics/district/network/profile/DNElementColorStyle.java index f8f6ba5c..859faa67 100644 --- a/org.simantics.district.network/src/org/simantics/district/network/profile/DNElementColorStyle.java +++ b/org.simantics.district.network/src/org/simantics/district/network/profile/DNElementColorStyle.java @@ -7,7 +7,6 @@ import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener; import org.simantics.db.exception.DatabaseException; -import org.simantics.diagram.profile.StyleBase; import org.simantics.scenegraph.INode; import org.simantics.scenegraph.g2d.nodes.SingleElementNode; import org.simantics.scenegraph.profile.EvaluationContext; diff --git a/org.simantics.district.network/src/org/simantics/district/network/profile/ThrottledStyleBase.java b/org.simantics.district.network/src/org/simantics/district/network/profile/ThrottledStyleBase.java index 67ca2595..93af11c4 100644 --- a/org.simantics.district.network/src/org/simantics/district/network/profile/ThrottledStyleBase.java +++ b/org.simantics.district.network/src/org/simantics/district/network/profile/ThrottledStyleBase.java @@ -38,7 +38,7 @@ public abstract class ThrottledStyleBase extends StyleBase> resultListener; diff --git a/org.simantics.district.region.ui/src/org/simantics/district/region/ui/DiagramRegionsTableUI.java b/org.simantics.district.region.ui/src/org/simantics/district/region/ui/DiagramRegionsTableUI.java index 562dd24b..bedea060 100644 --- a/org.simantics.district.region.ui/src/org/simantics/district/region/ui/DiagramRegionsTableUI.java +++ b/org.simantics.district.region.ui/src/org/simantics/district/region/ui/DiagramRegionsTableUI.java @@ -101,7 +101,8 @@ public class DiagramRegionsTableUI extends Composite { public Object[] getElements(Object inputElement) { if (inputElement == null && (!(inputElement instanceof Collection))) return new Object[0]; - Set set = (Set) inputElement; + @SuppressWarnings("unchecked") + Set set = (Set) inputElement; return set.toArray(); } diff --git a/org.simantics.district.region.ui/src/org/simantics/district/region/ui/handlers/RemoveRegionHandler.java b/org.simantics.district.region.ui/src/org/simantics/district/region/ui/handlers/RemoveRegionHandler.java index 46b11a2f..0fe76c36 100644 --- a/org.simantics.district.region.ui/src/org/simantics/district/region/ui/handlers/RemoveRegionHandler.java +++ b/org.simantics.district.region.ui/src/org/simantics/district/region/ui/handlers/RemoveRegionHandler.java @@ -18,7 +18,8 @@ import org.slf4j.LoggerFactory; public class RemoveRegionHandler { - private static final Logger LOGGER = LoggerFactory.getLogger(RemoveRegionHandler.class); + @SuppressWarnings("unused") + private static final Logger LOGGER = LoggerFactory.getLogger(RemoveRegionHandler.class); public static final String COMMAND_ID = "org.simantics.district.region.ui.command.removeRegion"; public static final String LABEL = "Remove Region"; diff --git a/org.simantics.district.selection.ui/src/org/simantics/district/selection/ui/handlers/DeleteElementSelector.java b/org.simantics.district.selection.ui/src/org/simantics/district/selection/ui/handlers/DeleteElementSelector.java index 4382e70c..6a005c41 100644 --- a/org.simantics.district.selection.ui/src/org/simantics/district/selection/ui/handlers/DeleteElementSelector.java +++ b/org.simantics.district.selection.ui/src/org/simantics/district/selection/ui/handlers/DeleteElementSelector.java @@ -20,6 +20,7 @@ import org.slf4j.LoggerFactory; public class DeleteElementSelector { + @SuppressWarnings("unused") private static final Logger LOGGER = LoggerFactory.getLogger(DeleteElementSelector.class); @Inject diff --git a/org.simantics.maps.server.ui/src/org/simantics/maps/server/ui/prefs/MapsServerPreferencePage.java b/org.simantics.maps.server.ui/src/org/simantics/maps/server/ui/prefs/MapsServerPreferencePage.java index 0dc33f13..8a1a6f91 100644 --- a/org.simantics.maps.server.ui/src/org/simantics/maps/server/ui/prefs/MapsServerPreferencePage.java +++ b/org.simantics.maps.server.ui/src/org/simantics/maps/server/ui/prefs/MapsServerPreferencePage.java @@ -89,10 +89,8 @@ public class MapsServerPreferencePage extends FieldEditorPreferencePage implemen String labelText = ""; String buttonText = ""; int labelColor = -1; - boolean running = false; try { if (server.isRunning()) { - running = true; buttonText = "Stop"; labelText = "running"; labelColor = SWT.COLOR_DARK_GREEN; diff --git a/org.simantics.maps.server/src/org/simantics/district/maps/server/TileserverMapnik.java b/org.simantics.maps.server/src/org/simantics/district/maps/server/TileserverMapnik.java index dbe52572..3ba5157d 100644 --- a/org.simantics.maps.server/src/org/simantics/district/maps/server/TileserverMapnik.java +++ b/org.simantics.maps.server/src/org/simantics/district/maps/server/TileserverMapnik.java @@ -1,13 +1,11 @@ package org.simantics.district.maps.server; -import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.nio.file.DirectoryStream; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.util.ArrayList; import java.util.HashMap; @@ -37,7 +35,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; public class TileserverMapnik { private static final Logger LOGGER = LoggerFactory.getLogger(TileserverMapnik.class); - private static final String[] ADDITIONAL_DEPENDENCIES = new String[] { "tilelive-vector@3.9.4", "tilelive-tmstyle@0.6.0" }; private SystemProcess process; private Path serverRoot; @@ -173,7 +170,8 @@ public class TileserverMapnik { // } - private Path tileserverMapnikRoot() { + @SuppressWarnings("unused") + private Path tileserverMapnikRoot() { return serverRoot.resolve("tileserver-mapnik").toAbsolutePath(); } @@ -185,7 +183,8 @@ public class TileserverMapnik { return serverRoot.resolve("dist/share/icu").toAbsolutePath(); } - private Path getTessera() { + @SuppressWarnings("unused") + private Path getTessera() { return serverRoot.resolve("tileserver-mapnik/bin/tessera.js").toAbsolutePath(); } @@ -244,6 +243,7 @@ public class TileserverMapnik { return getDataDirectory().resolve(MapsServerPreferences.currentMBTiles()); } + @SuppressWarnings("unchecked") public void checkTm2Styles() { Path tm2 = getStyleDirectory(); try (DirectoryStream stream = Files.newDirectoryStream(tm2)) { -- 2.47.1