X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.equation%2Fsrc%2Forg%2Fsimantics%2Fequation%2FActivator.java;h=3b5d4799712cf3e64aae29a226562af71a7bdc8f;hb=refs%2Fchanges%2F38%2F238%2F2;hp=7f5671335182dcf55ee1bea924101844d40b2403;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.equation/src/org/simantics/equation/Activator.java b/bundles/org.simantics.equation/src/org/simantics/equation/Activator.java index 7f5671335..3b5d47997 100644 --- a/bundles/org.simantics.equation/src/org/simantics/equation/Activator.java +++ b/bundles/org.simantics.equation/src/org/simantics/equation/Activator.java @@ -1,97 +1,97 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * 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: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.equation; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; -import org.simantics.db.ReadGraph; -import org.simantics.db.common.request.ReadRequest; -import org.simantics.db.management.ISessionContext; -import org.simantics.db.management.ISessionContextChangedListener; -import org.simantics.db.management.SessionContextChangedEvent; -import org.simantics.ui.SimanticsUI; - -/** - * 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.simantics.equation"; - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - } - - /* - * (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; - - SimanticsUI.getSessionContextProvider().addContextChangedListener(new ISessionContextChangedListener() { - @Override - public void sessionContextChanged(SessionContextChangedEvent event) { - ISessionContext ctx = event.getNewValue(); - if (ctx != null) { - ctx.getSession().asyncRequest(new ReadRequest() { - @Override - public void run(ReadGraph g) { - EquationResources.initialize(g); - }; - }); - } else { - EquationResources.deinitialize(); - } - } - }); - - try { - SimanticsUI.getSession().syncRequest(new ReadRequest() { - @Override - public void run(ReadGraph g) { - EquationResources.initialize(g); - } - }); - } catch (Exception e) { - - } - - - } - - /* - * (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; - } - -} +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * 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: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.equation; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; +import org.simantics.db.ReadGraph; +import org.simantics.db.common.request.ReadRequest; +import org.simantics.db.management.ISessionContext; +import org.simantics.db.management.ISessionContextChangedListener; +import org.simantics.db.management.SessionContextChangedEvent; +import org.simantics.ui.SimanticsUI; + +/** + * 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.simantics.equation"; + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (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; + + SimanticsUI.getSessionContextProvider().addContextChangedListener(new ISessionContextChangedListener() { + @Override + public void sessionContextChanged(SessionContextChangedEvent event) { + ISessionContext ctx = event.getNewValue(); + if (ctx != null) { + ctx.getSession().asyncRequest(new ReadRequest() { + @Override + public void run(ReadGraph g) { + EquationResources.initialize(g); + }; + }); + } else { + EquationResources.deinitialize(); + } + } + }); + + try { + SimanticsUI.getSession().syncRequest(new ReadRequest() { + @Override + public void run(ReadGraph g) { + EquationResources.initialize(g); + } + }); + } catch (Exception e) { + + } + + + } + + /* + * (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; + } + +}