Java Code Examples for org.eclipse.osgi.service.datalocation.Location#getDefault()

The following examples show how to use org.eclipse.osgi.service.datalocation.Location#getDefault() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Application.java    From tlaplus with MIT License 6 votes vote down vote up
private static String getPreviousInstanceLocation(final Location instanceLocation) {
	// CWD is Eclipse infrastructure which stores the location of the
	// current workspace in a (text) file in the configuration area (Toolbox
	// installation directory) in 1.5.3. With version 1.5.4 of the Toolbox, we will
	// use this information below to migrate all workspaces to @user.home/.tlaplus.
	final ChooseWorkspaceData launchData = new ChooseWorkspaceData(instanceLocation.getDefault());
	final List<String> recentWorkspaces = Arrays.asList(launchData.getRecentWorkspaces());
	if (!recentWorkspaces.isEmpty()) {
		// Get the first non-null workspace. It is the most recently used one.
		for(int i = 0; i < recentWorkspaces.size(); i++) {
			if (recentWorkspaces.get(i) != null) {
				return recentWorkspaces.get(i);
			}
		}
	}
	return null;
}
 
Example 2
Source File: Application.java    From tlaplus with MIT License 4 votes vote down vote up
private static void clearPreviousInstanceLocation(final Location instanceLocation) {
	final ChooseWorkspaceData launchData = new ChooseWorkspaceData(instanceLocation.getDefault());
	launchData.setRecentWorkspaces(new String[0]);
	launchData.writePersistedData();
}