diff -r 8adaceef6422 autoupdate.services/apichanges.xml --- a/autoupdate.services/apichanges.xml Mon Oct 29 17:00:46 2012 +0100 +++ b/autoupdate.services/apichanges.xml Mon Oct 29 17:16:07 2012 +0100 @@ -57,6 +57,23 @@ + + + Find a visible ancestor of UpdateUnit + + + + + +

+ Added a method {@link org.netbeans.api.autoupdate.UpdateUnit#getVisibleAncestor} which returns a visible plugin + which depending upon this unit. Returns a unit if this unit is installed in the system and some of visible + units depending upon this one, otherwise returns null. +

+
+ + +
Mark an update as preferred just if needed diff -r 8adaceef6422 autoupdate.services/manifest.mf --- a/autoupdate.services/manifest.mf Mon Oct 29 17:00:46 2012 +0100 +++ b/autoupdate.services/manifest.mf Mon Oct 29 17:16:07 2012 +0100 @@ -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.36 +OpenIDE-Module-Specification-Version: 1.37 OpenIDE-Module-Layer: org/netbeans/modules/autoupdate/services/resources/layer.xml AutoUpdate-Show-In-Client: false AutoUpdate-Essential-Module: true diff -r 8adaceef6422 autoupdate.services/src/org/netbeans/api/autoupdate/UpdateUnit.java --- a/autoupdate.services/src/org/netbeans/api/autoupdate/UpdateUnit.java Mon Oct 29 17:00:46 2012 +0100 +++ b/autoupdate.services/src/org/netbeans/api/autoupdate/UpdateUnit.java Mon Oct 29 17:16:07 2012 +0100 @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. + * Copyright 1997-2012 Oracle and/or its affiliates. All rights reserved. * * Oracle and Java are registered trademarks of Oracle and/or its affiliates. * Other names may be trademarks of their respective owners. @@ -136,6 +136,22 @@ return impl.isPending (); } + /** Returns a nearest plugin depending upon this unit which is supposed + * to be visible in application UI. + * Works only for units which are already installed in the application. + * + * @since 1.37 + * @return UpdateUnit or null + */ + public UpdateUnit getVisibleAncestor() { + if (getInstalled() != null) { + return impl.getVisibleAncestor(); + } else { + return null; + } + } + + @Override public boolean equals(Object obj) { if (obj == null) return false; @@ -149,6 +165,7 @@ return true; } + @Override public int hashCode() { int hash = 5;