introduced new ITestElementResolver, old resolver code is called if there is no new implementation
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/model/TestRunSession.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/model/TestRunSession.java
index 9d94142..18c82c4 100755
--- a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/model/TestRunSession.java
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/model/TestRunSession.java
@@ -161,7 +161,7 @@
if (launchConfiguration != null) {
fTestRunName= launchConfiguration.getName();
fTestingEngine= DLTKTestingConstants.getTestingEngine(launchConfiguration);
- testRunnerUI= fTestingEngine.getTestRunnerUI(launchConfiguration);
+ testRunnerUI= fTestingEngine.getTestRunnerUI(project, launchConfiguration);
} else {
fTestRunName= project.getElementName();
fTestingEngine= NullTestingEngine.getInstance();
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/OpenEditorAction.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/OpenEditorAction.java
deleted file mode 100755
index 1c1fca0..0000000
--- a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/OpenEditorAction.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.dltk.internal.testing.ui;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.dltk.core.DLTKCore;
-import org.eclipse.dltk.core.IModelElement;
-import org.eclipse.dltk.core.IScriptProject;
-import org.eclipse.dltk.core.ISourceModule;
-import org.eclipse.dltk.core.ModelException;
-import org.eclipse.dltk.internal.testing.MemberResolverManager;
-import org.eclipse.dltk.launching.ScriptLaunchConfigurationConstants;
-import org.eclipse.dltk.testing.DLTKTestingConstants;
-import org.eclipse.dltk.testing.DLTKTestingMessages;
-import org.eclipse.dltk.testing.ITestingElementResolver;
-import org.eclipse.dltk.ui.DLTKUIPlugin;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-/**
- * Abstract Action for opening a Java editor.
- */
-public abstract class OpenEditorAction extends Action {
- protected String fName;
- protected TestRunnerViewPart fTestRunner;
- private final boolean fActivate;
-
- protected OpenEditorAction(TestRunnerViewPart testRunner,
- String testClassName) {
- this(testRunner, testClassName, true);
- }
-
- public OpenEditorAction(TestRunnerViewPart testRunner, String className,
- boolean activate) {
- super(DLTKTestingMessages.OpenEditorAction_action_label);
- fName = className;
- fTestRunner = testRunner;
- fActivate = activate;
- }
-
- /*
- * @see IAction#run()
- */
- public void run() {
- ITextEditor textEditor = null;
- try {
- IModelElement element = findMember(getLaunchedProject(), fName);
- if (element == null) {
- MessageDialog
- .openError(
- getShell(),
- DLTKTestingMessages.OpenEditorAction_error_cannotopen_title,
- DLTKTestingMessages.OpenEditorAction_error_cannotopen_message);
- return;
- }
- textEditor = (ITextEditor) DLTKUIPlugin.openInEditor(element,
- fActivate, false);
- } catch (CoreException e) {
- ErrorDialog.openError(getShell(),
- DLTKTestingMessages.OpenEditorAction_error_dialog_title,
- DLTKTestingMessages.OpenEditorAction_error_dialog_message,
- e.getStatus());
- return;
- }
- if (textEditor == null) {
- fTestRunner
- .registerInfoMessage(DLTKTestingMessages.OpenEditorAction_message_cannotopen);
- return;
- }
- reveal(textEditor);
- }
-
- protected Shell getShell() {
- return fTestRunner.getSite().getShell();
- }
-
- /**
- * @return the Java project, or <code>null</code>
- */
- protected IScriptProject getLaunchedProject() {
- return fTestRunner.getLaunchedProject();
- }
-
- protected String getClassName() {
- return fName;
- }
-
- protected IModelElement findMember(IScriptProject project, String name)
- throws ModelException {
- IScriptProject launchedProject = fTestRunner.getLaunchedProject();
- ILaunch launch = fTestRunner.getLaunch();
- ILaunchConfiguration launchConfiguration = launch
- .getLaunchConfiguration();
- IModelElement element = null;
- String id = null;
- try {
- id = launchConfiguration.getAttribute(
- DLTKTestingConstants.ATTR_ENGINE_ID, "");
- } catch (CoreException e) {
- if (DLTKCore.DEBUG) {
- e.printStackTrace();
- }
- }
- if (id != null) {
- ITestingElementResolver resolver = MemberResolverManager.getResolver(id);
- if (resolver == null) {
- return element;
- }
- ISourceModule module = resolveSourceModule(launchedProject,
- launchConfiguration);
- element = resolver.resolveElement(launchedProject,
- launchConfiguration, module, name);
- if (element == null) {
- String title = DLTKTestingMessages.OpenTestAction_error_title;
- String message = "Error";
- MessageDialog.openInformation(getShell(), title, message);
- return element;
- }
- }
- return element;
- }
-
- protected ISourceModule resolveSourceModule(IScriptProject launchedProject,
- ILaunchConfiguration launchConfiguration) {
- String scriptName;
- try {
- scriptName = launchConfiguration.getAttribute(
- ScriptLaunchConfigurationConstants.ATTR_MAIN_SCRIPT_NAME,
- (String) null);
- } catch (CoreException e) {
- if (DLTKCore.DEBUG) {
- e.printStackTrace();
- }
- return null;
- }
- IProject prj = launchedProject.getProject();
- IResource file = prj.findMember(new Path(scriptName));
- if (file instanceof IFile) {
- return (ISourceModule) DLTKCore.create(file);
- }
- return null;
- }
-
- protected abstract void reveal(ITextEditor editor);
-}
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/OpenEditorAtLineAction.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/OpenEditorAtLineAction.java
deleted file mode 100755
index 1763150..0000000
--- a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/OpenEditorAtLineAction.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Sebastian Davids: sdavids@gmx.de bug 37333 Failure Trace cannot
- * navigate to non-public class in CU throwing Exception
- *******************************************************************************/
-package org.eclipse.dltk.internal.testing.ui;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-/**
- * Open a test in the Java editor and reveal a given line
- */
-public class OpenEditorAtLineAction extends OpenEditorAction {
-
- private int fLineNumber;
-
- public OpenEditorAtLineAction(TestRunnerViewPart testRunner, String cuName, String className, int line) {
- super(testRunner, className);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDLTKTestingHelpContextIds.OPENEDITORATLINE_ACTION);
- fLineNumber= line;
- }
-
- protected void reveal(ITextEditor textEditor) {
- if (fLineNumber >= 0) {
- try {
- IDocument document= textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());
- textEditor.selectAndReveal(document.getLineOffset(fLineNumber-1), document.getLineLength(fLineNumber-1));
- } catch (BadLocationException x) {
- // marker refers to invalid text position -> do nothing
- }
- }
- }
-}
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/OpenTestAction.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/OpenTestAction.java
index 4c195e5..d5d3022 100755
--- a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/OpenTestAction.java
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/OpenTestAction.java
@@ -11,77 +11,107 @@
package org.eclipse.dltk.internal.testing.ui;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.dltk.core.DLTKCore;
-import org.eclipse.dltk.core.IMember;
-import org.eclipse.dltk.core.IModelElement;
import org.eclipse.dltk.core.IScriptProject;
-import org.eclipse.dltk.core.ISourceModule;
import org.eclipse.dltk.core.ISourceRange;
-import org.eclipse.dltk.core.ModelException;
-import org.eclipse.dltk.internal.testing.MemberResolverManager;
-import org.eclipse.dltk.testing.DLTKTestingConstants;
-import org.eclipse.dltk.testing.ITestingElementResolver;
+import org.eclipse.dltk.internal.testing.model.TestElement;
+import org.eclipse.dltk.internal.testing.util.LegacyTestElementResolver;
+import org.eclipse.dltk.testing.DLTKTestingMessages;
+import org.eclipse.dltk.testing.ITestElementResolver;
+import org.eclipse.dltk.testing.TestElementResolution;
+import org.eclipse.dltk.ui.DLTKUIPlugin;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.texteditor.ITextEditor;
/**
- * Open a class on a Test method.
+ * Abstract Action for opening a Java editor.
*/
-public class OpenTestAction extends OpenEditorAction {
+public class OpenTestAction extends Action {
+ private final TestElement fTestElement;
+ protected TestRunnerViewPart fTestRunner;
+ private final boolean fActivate;
- private String fMethodName;
- private ISourceRange fRange;
-
- public OpenTestAction(TestRunnerViewPart testRunner, String className,
- String method) {
- this(testRunner, className, method, true);
+ protected OpenTestAction(TestRunnerViewPart testRunner,
+ TestElement testElement) {
+ this(testRunner, testElement, true);
}
- public OpenTestAction(TestRunnerViewPart testRunner, String className) {
- this(testRunner, className, null);
- }
-
- public OpenTestAction(TestRunnerViewPart testRunner, String className,
- String method, boolean activate) {
- super(testRunner, className, activate);
+ public OpenTestAction(TestRunnerViewPart testRunner,
+ TestElement testElement, boolean activate) {
+ super(DLTKTestingMessages.OpenEditorAction_action_label);
+ fTestElement = testElement;
+ fTestRunner = testRunner;
+ fActivate = activate;
PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
IDLTKTestingHelpContextIds.OPENTEST_ACTION);
- fMethodName = method;
}
- protected void reveal(ITextEditor textEditor) {
- if (fRange != null)
- textEditor.selectAndReveal(fRange.getOffset(), fRange.getLength());
- }
-
- protected IModelElement findMember(IScriptProject project, String name)
- throws ModelException {
- IScriptProject launchedProject = fTestRunner.getLaunchedProject();
- ILaunch launch = fTestRunner.getLaunch();
- ILaunchConfiguration launchConfiguration = launch
- .getLaunchConfiguration();
- IModelElement element = null;
- String id = null;
+ /*
+ * @see IAction#run()
+ */
+ public void run() {
+ final ITestElementResolver resolver = acquireResolver();
+ final TestElementResolution resolution = resolver
+ .resolveElement(fTestElement);
+ if (resolution == null) {
+ MessageDialog
+ .openError(
+ getShell(),
+ DLTKTestingMessages.OpenEditorAction_error_cannotopen_title,
+ DLTKTestingMessages.OpenEditorAction_error_cannotopen_message);
+ return;
+ }
try {
- id = launchConfiguration.getAttribute(
- DLTKTestingConstants.ATTR_ENGINE_ID, "");
+ final ITextEditor textEditor = (ITextEditor) DLTKUIPlugin
+ .openInEditor(resolution.getElement(), fActivate, false);
+ if (textEditor != null) {
+ final ISourceRange range = resolution.getRange();
+ if (range != null) {
+ textEditor.selectAndReveal(range.getOffset(), range
+ .getLength());
+ }
+ } else {
+ fTestRunner
+ .registerInfoMessage(DLTKTestingMessages.OpenEditorAction_message_cannotopen);
+ }
} catch (CoreException e) {
- if (DLTKCore.DEBUG) {
- e.printStackTrace();
- }
+ ErrorDialog.openError(getShell(),
+ DLTKTestingMessages.OpenEditorAction_error_dialog_title,
+ DLTKTestingMessages.OpenEditorAction_error_dialog_message,
+ e.getStatus());
}
- if (id != null) {
- ITestingElementResolver resolver = MemberResolverManager.getResolver(id);
- if (resolver == null) {
- return element;
- }
- ISourceModule module = this.resolveSourceModule(launchedProject, launchConfiguration);
- element = resolver.resolveElement(launchedProject, launchConfiguration, module, name);
- this.fRange = resolver.resolveRange(project, launchConfiguration, name, module, element, this.fMethodName);
- }
- return element;
}
-
+
+ /**
+ * @return
+ */
+ private ITestElementResolver acquireResolver() {
+ final ITestElementResolver resolver = (ITestElementResolver) fTestRunner
+ .getTestRunnerUI().getAdapter(ITestElementResolver.class);
+ if (resolver != null) {
+ return resolver;
+ } else {
+ return new LegacyTestElementResolver(getLaunchedProject(),
+ fTestRunner.getLaunch().getLaunchConfiguration());
+ }
+ }
+
+ protected Shell getShell() {
+ return fTestRunner.getSite().getShell();
+ }
+
+ /**
+ * @return the project, or <code>null</code>
+ */
+ protected IScriptProject getLaunchedProject() {
+ return fTestRunner.getLaunchedProject();
+ }
+
+ protected TestElement getTestElement() {
+ return fTestElement;
+ }
+
}
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/TestViewer.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/TestViewer.java
index d5d2f1c..cff6813 100755
--- a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/TestViewer.java
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/TestViewer.java
@@ -223,10 +223,10 @@
if (!selection.isEmpty()) {
TestElement testElement = (TestElement) selection.getFirstElement();
- String testLabel = testElement.getTestName();
+ // String testLabel = testElement.getTestName();
String className = testElement.getClassName();
if (testElement instanceof TestSuiteElement) {
- manager.add(new OpenTestAction(fTestRunnerPart, testLabel));
+ manager.add(new OpenTestAction(fTestRunnerPart, testElement));
manager.add(new Separator());
if (testClassExists(className)
&& !fTestRunnerPart.lastLaunchIsKeptAlive()) {
@@ -242,8 +242,7 @@
} else {
TestCaseElement testCaseElement = (TestCaseElement) testElement;
String testMethodName = testCaseElement.getTestMethodName();
- manager.add(new OpenTestAction(fTestRunnerPart, className,
- testMethodName));
+ manager.add(new OpenTestAction(fTestRunnerPart, testElement));
manager.add(new Separator());
if (fTestRunnerPart.lastLaunchIsKeptAlive()) {
manager.add(new RerunAction(
@@ -313,12 +312,9 @@
OpenTestAction action;
if (testElement instanceof TestSuiteElement) {
- action = new OpenTestAction(fTestRunnerPart,
- getRootRelativeName(testElement));
+ action = new OpenTestAction(fTestRunnerPart, testElement);
} else if (testElement instanceof TestCaseElement) {
- TestCaseElement testCase = (TestCaseElement) testElement;
- action = new OpenTestAction(fTestRunnerPart,
- getRootRelativeName(testCase), testCase.getTestMethodName());
+ action = new OpenTestAction(fTestRunnerPart, testElement);
} else {
throw new IllegalStateException(String.valueOf(testElement));
}
@@ -327,26 +323,6 @@
action.run();
}
- private String getRootRelativeName(TestElement testCase) {
- String name = null;
- TestElement el = testCase;
- while (el != null) {
- if (name != null) {
- name = el.getClassName() + "." + name;
- } else {
- name = el.getClassName();
- }
- el = el.getParent();
- if (el instanceof TestRoot) {
- break;
- }
- }
- if (name.startsWith(".")) {
- return name.substring(1);
- }
- return name;
- }
-
private void handleSelected() {
IStructuredSelection selection = (IStructuredSelection) fSelectionProvider
.getSelection();
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/util/LegacyTestElementResolver.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/util/LegacyTestElementResolver.java
new file mode 100644
index 0000000..df844b9
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/util/LegacyTestElementResolver.java
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2008 xored software, Inc.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * xored software, Inc. - initial API and Implementation (Alex Panchenko)
+ *******************************************************************************/
+package org.eclipse.dltk.internal.testing.util;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.dltk.compiler.util.Util;
+import org.eclipse.dltk.core.DLTKCore;
+import org.eclipse.dltk.core.IModelElement;
+import org.eclipse.dltk.core.IScriptProject;
+import org.eclipse.dltk.core.ISourceModule;
+import org.eclipse.dltk.core.ISourceRange;
+import org.eclipse.dltk.internal.testing.MemberResolverManager;
+import org.eclipse.dltk.internal.testing.model.TestElement;
+import org.eclipse.dltk.internal.testing.model.TestRoot;
+import org.eclipse.dltk.launching.ScriptLaunchConfigurationConstants;
+import org.eclipse.dltk.testing.DLTKTestingConstants;
+import org.eclipse.dltk.testing.ITestElementResolver;
+import org.eclipse.dltk.testing.ITestingElementResolver;
+import org.eclipse.dltk.testing.TestElementResolution;
+import org.eclipse.dltk.testing.model.ITestCaseElement;
+import org.eclipse.dltk.testing.model.ITestElement;
+
+public class LegacyTestElementResolver implements ITestElementResolver {
+
+ private final IScriptProject project;
+ private final ILaunchConfiguration launchConfiguration;
+
+ /**
+ * @param launchedProject
+ * @param launchConfiguration
+ */
+ public LegacyTestElementResolver(IScriptProject project,
+ ILaunchConfiguration configuration) {
+ this.project = project;
+ this.launchConfiguration = configuration;
+ }
+
+ public TestElementResolution resolveElement(ITestElement testElement) {
+ final String engineId;
+ try {
+ engineId = launchConfiguration.getAttribute(
+ DLTKTestingConstants.ATTR_ENGINE_ID, (String) null);
+ } catch (CoreException e) {
+ return null;
+ }
+ if (engineId == null) {
+ return null;
+ }
+ final ITestingElementResolver resolver = MemberResolverManager
+ .getResolver(engineId);
+ if (resolver == null) {
+ return null;
+ }
+ final ISourceModule module = resolveSourceModule();
+ if (module == null) {
+ return null;
+ }
+ final String relativeName = getRootRelativeName((TestElement) testElement);
+ final IModelElement element = resolver.resolveElement(project,
+ launchConfiguration, module, relativeName);
+ if (element == null) {
+ return null;
+ }
+ final String method = testElement instanceof ITestCaseElement ? ((ITestCaseElement) testElement)
+ .getTestMethodName()
+ : null;
+ ISourceRange range = resolver.resolveRange(project,
+ launchConfiguration, relativeName, module, element, method);
+ return new TestElementResolution(element, range);
+ }
+
+ protected ISourceModule resolveSourceModule() {
+ String scriptName;
+ try {
+ scriptName = launchConfiguration.getAttribute(
+ ScriptLaunchConfigurationConstants.ATTR_MAIN_SCRIPT_NAME,
+ (String) null);
+ } catch (CoreException e) {
+ if (DLTKCore.DEBUG) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+ IProject prj = project.getProject();
+ IResource file = prj.findMember(new Path(scriptName));
+ if (file instanceof IFile) {
+ return (ISourceModule) DLTKCore.create(file);
+ }
+ return null;
+ }
+
+ private String getRootRelativeName(TestElement testCase) {
+ String name = Util.EMPTY_STRING;
+ TestElement el = testCase;
+ while (el != null) {
+ if (name.length() != 0) {
+ name = el.getClassName() + "." + name;
+ } else {
+ name = el.getClassName();
+ }
+ el = el.getParent();
+ if (el instanceof TestRoot) {
+ break;
+ }
+ }
+ if (name.startsWith(".")) {
+ return name.substring(1);
+ }
+ return name;
+ }
+
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+}
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/AbstractTestRunnerUI.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/AbstractTestRunnerUI.java
index f0c25bf..16fa7ac 100644
--- a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/AbstractTestRunnerUI.java
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/AbstractTestRunnerUI.java
@@ -11,6 +11,7 @@
*******************************************************************************/
package org.eclipse.dltk.testing;
+import org.eclipse.dltk.testing.model.ITestElement;
import org.eclipse.jface.action.IAction;
public abstract class AbstractTestRunnerUI implements ITestRunnerUI {
@@ -27,4 +28,15 @@
return null;
}
+ public TestElementResolution resolveElement(ITestElement element) {
+ return null;
+ }
+
+ /*
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
}
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/AbstractTestingEngine.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/AbstractTestingEngine.java
index 56ea038..cfa6cc5 100644
--- a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/AbstractTestingEngine.java
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/AbstractTestingEngine.java
@@ -18,6 +18,7 @@
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.dltk.core.DLTKContributedExtension;
import org.eclipse.dltk.core.IModelElement;
+import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.ISourceModule;
import org.eclipse.dltk.core.environment.IEnvironment;
import org.eclipse.dltk.internal.testing.launcher.NullTestRunnerUI;
@@ -49,7 +50,8 @@
return null;
}
- public ITestRunnerUI getTestRunnerUI(ILaunchConfiguration configuration) {
+ public ITestRunnerUI getTestRunnerUI(IScriptProject project,
+ ILaunchConfiguration configuration) {
return NullTestRunnerUI.getInstance();
}
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/ITestElementResolver.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/ITestElementResolver.java
new file mode 100644
index 0000000..8aa4315
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/ITestElementResolver.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2008 xored software, Inc.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * xored software, Inc. - initial API and Implementation (Alex Panchenko)
+ *******************************************************************************/
+package org.eclipse.dltk.testing;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.dltk.testing.model.ITestElement;
+
+public interface ITestElementResolver extends IAdaptable {
+
+ TestElementResolution resolveElement(ITestElement element);
+
+}
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/ITestRunnerUI.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/ITestRunnerUI.java
index 7801522..b16e594 100644
--- a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/ITestRunnerUI.java
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/ITestRunnerUI.java
@@ -11,10 +11,11 @@
*******************************************************************************/
package org.eclipse.dltk.testing;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
-public interface ITestRunnerUI {
+public interface ITestRunnerUI extends IAdaptable {
/**
* Filters the stack trace if filtering is enabled for this engine.
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/ITestingEngine.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/ITestingEngine.java
index 5832452..850a97f 100644
--- a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/ITestingEngine.java
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/ITestingEngine.java
@@ -6,6 +6,7 @@
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.dltk.core.IModelElement;
+import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.ISourceModule;
import org.eclipse.dltk.core.environment.IEnvironment;
import org.eclipse.dltk.launching.InterpreterConfig;
@@ -32,5 +33,6 @@
String getContainerLauncher(ILaunchConfiguration configuration,
IEnvironment scriptEnvironment) throws CoreException;
- ITestRunnerUI getTestRunnerUI(ILaunchConfiguration configuration);
+ ITestRunnerUI getTestRunnerUI(IScriptProject project,
+ ILaunchConfiguration configuration);
}
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/TestElementResolution.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/TestElementResolution.java
new file mode 100644
index 0000000..ae46c2b
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/TestElementResolution.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2008 xored software, Inc.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * xored software, Inc. - initial API and Implementation (Alex Panchenko)
+ *******************************************************************************/
+package org.eclipse.dltk.testing;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.dltk.core.IModelElement;
+import org.eclipse.dltk.core.ISourceRange;
+
+public class TestElementResolution {
+
+ private final IModelElement element;
+
+ private final ISourceRange range;
+
+ /**
+ * @param element
+ * @param range
+ */
+ public TestElementResolution(IModelElement element, ISourceRange range) {
+ Assert.isNotNull(element);
+ this.element = element;
+ this.range = range;
+ }
+
+ /**
+ * Returns the model element. Should not be <code>null</code>.
+ *
+ * @return the element
+ */
+ public IModelElement getElement() {
+ return element;
+ }
+
+ /**
+ * Returns the source range. Could be <code>null</code>.
+ *
+ * @return the range
+ */
+ public ISourceRange getRange() {
+ return range;
+ }
+
+}