1 /*******************************************************************************
2 * Copyright (c) 2013, 2015 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Alexandre Montplaisir - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.ctf
.core
.tests
;
16 import java
.net
.URISyntaxException
;
18 import org
.eclipse
.core
.runtime
.Plugin
;
19 import org
.eclipse
.core
.runtime
.URIUtil
;
20 import org
.eclipse
.tracecompass
.internal
.ctf
.core
.Activator
;
21 import org
.osgi
.framework
.BundleContext
;
24 * The activator class controls the plug-in life cycle
26 public class CtfCoreTestPlugin
extends Plugin
{
28 private static final String TEMP_DIR_NAME
= ".temp"; //$NON-NLS-1$
30 // ------------------------------------------------------------------------
32 // ------------------------------------------------------------------------
35 public static final String PLUGIN_ID
= "org.eclipse.tracecompass.ctf.core.tests";
37 // The shared instance
38 private static CtfCoreTestPlugin fPlugin
;
40 // ------------------------------------------------------------------------
42 // ------------------------------------------------------------------------
47 public CtfCoreTestPlugin() {
51 // ------------------------------------------------------------------------
53 // ------------------------------------------------------------------------
56 * @return the shared instance
58 public static CtfCoreTestPlugin
getDefault() {
66 private static void setDefault(CtfCoreTestPlugin plugin
) {
70 // ------------------------------------------------------------------------
72 // ------------------------------------------------------------------------
75 public void start(BundleContext context
) throws Exception
{
81 public void stop(BundleContext context
) throws Exception
{
87 * Get the temporary directory path. If there is an instance of Eclipse
88 * running, the temporary directory will reside under the workspace.
90 * @return the temporary directory path suitable to be passed to the
91 * java.io.File constructor without a trailing separator
93 public static String
getTemporaryDirPath() {
94 String property
= System
.getProperty("osgi.instance.area"); //$NON-NLS-1$
95 if (property
!= null) {
97 File dir
= URIUtil
.toFile(URIUtil
.fromString(property
));
98 dir
= new File(dir
.getAbsolutePath() + File
.separator
+ TEMP_DIR_NAME
);
102 return dir
.getAbsolutePath();
103 } catch (URISyntaxException e
) {
104 Activator
.logError(e
.getLocalizedMessage(), e
);
107 return System
.getProperty("java.io.tmpdir"); //$NON-NLS-1$