You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by ma...@apache.org on 2019/12/10 19:45:34 UTC
[netbeans] 07/09: Allow marking an AutoupdateCatalogProvider as
trusted
This is an automated email from the ASF dual-hosted git repository.
matthiasblaesing pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
commit cf4a7da15d780197b87beab6ef3ce59eb1122e46
Author: Matthias Bläsing <mb...@doppel-helix.eu>
AuthorDate: Fri Nov 15 20:53:37 2019 +0100
Allow marking an AutoupdateCatalogProvider as trusted
When an AutoupdateCatalogProvider is marked as trusted and the Auto Update
Service can make a connection between the catalog and the update item,
the update item will also be trusted. The connection can for example be
established if the catalog provides checksums/hashes/message digests for
the referenced items.
---
.../modules/updatecenters/resources/mf-layer.xml | 1 +
platform/autoupdate.services/apichanges.xml | 18 +++++++
platform/autoupdate.services/manifest.mf | 2 +-
.../api/autoupdate/UpdateUnitProvider.java | 23 +++++++++
.../autoupdate/services/InstallSupportImpl.java | 60 ++++++++++++----------
.../autoupdate/services/UpdateElementImpl.java | 13 ++++-
.../autoupdate/services/UpdateUnitFactory.java | 11 ++--
.../services/UpdateUnitProviderImpl.java | 43 +++++++++++++++-
.../updateprovider/AutoupdateCatalogFactory.java | 7 +++
.../updateprovider/AutoupdateCatalogProvider.java | 13 +++++
.../autoupdate/updateprovider/UpdateItemImpl.java | 9 ++++
platform/autoupdate.ui/manifest.mf | 2 +-
platform/autoupdate.ui/nbproject/project.xml | 12 ++---
.../modules/autoupdate/ui/Bundle.properties | 1 +
.../modules/autoupdate/ui/SettingsTab.java | 5 +-
.../autoupdate/ui/UpdateUnitProviderPanel.form | 27 +++++++++-
.../autoupdate/ui/UpdateUnitProviderPanel.java | 24 +++++++--
17 files changed, 221 insertions(+), 50 deletions(-)
diff --git a/nb/updatecenters/src/org/netbeans/modules/updatecenters/resources/mf-layer.xml b/nb/updatecenters/src/org/netbeans/modules/updatecenters/resources/mf-layer.xml
index de190a3..b57d7a8 100644
--- a/nb/updatecenters/src/org/netbeans/modules/updatecenters/resources/mf-layer.xml
+++ b/nb/updatecenters/src/org/netbeans/modules/updatecenters/resources/mf-layer.xml
@@ -31,6 +31,7 @@
<attr name="url" bundlevalue="org.netbeans.modules.updatecenters.resources.Bundle#URL_Distribution"/>
<attr name="category" stringvalue="STANDARD"/>
<attr name="enabled" boolvalue="true"/>
+ <attr name="trusted" boolvalue="true"/>
<attr name="instanceOf" stringvalue="org.netbeans.spi.autoupdate.UpdateProvider" />
<attr name="instanceCreate" methodvalue="org.netbeans.modules.autoupdate.updateprovider.AutoupdateCatalogFactory.createUpdateProvider"/>
</file>
diff --git a/platform/autoupdate.services/apichanges.xml b/platform/autoupdate.services/apichanges.xml
index 350a3a2..a51099c 100644
--- a/platform/autoupdate.services/apichanges.xml
+++ b/platform/autoupdate.services/apichanges.xml
@@ -33,6 +33,24 @@
<!-- ACTUAL CHANGES BEGIN HERE: -->
<changes>
+ <change id="enable-trusted-update-centers">
+ <api name="general"/>
+ <summary>KeyStoreProviders can now report which trustlevel they intent to supply</summary>
+ <version major="1" minor="62"/>
+ <date day="4" month="11" year="2019"/>
+ <author login="matthiasblaesing"/>
+ <compatibility addition="yes" binary="compatible" deletion="no" deprecation="no" semantic="compatible" source="compatible"/>
+ <description>
+ <p>
+ The UpdateUnitProvider can now be declared trusted. If
+ UpdateItems are provided by a trusted UpdateUnitProvider
+ and can be linked to it (for example because the provider provides
+ checksums in the catalog), they are considered trusted by the Autoupdate
+ mechanism and will not trigger certificate warnings.
+ </p>
+ </description>
+ <class package="org.netbeans.api.autoupdate" name="OperationContainer"/>
+ </change>
<change id="keystores-for-validation">
<api name="general"/>
<summary>KeyStoreProviders can now report which trustlevel they intent to supply</summary>
diff --git a/platform/autoupdate.services/manifest.mf b/platform/autoupdate.services/manifest.mf
index f664430..c9df2d4 100644
--- a/platform/autoupdate.services/manifest.mf
+++ b/platform/autoupdate.services/manifest.mf
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
OpenIDE-Module: org.netbeans.modules.autoupdate.services
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/autoupdate/services/resources/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.61
+OpenIDE-Module-Specification-Version: 1.62
OpenIDE-Module-Layer: org/netbeans/modules/autoupdate/services/resources/layer.xml
AutoUpdate-Show-In-Client: false
AutoUpdate-Essential-Module: true
diff --git a/platform/autoupdate.services/src/org/netbeans/api/autoupdate/UpdateUnitProvider.java b/platform/autoupdate.services/src/org/netbeans/api/autoupdate/UpdateUnitProvider.java
index 80d17d2..92f2e8c 100644
--- a/platform/autoupdate.services/src/org/netbeans/api/autoupdate/UpdateUnitProvider.java
+++ b/platform/autoupdate.services/src/org/netbeans/api/autoupdate/UpdateUnitProvider.java
@@ -193,4 +193,27 @@ public final class UpdateUnitProvider {
public String toString() {
return super.toString() + "[" + impl + "]";
}
+
+ /** Sets the trusted flag.
+ *
+ * @see #isTrusted
+ * @param trusted
+ * @since 1.62
+ */
+ public void setTrusted (boolean trusted) {
+ impl.setTrusted(trusted);
+ }
+
+ /** Returns <code>true</code> if the provider is considered to be trusted.
+ * If {@link UpdateItem} are provided by a trusted {@code UpdateUnitProvider}
+ * and can be linked to it (for example because the provider provides
+ * checksums in the catalog), they are considered trusted by the Autoupdate
+ * mechanism and will not trigger certificate warnings.
+ *
+ * @return trusted flag
+ * @since 1.62
+ */
+ public boolean isTrusted () {
+ return impl.isTrusted();
+ }
}
diff --git a/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/services/InstallSupportImpl.java b/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/services/InstallSupportImpl.java
index 7a37748..61f7ba9 100644
--- a/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/services/InstallSupportImpl.java
+++ b/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/services/InstallSupportImpl.java
@@ -1093,34 +1093,6 @@ public class InstallSupportImpl {
progress.progress (el.getDisplayName (), verified < wasDownloaded ? verified : wasDownloaded);
}
- try {
- Collection<CodeSigner> nbmCerts = Utilities.getNbmCertificates(nbmFile);
- if(nbmCerts == null) {
- res = Utilities.N_A;
- } else if (nbmCerts.isEmpty()) {
- res = Utilities.UNSIGNED;
- } else {
- // Iterate all certpaths that can be considered for the NBM
- // choose the certpath, that has the highest trust level
- // TRUSTED -> SIGNATURE_VERIFIED -> SIGNATURE_UNVERIFIED
- // or comes first
- for(CodeSigner cs: nbmCerts) {
- String localRes = Utilities.verifyCertificates(cs, trustedCerts, trustedCACerts, validationCerts, validationCACerts);
- // If there is no previous result or if the local
- // verification yielded a better result than the
- // previous result, replace it
- if (res == null
- || VERIFICATION_RESULT_COMPARATOR.compare(res, localRes) > 0) {
- res = localRes;
- certs.put(el, (List<Certificate>) cs.getSignerCertPath().getCertificates());
- }
- }
- }
- } catch (SecurityException ex) {
- LOG.log(Level.INFO, "The content of the jar/nbm has been modified or certificate paths were inconsistent - " + ex.getMessage(), ex);
- res = Utilities.MODIFIED;
- }
-
{
MessageDigestChecker mdChecker = new MessageDigestChecker(impl.getMessageDigests());
byte[] buffer = new byte[102400];
@@ -1141,6 +1113,38 @@ public class InstallSupportImpl {
});
}
res = Utilities.MODIFIED;
+ } else if (mdChecker.isDigestAvailable() && impl.isCatalogTrusted()) {
+ res = Utilities.TRUSTED;
+ }
+ }
+
+ if(res == null) {
+ try {
+ Collection<CodeSigner> nbmCerts = Utilities.getNbmCertificates(nbmFile);
+ if (nbmCerts == null) {
+ res = Utilities.N_A;
+ } else if (nbmCerts.isEmpty()) {
+ res = Utilities.UNSIGNED;
+ } else {
+ // Iterate all certpaths that can be considered for the NBM
+ // choose the certpath, that has the highest trust level
+ // TRUSTED -> SIGNATURE_VERIFIED -> SIGNATURE_UNVERIFIED
+ // or comes first
+ for (CodeSigner cs : nbmCerts) {
+ String localRes = Utilities.verifyCertificates(cs, trustedCerts, trustedCACerts, validationCerts, validationCACerts);
+ // If there is no previous result or if the local
+ // verification yielded a better result than the
+ // previous result, replace it
+ if (res == null
+ || VERIFICATION_RESULT_COMPARATOR.compare(res, localRes) > 0) {
+ res = localRes;
+ certs.put(el, (List<Certificate>) cs.getSignerCertPath().getCertificates());
+ }
+ }
+ }
+ } catch (SecurityException ex) {
+ LOG.log(Level.INFO, "The content of the jar/nbm has been modified or certificate paths were inconsistent - " + ex.getMessage(), ex);
+ res = Utilities.MODIFIED;
}
}
diff --git a/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/services/UpdateElementImpl.java b/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/services/UpdateElementImpl.java
index d2ba5dd..31a2688 100644
--- a/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/services/UpdateElementImpl.java
+++ b/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/services/UpdateElementImpl.java
@@ -38,11 +38,13 @@ public abstract class UpdateElementImpl extends Object {
private UpdateUnit unit;
private UpdateElement element;
private List<MessageDigestValue> messageDigests = new ArrayList<>();
-
+ private boolean catalogTrusted = false;
+
public UpdateElementImpl (UpdateItemImpl item, String providerName) {
if(item.getMessageDigests() != null) {
messageDigests.addAll(item.getMessageDigests());
}
+ this.catalogTrusted = item.isCatalogTrusted();
}
public UpdateUnit getUpdateUnit () {
@@ -113,4 +115,13 @@ public abstract class UpdateElementImpl extends Object {
public void setMessageDigests(List<MessageDigestValue> messageDigests) {
this.messageDigests = messageDigests;
}
+
+ public boolean isCatalogTrusted() {
+ return catalogTrusted;
+ }
+
+ public void setCatalogTrusted(boolean catalogTrusted) {
+ this.catalogTrusted = catalogTrusted;
+ }
+
}
diff --git a/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/services/UpdateUnitFactory.java b/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/services/UpdateUnitFactory.java
index 646df0a..529ada0 100644
--- a/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/services/UpdateUnitFactory.java
+++ b/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/services/UpdateUnitFactory.java
@@ -113,7 +113,7 @@ public class UpdateUnitFactory {
for (UpdateUnitProvider up : updates) {
UpdateUnitProviderImpl impl = Trampoline.API.impl (up);
-
+
// append units from provider
mappedImpl = appendUpdateItems (mappedImpl, impl.getUpdateProvider ());
reportRunTime ("AppendUpdateItems for " + impl.getUpdateProvider ().getDisplayName ());
@@ -126,7 +126,7 @@ public class UpdateUnitFactory {
//TODO: this call should be forced not to be called from AWT
//assert !SwingUtilities.isEventDispatchThread();
resetRunTime ("Measuring UpdateUnitFactory.getUpdateUnits (" + provider.getDisplayName () + ")"); // NOI18N
-
+
// append units from provider
Map<String, UpdateUnit> temp = appendUpdateItems (new HashMap<String, UpdateUnit> (), provider);
reportRunTime ("Get appendUpdateItems for " + provider.getDisplayName ());
@@ -143,6 +143,8 @@ public class UpdateUnitFactory {
Map<String, UpdateUnit> appendUpdateItems (Map<String, UpdateUnit> originalUnits, UpdateProvider provider) {
assert originalUnits != null : "Map of original UnitImpl cannot be null";
+ boolean trusted = UpdateUnitProviderImpl.loadTrusted(provider);
+
Map<String, UpdateItem> items;
try {
items = provider.getUpdateItems ();
@@ -155,7 +157,7 @@ public class UpdateUnitFactory {
// append updates
for (String simpleItemId : items.keySet ()) {
-
+
UpdateElement updateEl = null;
try {
@@ -204,6 +206,7 @@ public class UpdateUnitFactory {
// add element to map
if (updateEl != null) {
+ Trampoline.API.impl(updateEl).setCatalogTrusted(trusted);
addElement (originalUnits, updateEl, provider);
}
}
@@ -282,7 +285,7 @@ public class UpdateUnitFactory {
// set UpdateUnit into element
elImpl.setUpdateUnit (unit);
-
+
}
private UpdateUnit mergeInstalledUpdateUnit (UpdateUnit uu) {
diff --git a/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/services/UpdateUnitProviderImpl.java b/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/services/UpdateUnitProviderImpl.java
index 102ee99..adc8f20 100644
--- a/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/services/UpdateUnitProviderImpl.java
+++ b/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/services/UpdateUnitProviderImpl.java
@@ -31,6 +31,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.prefs.BackingStoreException;
@@ -68,6 +69,7 @@ public final class UpdateUnitProviderImpl {
private static final String URL = "url";
private static final String DISPLAY_NAME = "displayName";
private static final String ENABLED = "enabled";
+ private static final String TRUSTED = "trusted";
private static final String CATEGORY_NAME = "categoryName";
private static final LookupListenerImpl UPDATE_PROVIDERS = new LookupListenerImpl();
@@ -133,7 +135,15 @@ public final class UpdateUnitProviderImpl {
public void setProviderURL (URL url) {
storeUrl (getUpdateProvider (), url);
}
-
+
+ public boolean isTrusted() {
+ return loadTrusted(getUpdateProvider());
+ }
+
+ public void setTrusted(Boolean trusted) {
+ storeTrusted(getUpdateProvider(), trusted);
+ }
+
public List<UpdateUnit> getUpdateUnits (UpdateManager.TYPE... types) {
return UpdateManagerImpl.getUpdateUnits (getUpdateProvider (), types);
}
@@ -343,6 +353,7 @@ public final class UpdateUnitProviderImpl {
String toUrl = providerPreferences.get (URL, providerPreferences.get (AutoupdateCatalogFactory.ORIGINAL_URL, null));
String displayName = providerPreferences.get (DISPLAY_NAME, providerPreferences.get (AutoupdateCatalogFactory.ORIGINAL_DISPLAY_NAME, codeName));
String categoryName = providerPreferences.get (CATEGORY_NAME, providerPreferences.get (AutoupdateCatalogFactory.ORIGINAL_CATEGORY_NAME, CATEGORY.COMMUNITY.name()));
+ Boolean trusted = providerPreferences.getBoolean(TRUSTED, providerPreferences.getBoolean(AutoupdateCatalogFactory.ORIGINAL_TRUSTED, false));
CATEGORY c;
try {
c = CATEGORY.valueOf(categoryName);
@@ -368,7 +379,9 @@ public final class UpdateUnitProviderImpl {
} catch (MalformedURLException mue) {
assert false : mue;
}
- return new AutoupdateCatalogProvider (codeName, displayName, url, pc);
+ AutoupdateCatalogProvider acp = new AutoupdateCatalogProvider (codeName, displayName, url, pc);
+ acp.setTrusted(trusted);
+ return acp;
}
private static boolean loadState (String codename) {
@@ -461,6 +474,32 @@ public final class UpdateUnitProviderImpl {
}
}
+ static boolean loadTrusted (UpdateProvider p) {
+ Preferences providerPreferences = getPreferences ().node (p.getName ());
+ assert providerPreferences != null : "Preferences node " + p.getName () + " found.";
+
+ Boolean trusted = null;
+ if (p instanceof AutoupdateCatalogProvider) {
+ trusted = ((AutoupdateCatalogProvider) p).isTrusted();
+ }
+ if(trusted == null) {
+ trusted = false;
+ }
+ return providerPreferences.getBoolean(TRUSTED, trusted);
+ }
+
+ private static void storeTrusted (UpdateProvider p, Boolean trusted) {
+ Preferences providerPreferences = getPreferences ().node (p.getName ());
+ assert providerPreferences != null : "Preferences node " + p.getName () + " found.";
+
+ // store only if differs
+ if (trusted == null) {
+ providerPreferences.remove (TRUSTED);
+ } else {
+ providerPreferences.putBoolean(TRUSTED, trusted);
+ }
+ }
+
private static class LookupListenerImpl implements LookupListener {
final Lookup.Result<UpdateProvider> result = Lookup.getDefault ().lookupResult(UpdateProvider.class);
diff --git a/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/updateprovider/AutoupdateCatalogFactory.java b/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/updateprovider/AutoupdateCatalogFactory.java
index ae134a1..1f0ec51 100644
--- a/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/updateprovider/AutoupdateCatalogFactory.java
+++ b/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/updateprovider/AutoupdateCatalogFactory.java
@@ -62,6 +62,7 @@ public class AutoupdateCatalogFactory {
public static final String ORIGINAL_ENABLED = "originalEnabled"; // NOI18N
public static final String ORIGINAL_CATEGORY_NAME = "originalCategoryName"; // NOI18N
public static final String ORIGINAL_CATEGORY_ICON_BASE = "originalCategoryIconBase"; // NOI18N
+ public static final String ORIGINAL_TRUSTED = "originalTrusted"; // NOI18N
public static UpdateProvider createUpdateProvider (FileObject fo) {
String sKey = (String) fo.getAttribute ("url_key"); // NOI18N
@@ -143,6 +144,12 @@ public class AutoupdateCatalogFactory {
providerPreferences.putBoolean (ORIGINAL_ENABLED, en);
}
+ Boolean trusted = (Boolean) fo.getAttribute("trusted"); // NOI18N
+ if(trusted != null) {
+ au_catalog.setTrusted(trusted);
+ providerPreferences.putBoolean(ORIGINAL_TRUSTED, trusted);
+ }
+
return au_catalog;
}
diff --git a/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/updateprovider/AutoupdateCatalogProvider.java b/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/updateprovider/AutoupdateCatalogProvider.java
index a9ea300..326fd11 100644
--- a/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/updateprovider/AutoupdateCatalogProvider.java
+++ b/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/updateprovider/AutoupdateCatalogProvider.java
@@ -26,6 +26,7 @@ import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.netbeans.api.autoupdate.UpdateUnitProvider.CATEGORY;
+import org.netbeans.modules.autoupdate.services.Trampoline;
import org.netbeans.spi.autoupdate.UpdateItem;
import org.netbeans.spi.autoupdate.UpdateProvider;
import org.openide.util.Parameters;
@@ -45,6 +46,7 @@ public class AutoupdateCatalogProvider implements UpdateProvider {
private ProviderCategory category;
private String contentDescription;
private boolean contentDescriptionInitialized;
+ private boolean trusted;
public AutoupdateCatalogProvider (String name, String displayName, URL updateCenter) {
this(name, displayName, updateCenter, ProviderCategory.forValue(CATEGORY.COMMUNITY));
@@ -117,6 +119,9 @@ public class AutoupdateCatalogProvider implements UpdateProvider {
synchronized(cache.getLock(toParse)) {
map = AutoupdateCatalogParser.getUpdateItems (toParse, this);
}
+ for(UpdateItem ui: map.values()) {
+ UpdateItemImpl impl = Trampoline.SPI.impl(ui);
+ }
descriptionInitialized = true;
return map;
}
@@ -158,4 +163,12 @@ public class AutoupdateCatalogProvider implements UpdateProvider {
public ProviderCategory getProviderCategory() {
return category;
}
+
+ public boolean isTrusted() {
+ return trusted;
+ }
+
+ public void setTrusted(boolean trusted) {
+ this.trusted = trusted;
+ }
}
diff --git a/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/updateprovider/UpdateItemImpl.java b/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/updateprovider/UpdateItemImpl.java
index bb4497c..30d410c 100644
--- a/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/updateprovider/UpdateItemImpl.java
+++ b/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/updateprovider/UpdateItemImpl.java
@@ -31,6 +31,7 @@ import org.netbeans.spi.autoupdate.UpdateItem;
public abstract class UpdateItemImpl {
private UpdateItem originalUpdateItem;
private List<MessageDigestValue> messageDigests = new ArrayList<>();
+ private boolean catalogTrusted = false;
/** Creates a new instance of UpdateItemImpl */
UpdateItemImpl () {
@@ -75,4 +76,12 @@ public abstract class UpdateItemImpl {
public void setMessageDigests(List<MessageDigestValue> messageDigests) {
this.messageDigests = new ArrayList<>(messageDigests);
}
+
+ public boolean isCatalogTrusted() {
+ return catalogTrusted;
+ }
+
+ public void setCatalogTrusted(boolean catalogTrusted) {
+ this.catalogTrusted = catalogTrusted;
+ }
}
diff --git a/platform/autoupdate.ui/manifest.mf b/platform/autoupdate.ui/manifest.mf
index 40be84a..d55d1d8 100644
--- a/platform/autoupdate.ui/manifest.mf
+++ b/platform/autoupdate.ui/manifest.mf
@@ -2,6 +2,6 @@ Manifest-Version: 1.0
OpenIDE-Module: org.netbeans.modules.autoupdate.ui
OpenIDE-Module-Install: org/netbeans/modules/autoupdate/ui/actions/Installer.class
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/autoupdate/ui/resources/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.52
+OpenIDE-Module-Specification-Version: 1.53
AutoUpdate-Show-In-Client: false
AutoUpdate-Essential-Module: true
diff --git a/platform/autoupdate.ui/nbproject/project.xml b/platform/autoupdate.ui/nbproject/project.xml
index 8615fb5..d09a3ce 100644
--- a/platform/autoupdate.ui/nbproject/project.xml
+++ b/platform/autoupdate.ui/nbproject/project.xml
@@ -56,7 +56,7 @@
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
- <specification-version>1.57</specification-version>
+ <specification-version>1.62</specification-version>
</run-dependency>
</dependency>
<dependency>
@@ -101,7 +101,7 @@
</run-dependency>
</dependency>
<dependency>
- <code-name-base>org.openide.util.ui</code-name-base>
+ <code-name-base>org.openide.util</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
@@ -109,19 +109,19 @@
</run-dependency>
</dependency>
<dependency>
- <code-name-base>org.openide.util</code-name-base>
+ <code-name-base>org.openide.util.lookup</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
- <specification-version>9.3</specification-version>
+ <specification-version>8.0</specification-version>
</run-dependency>
</dependency>
<dependency>
- <code-name-base>org.openide.util.lookup</code-name-base>
+ <code-name-base>org.openide.util.ui</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
- <specification-version>8.0</specification-version>
+ <specification-version>9.3</specification-version>
</run-dependency>
</dependency>
<dependency>
diff --git a/platform/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/Bundle.properties b/platform/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/Bundle.properties
index af27211..e718266 100644
--- a/platform/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/Bundle.properties
+++ b/platform/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/Bundle.properties
@@ -211,3 +211,4 @@ Unit_InternalUpdates_Version=(Internal Updates)
Unit_InternalUpdates_Title=Internal Updates
ProblemPanel.cbShowAgain.text=&Don't show this message again
SettingsTab.lLocation.text=Plugin &Install Location:
+UpdateUnitProviderPanel.cbTrusted.text=&Trust update center fully and allow automatic installations
diff --git a/platform/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/SettingsTab.java b/platform/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/SettingsTab.java
index 40e33dd..49024ee 100644
--- a/platform/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/SettingsTab.java
+++ b/platform/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/SettingsTab.java
@@ -512,6 +512,7 @@ private void bProxyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:
}
provider.setEnable (panel.isActive ());
+ provider.setTrusted(panel.isTrusted());
if (panel.isActive ()) {
// was not enabled and will be -> add it to model and read its content
refreshProvider (provider, forceRead);
@@ -566,7 +567,8 @@ private void bProxyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:
final UpdateUnitProviderPanel panel = new UpdateUnitProviderPanel(provider.isEnabled(),
provider.getDisplayName(), // display name
provider.getProviderURL().toExternalForm(), // URL
- true); // editing
+ true, // editing
+ provider.isTrusted());
DialogDescriptor descriptor = getCustomizerDescriptor(panel);
panel.getOKButton().addActionListener(new ActionListener(){
@Override
@@ -628,6 +630,7 @@ private void bProxyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:
final UpdateUnitProviderPanel panel = new UpdateUnitProviderPanel(true,
NbBundle.getMessage(SettingsTab.class, "SettingsTab_NewProviderName"), // NOI18N
NbBundle.getMessage(SettingsTab.class, "SettingsTab_NewProviderURL"), // NOI18N
+ false,
false);
DialogDescriptor descriptor = getCustomizerDescriptor(panel);
panel.getOKButton().addActionListener(new ActionListener(){
diff --git a/platform/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/UpdateUnitProviderPanel.form b/platform/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/UpdateUnitProviderPanel.form
index bf2d7c3..495a23c 100644
--- a/platform/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/UpdateUnitProviderPanel.form
+++ b/platform/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/UpdateUnitProviderPanel.form
@@ -49,7 +49,13 @@
<Group type="103" groupAlignment="0" attributes="0">
<Component id="tfURL" alignment="0" pref="474" max="32767" attributes="0"/>
<Component id="tfName" pref="474" max="32767" attributes="0"/>
- <Component id="cbActive" alignment="0" min="-2" max="-2" attributes="0"/>
+ <Group type="102" attributes="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="cbTrusted" min="-2" max="-2" attributes="0"/>
+ <Component id="cbActive" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
+ </Group>
</Group>
</Group>
</Group>
@@ -72,7 +78,9 @@
<Component id="lURL" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="tfURL" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
- <EmptySpace pref="20" max="32767" attributes="0"/>
+ <EmptySpace type="separate" max="-2" attributes="0"/>
+ <Component id="cbTrusted" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="32767" attributes="0"/>
<Component id="errorLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
@@ -142,5 +150,20 @@
</Component>
<Component class="javax.swing.JLabel" name="errorLabel">
</Component>
+ <Component class="javax.swing.JCheckBox" name="cbTrusted">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/autoupdate/ui/Bundle.properties" key="UpdateUnitProviderPanel.cbTrusted.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
+ <EmptyBorder bottom="0" left="0" right="0" top="0"/>
+ </Border>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
</SubComponents>
</Form>
diff --git a/platform/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/UpdateUnitProviderPanel.java b/platform/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/UpdateUnitProviderPanel.java
index 98e2dc1..c419202 100644
--- a/platform/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/UpdateUnitProviderPanel.java
+++ b/platform/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/UpdateUnitProviderPanel.java
@@ -50,7 +50,7 @@ public class UpdateUnitProviderPanel extends javax.swing.JPanel {
private final Icon errorIcon = ImageUtilities.loadImageIcon("org/netbeans/modules/autoupdate/ui/resources/error.png", false);
/** Creates new form UpdateUnitProviderPanel */
- public UpdateUnitProviderPanel(boolean isActive, String name, String url, boolean editing) {
+ public UpdateUnitProviderPanel(boolean isActive, String name, String url, boolean editing, boolean isTrusted) {
isEdit = editing;
originalName = name;
initComponents();
@@ -58,6 +58,7 @@ public class UpdateUnitProviderPanel extends javax.swing.JPanel {
tfURL.setText(url);
tfName.setText(name);
cbActive.setSelected(isActive);
+ cbTrusted.setSelected(isTrusted);
getAccessibleContext().setAccessibleName("ACN_UpdateCenterCustomizer");
getAccessibleContext().setAccessibleDescription("ACD_UpdateCenterCustomizer");
}
@@ -239,7 +240,11 @@ public class UpdateUnitProviderPanel extends javax.swing.JPanel {
public String getProviderURL() {
return tfURL.getText().trim();
}
-
+
+ public boolean isTrusted() {
+ return cbTrusted.isSelected();
+ }
+
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
@@ -254,6 +259,7 @@ public class UpdateUnitProviderPanel extends javax.swing.JPanel {
tfURL = new javax.swing.JTextField();
cbActive = new javax.swing.JCheckBox();
errorLabel = new javax.swing.JLabel();
+ cbTrusted = new javax.swing.JCheckBox();
lName.setLabelFor(tfName);
org.openide.awt.Mnemonics.setLocalizedText(lName, org.openide.util.NbBundle.getMessage(UpdateUnitProviderPanel.class, "UpdateUnitProviderPanel.lName.text")); // NOI18N
@@ -264,6 +270,9 @@ public class UpdateUnitProviderPanel extends javax.swing.JPanel {
org.openide.awt.Mnemonics.setLocalizedText(cbActive, org.openide.util.NbBundle.getMessage(UpdateUnitProviderPanel.class, "UpdateUnitProviderPanel.cbActive.text")); // NOI18N
cbActive.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
+ org.openide.awt.Mnemonics.setLocalizedText(cbTrusted, org.openide.util.NbBundle.getMessage(UpdateUnitProviderPanel.class, "UpdateUnitProviderPanel.cbTrusted.text")); // NOI18N
+ cbTrusted.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
+
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@@ -280,7 +289,11 @@ public class UpdateUnitProviderPanel extends javax.swing.JPanel {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(tfURL, javax.swing.GroupLayout.DEFAULT_SIZE, 474, Short.MAX_VALUE)
.addComponent(tfName, javax.swing.GroupLayout.DEFAULT_SIZE, 474, Short.MAX_VALUE)
- .addComponent(cbActive))))
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(cbTrusted)
+ .addComponent(cbActive))
+ .addGap(0, 0, Short.MAX_VALUE)))))
.addContainerGap())
);
layout.setVerticalGroup(
@@ -296,7 +309,9 @@ public class UpdateUnitProviderPanel extends javax.swing.JPanel {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lURL)
.addComponent(tfURL, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 20, Short.MAX_VALUE)
+ .addGap(18, 18, 18)
+ .addComponent(cbTrusted)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(errorLabel)
.addContainerGap())
);
@@ -309,6 +324,7 @@ public class UpdateUnitProviderPanel extends javax.swing.JPanel {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JCheckBox cbActive;
+ private javax.swing.JCheckBox cbTrusted;
private javax.swing.JLabel errorLabel;
private javax.swing.JLabel lName;
private javax.swing.JLabel lURL;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists