From 3b613d12f3c105228bd6ed5474c227c2842c3b66 Mon Sep 17 00:00:00 2001
From: Florian Hoelzl <hoelzl@fortiss.org>
Date: Tue, 1 Mar 2011 20:09:29 +0000
Subject: [PATCH] reworked emfstore and unicase client storage location
 providers

---
 .../EclipseWorkspaceLocationProviderBase.java | 22 ++++++++++++++-----
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/emfstore/EclipseWorkspaceLocationProviderBase.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/emfstore/EclipseWorkspaceLocationProviderBase.java
index 08bb4cf0c..d8addc971 100644
--- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/emfstore/EclipseWorkspaceLocationProviderBase.java
+++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/emfstore/EclipseWorkspaceLocationProviderBase.java
@@ -36,13 +36,16 @@ public abstract class EclipseWorkspaceLocationProviderBase implements
 		LocationProvider {
 
 	/** Store the workspace location. */
-	private final IProject workspaceProject;
+	private IProject workspaceProject;
 
 	/** Stores the backup location. */
-	private final IProject backupProject;
+	private IProject backupProject;
 
-	/** Constructor. */
-	public EclipseWorkspaceLocationProviderBase() {
+	/** Stores initilization flag. */
+	private boolean initialized = false;
+
+	/** Initialize the locations. */
+	private void initialize() {
 		IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
 		this.workspaceProject = workspaceRoot
 				.getProject(getWorkspaceProjectName());
@@ -61,6 +64,7 @@ public abstract class EclipseWorkspaceLocationProviderBase implements
 				printCreationError(getBackupProjectName(), e);
 			}
 		}
+		initialized = true;
 	}
 
 	/** Prints error message to standard error. */
@@ -78,12 +82,18 @@ public abstract class EclipseWorkspaceLocationProviderBase implements
 	/** {@inheritDoc} */
 	@Override
 	public final String getWorkspaceDirectory() {
-		return workspaceProject.getFullPath().toString();
+		if (!initialized) {
+			initialize();
+		}
+		return workspaceProject.getLocation().toString();
 	}
 
 	/** {@inheritDoc} */
 	@Override
 	public final String getBackupDirectory() {
-		return backupProject.getFullPath().toString();
+		if (!initialized) {
+			initialize();
+		}
+		return backupProject.getLocation().toString();
 	}
 }
-- 
GitLab