class Upgrader {

    private final static String UPGRADER_LAST_VERSION = "Upgrader_Last_Version";
    private final static List<String> VERSION_TO_CHECK
        = Arrays.asList("0.9.0", "0.9.1", "0.9.2", "0.9");

    public void upgrade() {<FILL_FUNCTION_BODY>}

    private boolean showRestartDialog() {
        String msg = NbBundle.getMessage(Upgrader.class, "Upgrader.restart.message");
        String title = NbBundle.getMessage(Upgrader.class, "Upgrader.restart.title");
        NotifyDescriptor nd = new NotifyDescriptor.Confirmation(msg, title, NotifyDescriptor.YES_NO_OPTION,
            NotifyDescriptor.QUESTION_MESSAGE);

        return DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.YES_OPTION;
    }

    private boolean showUpgradeDialog(File source) {
        String msg = NbBundle.getMessage(Upgrader.class, "Upgrader.message", source.getName());
        String title = NbBundle.getMessage(Upgrader.class, "Upgrader.title");
        NotifyDescriptor nd = new NotifyDescriptor.Confirmation(msg, title, NotifyDescriptor.YES_NO_OPTION,
            NotifyDescriptor.QUESTION_MESSAGE);

        return DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.YES_OPTION;
    }

    private String getCurrentVersion() {
        File userDir = Places.getUserDirectory();
        if (userDir.getName().equalsIgnoreCase("testuserdir")) {
            return userDir.getName();
        }
        return userDir.getParentFile().getName().replace(".", "");
    }

    private File checkPrevious() {
        File userDir = Places.getUserDirectory();
        File sourceFolder = null;

        if (userDir.exists()) {
            File userHomeFile;
            if (userDir.getParentFile().getName().equalsIgnoreCase("dev")) {
                userHomeFile = userDir.getParentFile().getParentFile();
            } else {
                userHomeFile = userDir.getParentFile();
            }
            Iterator<String> it = VERSION_TO_CHECK.iterator();
            String ver;
            while (it.hasNext() && sourceFolder == null) {
                ver = it.next();
                sourceFolder = new File(userHomeFile.getAbsolutePath(), ver);

                if (sourceFolder.isDirectory()) {
                    break;
                }
                sourceFolder = new File(userHomeFile.getAbsolutePath(), "." + ver);
                if (sourceFolder.isDirectory()) {
                    break;
                }
                sourceFolder = null;
            }
            return sourceFolder;
        } else {
            return null;
        }
    }
}

        String currentVersion = getCurrentVersion();
        if (currentVersion.equalsIgnoreCase("target") || currentVersion.contains("SNAPSHOT")) {
            // Development version
            return;
        }
        Logger.getLogger("").log(Level.INFO, "Current Version is {0}", currentVersion);

        String lastVersion = NbPreferences.forModule(Upgrader.class).get(UPGRADER_LAST_VERSION, null);
        if (lastVersion == null || !lastVersion.equals(currentVersion)) {
            File latestPreviousVersion = checkPrevious();
            if (latestPreviousVersion != null &&
                !latestPreviousVersion.getName().replace(".", "").equals(currentVersion)) {
                File source = new File(latestPreviousVersion, "dev");
                source = source.exists() ? source : latestPreviousVersion;
                File dest = Places.getUserDirectory();
                if (source.exists() && dest.exists()) {
                    NbPreferences.forModule(Upgrader.class).put(UPGRADER_LAST_VERSION, currentVersion);

                    boolean confirm = showUpgradeDialog(latestPreviousVersion);
                    if (confirm) {
                        try {
                            CopyFiles.copyDeep(source, dest);

                            //Restart
                            if (showRestartDialog()) {
                                LifecycleManager.getDefault().markForRestart();
                                LifecycleManager.getDefault().exit();
                            }
                        } catch (IOException ex) {
                            Exceptions.printStackTrace(ex);
                        }
                    }
                }
            }
        }
    
<no_super_class>