1 /*******************************************************************************
2 * Copyright (c) 2012 Association for Decentralized Information Management in
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
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.document.ui;
14 import java.nio.file.Path;
15 import java.nio.file.Paths;
17 import org.eclipse.core.runtime.IPath;
18 import org.eclipse.core.runtime.Platform;
19 import org.eclipse.jface.resource.ImageDescriptor;
20 import org.eclipse.ui.plugin.AbstractUIPlugin;
21 import org.osgi.framework.Bundle;
22 import org.osgi.framework.BundleContext;
23 import org.simantics.document.ui.graphfile.ExternalEditorAdapter;
26 * The activator class controls the plug-in life cycle
28 public class Activator extends AbstractUIPlugin {
31 public static final String PLUGIN_ID = "org.simantics.document.ui"; //$NON-NLS-1$
33 // The shared instance
34 private static Activator plugin;
36 public ImageDescriptor DOCUMENT_DECORATION_ICON;
38 public ImageDescriptor cross;
39 public ImageDescriptor clock_red;
41 private static Path location;
51 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
53 public void start(BundleContext context) throws Exception {
59 Bundle bundle = context.getBundle();
61 DOCUMENT_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/document_decoration.png"));
62 cross = ImageDescriptor.createFromURL(bundle.getResource("icons/silk_small/cross.png"));
63 clock_red = ImageDescriptor.createFromURL(bundle.getResource("icons/silk_small/clock_red.png"));
65 IPath ipath = Platform.getStateLocation(bundle);
66 location = Paths.get(ipath.toOSString());
71 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
73 public void stop(BundleContext context) throws Exception {
74 ExternalEditorAdapter.stopFileWatcher();
80 * Returns the shared instance
82 * @return the shared instance
84 public static Activator getDefault() {
88 public static Path getInstanceLocation() {