--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.search.system.tests/.classpath Fri Oct 15 13:04:49 2010 -0500
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.search.system.tests/.project Fri Oct 15 13:04:49 2010 -0500
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>com.nokia.carbide.search.system.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.search.system.tests/.settings/org.eclipse.jdt.core.prefs Fri Oct 15 13:04:49 2010 -0500
@@ -0,0 +1,8 @@
+#Tue Oct 12 13:02:47 CDT 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.search.system.tests/META-INF/MANIFEST.MF Fri Oct 15 13:04:49 2010 -0500
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: System Search Tests
+Bundle-SymbolicName: com.nokia.carbide.search.system.tests;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: com.nokia.carbide.search.system.tests.TestPlugin
+Bundle-Vendor: Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.junit,
+ com.nokia.carbide.search.system,
+ org.eclipse.ui,
+ org.eclipse.core.resources,
+ com.nokia.carbide.cpp.sdk.core,
+ org.eclipse.cdt.core,
+ com.nokia.carbide.cpp.project.core,
+ com.nokia.cpp.utils.core
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.search.system.tests/build.properties Fri Oct 15 13:04:49 2010 -0500
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ data/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.search.system.tests/data/TestProject/group/Test1.mmp Fri Oct 15 13:04:49 2010 -0500
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+TARGET Test1.exe
+TARGETTYPE exe
+UID 0 0xE7A5D6D0
+
+USERINCLUDE ..\inc
+SYSTEMINCLUDE \epoc32\include
+
+SOURCEPATH ..\src
+SOURCE TestProject.cpp
+
+LIBRARY euser.lib
+
+#ifdef ENABLE_ABIV2_MODE
+ DEBUGGABLE
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.search.system.tests/data/TestProject/group/Test2.mmp Fri Oct 15 13:04:49 2010 -0500
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+TARGET Test2.exe
+TARGETTYPE exe
+UID 0 0xE7A5D6D0
+
+USERINCLUDE ..\inc
+SYSTEMINCLUDE \epoc32\include
+
+SOURCEPATH ..\src
+SOURCE TestProject.cpp
+
+LIBRARY euser.lib
+
+#ifdef ENABLE_ABIV2_MODE
+ DEBUGGABLE
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.search.system.tests/data/TestProject/group/bld.inf Fri Oct 15 13:04:49 2010 -0500
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+Test1.mmp
+Test2.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.search.system.tests/data/TestProject/inc/TestProject.h Fri Oct 15 13:04:49 2010 -0500
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __TESTPROJECT_H__
+#define __TESTPROJECT_H__
+
+// Include Files
+
+#include <e32base.h>
+
+// Function Prototypes
+
+GLDEF_C TInt E32Main();
+
+#endif // __TESTPROJECT_H__
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.search.system.tests/data/TestProject/src/TestProject.cpp Fri Oct 15 13:04:49 2010 -0500
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// Include Files
+
+#include "TestProject.h"
+#include <e32base.h>
+#include <e32std.h>
+#include <e32cons.h> // Console
+
+// Constants
+
+_LIT(KTextConsoleTitle, "Console");
+_LIT(KTextFailed, " failed, leave code = %d");
+_LIT(KTextPressAnyKey, " [press any key]\n");
+
+// Global Variables
+
+LOCAL_D CConsoleBase* console; // write all messages to this
+
+
+// Local Functions
+
+LOCAL_C void MainL()
+ {
+ //
+ // add your program code here, example code below
+ //
+ console->Write(_L("Hello, world!\n"));
+ }
+
+LOCAL_C void DoStartL()
+ {
+ // Create active scheduler (to run active objects)
+ CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
+ CleanupStack::PushL(scheduler);
+ CActiveScheduler::Install(scheduler);
+
+ MainL();
+
+ // Delete active scheduler
+ CleanupStack::PopAndDestroy(scheduler);
+ }
+
+// Global Functions
+
+GLDEF_C TInt E32Main()
+ {
+ // Create cleanup stack
+ __UHEAP_MARK;
+ CTrapCleanup* cleanup = CTrapCleanup::New();
+
+ // Create output console
+ TRAPD(createError, console = Console::NewL(KTextConsoleTitle, TSize(
+ KConsFullScreen, KConsFullScreen)));
+ if (createError)
+ return createError;
+
+ // Run application code inside TRAP harness, wait keypress when terminated
+ TRAPD(mainError, DoStartL());
+ if (mainError)
+ console->Printf(KTextFailed, mainError);
+ console->Printf(KTextPressAnyKey);
+ console->Getch();
+
+ delete console;
+ delete cleanup;
+ __UHEAP_MARKEND;
+ return KErrNone;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.search.system.tests/data/file1.txt Fri Oct 15 13:04:49 2010 -0500
@@ -0,0 +1,1 @@
+This is a the text search file that contains the text to search.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.search.system.tests/data/file2.txt Fri Oct 15 13:04:49 2010 -0500
@@ -0,0 +1,1 @@
+This is a the text search file that contains the text to search.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.search.system.tests/src/com/nokia/carbide/search/system/tests/AllTests.java Fri Oct 15 13:04:49 2010 -0500
@@ -0,0 +1,16 @@
+package com.nokia.carbide.search.system.tests;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AllTests.class.getName());
+ //$JUnit-BEGIN$
+ suite.addTestSuite(BasicTest.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.search.system.tests/src/com/nokia/carbide/search/system/tests/BasicTest.java Fri Oct 15 13:04:49 2010 -0500
@@ -0,0 +1,230 @@
+/**
+ *
+ */
+package com.nokia.carbide.search.system.tests;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.dom.IPDOMManager;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceDescription;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IWorkingSet;
+import org.junit.Test;
+
+import com.nokia.carbide.cpp.project.core.ProjectCorePlugin;
+import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
+import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID;
+import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
+import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
+import com.nokia.carbide.search.system.core.text.TextSearchEngine;
+import com.nokia.carbide.search.system.core.text.TextSearchScope;
+import com.nokia.carbide.search.system.internal.core.text.PatternConstructor;
+import com.nokia.carbide.search.system.internal.core.text.TextSearchEngineRegistry;
+import com.nokia.carbide.search.system.internal.ui.SearchMessages;
+import com.nokia.carbide.search.system.internal.ui.SearchPlugin;
+import com.nokia.carbide.search.system.internal.ui.text.BasicElementLabels;
+import com.nokia.carbide.search.system.internal.ui.text.FileSearchQuery;
+import com.nokia.carbide.search.system.internal.ui.text.FileSearchResult;
+import com.nokia.carbide.search.system.ui.ISearchQuery;
+import com.nokia.carbide.search.system.ui.ISearchResult;
+import com.nokia.carbide.search.system.ui.text.FileTextSearchScope;
+import com.nokia.carbide.search.system.ui.text.IEditorMatchAdapter;
+import com.nokia.carbide.search.system.ui.text.IFileMatchAdapter;
+import com.nokia.cpp.internal.api.utils.core.FileUtils;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ */
+public class BasicTest extends TestCase {
+ static IProject carbideProject;
+ private static final String BASE_DIR = "data/TestProject/";
+ private static final String CARBIDE_PROJECT_NAME = "CarbideProject";
+ private static final String PROJECT_RELATIVE_BLDINF_PATH = "group/bld.inf";
+
+ @Override
+ protected void setUp() throws Exception {
+ // TODO Auto-generated method stub
+ super.setUp();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ // TODO Auto-generated method stub
+ super.tearDown();
+ }
+
+ @Test
+ public void testTextSearchEngineRegistry() throws Exception {
+ TextSearchEngine engine = TextSearchEngine.create();
+ TextSearchEngineRegistry registry = SearchPlugin.getDefault().getTextSearchEngineRegistry();
+ String[][] availableEngines = registry.getAvailableEngines();
+ }
+
+ @Test
+ public void testBasicFileTextSearch() throws Exception {
+ String folderName = TestPlugin.getPluginPath("data");
+ String[] fileNamePatterns = {"*.txt"};
+ boolean includeSubFolders = true;
+ boolean includeHidden = true;
+ boolean includeArchives = true;
+ FileTextSearchScope scope = FileTextSearchScope.newSystemScope(folderName, fileNamePatterns, folderName, includeSubFolders, includeHidden, includeArchives);
+ assertNotNull("Search scope not created", scope);
+ assertNotNull("Scope description is null", scope.getDescription());
+ assertNull("Scope working set is not null", scope.getWorkingSets());
+ assertNull("Scope content types is not null", scope.getContentTypes());
+ assertNotNull("Scope fileNamePatterns is null", scope.getFileNamePatterns());
+ assertNotNull("Scope filterDescription is null", scope.getFilterDescription());
+ assertEquals("Scope includeSubFolders not expected", includeSubFolders, scope.includeSubfolders());
+ assertEquals("Scope isIncludeSubFolders not expected", includeSubFolders, scope.isIncludeSubfolders());
+ assertEquals("Scope includeHidden not expected", includeHidden, scope.includeHidden());
+ assertEquals("Scope isIncludeHidden not expected", includeHidden, scope.isIncludeHidden());
+ assertEquals("Scope includeArchives not expected", includeArchives, scope.includeArchives());
+ IResource[] res = scope.getRoots();
+ scope.getRootFolder();
+
+ String searchText = "the";
+ boolean isRegEx = false;
+ boolean isCaseSensitive = false;
+ FileSearchQuery query = new FileSearchQuery(searchText, isRegEx, isCaseSensitive, scope);
+ assertNotNull("Query not created", query);
+ assertEquals("Query isRegEx not expected", isRegEx, query.isRegexSearch());
+ assertEquals("Query isCaseSensitive not expected", isCaseSensitive, query.isCaseSensitive());
+ assertTrue("Query canRerun not true", query.canRerun());
+ assertTrue("Query canRunInBackground not true", query.canRunInBackground());
+ assertNotNull("Query scope is null", query.getSearchScope());
+ assertEquals("Query search label not expected", SearchMessages.FileSearchQuery_label, query.getLabel());
+ assertEquals("Query search text not expected", searchText, query.getSearchString());
+
+ FileSearchResult result = (FileSearchResult)query.getSearchResult();
+ assertNotNull("Search results are null", result);
+
+ IProgressMonitor monitor = new NullProgressMonitor();
+ IStatus status = query.run(monitor);
+ assertEquals("Status from search query should be 0", 0, status.getCode());
+ result = (FileSearchResult)query.getSearchResult();
+ int matchCount = result.getMatchCount();
+ assertTrue("Expected number of matches not found", matchCount > 0);
+ Object[] elements = result.getElements();
+ assertNotNull("Result elements is null", elements);
+ String toolTip = result.getTooltip();
+ ImageDescriptor d = result.getImageDescriptor();
+ FileSearchQuery q = (FileSearchQuery)result.getQuery();
+ IFileMatchAdapter f = result.getFileMatchAdapter();
+ IEditorMatchAdapter e = result.getEditorMatchAdapter();
+ String l = result.getLabel();
+ String rl = q.getResultLabel(1);
+ TextSearchEngineRegistry registry = SearchPlugin.getDefault().getTextSearchEngineRegistry();
+ String[][] availableEngines = registry.getAvailableEngines();
+
+ // file search only
+ query = new FileSearchQuery("", isRegEx, isCaseSensitive, scope);
+ status = query.run(monitor);
+ assertEquals("Status from search query should be 0", 0, status.getCode());
+ result = (FileSearchResult)query.getSearchResult();
+ matchCount = result.getMatchCount();
+ assertTrue("Expected number of matches not found", matchCount > 0);
+ toolTip = result.getTooltip();
+
+ }
+ @Test
+ public void testPatternConstructor() throws Exception {
+ Pattern pattern = PatternConstructor.createPattern("word word", true, false, true, true);
+ pattern = PatternConstructor.createPattern("word word", false, false, true, true);
+ pattern = PatternConstructor.createPattern("(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)", true, false, true, true);
+ }
+ @Test
+ public void testBasicElementLabels() throws Exception {
+ BasicElementLabels.getFilePattern("file");
+ IPath p = new Path("/os");
+ BasicElementLabels.getPathLabel(p, true);
+ BasicElementLabels.getPathLabel(p, false);
+ BasicElementLabels.getResourceName("resource");
+ BasicElementLabels.getURLPart("http://www.x.xom/s.html#1");
+ BasicElementLabels.getVersionName("1.4.1");
+ }
+
+ @Test
+ public void testResourceSearch() throws Exception {
+// setUpProject();
+// tearDownProject();
+ }
+
+ private void tearDownProject() throws Exception {
+ carbideProject.delete(true, true, null);
+ }
+
+ private void setUpProject() throws Exception {
+ if (carbideProject == null){
+ // turn off the indexer
+ CCorePlugin.getIndexManager().setDefaultIndexerId(IPDOMManager.ID_NO_INDEXER);
+
+ // turn off auto-building
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceDescription workspaceDesc = workspace.getDescription();
+ workspaceDesc.setAutoBuilding(false);
+ workspace.setDescription(workspaceDesc);
+
+ // create the test project
+ carbideProject = ProjectCorePlugin.createProject(CARBIDE_PROJECT_NAME, null);
+ assertNotNull(carbideProject);
+
+ // copy the project contents into the workspace
+ File baseDir;
+ if (Platform.isRunning()) {
+ baseDir = FileUtils.pluginRelativeFile(TestPlugin.getDefault(), BASE_DIR);
+ } else {
+ baseDir = new File(BASE_DIR).getAbsoluteFile();
+ }
+
+ FileUtils.copyTreeNoParent(baseDir, carbideProject.getLocation().toFile(), new FileFilter() {
+ public boolean accept(File arg0) {
+ return true;
+ }
+ });
+
+ // refresh the workspace
+ ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, null);
+
+ List<ISymbianBuildContext> configs = getUsableBuildConfigs();
+
+ ProjectCorePlugin.postProjectCreatedActions(carbideProject, PROJECT_RELATIVE_BLDINF_PATH, configs, new ArrayList<String>(), "Debug MMP", null, new NullProgressMonitor());
+ }
+ }
+
+ /**
+ * Get some build configurations for the first non-empty SDK we find.
+ * @return a list of contexts, maximum 8
+ */
+ private List<ISymbianBuildContext> getUsableBuildConfigs() {
+ for (ISymbianSDK sdk : SDKCorePlugin.getSDKManager().getSDKList()) {
+ if ((new File(sdk.getEPOCROOT()).exists())){
+ // TODO: Convert to SBSv2 test
+ List<ISymbianBuildContext> contexts = sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER).getAllBuildConfigurations();
+ if (contexts.size() > 0) {
+ return contexts.subList(0, Math.min(contexts.size(), 8));
+ }
+ }
+ }
+ TestCase.fail("No installed SDKs provide build configurations");
+ return Collections.emptyList();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.search.system.tests/src/com/nokia/carbide/search/system/tests/TestPlugin.java Fri Oct 15 13:04:49 2010 -0500
@@ -0,0 +1,72 @@
+package com.nokia.carbide.search.system.tests;
+
+import java.io.File;
+import java.net.URL;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+public class TestPlugin extends Plugin {
+
+ private static BundleContext bundleContext;
+ private static TestPlugin plugin;
+
+ public static TestPlugin getDefault() {
+ return plugin;
+ }
+
+ static BundleContext getBundleContext() {
+ return bundleContext;
+ }
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "com.nokia.carbide.search.system.tests";
+
+ public void start(BundleContext bundleContext) throws Exception {
+ super.start(bundleContext);
+ TestPlugin.bundleContext = bundleContext;
+ plugin = this;
+ URL pluginURL = FileLocator.find(bundleContext.getBundle(), new Path(""), null); //$NON-NLS-1$
+ pluginURL = FileLocator.resolve(pluginURL);
+ String pluginFilePath = pluginURL.getFile();
+ pluginPath = new Path(pluginFilePath);
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ plugin = null;
+ super.stop(bundleContext);
+ }
+
+ public static String projectRelativePath(String file) throws Exception {
+ File f;
+ if (!Platform.isRunning()) {
+ // get file relative to CWD (i.e. this project)
+ f = new File(file);
+ f = f.getCanonicalFile();
+ } else {
+ // get file relative to running plugin (still this project)
+ f = new File(getDefault().getPluginFilePath(file).toOSString());
+ }
+
+ return f.getAbsolutePath();
+ }
+ private Path pluginPath;
+
+ /**
+ * Returns a path relative to this plugin.
+ *
+ * @param inPluginPath
+ * @return
+ */
+ public IPath getPluginFilePath(String inPluginPath) {
+ return pluginPath.append(inPluginPath);
+ }
+
+ public static String getPluginPath(String inPluginPath) {
+ return getDefault().getPluginFilePath(inPluginPath).toOSString();
+ }
+}
--- a/core/com.nokia.carbide.search.system/META-INF/MANIFEST.MF Thu Oct 14 11:27:24 2010 -0500
+++ b/core/com.nokia.carbide.search.system/META-INF/MANIFEST.MF Fri Oct 15 13:04:49 2010 -0500
@@ -7,7 +7,7 @@
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: com.nokia.carbide.search.system.core.text,
- com.nokia.carbide.search.system.internal.core.text;x-internal:=true,
+ com.nokia.carbide.search.system.internal.core.text;x-friends:="com.nokia.carbide.search.system.tests",
com.nokia.carbide.search.system.internal.ui,
com.nokia.carbide.search.system.internal.ui.text,
com.nokia.carbide.search.system.internal.ui.util,