[571624] Removed FB shape border, reduced FB corner radius

Based on the previous commit the shadow was sharpened and with that the
FB border could be dropped. This leads to nicer looking FB shapes,
especially for mapped FBs.

Furthermore as suggested in the bug report the corner radius was reduced
to half to make the fb shape better visible.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=571624
Change-Id: I8303a4d61135050bd82fd05824ce073a9f7c008a
Signed-off-by: Alois Zoitl <alois.zoitl@gmx.at>
diff --git a/plugins/org.eclipse.fordiac.ide.gef/src/org/eclipse/fordiac/ide/gef/draw2d/AdvancedRoundedRectangle.java b/plugins/org.eclipse.fordiac.ide.gef/src/org/eclipse/fordiac/ide/gef/draw2d/AdvancedRoundedRectangle.java
deleted file mode 100644
index 9d8f771..0000000
--- a/plugins/org.eclipse.fordiac.ide.gef/src/org/eclipse/fordiac/ide/gef/draw2d/AdvancedRoundedRectangle.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 - 2016 Profactor GmbH, fortiss GmbH
- *               2020 Johannes Kepler University Linz
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- *   Gerhard Ebenhofer, Monika Wenger, Alois Zoitl
- *     - initial API and implementation and/or initial documentation
- *  Bianca Wiesmayr
- *     - make border color editable
- *******************************************************************************/
-package org.eclipse.fordiac.ide.gef.draw2d;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.RoundedRectangle;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.swt.graphics.Color;
-
-public class AdvancedRoundedRectangle extends RoundedRectangle {
-
-	private int side = PositionConstants.NONE;
-	private Color borderColor;
-
-	public AdvancedRoundedRectangle(int side) {
-		super();
-		this.side = side;
-	}
-
-	public AdvancedRoundedRectangle(int side, Color borderColor) {
-		super();
-		this.side = side;
-		this.borderColor = borderColor;
-	}
-
-	public void setSide(int side) {
-		this.side = side;
-	}
-
-	public void setBorderColor(Color color) {
-		this.borderColor = color;
-	}
-
-	@Override
-	protected void outlineShape(Graphics graphics) {
-		if (null != borderColor) {
-			graphics.setForegroundColor(borderColor);
-		}
-		float lineInset = Math.max(1.0F, getLineWidthFloat()) / 2.0F;
-		int inset1 = (int) Math.floor(lineInset);
-		int inset2 = (int) Math.ceil(lineInset);
-
-		Rectangle r = Rectangle.SINGLETON.setBounds(getBounds());
-		r.x += inset1;
-		r.y += inset1;
-		r.width -= inset1 + inset2;
-		r.height -= inset1 + inset2;
-
-		int x = r.x;
-		int y = r.y;
-
-		int width = r.width;
-		int height = r.height;
-		int arcWidth = Math.max(0, getCornerDimensions().width - (int) lineInset);
-		int arcHeight = Math.max(0, getCornerDimensions().height - (int) lineInset);
-
-		if ((width == 0) || (height == 0)) {
-			return;
-		}
-		if ((arcWidth == 0) || (arcHeight == 0)) {
-			if ((side & PositionConstants.NORTH) != 0) {
-				graphics.drawLine(r.x, r.y, r.x + r.width, r.y);
-			}
-			if ((side & PositionConstants.EAST) != 0) {
-				graphics.drawLine(r.x + r.width, r.y, r.x + r.width, r.y + r.height);
-			}
-			if ((side & PositionConstants.SOUTH) != 0) {
-				graphics.drawLine(r.x, r.y + r.height, r.x + r.width, r.y + r.height);
-			}
-			if ((side & PositionConstants.WEST) != 0) {
-				graphics.drawLine(r.x, r.y, r.x, r.y + r.height);
-			}
-			if ((side & PositionConstants.NONE) != 0) {
-				// nothing to do!
-			}
-
-			return;
-		}
-		if (width < 0) {
-			x += width;
-			width = -width;
-		}
-		if (height < 0) {
-			y += height;
-			height = -height;
-		}
-		if (arcWidth < 0) {
-			arcWidth = -arcWidth;
-		}
-		if (arcHeight < 0) {
-			arcHeight = -arcHeight;
-		}
-		if (arcWidth > width) {
-			arcWidth = width;
-		}
-		if (arcHeight > height) {
-			arcHeight = height;
-		}
-
-		if (arcWidth < width) {
-			if ((side & PositionConstants.NORTH) != 0) {
-				graphics.drawLine(x + (arcWidth / 2), y, (x + width) - (arcWidth / 2), y);
-			}
-			if ((side & PositionConstants.SOUTH) != 0) {
-				graphics.drawLine(x + (arcWidth / 2), y + height, (x + width) - (arcWidth / 2), y + height);
-			}
-		}
-		if (arcHeight < height) {
-			if ((side & PositionConstants.WEST) != 0) {
-				graphics.drawLine(x, y + (arcHeight / 2), x, (y + height) - (arcHeight / 2));
-			}
-			if ((side & PositionConstants.EAST) != 0) {
-				graphics.drawLine(x + width, y + (arcHeight / 2), x + width, (y + height) - (arcHeight / 2));
-			}
-		}
-		if ((arcWidth != 0) && (arcHeight != 0) && (side != PositionConstants.NONE)) {
-			graphics.drawArc(x, y, arcWidth, arcHeight, 90, 90);
-			graphics.drawArc((x + width) - arcWidth, y, arcWidth, arcHeight, 0, 90);
-			graphics.drawArc((x + width) - arcWidth, (y + height) - arcHeight, arcWidth, arcHeight, 0, -90);
-			graphics.drawArc(x, (y + height) - arcHeight, arcWidth, arcHeight, 180, 90);
-		}
-
-	}
-
-}
diff --git a/plugins/org.eclipse.fordiac.ide.gef/src/org/eclipse/fordiac/ide/gef/figures/FBShape.java b/plugins/org.eclipse.fordiac.ide.gef/src/org/eclipse/fordiac/ide/gef/figures/FBShape.java
index b35fc78..15f0e43 100644
--- a/plugins/org.eclipse.fordiac.ide.gef/src/org/eclipse/fordiac/ide/gef/figures/FBShape.java
+++ b/plugins/org.eclipse.fordiac.ide.gef/src/org/eclipse/fordiac/ide/gef/figures/FBShape.java
@@ -1,7 +1,7 @@
 /*******************************************************************************
- * Copyright (c) 2008 - 2017 Profactor GmbH, TU Wien ACIN, fortiss GmbH
- * 				 2019 - 2020 Johannes Kepler University Linz
- * 				 2020        Primetals Technologies Germany GmbH
+ * Copyright (c) 2008, 2021 Profactor GmbH, TU Wien ACIN, fortiss GmbH,
+ *                          Johannes Kepler University Linz,
+ *                          Primetals Technologies Germany GmbH
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License 2.0 which is available at
@@ -19,11 +19,12 @@
  *               - extracted common FB shape for interface and fbn editors
  *   Bianca Wiesmayr - edited appearance of FBs
  *   Daniel Lindhuber - changed layout of top part
+ *   Alois Zoitl - Added shadow border, removed sharp border
  *******************************************************************************/
 package org.eclipse.fordiac.ide.gef.figures;
 
+import org.eclipse.draw2d.AbstractBackground;
 import org.eclipse.draw2d.BorderLayout;
-import org.eclipse.draw2d.ColorConstants;
 import org.eclipse.draw2d.Figure;
 import org.eclipse.draw2d.Graphics;
 import org.eclipse.draw2d.GridData;
@@ -36,34 +37,29 @@
 import org.eclipse.draw2d.Shape;
 import org.eclipse.draw2d.ToolbarLayout;
 import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
 import org.eclipse.fordiac.ide.gef.Messages;
-import org.eclipse.fordiac.ide.gef.draw2d.AdvancedRoundedRectangle;
 import org.eclipse.fordiac.ide.gef.draw2d.UnderlineAlphaLabel;
 import org.eclipse.fordiac.ide.gef.listeners.IFontUpdateListener;
 import org.eclipse.fordiac.ide.gef.preferences.DiagramPreferences;
 import org.eclipse.fordiac.ide.model.edit.providers.ResultListLabelProvider;
-import org.eclipse.fordiac.ide.model.libraryElement.AdapterFBType;
 import org.eclipse.fordiac.ide.model.libraryElement.FBType;
-import org.eclipse.fordiac.ide.model.libraryElement.LibraryElement;
 import org.eclipse.fordiac.ide.ui.FordiacMessages;
 import org.eclipse.fordiac.ide.ui.preferences.PreferenceConstants;
-import org.eclipse.fordiac.ide.ui.preferences.PreferenceGetter;
-import org.eclipse.fordiac.ide.util.ColorHelper;
 import org.eclipse.jface.resource.JFaceResources;
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
 
 public class FBShape extends Shape implements IFontUpdateListener {
 
+	private static final int FB_NOTCH_INSET = 9;
+
 	/** The top. */
 	private RoundedRectangle top;
 
 	/** The middle. */
-	private AdvancedRoundedRectangle middle;
+	private RoundedRectangle middle;
 
 	/** The bottom. */
-	private AdvancedRoundedRectangle bottom;
+	private RoundedRectangle bottom;
 
 	/** The event inputs. */
 	private final Figure eventInputs = new Figure();
@@ -89,6 +85,7 @@
 		configureMainFigure();
 		createFBFigureShape(fbType);
 		setTypeLabelFont();
+		setBorder(new FBShapeShadowBorder());
 	}
 
 	/**
@@ -143,11 +140,11 @@
 		return top;
 	}
 
-	public AdvancedRoundedRectangle getMiddle() {
+	public RoundedRectangle getMiddle() {
 		return middle;
 	}
 
-	public AdvancedRoundedRectangle getBottom() {
+	public RoundedRectangle getBottom() {
 		return bottom;
 	}
 
@@ -178,7 +175,6 @@
 	@Override
 	protected void fillShape(final Graphics graphics) {
 		// not used
-		drawShadow(graphics);
 	}
 
 	@Override
@@ -186,6 +182,15 @@
 		// not used
 	}
 
+	@Override
+	public void paintFigure(final Graphics graphics) {
+		// paint figure of shape does not check for background borders, needed for drop shadow
+		if (getBorder() instanceof AbstractBackground) {
+			((AbstractBackground) getBorder()).paintBackground(this, graphics, NO_INSETS);
+		}
+		super.paintFigure(graphics);
+	}
+
 	private void configureMainFigure() {
 		setFillXOR(false);
 		setOpaque(false);
@@ -199,17 +204,15 @@
 	}
 
 	private void createFBFigureShape(final FBType fbType) {
-		final Color borderColor = getBorderColor(fbType);
-
 		final Figure fbFigureContainer = createFigureContainer();
-		createFBTop(fbFigureContainer, DiagramPreferences.CORNER_DIM, borderColor);
-		configureFBMiddle(fbType, fbFigureContainer, borderColor);
-		createFBBottom(fbFigureContainer, DiagramPreferences.CORNER_DIM, borderColor);
+		createFBTop(fbFigureContainer, DiagramPreferences.CORNER_DIM);
+		configureFBMiddle(fbType, fbFigureContainer);
+		createFBBottom(fbFigureContainer, DiagramPreferences.CORNER_DIM);
 	}
 
-	private void createFBBottom(final Figure fbFigureContainer, final int cornerDim, final Color borderColor) {
-		bottom = new AdvancedRoundedRectangle(PositionConstants.SOUTH | PositionConstants.EAST | PositionConstants.WEST,
-				borderColor);
+	private void createFBBottom(final Figure fbFigureContainer, final int cornerDim) {
+		bottom = new RoundedRectangle();
+		bottom.setOutline(false);
 		bottom.setCornerDimensions(new Dimension(cornerDim, cornerDim));
 		final GridLayout bottomLayout = new GridLayout(3, false);
 		bottomLayout.marginHeight = 4;
@@ -228,23 +231,23 @@
 		setBottomIOs(bottom);
 	}
 
-	private void configureFBMiddle(final FBType fbType, final Figure fbFigureContainer, final Color borderColor) {
+	private void configureFBMiddle(final FBType fbType, final Figure fbFigureContainer) {
 		final Figure middleContainer = new Figure();
 		final BorderLayout borderLayout = new BorderLayout();
 		middleContainer.setLayoutManager(borderLayout);
 		borderLayout.setHorizontalSpacing(10);
-		middleContainer.setBorder(new MarginBorder(0, 7, 0, 7));
+		middleContainer.setBorder(new MarginBorder(0, FB_NOTCH_INSET, 0, FB_NOTCH_INSET));
 
 		fbFigureContainer.add(middleContainer);
 		final GridData middleLayouData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
 		fbFigureContainer.setConstraint(middleContainer, middleLayouData);
 
-		setupTypeNameAndVersion(fbType, middleContainer, borderColor);
+		setupTypeNameAndVersion(fbType, middleContainer);
 	}
 
-	private void createFBTop(final Figure fbFigureContainer, final int cornerDim, final Color borderColor) {
-		top = new AdvancedRoundedRectangle(PositionConstants.NORTH | PositionConstants.EAST | PositionConstants.WEST,
-				borderColor);
+	private void createFBTop(final Figure fbFigureContainer, final int cornerDim) {
+		top = new RoundedRectangle();
+		top.setOutline(false);
 		top.setCornerDimensions(new Dimension(cornerDim, cornerDim));
 
 		final GridLayout topLayout = new GridLayout(3, false);
@@ -330,9 +333,9 @@
 		bottomOutputArea.add(plugs);
 	}
 
-	protected void setupTypeNameAndVersion(final FBType type, final Figure container, final Color borderColor) {
-		middle = new AdvancedRoundedRectangle(PositionConstants.EAST | PositionConstants.WEST, borderColor);
-
+	protected void setupTypeNameAndVersion(final FBType type, final Figure container) {
+		middle = new RoundedRectangle();
+		middle.setOutline(false);
 		container.add(middle, BorderLayout.CENTER);
 		middle.setCornerDimensions(new Dimension());
 
@@ -352,75 +355,4 @@
 		middle.setConstraint(typeLabel, new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
 	}
 
-	@Override
-	public void setBackgroundColor(final Color bg) {
-		// set border color
-		super.setBackgroundColor(bg);
-		if (bg == null) {
-			((AdvancedRoundedRectangle) top).setBorderColor(getLocalForegroundColor());
-			middle.setBorderColor(getLocalForegroundColor());
-			bottom.setBorderColor(getLocalForegroundColor());
-		} else {
-			final Color darkerColor = ColorHelper.darker(bg);
-			((AdvancedRoundedRectangle) top).setBorderColor(darkerColor);
-			middle.setBorderColor(darkerColor);
-			bottom.setBorderColor(darkerColor);
-		}
-	}
-
-	private static Color getBorderColor(final LibraryElement type) {
-		if (type instanceof AdapterFBType) {
-			return PreferenceGetter.getColor(PreferenceConstants.P_ADAPTER_CONNECTOR_COLOR);
-		}
-		return ColorConstants.gray;
-	}
-
-	private void drawShadow(final Graphics graphics) {
-		final int shadow = 6;
-
-		graphics.pushState();
-		graphics.setBackgroundColor(ColorConstants.black);
-		graphics.setAlpha(20);
-
-		final Rectangle topShadowRect = top.getBounds().getExpanded(2, 2);
-		final Rectangle middleShadowRect = middle.getBounds().getExpanded(2, 0);
-		final Rectangle bottomShadowRect = bottom.getBounds().getExpanded(2, 2);
-
-
-		final Rectangle clipRect = topShadowRect.getCopy();
-		clipRect.union(middleShadowRect);
-		clipRect.union(bottomShadowRect);
-		clipRect.width += shadow;
-		clipRect.height += shadow;
-		graphics.setClip(clipRect);
-
-		drawShadowFigure(graphics, topShadowRect, middleShadowRect, bottomShadowRect);
-
-		topShadowRect.shrink(1, 1);
-		middleShadowRect.shrink(1, 0);
-		bottomShadowRect.shrink(1, 1);
-		drawShadowFigure(graphics, topShadowRect, middleShadowRect, bottomShadowRect);
-		final double horInc = 0.66;  // emulate a roughly 30° shadow angle
-		double horI = 0;
-		for (int i = 0; i <= shadow; i++) {
-			horI += horInc;
-			topShadowRect.translate((int) horI, 1);
-			middleShadowRect.translate((int) horI, 1);
-			bottomShadowRect.translate((int) horI, 1);
-			drawShadowFigure(graphics, topShadowRect, middleShadowRect, bottomShadowRect);
-			if (horI > 1.0) {
-				horI -= 1.0;
-			}
-		}
-
-		graphics.popState();
-	}
-
-	private static void drawShadowFigure(final Graphics graphics, final Rectangle topShadowRect,
-			final Rectangle middleShadowRect, final Rectangle bottomShadowRect) {
-		graphics.fillRoundRectangle(topShadowRect, DiagramPreferences.CORNER_DIM, DiagramPreferences.CORNER_DIM);
-		graphics.fillRectangle(middleShadowRect);
-		graphics.fillRoundRectangle(bottomShadowRect, DiagramPreferences.CORNER_DIM, DiagramPreferences.CORNER_DIM);
-	}
-
 }
diff --git a/plugins/org.eclipse.fordiac.ide.gef/src/org/eclipse/fordiac/ide/gef/figures/FBShapeShadowBorder.java b/plugins/org.eclipse.fordiac.ide.gef/src/org/eclipse/fordiac/ide/gef/figures/FBShapeShadowBorder.java
new file mode 100644
index 0000000..c7ee066
--- /dev/null
+++ b/plugins/org.eclipse.fordiac.ide.gef/src/org/eclipse/fordiac/ide/gef/figures/FBShapeShadowBorder.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2021 Johannes Kepler University Linz
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ *   Alois Zoitl - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.fordiac.ide.gef.figures;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.draw2d.AbstractBackground;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Insets;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.fordiac.ide.gef.preferences.DiagramPreferences;
+
+class FBShapeShadowBorder extends AbstractBackground {
+
+	private static final int SHADOW_ALPHA = 25;
+
+	private static final int SHADOW_SIZE = 6;
+
+	protected static final Insets SHADOW_INSETS = new Insets(2, 2, SHADOW_SIZE, SHADOW_SIZE * 2 / 3);
+
+	@Override
+	public Insets getInsets(final IFigure figure) {
+		return SHADOW_INSETS;
+	}
+
+	@Override
+	public boolean isOpaque() {
+		return true;
+	}
+
+	@Override
+	public void paintBackground(final IFigure figure, final Graphics graphics, final Insets insets) {
+		Assert.isTrue(figure instanceof FBShape);
+		final FBShape fbShape = (FBShape) figure;
+
+		graphics.pushState();
+		graphics.setBackgroundColor(ColorConstants.black);
+
+		final Rectangle topShadowRect = fbShape.getTop().getBounds().getExpanded(2, 2);
+		final Rectangle middleShadowRect = fbShape.getMiddle().getBounds().getExpanded(2, 0);
+		final Rectangle bottomShadowRect = fbShape.getBottom().getBounds().getExpanded(2, 2);
+
+		final Rectangle clipRect = topShadowRect.getCopy();
+		clipRect.union(middleShadowRect);
+		clipRect.union(bottomShadowRect);
+		clipRect.width += SHADOW_SIZE;
+		clipRect.height += SHADOW_SIZE;
+		graphics.setClip(clipRect);
+
+		drawShadowHalo(graphics, topShadowRect, middleShadowRect, bottomShadowRect);
+
+		drawDropShadow(graphics, topShadowRect, middleShadowRect, bottomShadowRect);
+
+		graphics.popState();
+	}
+
+	private static void drawShadowHalo(final Graphics graphics, final Rectangle topShadowRect,
+			final Rectangle middleShadowRect, final Rectangle bottomShadowRect) {
+		graphics.setAlpha(SHADOW_ALPHA);
+		drawShadowFigure(graphics, topShadowRect, middleShadowRect, bottomShadowRect);
+		topShadowRect.shrink(1, 1);
+		middleShadowRect.shrink(1, 0);
+		bottomShadowRect.shrink(1, 1);
+		graphics.setAlpha(2 * SHADOW_ALPHA);
+		drawShadowFigure(graphics, topShadowRect, middleShadowRect, bottomShadowRect);
+	}
+
+	private static void drawDropShadow(final Graphics graphics, final Rectangle topShadowRect,
+			final Rectangle middleShadowRect, final Rectangle bottomShadowRect) {
+		graphics.setAlpha(SHADOW_ALPHA);
+		final double horInc = 0.8;  // emulate a roughly 30° shadow angle
+		double horI = 0;
+		for (int i = 0; i < SHADOW_SIZE; i++) {
+			horI += horInc;
+			topShadowRect.translate((int) horI, 1);
+			middleShadowRect.translate((int) horI, 1);
+			bottomShadowRect.translate((int) horI, 1);
+			drawShadowFigure(graphics, topShadowRect, middleShadowRect, bottomShadowRect);
+			if (horI > 1.0) {
+				horI -= 1.0;
+			}
+		}
+	}
+
+	private static void drawShadowFigure(final Graphics graphics, final Rectangle topShadowRect,
+			final Rectangle middleShadowRect, final Rectangle bottomShadowRect) {
+		graphics.fillRoundRectangle(topShadowRect, DiagramPreferences.CORNER_DIM, DiagramPreferences.CORNER_DIM);
+		graphics.fillRectangle(middleShadowRect);
+		graphics.fillRoundRectangle(bottomShadowRect, DiagramPreferences.CORNER_DIM, DiagramPreferences.CORNER_DIM);
+	}
+
+
+}
diff --git a/plugins/org.eclipse.fordiac.ide.gef/src/org/eclipse/fordiac/ide/gef/preferences/DiagramPreferences.java b/plugins/org.eclipse.fordiac.ide.gef/src/org/eclipse/fordiac/ide/gef/preferences/DiagramPreferences.java
index 1a741ef..8def04e 100644
--- a/plugins/org.eclipse.fordiac.ide.gef/src/org/eclipse/fordiac/ide/gef/preferences/DiagramPreferences.java
+++ b/plugins/org.eclipse.fordiac.ide.gef/src/org/eclipse/fordiac/ide/gef/preferences/DiagramPreferences.java
@@ -49,7 +49,7 @@
 	public static final String CONNECTION_ROUTER = "ConnectionRouter"; //$NON-NLS-1$
 
 	/** The Constant CORNER_DIM. */
-	public static final int CORNER_DIM = 14;
+	public static final int CORNER_DIM = 6;
 	public static final int CORNER_DIM_HALF = CORNER_DIM / 2;
 
 	public static final String GRID_SPACING = "GridSpacing"; //$NON-NLS-1$
@@ -90,15 +90,15 @@
 		createGroupLabelSize();
 	}
 
-	private Group createGroup(String title) {
-		Group group = new Group(getFieldEditorParent(), SWT.NONE);
+	private Group createGroup(final String title) {
+		final Group group = new Group(getFieldEditorParent(), SWT.NONE);
 		group.setText(title);
 		return group;
 	}
 
-	private void configGroup(Group group) {
-		GridLayout gridLayout = new GridLayout(2, false);
-		GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+	private void configGroup(final Group group) {
+		final GridLayout gridLayout = new GridLayout(2, false);
+		final GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
 		gridData.grabExcessHorizontalSpace = true;
 
 		gridData.horizontalSpan = 2;
@@ -107,8 +107,8 @@
 	}
 
 	private void createGroupLabelSize() {
-		Group labelSize = createGroup(Messages.DiagramPreferences_LabelSize);
-		IntegerFieldEditor integerFieldEditor = new IntegerFieldEditor(MAX_VALUE_LABEL_SIZE,
+		final Group labelSize = createGroup(Messages.DiagramPreferences_LabelSize);
+		final IntegerFieldEditor integerFieldEditor = new IntegerFieldEditor(MAX_VALUE_LABEL_SIZE,
 				Messages.DiagramPreferences_MaximumValueLabelSize, labelSize);
 		integerFieldEditor.setValidRange(0, 120);
 		addField(integerFieldEditor);
@@ -116,21 +116,21 @@
 	}
 
 	private void createGroupRulerGrid() {
-		Group group = createGroup(Messages.DiagramPreferences_FieldEditors_RulerAndGrid);
+		final Group group = createGroup(Messages.DiagramPreferences_FieldEditors_RulerAndGrid);
 		// Add the fields to the group
-		BooleanFieldEditor showRulers = new BooleanFieldEditor(SHOW_RULERS,
+		final BooleanFieldEditor showRulers = new BooleanFieldEditor(SHOW_RULERS,
 				Messages.DiagramPreferences_FieldEditors_ShowRuler, group);
 		addField(showRulers);
 
-		BooleanFieldEditor showGrid = new BooleanFieldEditor(SHOW_GRID,
+		final BooleanFieldEditor showGrid = new BooleanFieldEditor(SHOW_GRID,
 				Messages.DiagramPreferences_FieldEditors_ShowGrid, group);
 		addField(showGrid);
 
-		BooleanFieldEditor snapToGrid = new BooleanFieldEditor(SNAP_TO_GRID,
+		final BooleanFieldEditor snapToGrid = new BooleanFieldEditor(SNAP_TO_GRID,
 				Messages.DiagramPreferences_FieldEditors_SnapToGrid, group);
 		addField(snapToGrid);
 
-		IntegerFieldEditor gridSpacing = new IntegerFieldEditor(GRID_SPACING,
+		final IntegerFieldEditor gridSpacing = new IntegerFieldEditor(GRID_SPACING,
 				Messages.DiagramPreferences_FieldEditors_GridSpacingInPixels, group);
 		gridSpacing.setTextLimit(10);
 		addField(gridSpacing);
@@ -138,37 +138,36 @@
 	}
 
 	private void createGroupRouter() {
-		Group router = createGroup(Messages.DiagramPreferences_ConnectionRouter);
+		final Group router = createGroup(Messages.DiagramPreferences_ConnectionRouter);
 
-		Map<String, IConnectionRouterFactory> connectionRouter = new HashMap<>();
+		final Map<String, IConnectionRouterFactory> connectionRouter = new HashMap<>();
 
-		IExtensionRegistry registry = Platform.getExtensionRegistry();
-		IConfigurationElement[] elems = registry.getConfigurationElementsFor(Activator.PLUGIN_ID,
+		final IExtensionRegistry registry = Platform.getExtensionRegistry();
+		final IConfigurationElement[] elems = registry.getConfigurationElementsFor(Activator.PLUGIN_ID,
 				"ConnectionRouterProvider"); //$NON-NLS-1$
-		for (int i = 0; i < elems.length; i++) {
-			IConfigurationElement element = elems[i];
+		for (final IConfigurationElement element : elems) {
 			try {
-				Object object = element.createExecutableExtension("class"); //$NON-NLS-1$
-				String name = element.getAttribute("name"); //$NON-NLS-1$
+				final Object object = element.createExecutableExtension("class"); //$NON-NLS-1$
+				final String name = element.getAttribute("name"); //$NON-NLS-1$
 				if (object instanceof IConnectionRouterFactory) {
-					IConnectionRouterFactory routerFactory = (IConnectionRouterFactory) object;
+					final IConnectionRouterFactory routerFactory = (IConnectionRouterFactory) object;
 					connectionRouter.put(name, routerFactory);
 				}
-			} catch (CoreException corex) {
+			} catch (final CoreException corex) {
 				Activator.getDefault().logError("Error loading ConnectionRouter", corex); //$NON-NLS-1$
 			}
 		}
 
-		Set<String> keySet = connectionRouter.keySet();
-		String[][] nameArray = new String[keySet.size()][2];
+		final Set<String> keySet = connectionRouter.keySet();
+		final String[][] nameArray = new String[keySet.size()][2];
 		int i = 0;
-		for (String key : keySet) {
+		for (final String key : keySet) {
 			nameArray[i][0] = key;
 			nameArray[i][1] = key;
 			i++;
 		}
 
-		ComboFieldEditor routerEditor = new ComboFieldEditor(CONNECTION_ROUTER,
+		final ComboFieldEditor routerEditor = new ComboFieldEditor(CONNECTION_ROUTER,
 				Messages.DiagramPreferences_DefaultRouter, nameArray, router);
 		addField(routerEditor);
 		configGroup(router);