org.springframework.ide.eclipse.boot.wizard.BootWizardActivator.java Source code

Java tutorial

Introduction

Here is the source code for org.springframework.ide.eclipse.boot.wizard.BootWizardActivator.java

Source

/*******************************************************************************
 * Copyright (c) 2016 Pivotal, Inc.
 * 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
 * https://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Pivotal, Inc. - initial API and implementation
 *******************************************************************************/
package org.springframework.ide.eclipse.boot.wizard;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

public class BootWizardActivator extends AbstractUIPlugin {

    public static final String PLUGIN_ID = "org.springframework.ide.eclipse.boot.wizard"; //$NON-NLS-1$
    private static BootWizardActivator plugin;

    public BootWizardActivator() {
    }

    public void start(BundleContext context) throws Exception {
        super.start(context);
        plugin = this;
    }

    public void stop(BundleContext context) throws Exception {
        plugin = null;
        super.stop(context);
    }

    public static BootWizardActivator getDefault() {
        return plugin;
    }

    public static IStatus createErrorStatus(Throwable exception) {
        String message = exception.getMessage();
        if (message == null) {
            message = "";
        }
        return new Status(IStatus.ERROR, PLUGIN_ID, 0, message, exception);
    }

    public static IStatus createInfoStatus(String msg) {
        return new Status(IStatus.INFO, PLUGIN_ID, msg);
    }

    public static void log(Throwable e) {
        getDefault().getLog().log(createErrorStatus(e));
    }

    public static void info(String msg) {
        getDefault().getLog().log(createInfoStatus(msg));
    }

}