diff --git a/cucumber.eclipse.editor/src/main/java/cucumber/eclipse/editor/editors/jumpto/JumpToStepDefinition.java b/cucumber.eclipse.editor/src/main/java/cucumber/eclipse/editor/editors/jumpto/JumpToStepDefinition.java index 507dbb01..b8b0ebc7 100644 --- a/cucumber.eclipse.editor/src/main/java/cucumber/eclipse/editor/editors/jumpto/JumpToStepDefinition.java +++ b/cucumber.eclipse.editor/src/main/java/cucumber/eclipse/editor/editors/jumpto/JumpToStepDefinition.java @@ -1,10 +1,12 @@ package cucumber.eclipse.editor.editors.jumpto; +import java.util.HashSet; import java.util.List; import java.util.Set; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; @@ -29,9 +31,18 @@ public static StepDefinition findStepDefinitionMatch(int selectionLineNumber, IF .getAttribute(MarkerFactory.STEP_DEFINITION_MATCH_JDT_HANDLE_IDENTIFIER_ATTRIBUTE); //Search step in repository if (id != null) { - StepDefinitionsRepository repository = StepDefinitionsStorage.INSTANCE - .getOrCreate(gherkinFile.getProject(), null); - Set stepDefinitions = repository.getAllStepDefinitions(); + Set stepDefinitions = new HashSet<>(); + for (IProject project : gherkinFile.getProject().getWorkspace().getRoot().getProjects()) { + try { + if (project.isOpen()) { + StepDefinitionsRepository repository = StepDefinitionsStorage.INSTANCE + .getOrCreate(project, null); + stepDefinitions.addAll(repository.getAllStepDefinitions()); + } + } catch (Exception e) { + e.printStackTrace(); + } + } for (StepDefinition step : stepDefinitions) { if (id.equals(step.getId())) { return step; diff --git a/cucumber.eclipse.editor/src/main/java/cucumber/eclipse/editor/editors/jumpto/StepHyperlinkDetector.java b/cucumber.eclipse.editor/src/main/java/cucumber/eclipse/editor/editors/jumpto/StepHyperlinkDetector.java index 4e510462..4bc1a4e6 100644 --- a/cucumber.eclipse.editor/src/main/java/cucumber/eclipse/editor/editors/jumpto/StepHyperlinkDetector.java +++ b/cucumber.eclipse.editor/src/main/java/cucumber/eclipse/editor/editors/jumpto/StepHyperlinkDetector.java @@ -1,9 +1,11 @@ package cucumber.eclipse.editor.editors.jumpto; +import java.util.HashSet; import java.util.Set; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; @@ -59,9 +61,18 @@ public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boo .getAttribute(MarkerFactory.STEP_DEFINITION_MATCH_JDT_HANDLE_IDENTIFIER_ATTRIBUTE); //Search step in repository if (id != null) { - StepDefinitionsRepository repository = StepDefinitionsStorage.INSTANCE - .getOrCreate(gherkinFile.getProject(), null); - Set stepDefinitions = repository.getAllStepDefinitions(); + Set stepDefinitions = new HashSet<>(); + for (IProject project : gherkinFile.getProject().getWorkspace().getRoot().getProjects()) { + try { + if (project.isOpen()) { + StepDefinitionsRepository repository = StepDefinitionsStorage.INSTANCE + .getOrCreate(project, null); + stepDefinitions.addAll(repository.getAllStepDefinitions()); + } + } catch (Exception e) { + e.printStackTrace(); + } + } for (StepDefinition stepDefinition : stepDefinitions) { if (id.equals(stepDefinition.getId())) { // define the hyperlink region