[510279] Fix potential NPE in AbstractEEFWidgetLifecycleManager

AbstractEEFWidgetLifecycleManager.lockedBy* are called asynchronously
and sometimes this can occur at a time when the ControlDecoration has
been disposed, causing NPEs in ControlDecoration.setImage() when it
accesses control.getShell(). ControlDecoration does not have an
isDisposed() method, but testing for getControl() != null is
equivalent.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=510279
Change-Id: Icf155151eacbdbf50db4161955222f566dadf70e
Signed-off-by: Stéphane Bégaudeau <stephane.begaudeau@obeo.fr>
diff --git a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/api/widgets/AbstractEEFWidgetLifecycleManager.java b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/api/widgets/AbstractEEFWidgetLifecycleManager.java
index e56f793..01b1c3e 100644
--- a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/api/widgets/AbstractEEFWidgetLifecycleManager.java
+++ b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/api/widgets/AbstractEEFWidgetLifecycleManager.java
@@ -343,7 +343,7 @@
 	/**
 	 * Handles the change in the lock status by switching the user interface to a "locked by me", "locked by other" or
 	 * "unlocked" state.
-	 * 
+	 *
 	 * @param status
 	 *            The lock status
 	 */
@@ -381,10 +381,12 @@
 	 * validation control.
 	 */
 	protected void lockedByMe() {
-		this.controlDecoration.hide();
-		this.controlDecoration.setDescriptionText(Messages.AbstractEEFWidgetLifecycleManager_lockedByMe);
-		this.controlDecoration.setImage(EEFIdeUiPlugin.getPlugin().getImageRegistry().get(Icons.PERMISSION_GRANTED_TO_CURRENT_USER_EXCLUSIVELY));
-		this.controlDecoration.show();
+		if (this.controlDecoration.getControl() != null) {
+			this.controlDecoration.hide();
+			this.controlDecoration.setDescriptionText(Messages.AbstractEEFWidgetLifecycleManager_lockedByMe);
+			this.controlDecoration.setImage(EEFIdeUiPlugin.getPlugin().getImageRegistry().get(Icons.PERMISSION_GRANTED_TO_CURRENT_USER_EXCLUSIVELY));
+			this.controlDecoration.show();
+		}
 	}
 
 	/**
@@ -395,20 +397,24 @@
 	protected void lockedByOther() {
 		this.setEnabled(false);
 
-		this.controlDecoration.hide();
-		this.controlDecoration.setDescriptionText(Messages.AbstractEEFWidgetLifecycleManager_lockedByOther);
-		this.controlDecoration.setImage(EEFIdeUiPlugin.getPlugin().getImageRegistry().get(Icons.PERMISSION_DENIED));
-		this.controlDecoration.show();
+		if (this.controlDecoration.getControl() != null) {
+			this.controlDecoration.hide();
+			this.controlDecoration.setDescriptionText(Messages.AbstractEEFWidgetLifecycleManager_lockedByOther);
+			this.controlDecoration.setImage(EEFIdeUiPlugin.getPlugin().getImageRegistry().get(Icons.PERMISSION_DENIED));
+			this.controlDecoration.show();
+		}
 	}
 
 	/**
-	 * Sets the appearance and behavior of the widget in order to indicate that the semantic element used by the widget is
-	 * currently unlocked. As a result, it will set back the widget to its default state.
+	 * Sets the appearance and behavior of the widget in order to indicate that the semantic element used by the widget
+	 * is currently unlocked. As a result, it will set back the widget to its default state.
 	 */
 	protected void unlocked() {
 		this.setEnabled(this.isEnabled());
 
-		this.controlDecoration.hide();
+		if (this.controlDecoration.getControl() != null) {
+			this.controlDecoration.hide();
+		}
 	}
 
 	/**