/restructuration/org.eclipse.emf.compare.mpatch/src/org/eclipse/emf/compare/mpatch/Activator.java
https://github.com/zenobios/emf.compare · Java · 104 lines · 55 code · 14 blank · 35 comment · 13 complexity · cb8a757dbef84448b9b5766e29fb32b9 MD5 · raw file
- /*******************************************************************************
- * Copyright (c) 2010, 2011 Technical University of Denmark.
- * 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
- *
- * Contributors:
- * Patrick Koenemann, DTU Informatics - initial API and implementation
- *******************************************************************************/
- package org.eclipse.emf.compare.mpatch;
-
- import org.eclipse.core.runtime.IStatus;
- import org.eclipse.core.runtime.Plugin;
- import org.eclipse.core.runtime.Status;
- import org.osgi.framework.BundleContext;
-
- /**
- * The activator class controls the plug-in life cycle.
- *
- * @author Patrick Koenemann (pk@imm.dtu.dk)
- */
- public class Activator extends Plugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.emf.compare.mpatch";
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- // Nothing to do
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- 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;
- }
-
- // //////////// SOME LOGGING
-
- public void logError(String error) {
- logError(error, null);
- }
-
- public void logError(String error, Throwable throwable) {
- if (error == null && throwable != null) {
- error = throwable.getMessage();
- }
- getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, error, throwable));
- debug(error, throwable);
- }
-
- public void logInfo(String message) {
- logInfo(message, null);
- }
-
- public void logInfo(String message, Throwable throwable) {
- if (message == null && throwable != null) {
- message = throwable.getMessage();
- }
- getLog().log(new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK, message, throwable));
- debug(message, throwable);
- }
-
- private void debug(String message, Throwable throwable) {
- if (!isDebugging()) {
- return;
- }
- if (message != null) {
- System.err.println(message);
- }
- if (throwable != null) {
- throwable.printStackTrace();
- }
- }
- }