// Path: FileSync/src/de/loskutov/fs/preferences/FileSyncConstants.java
// public interface FileSyncConstants {
//     /** used for tests to not to open dialogs */
//     String KEY_ASK_USER = "askUser";
// }


import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import de.loskutov.fs.preferences.FileSyncConstants;

/*******************************************************************************
 * Copyright (c) 2009 Andrey Loskutov.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * Contributor:  Andrey Loskutov - initial API and implementation
 *******************************************************************************/
package de.loskutov.fs;



/**
 * The main plugin class to be used in the desktop.
 */
public class FileSyncPlugin extends AbstractUIPlugin {

    private static FileSyncPlugin plugin;

    public static final String PLUGIN_ID = "de.loskutov.FileSync";

    /**
     * The constructor.
     */
    public FileSyncPlugin() {
        super();
        if(plugin != null){
            throw new IllegalStateException("FileSync plugin is singleton!");
        }
        plugin = this;
    }

    /**
     * Returns the shared instance.
     */
    public static FileSyncPlugin getDefault() {
        return plugin;
    }

    public static void error(String message, Throwable error) {
        Shell shell = FileSyncPlugin.getShell();
        if(message == null){
            message = "";
        }
        if (error != null) {
            message = message + " " + error.getMessage();
        }
        IPreferenceStore store = getDefault().getPreferenceStore();

// Path: FileSync/src/de/loskutov/fs/preferences/FileSyncConstants.java
// public interface FileSyncConstants {
//     /** used for tests to not to open dialogs */
//     String KEY_ASK_USER = "askUser";
// }


// Path: FileSync/src/de/loskutov/fs/FileSyncPlugin.java
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import de.loskutov.fs.preferences.FileSyncConstants;

/*******************************************************************************
 * Copyright (c) 2009 Andrey Loskutov.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * Contributor:  Andrey Loskutov - initial API and implementation
 *******************************************************************************/
package de.loskutov.fs;



/**
 * The main plugin class to be used in the desktop.
 */
public class FileSyncPlugin extends AbstractUIPlugin {

    private static FileSyncPlugin plugin;

    public static final String PLUGIN_ID = "de.loskutov.FileSync";

    /**
     * The constructor.
     */
    public FileSyncPlugin() {
        super();
        if(plugin != null){
            throw new IllegalStateException("FileSync plugin is singleton!");
        }
        plugin = this;
    }

    /**
     * Returns the shared instance.
     */
    public static FileSyncPlugin getDefault() {
        return plugin;
    }

    public static void error(String message, Throwable error) {
        Shell shell = FileSyncPlugin.getShell();
        if(message == null){
            message = "";
        }
        if (error != null) {
            message = message + " " + error.getMessage();
        }
        IPreferenceStore store = getDefault().getPreferenceStore();

        if (store.getBoolean(FileSyncConstants.KEY_ASK_USER)) {
