Package org.eclipse.maven

Source Code of org.eclipse.maven.Activator

package org.eclipse.maven;

import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.maven.core.OutPutHandler;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.osgi.framework.BundleContext;

/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractUIPlugin {
 
  // The plug-in ID
  public static final String PLUGIN_ID = "org.eclipse.maven"; //$NON-NLS-1$
 
  public final static OutPutHandler outPut = new OutPutHandler();
 
  // The shared instance
  private static Activator plugin;
  private ScopedPreferenceStore store;
 
  /**
   * The constructor
   */
  public Activator() {
 
  }
 
  public static void logError(String msg) {
    getDefault().getLog().log(new Status(Status.ERROR, PLUGIN_ID, msg));
  }
 
  public static void logError(String msg, Throwable th) {
    getDefault().getLog().log(new Status(Status.ERROR, PLUGIN_ID, msg, th));
  }
 
  public static void log(String msg) {
    getDefault().getLog().log(new Status(Status.INFO, PLUGIN_ID, msg));
  }

  /*
   * (non-Javadoc)
   * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
   */
  public void start(BundleContext context) throws Exception {
    super.start(context);
    plugin = this;
    store = new ScopedPreferenceStore(new InstanceScope(), Activator.PLUGIN_ID);
  }

  /*
   * (non-Javadoc)
   * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
   */
  public void stop(BundleContext context) throws Exception {
    plugin = null;
    super.stop(context);
  }

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

  @Override
  public IPreferenceStore getPreferenceStore() {
    return store;
  }
}
TOP

Related Classes of org.eclipse.maven.Activator

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.