/** | |
* Copyright (c) 2019 CEA LIST. | |
* | |
* All rights reserved. This program and the accompanying materials | |
* are the property of the CEA. | |
* Any use is subject to specific agreement with the CEA. | |
* Contributors: | |
* | |
* Patrick Tessier (CEA LIST) - Initial API and implementation | |
* Gabriel Pedroza (CEA LIST) - API extensions and modifications | |
* | |
*/ | |
package org.eclipse.papyrus.pdp4eng.designer.datastrategies; | |
import org.eclipse.papyrus.pdp4eng.designer.engine.api.CatalogFactory; | |
import org.eclipse.papyrus.pdp4eng.designer.engine.api.IStrategyCatalog; | |
import org.eclipse.papyrus.pdp4eng.designer.engine.api.StrategyEngineFactory; | |
import org.eclipse.ui.IStartup; | |
import org.eclipse.ui.plugin.AbstractUIPlugin; | |
import org.osgi.framework.BundleContext; | |
public class Activator extends AbstractUIPlugin implements IStartup{ | |
// The plug-in ID | |
public static final String pluginId = "org.eclipse.papyrus.pdp4eng.designer.datastrategies"; | |
// The shared instance | |
private static Activator plugin; | |
@Override | |
public void start(BundleContext context) throws Exception { | |
super.start(context); | |
Activator.plugin = this; | |
StrategyEngineFactory engineFactory= StrategyEngineFactory.getInstance(); | |
CatalogFactory catalogFactory= new CatalogFactory(); | |
IStrategyCatalog catalog=catalogFactory.createCatalog("Data-oriented Strategies"); | |
catalog.addStrategy(new KanonymityStrategy()); | |
engineFactory.getCurrentEngine().connectACatalog(catalog); | |
//System.out.printf(catalog.toString()); | |
} | |
@Override | |
public void stop(BundleContext context) throws Exception { | |
Activator.plugin = null; | |
super.stop(context); | |
} | |
@Override | |
public void earlyStartup() { | |
// TODO Auto-generated method stub | |
} | |
/** | |
* Returns the shared instance | |
* | |
* @return the shared instance | |
*/ | |
public static Activator getDefault() { | |
return Activator.plugin; | |
} | |
} |