blob: 9fd77416cb1b569c834b18cf6424101375dc3766 [file] [log] [blame]
/*****************************************************************************
* Copyright (c) 2019 CEA LIST, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.sysml16.diagram.parametric;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
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.papyrus.sysml16.diagram.parametric"; //$NON-NLS-1$
/**
* The shared instance.
*/
private static Activator plugin;
/**
* {@inheritDoc}
*
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
@Override
public void start(final BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/**
* {@inheritDoc}
*
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
@Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns an image descriptor for the image file at the given plug-in relative path
*
* @param path
* The path.
* @return The image descriptor.
*/
public static ImageDescriptor getImageDescriptor(final String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
/**
* Default plug-in.
*
* @return The default plug-in.
*/
public static Activator getDefault() {
return plugin;
}
/**
* Log the status.
*
* @param status
* The status.
*/
public static void log(final IStatus status) {
Activator.getDefault().getLog().log(status);
}
/**
* Log the message.
*
* @param severity
* The severity.
* @param message
* The log message.
*/
public static void log(final int severity, final String message) {
log(new Status(severity, PLUGIN_ID, message));
}
}