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> " + upd.getDisplayName() + |
450 |
" [" + |
451 |
unit.getInstalled().getSpecificationVersion() + " -> " + |
452 |
unit.getAvailableUpdates().get(0).getSpecificationVersion() + |
453 |
"]"; |
454 |
} else { |
455 |
updatename += "<br> " + 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 ()); |