Bug 562908 - Populate the JustJ Git clones with initial content
Build the full bread crumb to the project root.
diff --git a/features/org.eclipse.justj.tools-feature/feature.properties b/features/org.eclipse.justj.tools-feature/feature.properties
index 2f8f0b0..8afbcb9 100644
--- a/features/org.eclipse.justj.tools-feature/feature.properties
+++ b/features/org.eclipse.justj.tools-feature/feature.properties
@@ -10,7 +10,7 @@
providerName = Eclipse JustJ
featureName = JustJ Tools
-description = Contains the plug-ins for the Tools
+description = Contains the plug-ins for the JustJ Tools
copyright = Copyright (c) 2020 Eclipse contributors and others.\n\
\n\
This program and the accompanying materials\n\
diff --git a/plugins/org.eclipse.justj.p2/src/org/eclipse/justj/p2/UpdateSiteGenerator.java b/plugins/org.eclipse.justj.p2/src/org/eclipse/justj/p2/UpdateSiteGenerator.java
index 5a2a15f..d58557f 100644
--- a/plugins/org.eclipse.justj.p2/src/org/eclipse/justj/p2/UpdateSiteGenerator.java
+++ b/plugins/org.eclipse.justj.p2/src/org/eclipse/justj/p2/UpdateSiteGenerator.java
@@ -529,7 +529,7 @@
private String getRepositoryVersion(IMetadataRepository repository)
{
IQueryResult<IInstallableUnit> groups = repository.query(QueryUtil.createIUGroupQuery(), new NullProgressMonitor());
- List<BasicVersion> versions = new ArrayList<BasicVersion>();
+ List<Version> versions = new ArrayList<Version>();
for (Iterator<IInstallableUnit> i = groups.iterator(); i.hasNext();)
{
IInstallableUnit group = i.next();
@@ -537,9 +537,10 @@
if (iuVersion.isOSGiCompatible() && iuVersion instanceof BasicVersion)
{
BasicVersion basicVersion = (BasicVersion)iuVersion;
- if (!versions.contains(basicVersion))
+ Version unqualifiedVersion = BasicVersion.createOSGi(basicVersion.getMajor(), basicVersion.getMinor(), basicVersion.getMicro());
+ if (!versions.contains(unqualifiedVersion))
{
- versions.add(basicVersion);
+ versions.add((BasicVersion)unqualifiedVersion);
}
}
}
@@ -550,16 +551,14 @@
}
else if (versions.size() == 1)
{
- BasicVersion version = versions.get(0);
- return version.getMajor() + "." + version.getMinor() + "." + version.getMicro();
+ return versions.get(0).toString();
}
else
{
Collections.sort(versions);
- BasicVersion minVersion = versions.get(0);
- BasicVersion maxVersion = versions.get(versions.size() - 1);
- return minVersion.getMajor() + "." + minVersion.getMinor() + "." + minVersion.getMicro() + "-" + maxVersion.getMajor() + "." + maxVersion.getMinor() + "."
- + maxVersion.getMicro();
+ Version minVersion = versions.get(0);
+ Version maxVersion = versions.get(versions.size() - 1);
+ return minVersion + " - " + maxVersion;
}
}
@@ -597,11 +596,9 @@
// We must set the user dir to ensure that we produce a composite that uses relative URIs!
//
- String oldUserDir = System.getProperty("user.dir");
+ String oldUserDir = System.setProperty("user.dir", destination.toString());
try
{
- System.setProperty("user.dir", destination.toString());
-
CompositeRepositoryApplication compositeRepositoryApplication = new CompositeRepositoryApplication()
{
@Override
diff --git a/plugins/org.eclipse.justj.p2/src/org/eclipse/justj/p2/UpdateSiteIndexGenerator.java b/plugins/org.eclipse.justj.p2/src/org/eclipse/justj/p2/UpdateSiteIndexGenerator.java
index 09dbfa0..fd9cff5 100644
--- a/plugins/org.eclipse.justj.p2/src/org/eclipse/justj/p2/UpdateSiteIndexGenerator.java
+++ b/plugins/org.eclipse.justj.p2/src/org/eclipse/justj/p2/UpdateSiteIndexGenerator.java
@@ -394,27 +394,41 @@
public Map<String, String> getBreadcrumbs()
{
Path root = updateSiteGenerator.getUpdateSiteRoot();
+ Path projectRoot = updateSiteGenerator.getProjectRoot();
- // Compute the labels in the right order.
+ // Compute the labels in the right order continuing only as far as the project root.
List<String> labels = new ArrayList<String>();
for (Path file = folder; file.getParent() != null; file = file.getParent())
{
- String name = file.getFileName().toString();
- labels.add(0, Character.toUpperCase(name.charAt(0)) + name.substring(1));
-
- if (file.equals(root))
+ if (file.equals(projectRoot))
{
break;
}
+
+ String name = file.getFileName().toString();
+ labels.add(0, Character.toUpperCase(name.charAt(0)) + name.substring(1));
}
- // Compute the uplinks in the reverse order.
- Map<String, String> result = new LinkedHashMap<String, String>();
+ // Compute the up-links in the reverse order.
+ Map<String, String> links = new LinkedHashMap<String, String>();
String link = null;
for (int i = labels.size() - 1; i >= 0; --i)
{
String label = labels.get(i);
- result.put(label, link);
+ if (link != null)
+ {
+ Path linkFolder = folder.resolve(link).normalize().getParent();
+ if (linkFolder.startsWith(root))
+ {
+ // Don't assume there is an index.html above the update site root.
+ links.put(label, link);
+ }
+ else
+ {
+ links.put(label, link.replace("index.html", ""));
+ }
+ }
+
if (link == null)
{
link = "../index.html";
@@ -429,7 +443,7 @@
Map<String, String> breadcumbs = new LinkedHashMap<String, String>(updateSiteGenerator.getBreadcrumbs());
for (String label : labels)
{
- breadcumbs.put(label, result.get(label));
+ breadcumbs.put(label, links.get(label));
}
return breadcumbs;
}