This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 141714
Collapse All | Expand All

(-)a/autoupdate.services/apichanges.xml (+20 lines)
Lines 71-76 Link Here
71
            <class package="org.netbeans.spi.autoupdate" name="UpdateItem"/>
71
            <class package="org.netbeans.spi.autoupdate" name="UpdateItem"/>
72
            <issue number="162673"/>
72
            <issue number="162673"/>
73
        </change>
73
        </change>
74
        
75
        <change id="new-operation-container">
76
            <api name="general"/>
77
            <summary>New operation type introduced together with method for create appropriate container</summary>
78
            <version major="1" minor="11"/>
79
            <date day="19" month="8" year="2009"/>
80
            <author login="dlipin"/>
81
            <compatibility semantic="compatible"/>
82
            <description>
83
                <p>
84
                    New operation type - <code>OperationSupport.OperationType.INTERNAL_UPDATE</code> is introduced.
85
                    This operation can be used to find out elements which have updates and
86
                    which the particular element has the dependency on.
87
                </p>
88
            </description>
89
            <class package="org.netbeans.api.autoupdate" name="OperationSupport"/>
90
            <class package="org.netbeans.api.autoupdate" name="OperationContainer"/>
91
            <issue number="141714"/>
92
        </change>
93
74
    </changes>
94
    </changes>
75
95
76
    <!-- Now the surrounding HTML text and document structure: -->
96
    <!-- Now the surrounding HTML text and document structure: -->
(-)a/autoupdate.services/manifest.mf (-1 / +1 lines)
Lines 1-6 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.modules.autoupdate.services
2
OpenIDE-Module: org.netbeans.modules.autoupdate.services
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/autoupdate/services/resources/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/autoupdate/services/resources/Bundle.properties
4
OpenIDE-Module-Specification-Version: 1.10
4
OpenIDE-Module-Specification-Version: 1.11
5
AutoUpdate-Show-In-Client: false
5
AutoUpdate-Show-In-Client: false
6
AutoUpdate-Essential-Module: true
6
AutoUpdate-Essential-Module: true
(-)a/autoupdate.services/src/org/netbeans/api/autoupdate/OperationContainer.java (+11 lines)
Lines 97-102 Link Here
97
    }
97
    }
98
98
99
    /**
99
    /**
100
     * The factory method to construct instance of <code>OperationContainer</code> for install operation
101
     * @return newly constructed instance of <code>OperationContainer</code> for install operation
102
     */
103
    public static OperationContainer<InstallSupport> createForInternalUpdate() {
104
        OperationContainer<InstallSupport> retval =
105
                new OperationContainer<InstallSupport>(OperationContainerImpl.createForInternalUpdate(), new InstallSupport());
106
        retval.getSupportInner ().setContainer(retval);
107
        return retval;
108
    }
109
110
    /**
100
     * The factory method to construct  instance of <code>OperationContainer</code> for install operation
111
     * The factory method to construct  instance of <code>OperationContainer</code> for install operation
101
     * @return newly constructed instance of <code>OperationContainer</code> for install operation
112
     * @return newly constructed instance of <code>OperationContainer</code> for install operation
102
     */
113
     */
(-)a/autoupdate.services/src/org/netbeans/api/autoupdate/OperationSupport.java (+3 lines)
Lines 151-156 Link Here
151
            case CUSTOM_UNINSTALL:
151
            case CUSTOM_UNINSTALL:
152
                impl = OperationSupportImpl.forCustomUninstall ();
152
                impl = OperationSupportImpl.forCustomUninstall ();
153
                break;
153
                break;
154
            case INTERNAL_UPDATE:
155
                impl = OperationSupportImpl.forInternalUpdate ();
156
                break;
154
            default:
157
            default:
155
                assert false : "Unknown OperationSupport for type " + type;
158
                assert false : "Unknown OperationSupport for type " + type;
156
        }
159
        }
(-)a/autoupdate.services/src/org/netbeans/modules/autoupdate/services/ModuleUpdateElementImpl.java (-1 / +1 lines)
Lines 151-157 Link Here
151
    public String getDate () {
151
    public String getDate () {
152
        return date;
152
        return date;
153
    }
153
    }
154
    
154
155
    public String getCategory () {
155
    public String getCategory () {
156
        if (category == null) {
156
        if (category == null) {
157
            category = item.getCategory ();
157
            category = item.getCategory ();
(-)a/autoupdate.services/src/org/netbeans/modules/autoupdate/services/OperationContainerImpl.java (-3 / +14 lines)
Lines 68-73 Link Here
68
    public static OperationContainerImpl<InstallSupport> createForInstall () {
68
    public static OperationContainerImpl<InstallSupport> createForInstall () {
69
        return new OperationContainerImpl<InstallSupport> (OperationType.INSTALL);
69
        return new OperationContainerImpl<InstallSupport> (OperationType.INSTALL);
70
    }
70
    }
71
    public static OperationContainerImpl<InstallSupport> createForInternalUpdate () {
72
        return new OperationContainerImpl<InstallSupport> (OperationType.INTERNAL_UPDATE);
73
    }
71
    public static OperationContainerImpl<InstallSupport> createForUpdate () {
74
    public static OperationContainerImpl<InstallSupport> createForUpdate () {
72
        return new OperationContainerImpl<InstallSupport> (OperationType.UPDATE);
75
        return new OperationContainerImpl<InstallSupport> (OperationType.UPDATE);
73
    }
76
    }
Lines 124-135 Link Here
124
                break;
127
                break;
125
            case INSTALL :
128
            case INSTALL :
126
            case UPDATE :
129
            case UPDATE :
127
            case CUSTOM_INSTALL:
130
            case CUSTOM_INSTALL:            
128
                if (updateUnit.getInstalled () == updateElement) {
131
                if (updateUnit.getInstalled () == updateElement) {
129
                    throw new IllegalArgumentException (updateUnit.getInstalled () +
132
                    throw new IllegalArgumentException (updateUnit.getInstalled () +
130
                            " and " + updateElement + " cannot be same for operation " + type);
133
                            " and " + updateElement + " cannot be same for operation " + type);
131
                }
134
                }
132
                break;
135
                break;
136
            case INTERNAL_UPDATE:
137
                if (updateUnit.getInstalled () != updateElement) {
138
                    throw new IllegalArgumentException (updateUnit.getInstalled () +
139
                            " and " + updateElement + " must be same for operation " + type);
140
                }
141
                break;
133
            default:
142
            default:
134
                assert false : "Unknown type of operation " + type;
143
                assert false : "Unknown type of operation " + type;
135
            }
144
            }
Lines 191-197 Link Here
191
        clearCache ();
200
        clearCache ();
192
        // handle eager modules
201
        // handle eager modules
193
        
202
        
194
        if (type == OperationType.INSTALL || type == OperationType.UPDATE) {
203
        if (type == OperationType.INSTALL || type == OperationType.UPDATE || type==OperationType.INTERNAL_UPDATE) {
195
            Collection<UpdateElement> all = new HashSet<UpdateElement> (operations.size ());
204
            Collection<UpdateElement> all = new HashSet<UpdateElement> (operations.size ());
196
            Collection<ModuleInfo> allModuleInfos = new HashSet<ModuleInfo> (operations.size ());
205
            Collection<ModuleInfo> allModuleInfos = new HashSet<ModuleInfo> (operations.size ());
197
            for (OperationInfo<?> i : operations) {
206
            for (OperationInfo<?> i : operations) {
Lines 219-225 Link Here
219
                for(ModuleInfo mi: infos) {
228
                for(ModuleInfo mi: infos) {
220
                    Set<UpdateElement> reqs = new HashSet<UpdateElement> ();
229
                    Set<UpdateElement> reqs = new HashSet<UpdateElement> ();
221
                    for (Dependency dep : mi.getDependencies ()) {
230
                    for (Dependency dep : mi.getDependencies ()) {
222
                        UpdateElement req = Utilities.handleDependency (dep, Collections.singleton (mi), new HashSet<Dependency> (), false);
231
                        UpdateElement req = Utilities.handleDependency (eagerEl, dep, Collections.singleton (mi), new HashSet<Dependency> (), false);
223
                        if (req != null) {
232
                        if (req != null) {
224
                            reqs.add (req);
233
                            reqs.add (req);
225
                        }
234
                        }
Lines 382-387 Link Here
382
        INSTALL,
391
        INSTALL,
383
        /** Uninstall <code>UpdateElement</code> */
392
        /** Uninstall <code>UpdateElement</code> */
384
        UNINSTALL,
393
        UNINSTALL,
394
        /** Internally update installed <code>UpdateElement</code> without version increase */
395
        INTERNAL_UPDATE,
385
        /** Uninstall <code>UpdateElement</code> on-the-fly */
396
        /** Uninstall <code>UpdateElement</code> on-the-fly */
386
        DIRECT_UNINSTALL,
397
        DIRECT_UNINSTALL,
387
        /** Update installed <code>UpdateElement</code> to newer version. */
398
        /** Update installed <code>UpdateElement</code> to newer version. */
(-)a/autoupdate.services/src/org/netbeans/modules/autoupdate/services/OperationSupportImpl.java (+23 lines)
Lines 79-84 Link Here
79
    private static final OperationSupportImpl FOR_DIRECT_UNINSTALL = new ForDirectUninstall();
79
    private static final OperationSupportImpl FOR_DIRECT_UNINSTALL = new ForDirectUninstall();
80
    private static final OperationSupportImpl FOR_CUSTOM_INSTALL = new ForCustomInstall ();
80
    private static final OperationSupportImpl FOR_CUSTOM_INSTALL = new ForCustomInstall ();
81
    private static final OperationSupportImpl FOR_CUSTOM_UNINSTALL = new ForCustomUninstall ();
81
    private static final OperationSupportImpl FOR_CUSTOM_UNINSTALL = new ForCustomUninstall ();
82
    private static final OperationSupportImpl FOR_INTERNAL_UPDATE = new ForInternalUpdate();
82
    
83
    
83
    private static final Logger LOGGER = Logger.getLogger ("org.netbeans.modules.autoupdate.services.OperationSupportImpl");
84
    private static final Logger LOGGER = Logger.getLogger ("org.netbeans.modules.autoupdate.services.OperationSupportImpl");
84
    
85
    
Lines 109-114 Link Here
109
    public static OperationSupportImpl forCustomUninstall () {
110
    public static OperationSupportImpl forCustomUninstall () {
110
        return FOR_CUSTOM_UNINSTALL;
111
        return FOR_CUSTOM_UNINSTALL;
111
    }
112
    }
113
    public static OperationSupportImpl forInternalUpdate () {
114
        return FOR_INTERNAL_UPDATE;
115
    }
112
    
116
    
113
    public abstract Boolean doOperation(ProgressHandle progress/*or null*/, OperationContainer<?> container) throws OperationException;
117
    public abstract Boolean doOperation(ProgressHandle progress/*or null*/, OperationContainer<?> container) throws OperationException;
114
    public abstract void doCancel () throws OperationException;
118
    public abstract void doCancel () throws OperationException;
Lines 551-556 Link Here
551
        }
555
        }
552
        
556
        
553
    }
557
    }
558
559
    private static class ForInternalUpdate extends OperationSupportImpl {
560
        public synchronized Boolean doOperation(ProgressHandle progress,
561
                OperationContainer container) throws OperationException {
562
            throw new UnsupportedOperationException("Not supported yet.");
563
        }
564
        public void doCancel () throws OperationException {
565
            assert false : "Not supported yet";
566
        }
567
568
        public void doRestart (Restarter restarter, ProgressHandle progress) throws OperationException {
569
            throw new UnsupportedOperationException ("Not supported yet.");
570
        }
571
572
        public void doRestartLater (Restarter restarter) {
573
            throw new UnsupportedOperationException ("Not supported yet.");
574
        }
575
576
    }
554
    
577
    
555
    private static class ForCustomInstall extends OperationSupportImpl {
578
    private static class ForCustomInstall extends OperationSupportImpl {
556
        private Collection<UpdateElement> affectedModules = null;
579
        private Collection<UpdateElement> affectedModules = null;
(-)a/autoupdate.services/src/org/netbeans/modules/autoupdate/services/OperationValidator.java (-1 / +15 lines)
Lines 66-71 Link Here
66
 */
66
 */
67
abstract class OperationValidator {
67
abstract class OperationValidator {
68
    private final static OperationValidator FOR_INSTALL = new InstallValidator();
68
    private final static OperationValidator FOR_INSTALL = new InstallValidator();
69
    private final static OperationValidator FOR_INTERNAL_UPDATE = new InternalUpdateValidator();
69
    private final static OperationValidator FOR_UNINSTALL = new UninstallValidator();
70
    private final static OperationValidator FOR_UNINSTALL = new UninstallValidator();
70
    private final static OperationValidator FOR_UPDATE = new UpdateValidator();
71
    private final static OperationValidator FOR_UPDATE = new UpdateValidator();
71
    private final static OperationValidator FOR_ENABLE = new EnableValidator();
72
    private final static OperationValidator FOR_ENABLE = new EnableValidator();
Lines 86-91 Link Here
86
        case INSTALL:
87
        case INSTALL:
87
            isValid = FOR_INSTALL.isValidOperationImpl(updateUnit, updateElement);
88
            isValid = FOR_INSTALL.isValidOperationImpl(updateUnit, updateElement);
88
            break;
89
            break;
90
        case INTERNAL_UPDATE:
91
            isValid = FOR_INTERNAL_UPDATE.isValidOperationImpl(updateUnit, updateElement);
92
            break;
89
        case DIRECT_UNINSTALL:
93
        case DIRECT_UNINSTALL:
90
        case UNINSTALL:
94
        case UNINSTALL:
91
            isValid = FOR_UNINSTALL.isValidOperationImpl(updateUnit, updateElement);
95
            isValid = FOR_UNINSTALL.isValidOperationImpl(updateUnit, updateElement);
Lines 141-146 Link Here
141
        case CUSTOM_UNINSTALL:
145
        case CUSTOM_UNINSTALL:
142
            retval = FOR_CUSTOM_UNINSTALL.getRequiredElementsImpl(updateElement, moduleInfos, brokenDependencies);
146
            retval = FOR_CUSTOM_UNINSTALL.getRequiredElementsImpl(updateElement, moduleInfos, brokenDependencies);
143
            break;
147
            break;
148
        case INTERNAL_UPDATE:
149
            retval = FOR_INTERNAL_UPDATE.getRequiredElementsImpl(updateElement, moduleInfos, brokenDependencies);
150
            break;
144
        default:
151
        default:
145
            assert false;
152
            assert false;
146
        }
153
        }
Lines 164-169 Link Here
164
                break;
171
                break;
165
            case INSTALL :
172
            case INSTALL :
166
            case UPDATE :
173
            case UPDATE :
174
            case INTERNAL_UPDATE:
167
                getRequiredElements (type, updateElement, moduleInfos, broken);
175
                getRequiredElements (type, updateElement, moduleInfos, broken);
168
                break;
176
                break;
169
            case UNINSTALL :
177
            case UNINSTALL :
Lines 184-190 Link Here
184
    abstract List<UpdateElement> getRequiredElementsImpl (UpdateElement uElement,
192
    abstract List<UpdateElement> getRequiredElementsImpl (UpdateElement uElement,
185
            List<ModuleInfo> moduleInfos,
193
            List<ModuleInfo> moduleInfos,
186
            Collection<String> brokenDependencies);
194
            Collection<String> brokenDependencies);
187
    
195
196
    private static class InternalUpdateValidator extends InstallValidator {
197
        @Override
198
        boolean isValidOperationImpl(UpdateUnit unit, UpdateElement uElement) {
199
            return unit.getInstalled()!=null && unit.getInstalled() == uElement;
200
        }
201
    }
188
    private static class InstallValidator extends OperationValidator {
202
    private static class InstallValidator extends OperationValidator {
189
        boolean isValidOperationImpl(UpdateUnit unit, UpdateElement uElement) {
203
        boolean isValidOperationImpl(UpdateUnit unit, UpdateElement uElement) {
190
            return unit.getInstalled() == null && containsElement (uElement, unit);
204
            return unit.getInstalled() == null && containsElement (uElement, unit);
(-)a/autoupdate.services/src/org/netbeans/modules/autoupdate/services/Utilities.java (-71 / +25 lines)
Lines 79-85 Link Here
79
import java.util.prefs.Preferences;
79
import java.util.prefs.Preferences;
80
import org.netbeans.Module;
80
import org.netbeans.Module;
81
import org.netbeans.ModuleManager;
81
import org.netbeans.ModuleManager;
82
import org.netbeans.api.autoupdate.InstallSupport;
83
import org.netbeans.api.autoupdate.OperationContainer;
84
import org.netbeans.api.autoupdate.OperationContainer.OperationInfo;
82
import org.netbeans.api.autoupdate.UpdateElement;
85
import org.netbeans.api.autoupdate.UpdateElement;
86
import org.netbeans.api.autoupdate.UpdateManager;
83
import org.netbeans.api.autoupdate.UpdateUnit;
87
import org.netbeans.api.autoupdate.UpdateUnit;
84
import org.netbeans.core.startup.Main;
88
import org.netbeans.core.startup.Main;
85
import org.netbeans.core.startup.TopLogging;
89
import org.netbeans.core.startup.TopLogging;
Lines 474-480 Link Here
474
            Set<Dependency> deps = new HashSet<Dependency> (((ModuleUpdateElementImpl) el).getModuleInfo ().getDependencies ());
478
            Set<Dependency> deps = new HashSet<Dependency> (((ModuleUpdateElementImpl) el).getModuleInfo ().getDependencies ());
475
            Set<ModuleInfo> availableInfos = new HashSet<ModuleInfo> (infos);
479
            Set<ModuleInfo> availableInfos = new HashSet<ModuleInfo> (infos);
476
            Set<Dependency> newones;
480
            Set<Dependency> newones;
477
            while (! (newones = processDependencies (deps, retval, availableInfos, brokenDependencies)).isEmpty ()) {
481
482
            while (! (newones = processDependencies (deps, retval, availableInfos, brokenDependencies, element)).isEmpty ()) {
478
                deps = newones;
483
                deps = newones;
479
            }
484
            }
480
            
485
            
Lines 570-576 Link Here
570
                                    Set<Dependency> deps = new HashSet<Dependency> (tryUpdated.getDependencies ());
575
                                    Set<Dependency> deps = new HashSet<Dependency> (tryUpdated.getDependencies ());
571
                                    Set<ModuleInfo> availableInfos = new HashSet<ModuleInfo> (forInstall);
576
                                    Set<ModuleInfo> availableInfos = new HashSet<ModuleInfo> (forInstall);
572
                                    Set<Dependency> newones;
577
                                    Set<Dependency> newones;
573
                                    while (! (newones = processDependencies (deps, moreRequested, availableInfos, brokenDependencies)).isEmpty ()) {
578
                                    while (! (newones = processDependencies (deps, moreRequested, availableInfos, brokenDependencies, tryUE)).isEmpty ()) {
574
                                        deps = newones;
579
                                        deps = newones;
575
                                    }
580
                                    }
576
                                    moreRequested.add (tryUE);
581
                                    moreRequested.add (tryUE);
Lines 587-608 Link Here
587
    private static Set<Dependency> processDependencies (final Set<Dependency> original,
592
    private static Set<Dependency> processDependencies (final Set<Dependency> original,
588
            Set<UpdateElement> retval,
593
            Set<UpdateElement> retval,
589
            Set<ModuleInfo> availableInfos,
594
            Set<ModuleInfo> availableInfos,
590
            Set<Dependency> brokenDependencies) {
595
            Set<Dependency> brokenDependencies,
596
            UpdateElement el) {
591
        Set<Dependency> res = new HashSet<Dependency> ();
597
        Set<Dependency> res = new HashSet<Dependency> ();
592
        for (Dependency dep : original) {
598
        for (Dependency dep : original) {
593
            UpdateElement req = handleDependency (dep, availableInfos, brokenDependencies, true);
599
            UpdateElement req = handleDependency (el, dep, availableInfos, brokenDependencies, true);
594
            if (req != null) {
600
            if (req != null) {
595
                ModuleUpdateElementImpl reqM = (ModuleUpdateElementImpl) Trampoline.API.impl (req);
601
                ModuleUpdateElementImpl reqM = (ModuleUpdateElementImpl) Trampoline.API.impl (req);
596
                availableInfos.add (reqM.getModuleInfo ());
602
                availableInfos.add (reqM.getModuleInfo ());
597
                retval.add (req);
603
                retval.add (req);
598
                res.addAll (reqM.getModuleInfo ().getDependencies ());
604
                res.addAll (reqM.getModuleInfo ().getDependencies ());                
599
            }
605
            }
600
        }
606
        }
601
        res.removeAll (original);
607
        res.removeAll (original);
602
        return res;
608
        return res;
603
    }
609
    }
604
    
610
    
605
    public static UpdateElement handleDependency (Dependency dep,
611
    public static UpdateElement handleDependency (UpdateElement el,
612
            Dependency dep,
606
            Collection<ModuleInfo> availableInfos,
613
            Collection<ModuleInfo> availableInfos,
607
            Set<Dependency> brokenDependencies,
614
            Set<Dependency> brokenDependencies,
608
            boolean aggressive) {
615
            boolean aggressive) {
Lines 621-685 Link Here
621
                break;
628
                break;
622
            case Dependency.TYPE_MODULE :
629
            case Dependency.TYPE_MODULE :
623
                UpdateUnit u = DependencyAggregator.getRequested (dep);
630
                UpdateUnit u = DependencyAggregator.getRequested (dep);
624
                
625
626
                //////////////////////////////////
627
                /*
628
                boolean matched = false;
629
                if (u == null) {
630
                    // last chance
631
                    for (ModuleInfo m : availableInfos) {
632
                        if (DependencyChecker.checkDependencyModule (dep, m)) {
633
                            matched = true;
634
                            break;
635
                        }
636
                    }
637
                    if (! matched) {
638
                        brokenDependencies.add (dep);
639
                    }
640
                } else {
641
                    if (u.getInstalled () != null) {
642
                        UpdateElementImpl reqElImpl = Trampoline.API.impl (u.getInstalled ());
643
                        matched = DependencyChecker.checkDependencyModule (dep, ((ModuleUpdateElementImpl) reqElImpl).getModuleInfo ());
644
                    }
645
                    if (! matched) {
646
                        // first chance
647
                        for (ModuleInfo m : availableInfos) {
648
                            if (DependencyChecker.checkDependencyModule (dep, m)) {
649
                                matched = true;
650
                                break;
651
                            }
652
                        }
653
                        if (! matched) {
654
                            UpdateElement reqEl = u.getAvailableUpdates ().isEmpty () ? null : u.getAvailableUpdates ().get (0);
655
                            if (reqEl == null) {
656
                                for (ModuleInfo m : availableInfos) {
657
                                    if (DependencyChecker.checkDependencyModule (dep, m)) {
658
                                        matched = true;
659
                                        break;
660
                                    }
661
                                }
662
                                if (! matched) {
663
                                    brokenDependencies.add (dep);
664
                                }
665
                            } else {
666
                                UpdateElementImpl reqElImpl = Trampoline.API.impl (reqEl);
667
                                ModuleUpdateElementImpl reqModuleImpl = (ModuleUpdateElementImpl) reqElImpl;
668
                                ModuleInfo info = reqModuleImpl.getModuleInfo ();
669
                                if (DependencyChecker.checkDependencyModule (dep, info)) {
670
                                    if (! availableInfos.contains (info)) {
671
                                        requested = reqEl;
672
                                    }
673
                                } else {
674
                                    brokenDependencies.add (dep);
675
                                }
676
                            }
677
                        }
678
                    }
679
                }
680
                */
681
                //////////////////////////////////
682
                
683
                boolean updateMatched = false;
631
                boolean updateMatched = false;
684
                boolean installMatched = false;
632
                boolean installMatched = false;
685
                boolean availableMatched = false;
633
                boolean availableMatched = false;
Lines 700-708 Link Here
700
                    }
648
                    }
701
649
702
                    if (u.getInstalled() != null) {
650
                    if (u.getInstalled() != null) {
703
                            UpdateElementImpl reqElImpl = Trampoline.API.impl(u.getInstalled());
651
                        UpdateElementImpl reqElImpl = Trampoline.API.impl(u.getInstalled());
704
                            installMatched = DependencyChecker.checkDependencyModule(dep, ((ModuleUpdateElementImpl) reqElImpl).getModuleInfo());
652
                        installMatched = DependencyChecker.checkDependencyModule(dep, ((ModuleUpdateElementImpl) reqElImpl).getModuleInfo());
705
                    }                    
653
                    }                 
706
                }
654
                }
707
655
708
                for (ModuleInfo m : availableInfos) {
656
                for (ModuleInfo m : availableInfos) {
Lines 712-726 Link Here
712
                    }
660
                    }
713
                }
661
                }
714
                if(updateMatched && installMatched && !aggressive) {
662
                if(updateMatched && installMatched && !aggressive) {
715
                    requested = null;
663
                    requested = null;                    
664
                }
665
                if (updateMatched && installMatched && aggressive) {
666
                    if (requested.getUpdateUnit().getType().equals(UpdateManager.TYPE.KIT_MODULE)) {
667
                        requested = null;                        
668
                    } else if (Trampoline.API.impl(el).isEager() &&
669
                            !el.getUpdateUnit().getType().equals(UpdateManager.TYPE.KIT_MODULE)) {
670
                        requested = null;                        
671
                    }
716
                }
672
                }
717
                
673
                
718
                if (!installMatched && !availableMatched && !updateMatched) {
674
                if (!installMatched && !availableMatched && !updateMatched) {
719
                    brokenDependencies.add(dep);
675
                    brokenDependencies.add(dep);
720
                }
676
                }
721
                
722
677
723
                //////////////////////////////////
724
                break;
678
                break;
725
            case Dependency.TYPE_REQUIRES :
679
            case Dependency.TYPE_REQUIRES :
726
            case Dependency.TYPE_NEEDS :
680
            case Dependency.TYPE_NEEDS :
(-)a/autoupdate.ui/manifest.mf (-1 / +1 lines)
Lines 3-8 Link Here
3
OpenIDE-Module-Install: org/netbeans/modules/autoupdate/ui/actions/Installer.class
3
OpenIDE-Module-Install: org/netbeans/modules/autoupdate/ui/actions/Installer.class
4
OpenIDE-Module-Layer: org/netbeans/modules/autoupdate/ui/resources/layer.xml
4
OpenIDE-Module-Layer: org/netbeans/modules/autoupdate/ui/resources/layer.xml
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/autoupdate/ui/resources/Bundle.properties
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/autoupdate/ui/resources/Bundle.properties
6
OpenIDE-Module-Specification-Version: 1.8
6
OpenIDE-Module-Specification-Version: 1.9
7
AutoUpdate-Show-In-Client: false
7
AutoUpdate-Show-In-Client: false
8
AutoUpdate-Essential-Module: true
8
AutoUpdate-Essential-Module: true
(-)a/autoupdate.ui/nbproject/project.xml (-1 / +1 lines)
Lines 28-34 Link Here
28
                    <build-prerequisite/>
28
                    <build-prerequisite/>
29
                    <compile-dependency/>
29
                    <compile-dependency/>
30
                    <run-dependency>
30
                    <run-dependency>
31
                        <specification-version>1.1</specification-version>
31
                        <specification-version>1.11</specification-version>
32
                    </run-dependency>
32
                    </run-dependency>
33
                </dependency>
33
                </dependency>
34
                <dependency>
34
                <dependency>
(-)a/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/Bundle.properties (+2 lines)
Lines 190-192 Link Here
190
UnitTab_Splitter_DefaultDividerLocation=390
190
UnitTab_Splitter_DefaultDividerLocation=390
191
#NOI18N
191
#NOI18N
192
SettingsTab_Splitter_DefaultDividerLocation=390
192
SettingsTab_Splitter_DefaultDividerLocation=390
193
Unit_InternalUpdates_Version=(Internal Updates)
194
Unit_InternalUpdates_Title=Internal Updates
(-)a/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/Containers.java (+15 lines)
Lines 53-58 Link Here
53
 */
53
 */
54
public class Containers {
54
public class Containers {
55
    private static Reference<OperationContainer<InstallSupport>> INSTALL;
55
    private static Reference<OperationContainer<InstallSupport>> INSTALL;
56
    private static Reference<OperationContainer<InstallSupport>> INTERNAL_UPDATE;
56
    private static Reference<OperationContainer<InstallSupport>> UPDATE;
57
    private static Reference<OperationContainer<InstallSupport>> UPDATE;
57
    private static Reference<OperationContainer<InstallSupport>> INSTALL_FOR_NBMS;   
58
    private static Reference<OperationContainer<InstallSupport>> INSTALL_FOR_NBMS;   
58
    private static Reference<OperationContainer<InstallSupport>> UPDATE_FOR_NBMS;
59
    private static Reference<OperationContainer<InstallSupport>> UPDATE_FOR_NBMS;
Lines 74-79 Link Here
74
            forDisable().removeAll();
75
            forDisable().removeAll();
75
            forCustomInstall().removeAll();
76
            forCustomInstall().removeAll();
76
            forCustomUninstall().removeAll();
77
            forCustomUninstall().removeAll();
78
            forInternalUpdate().removeAll();
77
        } catch (NullPointerException npe) {
79
        } catch (NullPointerException npe) {
78
            // doesn't matter, can ignore that
80
            // doesn't matter, can ignore that
79
        }
81
        }
Lines 197-200 Link Here
197
            return container;
199
            return container;
198
        }        
200
        }        
199
    }
201
    }
202
    public static OperationContainer<InstallSupport> forInternalUpdate () {
203
        synchronized (Containers.class) {
204
            OperationContainer<InstallSupport> container = null;
205
            if (INTERNAL_UPDATE != null) {
206
                container = INTERNAL_UPDATE.get ();
207
            }
208
            if(container == null) {
209
                container = OperationContainer.createForInternalUpdate();
210
                INTERNAL_UPDATE = new WeakReference<OperationContainer<InstallSupport>> (container);
211
            }
212
            return container;
213
        }
214
    }
200
}
215
}
(-)a/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/Unit.java (-3 / +88 lines)
Lines 44-51 Link Here
44
import java.text.Collator;
44
import java.text.Collator;
45
import java.text.DateFormat;
45
import java.text.DateFormat;
46
import java.text.ParseException;
46
import java.text.ParseException;
47
import java.util.ArrayList;
47
import java.util.Date;
48
import java.util.Date;
48
import java.util.Iterator;
49
import java.util.Iterator;
50
import java.util.List;
49
import java.util.Locale;
51
import java.util.Locale;
50
import java.util.Set;
52
import java.util.Set;
51
import java.util.logging.Level;
53
import java.util.logging.Level;
Lines 59-64 Link Here
59
import org.netbeans.api.autoupdate.UpdateUnitProvider.CATEGORY;
61
import org.netbeans.api.autoupdate.UpdateUnitProvider.CATEGORY;
60
import org.netbeans.modules.autoupdate.ui.UnitCategoryTableModel.Type;
62
import org.netbeans.modules.autoupdate.ui.UnitCategoryTableModel.Type;
61
import org.openide.modules.SpecificationVersion;
63
import org.openide.modules.SpecificationVersion;
64
import org.openide.util.NbBundle;
62
import org.openide.util.RequestProcessor;
65
import org.openide.util.RequestProcessor;
63
66
64
/**
67
/**
Lines 395-406 Link Here
395
        }
398
        }
396
        
399
        
397
    }
400
    }
401
402
    public static class InternalUpdate extends Unit.Update  {
403
        
404
        private List <UpdateUnit> internalUpdates;        
405
406
        public InternalUpdate(UpdateUnit updateUnit, String categoryName, boolean isNbms) {
407
            super(updateUnit, false, categoryName);
408
        }
409
410
        public List <UpdateUnit> getUpdateUnits() {
411
            if(internalUpdates == null) {
412
                internalUpdates = new ArrayList <UpdateUnit>();
413
            }
414
            return internalUpdates;
415
        }
416
        public UpdateUnit getVisibleUnit() {
417
            return updateUnit;
418
        }
419
        
420
        @Override
421
        public UpdateElement getRelevantElement() {
422
            return updateUnit.getInstalled();
423
        }
424
425
        @Override
426
        public boolean isMarked() {
427
            OperationContainer container = Containers.forUpdate ();
428
            for(UpdateUnit invisible : getUpdateUnits()) {
429
                if(!container.contains(invisible.getAvailableUpdates().get(0))) {
430
                    return false;
431
                }
432
            }
433
            return true;
434
        }
435
436
        @Override
437
        public String getAvailableVersion () {
438
            return getInstalledVersion() + " " + getBundle("Unit_InternalUpdates_Version");
439
        }
440
        @Override
441
        public void setMarked(boolean marked) {
442
            assert marked != isMarked();
443
            OperationContainer container = Containers.forUpdate();
444
            for (UpdateUnit invisible : getUpdateUnits()) {
445
                if (marked) {
446
                    if (container.canBeAdded(invisible, invisible.getAvailableUpdates().get(0))) {
447
                        container.add(invisible, invisible.getAvailableUpdates().get(0));
448
                    }
449
                } else {
450
                    container.remove(invisible.getAvailableUpdates().get(0));
451
                }
452
            }
453
        }
454
455
        @Override
456
        public int getCompleteSize() {
457
            if (size == -1) {
458
                size = 0;
459
                for (UpdateUnit u : getUpdateUnits()) {
460
                    size += u.getAvailableUpdates().get(0).getDownloadSize();
461
                }
462
463
            }
464
            return size;
465
        }
466
467
        public String getSize () {
468
            return Utilities.getDownloadSizeAsString (getCompleteSize());
469
        }
470
471
        @Override
472
        public Type getModelType() {
473
            return Type.UPDATE;
474
        }
475
        
476
    }
398
    
477
    
399
    public static class Update extends Unit {
478
    public static class Update extends Unit {
400
        private UpdateElement installEl = null;
479
        private UpdateElement installEl = null;
401
        private UpdateElement updateEl = null;
480
        private UpdateElement updateEl = null;
402
        private boolean isNbms;
481
        private boolean isNbms;
403
        private int size = -1;
482
        protected int size = -1;
404
        
483
        
405
        public Update (UpdateUnit unit, boolean isNbms,String categoryName) {
484
        public Update (UpdateUnit unit, boolean isNbms,String categoryName) {
406
            super (categoryName);
485
            super (categoryName);
Lines 408-415 Link Here
408
            this.updateUnit = unit;
487
            this.updateUnit = unit;
409
            this.installEl = unit.getInstalled ();
488
            this.installEl = unit.getInstalled ();
410
            assert installEl != null : "Updateable UpdateUnit " + unit + " has Installed UpdateElement.";
489
            assert installEl != null : "Updateable UpdateUnit " + unit + " has Installed UpdateElement.";
411
            this.updateEl = unit.getAvailableUpdates ().get (0);
490
            if(unit.getAvailableUpdates().size() > 0) {
412
            assert updateEl != null : "Updateable UpdateUnit " + unit + " has UpdateElement for update.";
491
                this.updateEl = unit.getAvailableUpdates ().get (0);
492
                assert updateEl != null : "Updateable UpdateUnit " + unit + " has UpdateElement for update.";
493
            }
413
            initState();
494
            initState();
414
        }
495
        }
415
        
496
        
Lines 599-603 Link Here
599
            return updateEl.getSourceCategory();
680
            return updateEl.getSourceCategory();
600
        }
681
        }
601
    }
682
    }
683
684
    private static String getBundle (String key) {
685
        return NbBundle.getMessage (Unit.class, key);
686
    }
602
    
687
    
603
}
688
}
(-)a/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/UnitDetails.java (-9 / +101 lines)
Lines 45-50 Link Here
45
import java.io.CharConversionException;
45
import java.io.CharConversionException;
46
import java.net.URL;
46
import java.net.URL;
47
import java.util.ArrayList;
47
import java.util.ArrayList;
48
import java.util.HashSet;
48
import java.util.LinkedHashSet;
49
import java.util.LinkedHashSet;
49
import java.util.List;
50
import java.util.List;
50
import java.util.Set;
51
import java.util.Set;
Lines 56-61 Link Here
56
import org.netbeans.api.autoupdate.OperationContainer.OperationInfo;
57
import org.netbeans.api.autoupdate.OperationContainer.OperationInfo;
57
import org.netbeans.api.autoupdate.UpdateElement;
58
import org.netbeans.api.autoupdate.UpdateElement;
58
import org.netbeans.api.autoupdate.UpdateManager;
59
import org.netbeans.api.autoupdate.UpdateManager;
60
import org.netbeans.api.autoupdate.UpdateUnit;
59
import org.netbeans.api.autoupdate.UpdateUnitProvider.CATEGORY;
61
import org.netbeans.api.autoupdate.UpdateUnitProvider.CATEGORY;
60
import org.openide.util.NbBundle;
62
import org.openide.util.NbBundle;
61
import org.openide.xml.XMLUtil;
63
import org.openide.xml.XMLUtil;
Lines 108-123 Link Here
108
                    Unit.Update uu = ((Unit.Update) u);
110
                    Unit.Update uu = ((Unit.Update) u);
109
                    text += "<b>" + getBundle ("UnitDetails_Plugin_InstalledVersion") + "</b>" + uu.getInstalledVersion () + "<br>"; // NOI18N
111
                    text += "<b>" + getBundle ("UnitDetails_Plugin_InstalledVersion") + "</b>" + uu.getInstalledVersion () + "<br>"; // NOI18N
110
                    text += "<b>" + getBundle ("UnitDetails_Plugin_AvailableVersion") + "</b>" + uu.getAvailableVersion () + "<br>"; // NOI18N
112
                    text += "<b>" + getBundle ("UnitDetails_Plugin_AvailableVersion") + "</b>" + uu.getAvailableVersion () + "<br>"; // NOI18N
113
                    if(!(u instanceof Unit.InternalUpdate)) {
114
                    OperationContainer<InstallSupport> container = OperationContainer.createForUpdate();
111
115
112
                    OperationContainer<InstallSupport> container = OperationContainer.createForUpdate();
116
                    container.add(u.updateUnit, uu.getRelevantElement());
113
                    OperationInfo<InstallSupport> info = container.add(u.updateUnit, uu.getRelevantElement());
114
                    Set<UpdateElement> reqs = info.getRequiredElements();
115
                    Set<UpdateElement> required = new LinkedHashSet<UpdateElement> ();
117
                    Set<UpdateElement> required = new LinkedHashSet<UpdateElement> ();
116
                    required.addAll(reqs);
118
117
                    for(OperationInfo i : container.listAll()) {
119
                    for (OperationInfo<InstallSupport> info : container.listAll()) {
120
                            Set<UpdateElement> reqs = info.getRequiredElements();
121
                            for (UpdateElement req : reqs) {
122
                                if (req.getUpdateUnit().getInstalled() != null) {
123
                                    for (UpdateElement e : OperationContainer.createForUpdate().add(req).getRequiredElements()) {
124
                                        if (!required.contains(e)) {
125
                                            required.add(e);
126
                                        }
127
                                    }
128
                                } else {
129
                                    //OperationContainer.createForInstall().
130
                                }
131
                            }
132
                            required.addAll(reqs);
133
                    }
134
                    
135
                    for(OperationInfo<InstallSupport> i : container.listAll()) {
118
                        if(!required.contains(i.getUpdateElement()) && !i.getUpdateUnit().equals(u.updateUnit)) {
136
                        if(!required.contains(i.getUpdateElement()) && !i.getUpdateUnit().equals(u.updateUnit)) {
119
                            required.add(i.getUpdateElement());
137
                            required.add(i.getUpdateElement());
120
                        }
138
                        }                        
121
                    }
139
                    }
122
140
123
141
Lines 128-135 Link Here
128
                                visibleRequirements.add(ue);
146
                                visibleRequirements.add(ue);
129
                            }
147
                            }
130
                        }
148
                        }
131
                        OperationContainer containerForVisibleUpdate = OperationContainer.createForUpdate();
149
                        OperationContainer<InstallSupport> containerForVisibleUpdate = OperationContainer.createForUpdate();
132
                        OperationContainer containerForVisibleInstall = OperationContainer.createForInstall();
150
                        OperationContainer<InstallSupport> containerForVisibleInstall = OperationContainer.createForInstall();
133
                        List<OperationInfo<InstallSupport>> infoList = new ArrayList<OperationInfo<InstallSupport>>();
151
                        List<OperationInfo<InstallSupport>> infoList = new ArrayList<OperationInfo<InstallSupport>>();
134
                        for (UpdateElement ue : visibleRequirements) {
152
                        for (UpdateElement ue : visibleRequirements) {
135
                            if (containerForVisibleUpdate.canBeAdded(ue.getUpdateUnit(), ue)) {
153
                            if (containerForVisibleUpdate.canBeAdded(ue.getUpdateUnit(), ue)) {
Lines 166-171 Link Here
166
                            }
184
                            }
167
                        }
185
                        }
168
                    }
186
                    }
187
                    } else {
188
                        Unit.InternalUpdate iu = (Unit.InternalUpdate) u;
189
                        desc = "";
190
                        
191
                        OperationContainer <InstallSupport> updContainer = OperationContainer.createForUpdate();
192
                        for(UpdateUnit inv : iu.getUpdateUnits()) {
193
                            updContainer.add(inv.getAvailableUpdates().get(0));
194
                        }
195
196
                        OperationContainer <InstallSupport> reiContainer = OperationContainer.createForInternalUpdate();
197
                        reiContainer.add(iu.getRelevantElement());
198
                        Set<UpdateElement> internalUpdates = new HashSet <UpdateElement> ();
199
200
                        for (OperationInfo<InstallSupport> info : updContainer.listAll()) {
201
                            internalUpdates.add(info.getUpdateElement());
202
                            for(UpdateElement r: info.getRequiredElements()) {
203
                                if(r.getUpdateUnit().getInstalled()!=null) {
204
                                    internalUpdates.add(r);
205
                                }
206
                                
207
                            }
208
                        }
209
                        for (OperationInfo<InstallSupport> info : reiContainer.listAll()) {
210
                            if(!info.getUpdateElement().equals(iu.updateUnit.getInstalled())) {
211
                                internalUpdates.add(info.getUpdateElement());
212
                            }
213
                            for(UpdateElement r: info.getRequiredElements()) {
214
                                if(r.getUpdateUnit().getInstalled()!=null) {
215
                                    internalUpdates.add(r);
216
                                }
217
                            }
218
                        }
219
                    
220
221
                        /*
222
                        for(UpdateElement e: container.add(u.getRelevantElement()).getRequiredElements()) {
223
                            if(!internalUpdates.contains(e.getUpdateUnit())) {
224
                                internalUpdates.add(e.getUpdateUnit());
225
                            }
226
                        }
227
                        for(OperationInfo <InstallSupport> info: container.listAll()) {
228
                            if(info.getUpdateUnit()!=u.updateUnit && !internalUpdates.contains(info.getUpdateUnit())) {
229
                                internalUpdates.add(info.getUpdateUnit());
230
                            }
231
                        }
232
                         */
233
                        /*
234
                        
235
236
                        for (UpdateUnit upd : iu.getUpdateUnits()) {                            
237
                            UpdateElement ue = upd.getAvailableUpdates().get(0);
238
                            for(UpdateElement e : OperationContainer.createForUpdate().add(ue).getRequiredElements()) {
239
                                if(!internalUpdates.contains(e.getUpdateUnit())) {
240
                                    internalUpdates.add(e.getUpdateUnit());
241
                                }
242
                            }
243
                        }*/
244
245
                        for (UpdateElement ue : internalUpdates) {
246
                            //UpdateElement ue = upd.getUgetAvailableUpdates().get(0);
247
                            desc += "&nbsp;&nbsp;&nbsp;&nbsp;" +
248
                                    ue.getDisplayName();
249
                            if (ue.getUpdateUnit().getInstalled() != null) {
250
                                desc += " [" + ue.getUpdateUnit().getInstalled().getSpecificationVersion() + "->";
251
                                } else {
252
                                desc += " <span color=\"red\">new!</span> [";
253
                            }
254
255
                            
256
                            desc += ue.getUpdateUnit().getAvailableUpdates().get(0).getSpecificationVersion();
257
                            desc += "]";
258
                            desc += "<br>";
259
                        }
260
                    }
169
                } else {
261
                } else {
170
                    text += "<b>" + getBundle ("UnitDetails_Plugin_Version") + "</b>" + u.getDisplayVersion() + "<br>"; // NOI18N
262
                    text += "<b>" + getBundle ("UnitDetails_Plugin_Version") + "</b>" + u.getDisplayVersion() + "<br>"; // NOI18N
171
                }
263
                }
Lines 193-199 Link Here
193
                    text += u.getDescription ();
285
                    text += u.getDescription ();
194
                }
286
                }
195
                if(desc!=null && desc.length() > 0) {
287
                if(desc!=null && desc.length() > 0) {
196
                    text += "<br><br><h4>" + "Internal Updates" + "</h4>"; // NOI18N
288
                    text += "<br><br><h4>" + getBundle ("UnitDetails_Plugin_Title") + "</h4>"; // NOI18N
197
                    text += desc;
289
                    text += desc;
198
                }
290
                }
199
            } catch (CharConversionException e) {
291
            } catch (CharConversionException e) {
(-)a/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/UpdateTableModel.java (-2 / +2 lines)
Lines 86-92 Link Here
86
            return ;
86
            return ;
87
        }
87
        }
88
        super.setValueAt(anValue, row, col);
88
        super.setValueAt(anValue, row, col);
89
        Unit.Update u = (Unit.Update) getUnitAtRow(row);
89
        Unit u = getUnitAtRow(row);
90
        assert anValue instanceof Boolean : anValue + " must be instanceof Boolean.";
90
        assert anValue instanceof Boolean : anValue + " must be instanceof Boolean.";
91
        boolean beforeMarked = u.isMarked();
91
        boolean beforeMarked = u.isMarked();
92
        u.setMarked(!beforeMarked);
92
        u.setMarked(!beforeMarked);
Lines 102-108 Link Here
102
    public Object getValueAt(int row, int col) {
102
    public Object getValueAt(int row, int col) {
103
        Object res = null;
103
        Object res = null;
104
        if (isExpansionControlAtRow(row)) return "";//NOI18N
104
        if (isExpansionControlAtRow(row)) return "";//NOI18N
105
        Unit.Update u = (Unit.Update) getUnitAtRow(row);
105
        Unit u = getUnitAtRow(row);
106
        switch (col) {
106
        switch (col) {
107
        case 0 :
107
        case 0 :
108
            res = u.isMarked() ? Boolean.TRUE : Boolean.FALSE;
108
            res = u.isMarked() ? Boolean.TRUE : Boolean.FALSE;
(-)a/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/Utilities.java (-1 / +144 lines)
Lines 52-59 Link Here
52
import java.util.Collections;
52
import java.util.Collections;
53
import java.util.Comparator;
53
import java.util.Comparator;
54
import java.util.Enumeration;
54
import java.util.Enumeration;
55
import java.util.HashMap;
55
import java.util.HashSet;
56
import java.util.HashSet;
56
import java.util.List;
57
import java.util.List;
58
import java.util.Set;
57
import java.util.StringTokenizer;
59
import java.util.StringTokenizer;
58
import java.util.logging.Level;
60
import java.util.logging.Level;
59
import java.util.logging.Logger;
61
import java.util.logging.Logger;
Lines 63-68 Link Here
63
import javax.swing.JLabel;
65
import javax.swing.JLabel;
64
import javax.swing.SwingConstants;
66
import javax.swing.SwingConstants;
65
import javax.swing.SwingUtilities;
67
import javax.swing.SwingUtilities;
68
import org.netbeans.api.autoupdate.InstallSupport;
69
import org.netbeans.api.autoupdate.OperationContainer;
70
import org.netbeans.api.autoupdate.OperationContainer.OperationInfo;
66
import org.netbeans.api.autoupdate.UpdateElement;
71
import org.netbeans.api.autoupdate.UpdateElement;
67
import org.netbeans.api.autoupdate.UpdateManager;
72
import org.netbeans.api.autoupdate.UpdateManager;
68
import org.netbeans.api.autoupdate.UpdateUnit;
73
import org.netbeans.api.autoupdate.UpdateUnit;
Lines 134-139 Link Here
134
        };
139
        };
135
140
136
    public static List<UnitCategory> makeUpdateCategories (final List<UpdateUnit> units, boolean isNbms) {
141
    public static List<UnitCategory> makeUpdateCategories (final List<UpdateUnit> units, boolean isNbms) {
142
        long start = System.currentTimeMillis();
137
        if (! isNbms && ! units.isEmpty ()) {
143
        if (! isNbms && ! units.isEmpty ()) {
138
            List<UnitCategory> fcCats = makeFirstClassUpdateCategories ();
144
            List<UnitCategory> fcCats = makeFirstClassUpdateCategories ();
139
            if (! fcCats.isEmpty ()) {
145
            if (! fcCats.isEmpty ()) {
Lines 143-149 Link Here
143
            }
149
            }
144
        }
150
        }
145
        List<UnitCategory> res = new ArrayList<UnitCategory> ();
151
        List<UnitCategory> res = new ArrayList<UnitCategory> ();
152
        if(units.isEmpty()) {
153
            return res;
154
        }
155
146
        List<String> names = new ArrayList<String> ();
156
        List<String> names = new ArrayList<String> ();
157
        Set<UpdateUnit> coveredByVisible = new HashSet <UpdateUnit> ();
158
147
        for (UpdateUnit u : units) {
159
        for (UpdateUnit u : units) {
148
            UpdateElement el = u.getInstalled ();
160
            UpdateElement el = u.getInstalled ();
149
            if (! u.isPending() && el != null) {
161
            if (! u.isPending() && el != null) {
Lines 151-156 Link Here
151
                if (updates.isEmpty()) {
163
                if (updates.isEmpty()) {
152
                    continue;
164
                    continue;
153
                }
165
                }
166
                coveredByVisible.add(u);
167
168
                OperationContainer<InstallSupport> container = OperationContainer.createForUpdate();
169
                OperationInfo<InstallSupport> info = container.add(updates.get(0));
170
                Set <UpdateElement> required = info.getRequiredElements();
171
                for(UpdateElement ue : required){
172
                    coveredByVisible.add(ue.getUpdateUnit());
173
                }
174
                for(OperationInfo <InstallSupport> i : container.listAll()) {
175
                    coveredByVisible.add((i.getUpdateUnit()));
176
                }
177
154
                String catName = el.getCategory();
178
                String catName = el.getCategory();
155
                if (names.contains (catName)) {
179
                if (names.contains (catName)) {
156
                    UnitCategory cat = res.get (names.indexOf (catName));
180
                    UnitCategory cat = res.get (names.indexOf (catName));
Lines 163-172 Link Here
163
                }
187
                }
164
            }
188
            }
165
        }
189
        }
166
        logger.log(Level.FINER, "makeUpdateCategories (" + units.size () + ") returns " + res.size ());
190
191
        // not covered by visible modules
192
193
        Collection<UpdateUnit> allUnits = UpdateManager.getDefault ().getUpdateUnits (UpdateManager.TYPE.MODULE);
194
        Set <UpdateUnit> otherUnits = new HashSet <UpdateUnit> ();
195
        for(UpdateUnit u : allUnits) {
196
            if(!coveredByVisible.contains(u) && 
197
                    u.getAvailableUpdates().size() > 0 &&
198
                    u.getInstalled()!=null &&
199
                    !u.isPending()) {
200
                otherUnits.add(u);
201
            }
202
        }
203
204
        List<Unit.InternalUpdate> internals = new ArrayList <Unit.InternalUpdate>();
205
        HashMap <UpdateUnit, List<UpdateElement>> map = getVisibleModulesDependecyMap(units);
206
        if(otherUnits.size() > 0 && !isNbms) {            
207
            for(UpdateUnit uu : otherUnits) {
208
                UpdateUnit u = getVisibleUnitForInvisibleModule(uu, map);
209
                if (u != null) {
210
                    boolean exist = false;
211
                    for(Unit.InternalUpdate internal : internals) {
212
                        if(internal.getVisibleUnit() == u) {
213
                            internal.getUpdateUnits().add(uu);
214
                            exist = true;
215
                        }
216
                    }
217
                    if(!exist) {
218
                        //all already determined "internal" visible updates does not contain just found one
219
                        String catName = u.getInstalled().getCategory();
220
                        Unit.InternalUpdate iu = new Unit.InternalUpdate(u, catName, false);
221
                        iu.getUpdateUnits().add(uu);
222
                        internals.add(iu);
223
                        UnitCategory cat = new UnitCategory(catName);
224
                        res.add(cat);
225
                        names.add(catName);
226
                        cat.addUnit(iu);
227
                    }
228
                } else {
229
                    // fallback, show module itself
230
                    String catName = uu.getAvailableUpdates().get(0).getCategory();
231
                    UnitCategory cat = null;
232
233
                    if (names.contains(catName)) {
234
                        cat = res.get(names.indexOf(catName));
235
                    } else {
236
                        cat = new UnitCategory(catName);
237
                        res.add(cat);
238
                        names.add(catName);
239
                    }
240
                    cat.addUnit(new Unit.Update(uu, isNbms, cat.getCategoryName()));
241
                }
242
            }            
243
        }
244
        for(Unit.InternalUpdate iu : internals) {
245
            iu.initState();
246
        }
247
        logger.log(Level.INFO, "makeUpdateCategories (" + units.size () + ") returns " + res.size () + ", took " + (System.currentTimeMillis()-start) + " ms");
248
167
        return res;
249
        return res;
168
    };
250
    };
169
251
252
    public static HashMap<UpdateUnit, List<UpdateElement>> getVisibleModulesDependecyMap(Collection<UpdateUnit> allUnits) {
253
        HashMap<UpdateUnit, List<UpdateElement>> result = new HashMap <UpdateUnit, List<UpdateElement>>();
254
        for (UpdateUnit u : allUnits) {
255
            if (u.getInstalled() != null && !u.isPending()) {
256
                OperationContainer<InstallSupport> container = OperationContainer.createForInternalUpdate();
257
                OperationInfo<InstallSupport> info = container.add(u, u.getInstalled());
258
259
                List<UpdateElement> list = new ArrayList<UpdateElement>();
260
261
                for (UpdateElement ur : info.getRequiredElements()) {
262
                    list.add(ur);
263
                }
264
                for (OperationInfo<InstallSupport> in : container.listAll()) {
265
                    UpdateUnit unit = in.getUpdateUnit();
266
                    if (unit != u) {
267
                        List<UpdateElement> updates = unit.getAvailableUpdates();
268
                        if (updates.size() > 0 && !list.contains(updates.get(0))) {
269
                            list.add(updates.get(0));
270
                        }
271
                    }
272
                }
273
                if(!list.isEmpty()) {
274
                    result.put(u, list);
275
                }
276
            }
277
        }
278
        return result;
279
    }
280
281
    public static UpdateUnit getVisibleUnitForInvisibleModule(UpdateUnit invisible, HashMap<UpdateUnit, List<UpdateElement>> map) {
282
        List <UpdateUnit> candidates = new ArrayList<UpdateUnit>();
283
284
        for(UpdateUnit unit : map.keySet()) {
285
            for (UpdateElement ue : map.get(unit)) {
286
                if (ue.getUpdateUnit().equals(invisible)) {
287
                    logger.log(Level.FINE,
288
                            "... found candidate visible module " + unit.getCodeName() + " for invisible " + invisible.getCodeName());
289
                    candidates.add(unit);
290
                }
291
            }
292
        }
293
294
        UpdateUnit result = null;
295
        if(candidates.size()==0) {
296
            logger.log(Level.FINE,
297
                    "Have not found visible module for invisible " + invisible.getCodeName());
298
        } else {
299
            result = candidates.get(0);
300
            for(UpdateUnit u : candidates) {
301
                if(u.getCodeName().endsWith(".kit")) {
302
                    result = u;break;
303
                }
304
            }
305
            logger.log(Level.FINE,
306
                    "Found visible module " + candidates.get(0).getCodeName() + " for invisible " + invisible.getCodeName());
307
        }
308
309
        return result;
310
    }
311
312
   
170
    public static long getTimeOfInitialization () {
313
    public static long getTimeOfInitialization () {
171
        return getPreferences ().getLong (TIME_OF_MODEL_INITIALIZATION, 0);
314
        return getPreferences ().getLong (TIME_OF_MODEL_INITIALIZATION, 0);
172
    }
315
    }
(-)a/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/actions/AutoupdateCheckScheduler.java (-12 / +24 lines)
Lines 44-49 Link Here
44
import java.awt.event.ActionEvent;
44
import java.awt.event.ActionEvent;
45
import java.awt.event.ActionListener;
45
import java.awt.event.ActionListener;
46
import java.io.IOException;
46
import java.io.IOException;
47
import java.util.ArrayList;
47
import java.util.Calendar;
48
import java.util.Calendar;
48
import java.util.Collection;
49
import java.util.Collection;
49
import java.util.Collections;
50
import java.util.Collections;
Lines 209-220 Link Here
209
        OperationContainer<InstallSupport> container = handleUpdates ?
210
        OperationContainer<InstallSupport> container = handleUpdates ?
210
            OperationContainer.createForUpdate () :
211
            OperationContainer.createForUpdate () :
211
            OperationContainer.createForInstall ();
212
            OperationContainer.createForInstall ();
213
214
215
        List<UpdateElement> elements = new ArrayList<UpdateElement>();
216
212
        for (UnitCategory cat : cats) {
217
        for (UnitCategory cat : cats) {
213
            for (Unit u : cat.getUnits ()) {
218
            for (Unit u : cat.getUnits ()) {        
214
                UpdateElement element = handleUpdates ?
219
                if(u instanceof Unit.Available) {
215
                    ((Unit.Update) u).getRelevantElement () :
220
                    elements.add(((Unit.Available) u).getRelevantElement ());
216
                    ((Unit.Available) u).getRelevantElement ();
221
                } else if (u instanceof Unit.InternalUpdate) {
217
                if (container.canBeAdded (element.getUpdateUnit (), element) && ! somePendingElements) {
222
                    for(UpdateUnit uu :((Unit.InternalUpdate) u).getUpdateUnits()) {
223
                        elements.add(uu.getAvailableUpdates().get(0));
224
                    }
225
                } else if (u instanceof Unit.Update) {
226
                    elements.add(((Unit.Update) u).getRelevantElement ());
227
                }
228
229
            }
230
        }
231
        for(UpdateElement element : elements) {
232
            if (! somePendingElements) {
233
                if(container.canBeAdded (element.getUpdateUnit (), element)) {
218
                    OperationInfo<InstallSupport> operationInfo = container.add (element);
234
                    OperationInfo<InstallSupport> operationInfo = container.add (element);
219
                    if (operationInfo == null) {
235
                    if (operationInfo == null) {
220
                        updates.add (element);
236
                        updates.add (element);
Lines 251-264 Link Here
251
        if (! somePendingElements && someBrokenDependencies) {
267
        if (! somePendingElements && someBrokenDependencies) {
252
            // 2. if some problem then try one by one
268
            // 2. if some problem then try one by one
253
            updates = new HashSet<UpdateElement> ();
269
            updates = new HashSet<UpdateElement> ();
254
            for (UnitCategory cat : cats) {
270
           for(UpdateElement element : elements) {
255
                for (Unit u : cat.getUnits ()) {
256
                    OperationContainer<InstallSupport> oc = handleUpdates ?
271
                    OperationContainer<InstallSupport> oc = handleUpdates ?
257
                        OperationContainer.createForUpdate () :
272
                        OperationContainer.createForUpdate () :
258
                        OperationContainer.createForInstall ();
273
                        OperationContainer.createForInstall ();
259
                    UpdateElement element = handleUpdates ?
274
                    
260
                        ((Unit.Update) u).getRelevantElement () :
261
                        ((Unit.Available) u).getRelevantElement ();
262
                    UpdateUnit unit = element.getUpdateUnit ();
275
                    UpdateUnit unit = element.getUpdateUnit ();
263
                    if (oc.canBeAdded (unit, element)) {
276
                    if (oc.canBeAdded (unit, element)) {
264
                        OperationInfo<InstallSupport> operationInfo = oc.add (element);
277
                        OperationInfo<InstallSupport> operationInfo = oc.add (element);
Lines 295-302 Link Here
295
                                        " cannot be installed, Install Container contains invalid elements " + oc.listInvalid ()); // NOI18N
308
                                        " cannot be installed, Install Container contains invalid elements " + oc.listInvalid ()); // NOI18N
296
                            }
309
                            }
297
                        }
310
                        }
298
                    }
311
                    }                
299
                }
300
            }
312
            }
301
        }
313
        }
302
314
(-)a/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/wizards/InstallStep.java (-3 / +4 lines)
Lines 551-562 Link Here
551
        if (installException == null) {
551
        if (installException == null) {
552
            component.setHeadAndContent (getBundle (HEAD_INSTALL_DONE), getBundle (CONTENT_INSTALL_DONE));
552
            component.setHeadAndContent (getBundle (HEAD_INSTALL_DONE), getBundle (CONTENT_INSTALL_DONE));
553
            panel.setBody (getBundle ("InstallStep_InstallDone_Text"),
553
            panel.setBody (getBundle ("InstallStep_InstallDone_Text"),
554
                    InstallUnitWizardModel.getVisibleUpdateElements (model.getAllUpdateElements (), false, model.getOperation ()));
554
                    model.getAllVisibleUpdateElements ());
555
        } else {
555
        } else {
556
            component.setHeadAndContent (getBundle (HEAD_INSTALL_UNSUCCESSFUL), getBundle (CONTENT_INSTALL_UNSUCCESSFUL));
556
            component.setHeadAndContent (getBundle (HEAD_INSTALL_UNSUCCESSFUL), getBundle (CONTENT_INSTALL_UNSUCCESSFUL));
557
            panel.setBody (getBundle ("InstallStep_InstallUnsuccessful_Text", installException.getLocalizedMessage ()),
557
            panel.setBody (getBundle ("InstallStep_InstallUnsuccessful_Text", installException.getLocalizedMessage ()),
558
                    InstallUnitWizardModel.getVisibleUpdateElements (model.getAllUpdateElements (), false, model.getOperation ()));
558
                    model.getAllVisibleUpdateElements ());
559
        }
559
        }
560
560
        panel.hideRunInBackground ();
561
        panel.hideRunInBackground ();
561
    }
562
    }
562
    
563
    
Lines 565-571 Link Here
565
        model.modifyOptionsForDoClose (wd, true);
566
        model.modifyOptionsForDoClose (wd, true);
566
        restarter = r;
567
        restarter = r;
567
        panel.setRestartButtonsVisible (true);
568
        panel.setRestartButtonsVisible (true);
568
        panel.setBody (getBundle ("InstallStep_InstallDone_Text"), InstallUnitWizardModel.getVisibleUpdateElements (model.getAllUpdateElements (), false, model.getOperation ()));
569
        panel.setBody (getBundle ("InstallStep_InstallDone_Text"), model.getAllVisibleUpdateElements ());
569
        panel.hideRunInBackground ();
570
        panel.hideRunInBackground ();
570
        if (runInBackground ()) {
571
        if (runInBackground ()) {
571
            InstallSupport support = model.getInstallSupport ();
572
            InstallSupport support = model.getInstallSupport ();
(-)a/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/wizards/OperationDescriptionStep.java (-10 / +100 lines)
Lines 44-49 Link Here
44
import java.awt.Component;
44
import java.awt.Component;
45
import java.util.ArrayList;
45
import java.util.ArrayList;
46
import java.util.Collections;
46
import java.util.Collections;
47
import java.util.HashMap;
47
import java.util.HashSet;
48
import java.util.HashSet;
48
import java.util.List;
49
import java.util.List;
49
import java.util.Set;
50
import java.util.Set;
Lines 55-65 Link Here
55
import javax.swing.SwingUtilities;
56
import javax.swing.SwingUtilities;
56
import javax.swing.event.ChangeEvent;
57
import javax.swing.event.ChangeEvent;
57
import javax.swing.event.ChangeListener;
58
import javax.swing.event.ChangeListener;
59
import org.netbeans.api.autoupdate.InstallSupport;
60
import org.netbeans.api.autoupdate.OperationContainer;
61
import org.netbeans.api.autoupdate.OperationContainer.OperationInfo;
58
import org.netbeans.api.autoupdate.OperationException;
62
import org.netbeans.api.autoupdate.OperationException;
59
import org.netbeans.api.autoupdate.UpdateElement;
63
import org.netbeans.api.autoupdate.UpdateElement;
60
import org.netbeans.api.autoupdate.UpdateManager;
64
import org.netbeans.api.autoupdate.UpdateManager;
61
import org.netbeans.api.autoupdate.UpdateUnit;
65
import org.netbeans.api.autoupdate.UpdateUnit;
62
import org.netbeans.modules.autoupdate.ui.Containers;
66
import org.netbeans.modules.autoupdate.ui.Containers;
67
import org.netbeans.modules.autoupdate.ui.Unit.InternalUpdate;
68
import org.netbeans.modules.autoupdate.ui.Utilities;
63
import org.netbeans.modules.autoupdate.ui.wizards.OperationWizardModel.OperationType;
69
import org.netbeans.modules.autoupdate.ui.wizards.OperationWizardModel.OperationType;
64
import org.openide.WizardDescriptor;
70
import org.openide.WizardDescriptor;
65
import org.openide.modules.Dependency;
71
import org.openide.modules.Dependency;
Lines 155-164 Link Here
155
            }
161
            }
156
            body = new OperationDescriptionPanel (tableTitle,
162
            body = new OperationDescriptionPanel (tableTitle,
157
                    preparePluginsForShow (
163
                    preparePluginsForShow (
158
                        OperationWizardModel.getVisibleUpdateElements (
164
                    model.getPrimaryVisibleUpdateElements(),
159
                                model.getPrimaryUpdateElements (),
160
                                false,
161
                                model.getOperation ()),
162
                        model.getCustomHandledComponents (),
165
                        model.getCustomHandledComponents (),
163
                        model.getOperation ()),
166
                        model.getOperation ()),
164
                    "",
167
                    "",
Lines 192-207 Link Here
192
                } else {
195
                } else {
193
                    body = new OperationDescriptionPanel (tableTitle,
196
                    body = new OperationDescriptionPanel (tableTitle,
194
                            preparePluginsForShow (
197
                            preparePluginsForShow (
195
                                OperationWizardModel.getVisibleUpdateElements (
198
                                model.getPrimaryVisibleUpdateElements(),
196
                                    model.getPrimaryUpdateElements (), false, model.getOperation ()),
197
                                model.getCustomHandledComponents (),
199
                                model.getCustomHandledComponents (),
198
                                model.getOperation ()),
200
                                model.getOperation ()),
199
                            dependenciesTitle,
201
                            dependenciesTitle,
200
                            preparePluginsForShow (
202
                            preparePluginsForShow (
201
                                OperationWizardModel.getVisibleUpdateElements (model.getRequiredUpdateElements (), true, model.getOperation ()),
203
                                model.getRequiredVisibleUpdateElements(),
202
                                null,
204
                                null,
203
                                model.getOperation ()),
205
                                model.getOperation ()),
204
                            ! OperationWizardModel.getVisibleUpdateElements (model.getRequiredUpdateElements (), true, model.getOperation ()).isEmpty ());
206
                            ! model.getRequiredVisibleUpdateElements().isEmpty ());
205
                }
207
                }
206
                final JPanel finalPanel = body;
208
                final JPanel finalPanel = body;
207
                readyToGo = model != null && ! hasBrokenDependencies;
209
                readyToGo = model != null && ! hasBrokenDependencies;
Lines 357-365 Link Here
357
        return presentationName == null ? dep : presentationName;
359
        return presentationName == null ? dep : presentationName;
358
    }
360
    }
359
    
361
    
360
    private String preparePluginsForShow (Set<UpdateElement> plugins, Set<UpdateElement> customHandled, OperationType type) {
362
    private String preparePluginsForShow (Set<UpdateElement> allplugins, Set<UpdateElement> customHandled, OperationType type) {
361
        String s = new String ();
363
        String s = new String ();
362
        List<String> names = new ArrayList<String> ();
364
        List<String> names = new ArrayList<String> ();
365
        List <UpdateUnit> invisibleIncluded = new ArrayList <UpdateUnit>();
366
        List <UpdateUnit> units = new ArrayList <UpdateUnit>();
367
        List <UpdateElement> plugins = new ArrayList<UpdateElement>();
368
        for(UpdateElement el : allplugins) {
369
            boolean internal = false;
370
            if (OperationWizardModel.OperationType.UPDATE == type && el.getUpdateUnit ().getInstalled () != null) {
371
                 String oldVersion = el.getUpdateUnit ().getInstalled ().getSpecificationVersion ();
372
                 String newVersion = el.getSpecificationVersion ();
373
                 if(oldVersion.equals(newVersion) || !el.getUpdateUnit().getType().equals(UpdateManager.TYPE.KIT_MODULE) ) {
374
                     internal = true;
375
                 }
376
            }
377
            if(internal) {
378
                plugins.add(el);
379
            } else {
380
                plugins.add(0, el);
381
            }
382
        }
383
384
        for(UpdateElement p : plugins) {
385
            units.add(p.getUpdateUnit());
386
        }
387
        //HashMap <UpdateUnit, List<UpdateElement>> map = Utilities.getVisibleModulesDependecyMap(UpdateManager.getDefault().getUpdateUnits(Utilities.getUnitTypes()));
388
        HashMap <UpdateUnit, List<UpdateElement>> map = Utilities.getVisibleModulesDependecyMap(units);
389
363
        if (plugins != null && ! plugins.isEmpty ()) {
390
        if (plugins != null && ! plugins.isEmpty ()) {
364
            for (UpdateElement el : plugins) {
391
            for (UpdateElement el : plugins) {
365
                String updatename;
392
                String updatename;
Lines 367-373 Link Here
367
                if (OperationWizardModel.OperationType.UPDATE == type && el.getUpdateUnit ().getInstalled () != null) {
394
                if (OperationWizardModel.OperationType.UPDATE == type && el.getUpdateUnit ().getInstalled () != null) {
368
                    String oldVersion = el.getUpdateUnit ().getInstalled ().getSpecificationVersion ();
395
                    String oldVersion = el.getUpdateUnit ().getInstalled ().getSpecificationVersion ();
369
                    String newVersion = el.getSpecificationVersion ();
396
                    String newVersion = el.getSpecificationVersion ();
370
                    updatename += getBundle ("OperationDescriptionStep_UpdatePluginVersionFormat", oldVersion, newVersion);
397
                    OperationContainer<InstallSupport> container = OperationContainer.createForUpdate();
398
                    if (oldVersion.equals(newVersion)) {
399
                        //internal update
400
                        //updatename += getBundle ("OperationDescriptionStep_PluginVersionFormat", oldVersion);
401
                        OperationContainer<InstallSupport> internalUpdate = OperationContainer.createForInternalUpdate();
402
                        internalUpdate.add(el);
403
                        for (OperationInfo<InstallSupport> info : internalUpdate.listAll()) {
404
                            if (!info.getUpdateElement().equals(el)) {
405
                                if (!container.contains(info.getUpdateElement())) {
406
                                    container.add(info.getUpdateElement());
407
                                }
408
                            }
409
                            for (UpdateElement r : info.getRequiredElements()) {
410
                                if (!container.contains(r)) {
411
                                    container.add(r);
412
                                }
413
                            }
414
                        }
415
                    } else {
416
                        updatename += getBundle("OperationDescriptionStep_UpdatePluginVersionFormat", oldVersion, newVersion);
417
                        container.add(el);
418
                    }
419
420
                    
421
422
                    List<UpdateElement> list = new ArrayList<UpdateElement>();
423
                    for (OperationInfo<InstallSupport> info : container.listAll()) {
424
425
                        if(!info.getUpdateUnit().equals(el.getUpdateUnit()) &&
426
                                info.getUpdateUnit().getInstalled() != null) {
427
                            list.add(info.getUpdateElement());
428
                        }
429
                        for (UpdateElement upd : info.getRequiredElements()) {
430
                            if (upd.getUpdateUnit().getInstalled() != null) {
431
                                list.add(upd);
432
                            }
433
                        }
434
                    }                    
435
                    
436
                    for (UpdateElement upd : list) {
437
                        UpdateUnit unit = upd.getUpdateUnit();
438
                        if(unit.getType().equals(UpdateManager.TYPE.KIT_MODULE) || invisibleIncluded.contains(unit)) {
439
                            continue;
440
                        }
441
                        UpdateUnit visibleUnit = Utilities.getVisibleUnitForInvisibleModule(unit, map);
442
                        if(visibleUnit!=null && visibleUnit != el.getUpdateUnit()) {
443
                            continue;
444
                        }
445
                        if(!unit.getType().equals(UpdateManager.TYPE.KIT_MODULE)) {
446
                            invisibleIncluded.add(unit);
447
                        }
448
                        if(unit.getInstalled()!=null) {
449
                            updatename += "<br>&nbsp;&nbsp;&nbsp;&nbsp;" + upd.getDisplayName() +
450
                                " [" +
451
                                unit.getInstalled().getSpecificationVersion() + " -> " +
452
                                unit.getAvailableUpdates().get(0).getSpecificationVersion() +
453
                                "]";
454
                        } else {
455
                            updatename += "<br>&nbsp;&nbsp;&nbsp;&nbsp;" + upd.getDisplayName() +
456
                                " [" +
457
                                unit.getAvailableUpdates().get(0).getSpecificationVersion() +
458
                                "]";
459
                        }
460
                    }                    
371
                } else {
461
                } else {
372
                    updatename += getBundle ("OperationDescriptionStep_PluginVersionFormat",  // NOI18N
462
                    updatename += getBundle ("OperationDescriptionStep_PluginVersionFormat",  // NOI18N
373
                        el.getSpecificationVersion ());
463
                        el.getSpecificationVersion ());
(-)a/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/wizards/OperationPanel.java (-8 / +3 lines)
Lines 190-205 Link Here
190
    }
190
    }
191
    
191
    
192
    private JComponent getElementsComponent (List<UpdateElement> elements) {
192
    private JComponent getElementsComponent (List<UpdateElement> elements) {
193
        JTextPane area = new JTextPane ();
193
        StringBuilder body = new StringBuilder ();
194
        area.setEditable (false);
195
        area.setContentType ("text/html"); // NOI18N
196
        String body = new String ();
197
        for (UpdateElement el : elements) {
194
        for (UpdateElement el : elements) {
198
            body = body + el.getDisplayName () + "<br>"; // NOI18N
195
            body.append(el.getDisplayName () + "<br>"); // NOI18N
199
        }
196
        }
200
        area.setText (body);
197
        return getElementsComponent(body.toString());
201
        area.setOpaque (false);
202
        return area;
203
    }
198
    }
204
    
199
    
205
    private JComponent getElementsComponent (String msg) {
200
    private JComponent getElementsComponent (String msg) {
(-)a/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/wizards/OperationWizardModel.java (-2 / +67 lines)
Lines 56-67 Link Here
56
import java.util.logging.Logger;
56
import java.util.logging.Logger;
57
import javax.swing.JButton;
57
import javax.swing.JButton;
58
import javax.swing.SwingUtilities;
58
import javax.swing.SwingUtilities;
59
import org.netbeans.api.autoupdate.InstallSupport;
59
import org.netbeans.api.autoupdate.OperationContainer;
60
import org.netbeans.api.autoupdate.OperationContainer;
60
import org.netbeans.api.autoupdate.OperationContainer.OperationInfo;
61
import org.netbeans.api.autoupdate.OperationContainer.OperationInfo;
61
import org.netbeans.api.autoupdate.OperationException;
62
import org.netbeans.api.autoupdate.OperationException;
62
import org.netbeans.api.autoupdate.OperationSupport;
63
import org.netbeans.api.autoupdate.OperationSupport;
63
import org.netbeans.api.autoupdate.UpdateElement;
64
import org.netbeans.api.autoupdate.UpdateElement;
64
import org.netbeans.api.autoupdate.UpdateManager;
65
import org.netbeans.api.autoupdate.UpdateManager;
66
import org.netbeans.api.autoupdate.UpdateUnit;
65
import org.netbeans.modules.autoupdate.ui.Containers;
67
import org.netbeans.modules.autoupdate.ui.Containers;
66
import org.netbeans.modules.autoupdate.ui.Utilities;
68
import org.netbeans.modules.autoupdate.ui.Utilities;
67
import org.openide.WizardDescriptor;
69
import org.openide.WizardDescriptor;
Lines 256-272 Link Here
256
        }
258
        }
257
        return allElements;
259
        return allElements;
258
    }
260
    }
259
    
261
260
    public static Set<UpdateElement> getVisibleUpdateElements (Set<UpdateElement> all, boolean canBeEmpty, OperationType operationType) {
262
263
    public Set<UpdateElement> getAllVisibleUpdateElements () {
264
        Set <UpdateElement> all = getAllUpdateElements();
265
        Set <UpdateElement> visible = getVisibleUpdateElements(all, false, getOperation(), true);
266
        return visible;
267
    }
268
    public Set<UpdateElement> getPrimaryVisibleUpdateElements () {
269
        Set <UpdateElement> primary = getPrimaryUpdateElements();
270
        Set <UpdateElement> visible = getVisibleUpdateElements(primary, false, getOperation(), true);
271
        return visible;
272
    }
273
    public Set<UpdateElement> getRequiredVisibleUpdateElements () {
274
        Set <UpdateElement> required = getRequiredUpdateElements();
275
        Set <UpdateElement> visible = getVisibleUpdateElements(required, true, getOperation(), false);
276
        return visible;
277
    }
278
279
    private static Set<UpdateElement> getVisibleUpdateElements (Set<UpdateElement> all, boolean canBeEmpty, OperationType operationType, boolean checkInternalUpdates) {
261
        if (Utilities.modulesOnly () || OperationType.LOCAL_DOWNLOAD == operationType) {
280
        if (Utilities.modulesOnly () || OperationType.LOCAL_DOWNLOAD == operationType) {
262
            return all;
281
            return all;
263
        } else {
282
        } else {
264
            Set<UpdateElement> visible = new HashSet<UpdateElement> ();
283
            Set<UpdateElement> visible = new HashSet<UpdateElement> ();
284
            Set<UpdateUnit> visibleUnits = new HashSet<UpdateUnit> ();
285
            Set<UpdateElement> invisible = new HashSet<UpdateElement> ();
265
            for (UpdateElement el : all) {
286
            for (UpdateElement el : all) {
266
                if (UpdateManager.TYPE.KIT_MODULE == el.getUpdateUnit ().getType ()) {
287
                if (UpdateManager.TYPE.KIT_MODULE == el.getUpdateUnit ().getType ()) {
267
                    visible.add (el);
288
                    visible.add (el);
289
                    visibleUnits.add(el.getUpdateUnit());
290
                } else {
291
                    invisible.add(el);
268
                }
292
                }
269
            }
293
            }
294
            //filter out eager invisible modules, which are covered by visible
295
            List <UpdateElement> realInvisible = new ArrayList <UpdateElement> (invisible);
296
            for(UpdateElement v : visible) {
297
                OperationContainer <InstallSupport> container;
298
                if(v.getUpdateUnit().getInstalled()!=null) {
299
                    container = OperationContainer.createForUpdate();
300
                } else {
301
                    container = OperationContainer.createForInstall();
302
                }
303
                container.add(v);
304
                for(OperationInfo<InstallSupport> info : container.listAll()) {
305
                    realInvisible.remove(info.getUpdateElement());
306
                }
307
            }
308
            //filter out eager invisible modules, which are covered by other invisible
309
            for(UpdateElement v : invisible) {
310
                OperationContainer <InstallSupport> container = OperationContainer.createForUpdate();
311
                container.add(v);
312
                for(OperationInfo<InstallSupport> info : container.listAll()) {
313
                    if(info.getUpdateElement()!=v) {
314
                        realInvisible.remove(info.getUpdateElement());
315
                    }
316
                }
317
            }
318
319
320
            if(!realInvisible.isEmpty() && checkInternalUpdates) {
321
                HashMap <UpdateUnit, List<UpdateElement>> map = Utilities.getVisibleModulesDependecyMap(UpdateManager.getDefault().getUpdateUnits(Utilities.getUnitTypes()));
322
                //HashMap <UpdateUnit, List<UpdateElement>> map = Utilities.getVisibleModulesDependecyMap(visibleUnits);
323
                for(UpdateElement el : realInvisible) {
324
                    if(el.getUpdateUnit().getInstalled()!=null) {
325
                        UpdateUnit visibleUU = Utilities.getVisibleUnitForInvisibleModule(el.getUpdateUnit(), map);
326
                        if(visibleUU!=null) {
327
                            visible.add(visibleUU.getInstalled());
328
                        } else {
329
                            visible.add(el);
330
                        }
331
                    }
332
                }
333
            }
334
270
            if (visible.isEmpty () && ! canBeEmpty) {
335
            if (visible.isEmpty () && ! canBeEmpty) {
271
                // in Downloaded tab may become all NBMs are hidden
336
                // in Downloaded tab may become all NBMs are hidden
272
                visible = all;
337
                visible = all;
(-)a/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/wizards/UninstallStep.java (-8 / +8 lines)
Lines 216-228 Link Here
216
        model.modifyOptionsForDoClose (wd);
216
        model.modifyOptionsForDoClose (wd);
217
        switch (model.getOperation ()) {
217
        switch (model.getOperation ()) {
218
            case UNINSTALL :
218
            case UNINSTALL :
219
                panel.setBody (getBundle ("UninstallStep_UninstallDone_Text"), UninstallUnitWizardModel.getVisibleUpdateElements (model.getAllUpdateElements (), false, model.getOperation ()));
219
                panel.setBody (getBundle ("UninstallStep_UninstallDone_Text"), model.getAllVisibleUpdateElements ());
220
                break;
220
                break;
221
            case ENABLE :
221
            case ENABLE :
222
                panel.setBody (getBundle ("UninstallStep_ActivateDone_Text"), UninstallUnitWizardModel.getVisibleUpdateElements (model.getAllUpdateElements (), false, model.getOperation ()));
222
                panel.setBody (getBundle ("UninstallStep_ActivateDone_Text"), model.getAllVisibleUpdateElements ());
223
                break;
223
                break;
224
            case DISABLE :
224
            case DISABLE :
225
                panel.setBody (getBundle ("UninstallStep_DeactivateDone_Text"), UninstallUnitWizardModel.getVisibleUpdateElements (model.getAllUpdateElements (), false, model.getOperation ()));
225
                panel.setBody (getBundle ("UninstallStep_DeactivateDone_Text"), model.getAllVisibleUpdateElements ());
226
                break;
226
                break;
227
            default:
227
            default:
228
                assert false : "Unknown OperationType " + model.getOperation ();
228
                assert false : "Unknown OperationType " + model.getOperation ();
Lines 247-253 Link Here
247
        switch (model.getOperation ()) {
247
        switch (model.getOperation ()) {
248
            case UNINSTALL :
248
            case UNINSTALL :
249
                panel.setBody (getBundle ("UninstallStep_UninstallFailed_Text", ex.getLocalizedMessage ()),
249
                panel.setBody (getBundle ("UninstallStep_UninstallFailed_Text", ex.getLocalizedMessage ()),
250
                        UninstallUnitWizardModel.getVisibleUpdateElements(model.getAllUpdateElements(), false, model.getOperation()));
250
                        model.getAllVisibleUpdateElements ());
251
                break;
251
                break;
252
            case ENABLE :
252
            case ENABLE :
253
                panel.setBody (getBundle ("UninstallStep_ActivateFailed_Text",
253
                panel.setBody (getBundle ("UninstallStep_ActivateFailed_Text",
Lines 256-262 Link Here
256
                break;
256
                break;
257
            case DISABLE :
257
            case DISABLE :
258
                panel.setBody (getBundle ("UninstallStep_DeactivateFailed_Text", ex.getLocalizedMessage ()),
258
                panel.setBody (getBundle ("UninstallStep_DeactivateFailed_Text", ex.getLocalizedMessage ()),
259
                        UninstallUnitWizardModel.getVisibleUpdateElements(model.getAllUpdateElements(), false, model.getOperation()));
259
                        model.getAllVisibleUpdateElements ());
260
                break;
260
                break;
261
            default:
261
            default:
262
                assert false : "Unknown OperationType " + model.getOperation ();
262
                assert false : "Unknown OperationType " + model.getOperation ();
Lines 270-282 Link Here
270
        panel.setRestartButtonsVisible (true);
270
        panel.setRestartButtonsVisible (true);
271
        switch (model.getOperation ()) {
271
        switch (model.getOperation ()) {
272
            case UNINSTALL :
272
            case UNINSTALL :
273
                panel.setBody (getBundle ("UninstallStep_UninstallDone_Text"), UninstallUnitWizardModel.getVisibleUpdateElements (model.getAllUpdateElements (), false, model.getOperation ()));
273
                panel.setBody (getBundle ("UninstallStep_UninstallDone_Text"), model.getAllVisibleUpdateElements ());
274
                break;
274
                break;
275
            case ENABLE :
275
            case ENABLE :
276
                panel.setBody (getBundle ("UninstallStep_ActivateDone_Text"), UninstallUnitWizardModel.getVisibleUpdateElements (model.getAllUpdateElements (), false, model.getOperation ()));
276
                panel.setBody (getBundle ("UninstallStep_ActivateDone_Text"), model.getAllVisibleUpdateElements ());
277
                break;
277
                break;
278
            case DISABLE :
278
            case DISABLE :
279
                panel.setBody (getBundle ("UninstallStep_DeactivateDone_Text"), UninstallUnitWizardModel.getVisibleUpdateElements (model.getAllUpdateElements (), false, model.getOperation ()));
279
                panel.setBody (getBundle ("UninstallStep_DeactivateDone_Text"), model.getAllVisibleUpdateElements ());
280
                break;
280
                break;
281
            default:
281
            default:
282
                assert false : "Unknown OperationType " + model.getOperation ();
282
                assert false : "Unknown OperationType " + model.getOperation ();

Return to bug 141714