1 11 12 package org.eclipse.ui.internal.preferences; 13 14 import org.eclipse.core.runtime.IPath; 15 import org.eclipse.core.runtime.IStatus; 16 import org.eclipse.core.runtime.Platform; 17 import org.eclipse.core.runtime.Status; 18 import org.eclipse.ui.internal.WorkbenchMessages; 19 import org.eclipse.ui.internal.WorkbenchPlugin; 20 import org.eclipse.ui.preferences.SettingsTransfer; 21 22 29 public abstract class WorkbenchSettingsTransfer extends SettingsTransfer { 30 31 35 protected IStatus noWorkingSettingsStatus() { 36 return new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 37 WorkbenchMessages.WorkbenchSettings_CouldNotFindLocation); 38 } 39 40 45 protected IPath getNewWorkbenchStateLocation(IPath newWorkspaceRoot) { 46 IPath currentWorkspaceRoot = Platform.getLocation(); 47 48 IPath dataLocation = WorkbenchPlugin.getDefault().getDataLocation(); 49 50 if (dataLocation == null) 51 return null; 52 int segmentsToRemove = dataLocation 53 .matchingFirstSegments(currentWorkspaceRoot); 54 55 dataLocation = dataLocation.removeFirstSegments(segmentsToRemove); 57 dataLocation = newWorkspaceRoot.append(dataLocation); 59 return dataLocation; 60 } 61 62 } 63 | Popular Tags |