1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.ui.internal;
\r
14 import org.eclipse.jface.preference.IPreferenceStore;
\r
15 import org.eclipse.jface.resource.ImageDescriptor;
\r
16 import org.eclipse.ui.plugin.AbstractUIPlugin;
\r
17 import org.osgi.framework.BundleContext;
\r
18 import org.simantics.internal.TimedSessionCache;
\r
19 import org.simantics.ui.DoubleClickExtensionManager;
\r
20 import org.simantics.ui.SimanticsUI;
\r
21 import org.simantics.ui.workbench.PerspectiveBarsManager;
\r
22 import org.simantics.ui.workbench.PerspectiveContextBindingManager;
\r
23 import org.simantics.ui.workbench.editor.EditorRegistry;
\r
24 import org.simantics.utils.ui.BundleUtils;
\r
28 * The activator class controls the plug-in life cycle
\r
30 public class Activator extends AbstractUIPlugin {
\r
33 public static final String PLUGIN_ID = SimanticsUI.PLUGIN_ID;
\r
35 // The shared instance
\r
36 private static Activator plugin;
\r
41 public Activator() {
\r
46 * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
\r
48 public void start(BundleContext context) throws Exception {
\r
49 super.start(context);
\r
52 TimedSessionCache.initialize(context);
\r
54 // Initialize extension managers.
\r
55 // Disposed respectively in #stop().
\r
56 DoubleClickExtensionManager.getInstance();
\r
57 PerspectiveContextBindingManager.getInstance();
\r
58 PerspectiveBarsManager.getInstance();
\r
60 // Will be started when getInstance is first invoked.
\r
61 //ResourceEditorRegistry.getInstance();
\r
63 initializeDefaultPreferences(plugin.getPreferenceStore());
\r
68 * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
\r
70 public void stop(BundleContext context) throws Exception {
\r
71 TimedSessionCache.close();
\r
75 // Dispose extension managers.
\r
76 EditorRegistry.dispose();
\r
78 PerspectiveContextBindingManager.dispose();
\r
79 PerspectiveBarsManager.dispose();
\r
80 DoubleClickExtensionManager.dispose();
\r
82 // Backup for disposing of the UI database session
\r
83 SimanticsUI.closeSessions();
\r
85 super.stop(context);
\r
89 * Returns the shared instance
\r
91 * @return the shared instance
\r
93 public static Activator getDefault() {
\r
98 * Returns an image descriptor for the image file at the given
\r
99 * plug-in relative path.
\r
101 * @param path the path
\r
102 * @return the image descriptor
\r
104 public static ImageDescriptor getImageDescriptor(String path) {
\r
105 return BundleUtils.getImageDescriptorFromPlugin(PLUGIN_ID, path);
\r
109 * Initializes a preference store with default preference values
\r
110 * for this plug-in.
\r
112 protected void initializeDefaultPreferences(IPreferenceStore store) {
\r
113 // store.setDefault("showRequirements", true);
\r
114 // store.setDefault("hasStructuralModelling", true);
\r
115 // store.setDefault("showPropertyTypes", true);
\r
116 // store.setDefault("showAllowedChildren", true);
\r
117 // store.setDefault("showConnectionInterface", true);
\r
118 // store.setDefault("showDataInterface", true);
\r