From 83e192d07ae6f14d8f483c5a315b10f3ba0851c6 Mon Sep 17 00:00:00 2001 From: Peter Kriens Date: Thu, 4 Apr 2024 16:23:07 +0200 Subject: [PATCH] Hmm, recursion. bndrun created a bndeditmodel --- Signed-off-by: Peter Kriens Signed-off-by: Peter Kriens --- .../aQute/bnd/build/model/BndEditModel.java | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/biz.aQute.bndlib/src/aQute/bnd/build/model/BndEditModel.java b/biz.aQute.bndlib/src/aQute/bnd/build/model/BndEditModel.java index 9085c3f85d..19cd872717 100644 --- a/biz.aQute.bndlib/src/aQute/bnd/build/model/BndEditModel.java +++ b/biz.aQute.bndlib/src/aQute/bnd/build/model/BndEditModel.java @@ -77,8 +77,6 @@ @SuppressWarnings("deprecation") public class BndEditModel { - private static final String BUILDFILE = Workspace.CNFDIR - + "/" + Workspace.BUILDFILE; public static final String NEWLINE_LINE_SEPARATOR = "\\n\\\n\t"; public static final String LIST_SEPARATOR = ",\\\n\t"; @@ -273,13 +271,6 @@ public ImportPattern error( // for change detection when multiple wizards look at the same model private long lastChangedAt; - /** - * Is either the workspace (when cnf/build.bnd) or a project (when its - * bnd.bnd) or a random bndrun linked to workspace (event if it isn't a - * bndrun). Primary purpose is to walk the inheritance chain implied in the - * Workspace/Project/sub bnd files/bndrun files - */ - Processor owner; // Converter resolveModeFormatter = // EnumFormatter.create(ResolveMode.class, ResolveMode.manual); @@ -395,9 +386,6 @@ public BndEditModel(Project bndrun) throws IOException { this(bndrun.getWorkspace()); this.project = bndrun; File propertiesFile = bndrun.getPropertiesFile(); - this.owner = workspace.findProcessor(propertiesFile) - .orElse(bndrun); - if (propertiesFile.isFile()) this.document = new Document(IO.collect(propertiesFile)); else @@ -405,6 +393,22 @@ public BndEditModel(Project bndrun) throws IOException { loadFrom(this.document); } + /** + * Is either the workspace (when cnf/build.bnd) or a project (when its + * bnd.bnd) or a random bndrun linked to workspace (event if it isn't a + * bndrun). Primary purpose is to walk the inheritance chain implied in the + * Workspace/Project/sub bnd files files + */ + Processor getOwner() { + File propertiesFile = project.getPropertiesFile(); + if (!propertiesFile.getName() + .endsWith(".bnd")) + return project; + + return workspace.findProcessor(propertiesFile) + .orElse(project); + } + public void loadFrom(IDocument document) throws IOException { try (InputStream in = toEscaped(document.get())) { loadFrom(in);