Change location of Open Data Folder action to
@@ -13,8 +13,8 @@ import java.io.IOException;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.osgi.service.datalocation.Location;
+
+import com.archimatetool.editor.ArchiPlugin;
@@ -27,7 +27,7 @@ public class OpenDataFolderHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- File folder = getInstanceLocation();
+ File folder = ArchiPlugin.INSTANCE.getUserDataFolder();
if(folder != null) {
try {
Desktop.getDesktop().open(folder);
@@ -40,17 +40,9 @@ public class OpenDataFolderHandler extends AbstractHandler {
return null;
}
- private File getInstanceLocation() {
- Location instanceLoc = Platform.getInstanceLocation();
- if(instanceLoc != null && instanceLoc.getURL() != null) {
- return new File(Platform.getInstanceLocation().getURL().getPath());
- }
- return null;
- }
-
@Override
public boolean isEnabled() {
- File folder = getInstanceLocation();
+ File folder = ArchiPlugin.INSTANCE.getUserDataFolder();
return folder != null && folder.exists() && Desktop.getDesktop().isSupported(Action.OPEN);
}
}
