use of org.knime.core.eclipseUtil.UpdateChecker.UpdateInfo in project knime-core by knime.
the class NewReleaseMessageInjector method injectUpdateMessage.
private void injectUpdateMessage(final Document doc) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException, TransformerException {
XPath xpath = m_xpathFactory.newXPath();
Element updateNode = (Element) xpath.evaluate("//div[@id='update-inner']", doc.getDocumentElement(), XPathConstants.NODE);
Element minorUpdatesAvailableSpan = (Element) xpath.evaluate("//span[@id='release-available']", updateNode, XPathConstants.NODE);
// removes the "hidden" style and makes it visible
minorUpdatesAvailableSpan.removeAttribute("style");
Element updateList = (Element) xpath.evaluate(".//ul[@id='release-list']", updateNode, XPathConstants.NODE);
// removes the "hidden" style and makes it visible
updateList.removeAttribute("style");
boolean updatePossible = true;
for (UpdateInfo ui : m_newMinorVersions) {
updatePossible &= ui.isUpdatePossible();
Element li = doc.createElement("li");
li.setTextContent(ui.getName());
updateList.appendChild(li);
}
if (updatePossible) {
Element updatePossibleNode = (Element) xpath.evaluate(".//span[@id='update-possible']", updateNode, XPathConstants.NODE);
updatePossibleNode.removeAttribute("style");
} else {
Element updateNotPossibleNode = (Element) xpath.evaluate(".//span[@id='update-not-possible']", updateNode, XPathConstants.NODE);
updateNotPossibleNode.removeAttribute("style");
}
if (m_prefs.getBoolean("org.knime.product.intro.update", true)) {
// removes the "hidden" style
updateNode.removeAttribute("style");
}
}
use of org.knime.core.eclipseUtil.UpdateChecker.UpdateInfo in project knime-core by knime.
the class NewReleaseMessageInjector method checkNewMinorVersion.
private List<UpdateInfo> checkNewMinorVersion() throws IOException, URISyntaxException {
final ProvisioningUI provUI = ProvisioningUI.getDefaultUI();
RepositoryTracker tracker = provUI.getRepositoryTracker();
if (tracker == null) {
// if run from the IDE there will be no tracker
return Collections.emptyList();
}
List<UpdateInfo> updateList = new ArrayList<>();
for (URI uri : tracker.getKnownRepositories(provUI.getSession())) {
if (("http".equals(uri.getScheme()) || "https".equals(uri.getScheme())) && (uri.getHost().endsWith(".knime.org") || uri.getHost().endsWith(".knime.com"))) {
UpdateInfo newRelease = UpdateChecker.checkForNewRelease(uri);
if (newRelease != null) {
updateList.add(newRelease);
}
}
}
return updateList;
}
Aggregations