]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.indexing/src/org/simantics/db/indexing/Activator.java
fbcace94b163484771dd86839c1e6c2284ebccae
[simantics/platform.git] / bundles / org.simantics.db.indexing / src / org / simantics / db / indexing / Activator.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.db.indexing;
13
14 import java.io.File;
15
16 import org.eclipse.core.runtime.IPath;
17 import org.eclipse.core.runtime.Platform;
18 import org.eclipse.core.runtime.Plugin;
19 import org.osgi.framework.BundleContext;
20
21 /**
22  * @author Tuukka Lehtonen
23  */
24 public class Activator extends Plugin {
25
26     // The plug-in ID
27     public static final String BUNDLE_ID = "org.simantics.db.indexing"; //$NON-NLS-1$
28
29     // The shared instance
30     private static Activator plugin;
31     
32     private File indexBaseFile;
33
34     /**
35      * The constructor
36      */
37     public Activator() {
38     }
39
40     /*
41      * (non-Javadoc)
42      * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
43      */
44     @Override
45     public void start(BundleContext context) throws Exception {
46         super.start(context);
47         plugin = this;
48         IPath state = Platform.getStateLocation(context.getBundle());
49         indexBaseFile = state.append("index").toFile();
50     }
51
52     public File getIndexBaseFile() {
53         return indexBaseFile;
54     }
55     
56     /*
57      * (non-Javadoc)
58      * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
59      */
60     @Override
61     public void stop(BundleContext context) throws Exception {
62         plugin = null;
63         super.stop(context);
64     }
65
66     /**
67      * Returns the shared instance
68      *
69      * @return the shared instance
70      */
71     public static Activator getDefault() {
72         return plugin;
73     }
74
75 }