]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.indexing/src/org/simantics/db/indexing/Activator.java
Add logging to indexing & replace File-API with NIO Path-API
[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 import java.nio.file.Path;
16
17 import org.eclipse.core.runtime.IPath;
18 import org.eclipse.core.runtime.Platform;
19 import org.eclipse.core.runtime.Plugin;
20 import org.osgi.framework.BundleContext;
21
22 /**
23  * @author Tuukka Lehtonen
24  */
25 public class Activator extends Plugin {
26
27     // The plug-in ID
28     public static final String BUNDLE_ID = "org.simantics.db.indexing"; //$NON-NLS-1$
29
30     // The shared instance
31     private static Activator plugin;
32     
33     private Path indexBaseFile;
34
35     /**
36      * The constructor
37      */
38     public Activator() {
39     }
40
41     /*
42      * (non-Javadoc)
43      * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
44      */
45     @Override
46     public void start(BundleContext context) throws Exception {
47         super.start(context);
48         plugin = this;
49         IPath state = Platform.getStateLocation(context.getBundle());
50         indexBaseFile = state.append("index").toFile().toPath();
51     }
52
53     public Path getIndexBaseFile() {
54         return indexBaseFile;
55     }
56     
57     /*
58      * (non-Javadoc)
59      * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
60      */
61     @Override
62     public void stop(BundleContext context) throws Exception {
63         plugin = null;
64         super.stop(context);
65     }
66
67     /**
68      * Returns the shared instance
69      *
70      * @return the shared instance
71      */
72     public static Activator getDefault() {
73         return plugin;
74     }
75
76 }