blob: 84619d06bf442c001db769e42fb867e6e61b1ea1 [file] [log] [blame]
/*****************************************************************************
* Copyright (c) 2017 CEA LIST and Thales
*
* 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
*
*****************************************************************************/
package org.eclipse.papyrus.robotics.diagrams;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.papyrus.infra.core.log.LogHelper;
import org.eclipse.papyrus.robotics.simplifiedui.ui.RoboticsPartListener;
import org.eclipse.ui.IPartService;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
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.robotics.diagrams"; //$NON-NLS-1$
private static Activator plugin;
public static LogHelper log;
/**
* 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(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
log = new LogHelper(this);
plugin = this;
IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IPartService service = (IPartService) workbenchWindow.getService(IPartService.class);
service.addPartListener(new RoboticsPartListener());
}
@Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
public static Activator getDefault() {
return plugin;
}
}