From f80789e2d0912e3a38528d0e5be53f7c57a4e50e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Tue, 7 Nov 2023 11:58:12 +0100 Subject: [PATCH 1/2] Use a default schema provider without path in case none is supplied Even though no search path is provided we need to decode the URL and see if we can find the schema in the current workspace. Also fixes an issue where schema can't be opened by double click on linux. Fix https://github.com/eclipse-pde/eclipse.pde/issues/890 --- .../eclipse/pde/internal/core/schema/SchemaInclude.java | 7 +++++-- .../pde/internal/ui/editor/schema/SchemaEditor.java | 9 ++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/schema/SchemaInclude.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/schema/SchemaInclude.java index f8455eb447..3428a7f01a 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/schema/SchemaInclude.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/schema/SchemaInclude.java @@ -14,6 +14,7 @@ package org.eclipse.pde.internal.core.schema; import java.io.PrintWriter; +import java.util.Objects; import org.eclipse.core.runtime.CoreException; import org.eclipse.pde.internal.core.PDECore; @@ -24,6 +25,8 @@ public class SchemaInclude extends SchemaObject implements ISchemaInclude { + private static final PathSchemaProvider DEFAULT_SCHEMA_PROVIDER = new PathSchemaProvider(null); + private static final long serialVersionUID = 1L; private String fLocation; @@ -57,7 +60,7 @@ public SchemaInclude(ISchemaObject parent, String location, boolean abbreviated, super(parent, location); fLocation = location; fAbbreviated = abbreviated; - this.schemaProvider = schemaProvider; + this.schemaProvider = Objects.requireNonNullElse(schemaProvider, DEFAULT_SCHEMA_PROVIDER); } /** @@ -98,7 +101,7 @@ public ISchema getIncludedSchema() { if (fAbbreviated) { SchemaRegistry registry = PDECore.getDefault().getSchemaRegistry(); fIncludedSchema = registry.getIncludedSchema(descriptor, fLocation); - } else if (fIncludedSchema == null && schemaProvider != null) { + } else if (fIncludedSchema == null) { fIncludedSchema = schemaProvider.createSchema(descriptor, fLocation); } return fIncludedSchema; diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/schema/SchemaEditor.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/schema/SchemaEditor.java index ead3667165..1f511c9cad 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/schema/SchemaEditor.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/schema/SchemaEditor.java @@ -187,10 +187,17 @@ public static boolean openSchema(IFile file) { public static boolean openSchema(IPath path) { String pluginId = path.segment(0); + int remove; + if ("schema:".equals(pluginId)) { //$NON-NLS-1$ + pluginId = path.segment(1); + remove = 2; + } else { + remove = 1; + } IPluginModelBase model = PluginRegistry.findModel(pluginId); if (model != null && model.getUnderlyingResource() != null) { IProject project = model.getUnderlyingResource().getProject(); - IFile file = project.getFile(path.removeFirstSegments(1)); + IFile file = project.getFile(path.removeFirstSegments(remove)); return openSchema(file); } return false; From baa56b47ae807d1ad30db8ad2fceef2a8161a73d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Fri, 10 Nov 2023 13:22:59 +0100 Subject: [PATCH 2/2] Try to enable the tests in org.eclipse.pde.build.tests --- .../build.properties | 2 +- build/pom.xml | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/build/org.eclipse.pde.build.tests/build.properties b/build/org.eclipse.pde.build.tests/build.properties index 5279318b69..2b93dbb3ba 100644 --- a/build/org.eclipse.pde.build.tests/build.properties +++ b/build/org.eclipse.pde.build.tests/build.properties @@ -20,5 +20,5 @@ bin.includes = META-INF/,\ test.xml src.includes = about.html jars.compile.order = . -pom.model.property.skipTests = true +pom.model.property.skipTests = false pom.model.property.code.ignoredWarnings = ${tests.ignoredWarnings} diff --git a/build/pom.xml b/build/pom.xml index ee217ec842..2f1bbbfa4d 100644 --- a/build/pom.xml +++ b/build/pom.xml @@ -23,4 +23,33 @@ org.eclipse.pde.build org.eclipse.pde.build.tests + + + + + org.eclipse.tycho + tycho-surefire-plugin + + + + eclipse-plugin + org.eclipse.osgi.compatibility.state + 0.0.0 + + + p2-installable-unit + org.eclipse.equinox.executable + 0.0.0 + + + eclipse-feature + org.eclipse.sdk + 0.0.0 + + + p2Installed + + + +