Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/p2/plugins/TXMUpdateHandler.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/p2/plugins/TXMUpdateHandler.java	(revision 2217)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/p2/plugins/TXMUpdateHandler.java	(revision 2218)
@@ -14,23 +14,30 @@
 import java.net.URI;
 import java.net.URL;
 import java.util.Arrays;
+import java.util.Iterator;
 
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.runtime.Assert;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.equinox.internal.p2.engine.Profile;
+import org.eclipse.equinox.internal.p2.engine.SimpleProfileRegistry;
+import org.eclipse.equinox.internal.p2.metadata.InstallableUnit;
 import org.eclipse.equinox.internal.p2.ui.sdk.ProvSDKMessages;
 import org.eclipse.equinox.internal.p2.ui.sdk.UpdateHandler;
 import org.eclipse.equinox.p2.core.IProvisioningAgent;
 import org.eclipse.equinox.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.engine.IProfile;
 import org.eclipse.equinox.p2.engine.IProfileRegistry;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
 import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
 import org.eclipse.equinox.p2.operations.RepositoryTracker;
 import org.eclipse.equinox.p2.operations.UpdateOperation;
 import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
 import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
 import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
 import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.statushandlers.StatusManager;
@@ -62,7 +69,7 @@
 					File installDirectory = new File(path);
 					Log.fine("Testing install directory rights: "+installDirectory);
 					if (!installDirectory.canWrite() || !installDirectory.canExecute()) {
-						Log.warning("Warning: you need administrator privileges to fully update TXM. Some updates might not be fully installed.");
+						Log.warning(NLS.bind("Warning: you need administrator privileges to fully update TXM (installed in {0}). Some updates might not be fully installed.", installDirectory));
 					}
 				} catch (Exception e) {
 					// TODO Auto-generated catch block
@@ -71,18 +78,46 @@
 			}
 		}
 
-		// Look for a profile.  We may not immediately need it in the
-		// handler, but if we don't have one, whatever we are trying to do
-		// will ultimately fail in a more subtle/low-level way.  So determine
-		// up front if the system is configured properly.
+		// Hacking p2 profile to be able to update installation directory even if -configuration is set
 		try {
-			String profileId = getProvisioningUI().getProfileId();
-			IProvisioningAgent agent = getProvisioningUI().getSession().getProvisioningAgent();
+			ProvisioningUI pui = ProvisioningUI.getDefaultUI();
 
+			String profileId = pui.getProfileId();
+			IProvisioningAgent agent = pui.getSession().getProvisioningAgent();
+
 			if (agent != null) {
-				IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
-				if (registry != null) {
-					registry.getProfile(profileId);
+				IProfileRegistry profileRegistry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
+
+
+				if (profileRegistry != null && profileRegistry instanceof SimpleProfileRegistry) {
+
+					SimpleProfileRegistry spr = (SimpleProfileRegistry)profileRegistry;
+
+					IProfile iprofile = profileRegistry.getProfile(profileId);
+					if (iprofile != null && iprofile instanceof Profile) {
+						Profile profile = (Profile)iprofile;
+
+						spr.lockProfile(profile);
+
+						//System.out.println("Profile: "+profile.getClass()+" = "+profile);
+						Iterator<IInstallableUnit> everything = profile.everything();
+						boolean changed = false;
+						while(everything.hasNext()) {
+							IInstallableUnit iu = everything.next();
+
+							String locked = profile.getInstallableUnitProperty(iu, IProfile.PROP_PROFILE_LOCKED_IU);
+
+							if (locked != null && !("0".equals(locked))) {
+								profile.setInstallableUnitProperty(iu, IProfile.PROP_PROFILE_LOCKED_IU, "0");
+								changed = true;
+							}
+						}
+						if (changed) {
+							spr.updateProfile(profile);
+						}
+
+						spr.unlockProfile(profile);									
+					}
 				}
 			}
 
@@ -105,7 +140,7 @@
 			Log.info("Looking for TXM updates...");
 			Object ret = super.execute(event);
 			Log.info("Done.");
-			
+
 			return ret;
 		} catch(Exception e) {
 			Log.severe("Could not update TXM: "+e + ".");
@@ -124,8 +159,8 @@
 	}
 
 	public static boolean patchGZProfile() {
-		//TODO: is this still useful with TXM 0.7.7 ? 
-		String path = System.getProperty("osgi.instance.area"); //$NON-NLS-1$
+		//TODO: is this still useful with TXM 0.7.7  -> yes&no : need to patch when --configuration is set, done by editing the Profile object directly
+		String path = BundleUtils.getInstallDirectory();//System.getProperty("osgi.instance.area"); //$NON-NLS-1$
 		URL location = null;
 		try {
 			location = new URL(path); //$NON-NLS-1$
@@ -154,7 +189,7 @@
 			return false;
 		} else {
 			try {
-				//2- extract profil from gz profile
+				//2- extract profile from gz profile
 				File profileXMLFile = GZip.uncompress(gzFile, profileDir);
 				//3- patch xml by removing lock properties
 				patchProfile(profileXMLFile);
@@ -332,7 +367,7 @@
 			System.out.println("No artifact repository manager found");
 			return false;
 		}
-		
+
 		Log.fine("Adding update site URL: "+location + "...");
 
 		try {
@@ -435,110 +470,110 @@
 	}
 
 	// COPY FROM UpdateHandler class
-	boolean hasNoRepos = false;
-	UpdateOperation operation;
+	//	boolean hasNoRepos = false;
+	//	UpdateOperation operation;
+	//
+	//	@Override
+	//	protected void doExecute(LoadMetadataRepositoryJob job) {
+	//		super.doExecute(job);
+	////		//System.out.println("TXMUpdateHandler: doExecute(...)");
+	////		if (hasNoRepos) {
+	////			if (getProvisioningUI().getPolicy().getRepositoriesVisible()) {
+	////				System.out.println(ProvSDKMessages.UpdateHandler_NoSitesMessage);
+	////			}
+	////			return;
+	////		}
+	////		// Report any missing repositories.
+	////		job.reportAccumulatedStatus();
+	////		if (continueWorkingWithOperation(operation, getShell())) {
+	////			if (operation.getResolutionResult() == Status.OK_STATUS) {
+	////				getProvisioningUI().openUpdateWizard(false, operation, job);
+	////			} else {
+	////
+	////				final RemediationOperation remediationOperation = new RemediationOperation(getProvisioningUI().getSession(), operation.getProfileChangeRequest(), RemedyConfig.getCheckForUpdateRemedyConfigs());
+	////				ProvisioningJob job2 = new ProvisioningJob(ProvSDKMessages.RemediationOperation_ResolveJobName, getProvisioningUI().getSession()) {
+	////					@Override
+	////					public IStatus runModal(IProgressMonitor monitor) {
+	////						monitor.beginTask(ProvSDKMessages.RemediationOperation_ResolveJobTask, RemedyConfig.getAllRemedyConfigs().length);
+	////						return remediationOperation.resolveModal(monitor);
+	////					}
+	////				};
+	////				job2.addJobChangeListener(new JobChangeAdapter() {
+	////					public void done(IJobChangeEvent event) {
+	////						if (PlatformUI.isWorkbenchRunning()) {
+	////							PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+	////								public void run() {
+	////									getProvisioningUI().openUpdateWizard(true, operation, remediationOperation, null);
+	////								}
+	////							});
+	////						}
+	////					}
+	////
+	////				});
+	////				getProvisioningUI().schedule(job2, StatusManager.SHOW | StatusManager.LOG);
+	////			}
+	////		}
+	//	}
+	//
+	//	/**
+	//	 * Answer a boolean indicating whether the caller should continue to work with the
+	//	 * specified operation.  This method is used when an operation has been resolved, but
+	//	 * the UI may have further restrictions on continuing with it.
+	//	 * 
+	//	 * @param operation the operation in question.  It must already be resolved.
+	//	 * @param shell the shell to use for any interaction with the user
+	//	 * @return <code>true</code> if processing of the operation should continue, <code>false</code> if
+	//	 * not.  It is up to the implementor to report any errors to the user when answering <code>false</code>.
+	//	 */
+	//	public boolean continueWorkingWithOperation(ProfileChangeOperation operation, Shell shell) {
+	//		//System.out.println("Test if any update available");
+	//		Assert.isTrue(operation.getResolutionResult() != null);
+	//		IStatus status = operation.getResolutionResult();
+	//		// user cancelled
+	//		if (status.getSeverity() == IStatus.CANCEL)
+	//			return false;
+	//
+	//		// Special case those statuses where we would never want to open a wizard
+	//		if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
+	//			//ProvUI.reportStatus(status, StatusManager.BLOCK);
+	//			//System.out.println("No update available.");
+	//			return false;
+	//		}
+	//
+	//		// there is no plan, so we can't continue.  Report any reason found
+	//		if (operation.getProvisioningPlan() == null && !status.isOK()) {
+	//			StatusManager.getManager().handle(status, StatusManager.LOG | StatusManager.SHOW);
+	//
+	//			return false;
+	//		}
+	//
+	//		// Allow the wizard to open otherwise.
+	//		return true;
+	//	}
+	//
+	//	protected void doPostLoadBackgroundWork(IProgressMonitor monitor) throws OperationCanceledException {
+	//		operation = getProvisioningUI().getUpdateOperation(null, null);
+	//		// check for updates
+	//		IStatus resolveStatus = operation.resolveModal(monitor);
+	//		if (resolveStatus.getSeverity() == IStatus.CANCEL)
+	//			throw new OperationCanceledException();
+	//	}
+	//
+	//	protected boolean preloadRepositories() {
+	//		hasNoRepos = false;
+	//		RepositoryTracker repoMan = getProvisioningUI().getRepositoryTracker();
+	//		if (repoMan.getKnownRepositories(getProvisioningUI().getSession()).length == 0) {
+	//			hasNoRepos = true;
+	//			return false;
+	//		}
+	//		return super.preloadRepositories();
+	//	}
+	//
+	//	@Override
+	//	protected String getProgressTaskName() {
+	//		return ProvSDKMessages.UpdateHandler_ProgressTaskName;
+	//	}
 
-	@Override
-	protected void doExecute(LoadMetadataRepositoryJob job) {
-		super.doExecute(job);
-//		//System.out.println("TXMUpdateHandler: doExecute(...)");
-//		if (hasNoRepos) {
-//			if (getProvisioningUI().getPolicy().getRepositoriesVisible()) {
-//				System.out.println(ProvSDKMessages.UpdateHandler_NoSitesMessage);
-//			}
-//			return;
-//		}
-//		// Report any missing repositories.
-//		job.reportAccumulatedStatus();
-//		if (continueWorkingWithOperation(operation, getShell())) {
-//			if (operation.getResolutionResult() == Status.OK_STATUS) {
-//				getProvisioningUI().openUpdateWizard(false, operation, job);
-//			} else {
-//
-//				final RemediationOperation remediationOperation = new RemediationOperation(getProvisioningUI().getSession(), operation.getProfileChangeRequest(), RemedyConfig.getCheckForUpdateRemedyConfigs());
-//				ProvisioningJob job2 = new ProvisioningJob(ProvSDKMessages.RemediationOperation_ResolveJobName, getProvisioningUI().getSession()) {
-//					@Override
-//					public IStatus runModal(IProgressMonitor monitor) {
-//						monitor.beginTask(ProvSDKMessages.RemediationOperation_ResolveJobTask, RemedyConfig.getAllRemedyConfigs().length);
-//						return remediationOperation.resolveModal(monitor);
-//					}
-//				};
-//				job2.addJobChangeListener(new JobChangeAdapter() {
-//					public void done(IJobChangeEvent event) {
-//						if (PlatformUI.isWorkbenchRunning()) {
-//							PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
-//								public void run() {
-//									getProvisioningUI().openUpdateWizard(true, operation, remediationOperation, null);
-//								}
-//							});
-//						}
-//					}
-//
-//				});
-//				getProvisioningUI().schedule(job2, StatusManager.SHOW | StatusManager.LOG);
-//			}
-//		}
-	}
 
-	/**
-	 * Answer a boolean indicating whether the caller should continue to work with the
-	 * specified operation.  This method is used when an operation has been resolved, but
-	 * the UI may have further restrictions on continuing with it.
-	 * 
-	 * @param operation the operation in question.  It must already be resolved.
-	 * @param shell the shell to use for any interaction with the user
-	 * @return <code>true</code> if processing of the operation should continue, <code>false</code> if
-	 * not.  It is up to the implementor to report any errors to the user when answering <code>false</code>.
-	 */
-	public boolean continueWorkingWithOperation(ProfileChangeOperation operation, Shell shell) {
-		//System.out.println("Test if any update available");
-		Assert.isTrue(operation.getResolutionResult() != null);
-		IStatus status = operation.getResolutionResult();
-		// user cancelled
-		if (status.getSeverity() == IStatus.CANCEL)
-			return false;
 
-		// Special case those statuses where we would never want to open a wizard
-		if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
-			//ProvUI.reportStatus(status, StatusManager.BLOCK);
-			//System.out.println("No update available.");
-			return false;
-		}
-
-		// there is no plan, so we can't continue.  Report any reason found
-		if (operation.getProvisioningPlan() == null && !status.isOK()) {
-			StatusManager.getManager().handle(status, StatusManager.LOG | StatusManager.SHOW);
-
-			return false;
-		}
-
-		// Allow the wizard to open otherwise.
-		return true;
-	}
-
-	protected void doPostLoadBackgroundWork(IProgressMonitor monitor) throws OperationCanceledException {
-		operation = getProvisioningUI().getUpdateOperation(null, null);
-		// check for updates
-		IStatus resolveStatus = operation.resolveModal(monitor);
-		if (resolveStatus.getSeverity() == IStatus.CANCEL)
-			throw new OperationCanceledException();
-	}
-
-	protected boolean preloadRepositories() {
-		hasNoRepos = false;
-		RepositoryTracker repoMan = getProvisioningUI().getRepositoryTracker();
-		if (repoMan.getKnownRepositories(getProvisioningUI().getSession()).length == 0) {
-			hasNoRepos = true;
-			return false;
-		}
-		return super.preloadRepositories();
-	}
-
-	@Override
-	protected String getProgressTaskName() {
-		return ProvSDKMessages.UpdateHandler_ProgressTaskName;
-	}
-
-
-
 }
\ No newline at end of file
