re Bug 571792:  Replaced deprecated Observable object. Still looking for
the race condition that interferes with map update.

Signed-off-by: James Kaufman <jhkauf@us.ibm.com>
diff --git a/org.eclipse.stem/core/org.eclipse.stem.ui/src/org/eclipse/stem/ui/views/graphmap/GraphMapCanvas.java b/org.eclipse.stem/core/org.eclipse.stem.ui/src/org/eclipse/stem/ui/views/graphmap/GraphMapCanvas.java
index a1177f1..12f22e5 100644
--- a/org.eclipse.stem/core/org.eclipse.stem.ui/src/org/eclipse/stem/ui/views/graphmap/GraphMapCanvas.java
+++ b/org.eclipse.stem/core/org.eclipse.stem.ui/src/org/eclipse/stem/ui/views/graphmap/GraphMapCanvas.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
+ * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2021
  * IBM Corporation, BfR, and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v2.0
@@ -16,13 +16,18 @@
 
 import java.awt.geom.Point2D;
 import java.awt.geom.Rectangle2D;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.beans.PropertyChangeEvent;
+
 import java.text.NumberFormat;
 import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.ConcurrentModificationException;
 import java.util.List;
-import java.util.Observable;
-import java.util.Observer;
+
+//import java.util.Observable;
+//import java.util.Observer;
 import java.util.concurrent.CopyOnWriteArrayList;
 
 import javax.swing.text.NumberFormatter;
@@ -33,7 +38,6 @@
 import org.eclipse.jface.action.Separator;
 import org.eclipse.jface.dialogs.IDialogSettings;
 import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.ISelectionProvider;
@@ -160,20 +164,28 @@
 	private Image canvasImage;
 	private volatile GraphMapView view;
 	private volatile GraphMapControl ctrl;
+	private static String mapPropertyName = "graphMapScaleFactor";
 
-	private Observable paneChangeSubject;
+	//private Observable paneChangeSubject;
+	
+	/*Changing paneChangeSubject from Observable to PropertyChangeSupport*/
+	private PropertyChangeSupport paneChangeSubject;
 
 	public GraphMapCanvas(Composite parent, int style, GraphMapView view) {
 		super(parent, SWT.DOUBLE_BUFFERED | SWT.NO_BACKGROUND);
 
 		this.ctrl = (GraphMapControl) parent;
-		this.paneChangeSubject = new Observable() {
-			@Override
-			public void notifyObservers(Object arg) {
-				super.setChanged();
-				super.notifyObservers(arg);
-			}
-		};
+		this.paneChangeSubject = new PropertyChangeSupport(this) {
+			
+		private static final long serialVersionUID = -55036425306354436L;
+
+		/*commenting this out as Observable is deprecated*/
+			/*
+			 * @Override public void notifyObservers(Object arg) { super. setChanged();
+			 * super.notifyObservers(arg); }
+			 */
+			};
+		 
 
 		drawPolygonBorders = INITIAL_DRAW_POLYGON_BORDERS;
 		useLogScaling = INITIAL_USE_LOG_SCALING;
@@ -199,8 +211,14 @@
 		stdColorProvider = new StandardColorProvider(this.getDisplay());
 		selectionChangedListeners = new CopyOnWriteArrayList<ISelectionChangedListener>();
 
-		Activator.getDefault().getPreferenceStore()
-				.addPropertyChangeListener(this);
+		  
+		
+	   Activator.getDefault().getPreferenceStore().addPropertyChangeListener(this);
+			 
+		 
+		
+		
+		
 		this.view = view;
 	}
 
@@ -250,9 +268,15 @@
 
 			double relTransX = cCX - translationX;
 			double relTransY = cCY - translationY;
-			// fire pane change event
-			this.paneChangeSubject.notifyObservers(new PaneChangeEvent(scaleX, // this.scaleFactor,
-					relTransX, relTransY));
+			double[] mapScale =  {scaleX,relTransX,relTransY};
+
+			// fire pane change event using notifyObservers
+			//this.paneChangeSubject.notifyObservers(new PaneChangeEvent(scaleX, relTransX, relTransY));
+			
+			PropertyChangeEvent evt = new PropertyChangeEvent (this, mapPropertyName, null, mapScale);
+			//fire pane change event using firePropertyChange in PropertyChangeSupport
+			this.paneChangeSubject.firePropertyChange(evt);
+			
 			for (StemPolygon stempoly : polygonsToRender) {
 				stempoly.computeTransformedPoints(translationX, translationY,
 						scaleX, scaleY);
@@ -531,7 +555,6 @@
 		transformationChanged = true;
 	}
 
-	@Override
 	public void propertyChange(PropertyChangeEvent event) {
 		if (!isDisposed()) {
 			redraw();
@@ -560,12 +583,12 @@
 		fireSelection(selection);
 	}
 
-	public void addPaneChangeListener(Observer listener) {
-		this.paneChangeSubject.addObserver(listener);
+	public void addPaneChangeListener(PropertyChangeListener listener) {
+		this.paneChangeSubject.addPropertyChangeListener(listener);
 	}
 
-	public void removePaneChangeListener(Observer listener) {
-		this.paneChangeSubject.deleteObserver(listener);
+	public void removePaneChangeListener(PropertyChangeListener listener) {
+		this.paneChangeSubject.removePropertyChangeListener(listener);
 	}
 
 	@Override
@@ -1401,4 +1424,13 @@
 		}
 	}
 
+	@Override
+	public void propertyChange(org.eclipse.jface.util.PropertyChangeEvent event) {
+		// TODO Auto-generated method stub
+		
+	}
+	 
+
+	
+
 }
diff --git a/org.eclipse.stem/core/org.eclipse.stem.ui/src/org/eclipse/stem/ui/views/graphmap/GraphMapControl.java b/org.eclipse.stem/core/org.eclipse.stem.ui/src/org/eclipse/stem/ui/views/graphmap/GraphMapControl.java
index 8289a4a..a152bbb 100644
--- a/org.eclipse.stem/core/org.eclipse.stem.ui/src/org/eclipse/stem/ui/views/graphmap/GraphMapControl.java
+++ b/org.eclipse.stem/core/org.eclipse.stem.ui/src/org/eclipse/stem/ui/views/graphmap/GraphMapControl.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
+ * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018,2021
  * IBM Corporation, BfR, and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v2.0
@@ -14,14 +14,16 @@
 
 package org.eclipse.stem.ui.views.graphmap;
 
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
 import java.util.ArrayList;
 import java.util.ConcurrentModificationException;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Observable;
-import java.util.Observer;
+//import java.util.Observable;
+//import java.util.Observer;
 import java.util.Set;
 
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -816,27 +818,51 @@
 
 	}
 
-	private class PaneChangeListener implements Observer {
+	private class PaneChangeListener implements PropertyChangeListener {
 		GraphMapControl thiss;
-
+		
 		public PaneChangeListener(GraphMapControl ctrl) {
 			this.thiss = ctrl;
 		}
 
-		@Override
-		public void update(Observable o, Object arg) {
-			PaneChangeEvent e = (PaneChangeEvent) arg;
-			int viewId = GraphMapRegistry.getInstance().getViewId(thiss.view);
-			GraphMapPreferences prefs = GraphMapPreferences.getInstance();
-			prefs.updatePreferenceState(viewId, thiss.getSimulation(),
-					PreferenceConstants.GRAPHMAP_PERSISTANT_VIEW_TRANS_X,
-					e.getTranformationX());
-			prefs.updatePreferenceState(viewId, thiss.getSimulation(),
-					PreferenceConstants.GRAPHMAP_PERSISTANT_VIEW_TRANS_Y,
-					e.getTranformationY());
-			prefs.updatePreferenceState(viewId, thiss.getSimulation(),
-					PreferenceConstants.GRAPHMAP_PERSISTANT_VIEW_SCALE_FACTOR,
-					e.getScaleFactor());
+		public void propertyChange(PropertyChangeEvent evt) {
+			
+			  double[] mapScale =  (double[]) evt.getNewValue();
+			  double scaleX = mapScale[0];
+			  double relTransX = mapScale[1];
+			  double relTransY = mapScale[2];
+			  int viewId = GraphMapRegistry.getInstance().getViewId(thiss.view); 
+			  GraphMapPreferences prefs = GraphMapPreferences.getInstance();
+			  prefs.updatePreferenceState(viewId, thiss.getSimulation(),
+			  PreferenceConstants.GRAPHMAP_PERSISTANT_VIEW_TRANS_X, relTransX);
+			  prefs.updatePreferenceState(viewId, thiss.getSimulation(),
+			  PreferenceConstants.GRAPHMAP_PERSISTANT_VIEW_TRANS_Y, relTransY);
+			  prefs.updatePreferenceState(viewId, thiss.getSimulation(),
+			  PreferenceConstants.GRAPHMAP_PERSISTANT_VIEW_SCALE_FACTOR,scaleX);
+			 
 		}
+
+		
+
+		// update method commented out since use of Observable has deprecated in Java 11
+		/*
+		 * @Override public void update(Observable o, Object arg) { PaneChangeEvent e =
+		 * (PaneChangeEvent) arg; int viewId =
+		 * GraphMapRegistry.getInstance().getViewId(thiss.view); GraphMapPreferences
+		 * prefs = GraphMapPreferences.getInstance();
+		 * prefs.updatePreferenceState(viewId, thiss.getSimulation(),
+		 * PreferenceConstants.GRAPHMAP_PERSISTANT_VIEW_TRANS_X, e.getTranformationX());
+		 * prefs.updatePreferenceState(viewId, thiss.getSimulation(),
+		 * PreferenceConstants.GRAPHMAP_PERSISTANT_VIEW_TRANS_Y, e.getTranformationY());
+		 * prefs.updatePreferenceState(viewId, thiss.getSimulation(),
+		 * PreferenceConstants.GRAPHMAP_PERSISTANT_VIEW_SCALE_FACTOR,
+		 * e.getScaleFactor()); }
+		 */
+		 
+
+		
+
+	    
+		
 	}
 }