/**
 * This program and the accompanying materials
 * are made available under the terms of the License
 * which accompanies this distribution in the file LICENSE.txt
 */
package com.archimatetool.editor.actions;

import java.awt.Desktop;
import java.awt.Desktop.Action;
import java.io.File;
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;



/**
 * Open Archi Data folder
 * 
 * @author Phillip Beauvoir
 */
public class OpenDataFolderHandler extends AbstractHandler {
    
    @Override
    public Object execute(ExecutionEvent event) throws ExecutionException {
        File folder = getInstanceLocation();
        if(folder != null) {
            try {
                Desktop.getDesktop().open(folder);
            }
            catch(IOException ex) {
                ex.printStackTrace();
            }
        }
        
        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();
        return folder != null && folder.exists() && Desktop.getDesktop().isSupported(Action.OPEN);
    }
}

@@ -485,103 +485,52 @@
 n;%0D%0A
+%0D%0A
 import 
-org.eclipse.core.runtime.Platform;%0D%0Aimport org.eclipse.osgi.service.datalocation.Locatio
+com.archimatetool.editor.ArchiPlugi
 n;%0D%0A
@@ -788,35 +788,54 @@
 older = 
-getInstanceLocation
+ArchiPlugin.INSTANCE.getUserDataFolder
 ();%0D%0A   
@@ -1098,308 +1098,8 @@
   %0D%0A
-    private File getInstanceLocation() %7B%0D%0A        Location instanceLoc = Platform.getInstanceLocation();%0D%0A        if(instanceLoc != null && instanceLoc.getURL() != null) %7B%0D%0A            return new File(Platform.getInstanceLocation().getURL().getPath());%0D%0A        %7D%0D%0A        return null;%0D%0A    %7D%0D%0A    %0D%0A
     
@@ -1169,27 +1169,46 @@
 r = 
-getInstanceLocation
+ArchiPlugin.INSTANCE.getUserDataFolder
 ();%0D

Change location of Open Data Folder action to @user.home/Documents/Archi