本文整理汇总了Java中org.netbeans.api.autoupdate.UpdateManager类的典型用法代码示例。如果您正苦于以下问题:Java UpdateManager类的具体用法?Java UpdateManager怎么用?Java UpdateManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UpdateManager类属于org.netbeans.api.autoupdate包,在下文中一共展示了UpdateManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FeatureUpdateElementImpl
import org.netbeans.api.autoupdate.UpdateManager; //导入依赖的package包/类
public FeatureUpdateElementImpl (FeatureItem item, String providerName,
Set<ModuleUpdateElementImpl> moduleElementsImpl,
Set<FeatureUpdateElementImpl> featureElementsImpl,
UpdateManager.TYPE type) {
super (item, providerName);
this.type = type;
this.moduleElementsImpl = moduleElementsImpl;
this.featureElementsImpl = featureElementsImpl;
codeName = item.getCodeName ();
String itemSpec = item.getSpecificationVersion ();
if (itemSpec == null) {
LOG.log (Level.INFO, codeName + " has no specificationVersion.");
} else {
specVersion = new SpecificationVersion (itemSpec);
}
installInfo = new InstallInfo (item);
displayName = item.getDisplayName ();
description = item.getDescription ();
category = item.getCategory ();
if (category == null) {
category = NbBundle.getMessage (UpdateElementImpl.class, "UpdateElementImpl_Feature_CategoryName");
}
}
示例2: filterUnitsByAskedTypes
import org.netbeans.api.autoupdate.UpdateManager; //导入依赖的package包/类
private static List<UpdateUnit> filterUnitsByAskedTypes (Collection<UpdateUnit> units, List<UpdateManager.TYPE> types) {
List<UpdateUnit> askedUnits = new ArrayList<UpdateUnit> ();
//hotfix for #113193 - reevaluate and probably fix better
List<UpdateManager.TYPE> tmpTypes = new ArrayList<UpdateManager.TYPE>(types);
if (tmpTypes.contains (UpdateManager.TYPE.MODULE) && !tmpTypes.contains (UpdateManager.TYPE.KIT_MODULE)) {
tmpTypes.add (UpdateManager.TYPE.KIT_MODULE);
}
for (UpdateUnit unit : units) {
UpdateUnitImpl impl = Trampoline.API.impl (unit);
if (tmpTypes.contains (impl.getType ())) {
askedUnits.add (unit);
}
}
return askedUnits;
}
示例3: setMarked
import org.netbeans.api.autoupdate.UpdateManager; //导入依赖的package包/类
@Override
public void setMarked (boolean marked) {
if (marked == isMarked()) {
return;
}
OperationContainer container;
if (isNbms) {
container = Containers.forUpdateNbms ();
} else if (UpdateManager.TYPE.CUSTOM_HANDLED_COMPONENT == updateUnit.getType ()) {
container = Containers.forCustomInstall ();
} else {
container = Containers.forUpdate ();
}
if (marked) {
try {
container.add (updateUnit, updateEl);
} catch (IllegalArgumentException ex) {
log.log(Level.WARNING, ex.getMessage());
}
} else {
container.remove (updateEl);
}
}
示例4: addRequiredElements
import org.netbeans.api.autoupdate.UpdateManager; //导入依赖的package包/类
private void addRequiredElements (Set<UpdateElement> elems) {
OperationContainer baseContainer = getBaseContainer();
OperationContainer customContainer = getCustomHandledContainer();
for (UpdateElement el : elems) {
if (el == null || el.getUpdateUnit () == null) {
Logger.getLogger (OperationWizardModel.class.getName ()).log (Level.INFO, "UpdateElement " + el + " cannot be null"
+ (el == null ? "" : " or UpdateUnit " + el.getUpdateUnit () + " cannot be null"));
continue;
}
if (UpdateManager.TYPE.CUSTOM_HANDLED_COMPONENT == el.getUpdateUnit ().getType ()) {
customContainer.add (el);
} else {
baseContainer.add (el);
}
}
}
示例5: getPluginUpdates
import org.netbeans.api.autoupdate.UpdateManager; //导入依赖的package包/类
@Override
@NbBundle.Messages({"LBL_Error=Error",
"# {0} - pluginName", "MSG_CannotBeInstalled={0} plugin cannot be installed"})
public Plugin getPluginUpdates(String cnb, final String pluginName) {
List<UpdateUnit> units = UpdateManager.getDefault().getUpdateUnits(UpdateManager.TYPE.MODULE);
for (UpdateUnit u : units) {
if(u.getCodeName().equals(cnb)) {
List<UpdateElement> elements = u.getAvailableUpdates();
final boolean isInstalled = u.getInstalled() != null;
if(elements != null) {
for (final UpdateElement updateElement : elements) {
// even if there is more UpdateElements (more plugins with different versions),
// we will return the first one - it is given that it will have the highest version.
return new Plugin() {
@Override
public String getDescription() {
return updateElement.getDescription();
}
@Override
public boolean installOrUpdate() {
OperationContainer<InstallSupport> oc = isInstalled ?
OperationContainer.createForUpdate() :
OperationContainer.createForInstall();
if (oc.canBeAdded(updateElement.getUpdateUnit(), updateElement)) {
oc.add(updateElement);
return PluginManager.openInstallWizard(oc);
} else {
notifyError(Bundle.LBL_Error(), Bundle.MSG_CannotBeInstalled(pluginName));
}
return false;
}
};
}
} else {
return null;
}
}
}
return null;
}
示例6: isPluginInstalled
import org.netbeans.api.autoupdate.UpdateManager; //导入依赖的package包/类
@Override
public boolean isPluginInstalled(String cnb) {
List<UpdateUnit> units = UpdateManager.getDefault().getUpdateUnits(UpdateManager.TYPE.MODULE);
for (UpdateUnit u : units) {
if(u.getCodeName().equals(cnb) && u.getInstalled() != null) {
return true;
}
}
return false;
}
示例7: findUpdateUnit
import org.netbeans.api.autoupdate.UpdateManager; //导入依赖的package包/类
@CheckForNull
private static UpdateUnit findUpdateUnit(@NonNull final String moduleCNB) {
for (UpdateUnit updateUnit : UpdateManager.getDefault().getUpdateUnits()) {
final String codeName = updateUnit.getCodeName();
if (moduleCNB.equals(codeName)) {
return updateUnit;
}
}
return null;
}
示例8: findModules
import org.netbeans.api.autoupdate.UpdateManager; //导入依赖的package包/类
private static Map<String, UpdateUnit> findModules(String... codeNames) {
Collection<String> names = Arrays.asList(codeNames);
Map<String, UpdateUnit> res = new HashMap<String, UpdateUnit>();
for (UpdateUnit unit : UpdateManager.getDefault().getUpdateUnits(UpdateManager.TYPE.MODULE)) {
if (names.contains(unit.getCodeName())) {
res.put(unit.getCodeName(), unit);
if (res.size() == names.size()) {
return res;
}
}
}
return res;
}
示例9: getType
import org.netbeans.api.autoupdate.UpdateManager; //导入依赖的package包/类
@Override
public UpdateManager.TYPE getType () {
if (getUpdateUnit () == null) {
return UpdateManager.TYPE.KIT_MODULE;
}
return getUpdateUnit ().getType ();
}
示例10: type2checkedList
import org.netbeans.api.autoupdate.UpdateManager; //导入依赖的package包/类
private static List<UpdateManager.TYPE> type2checkedList (UpdateManager.TYPE... types) {
List<UpdateManager.TYPE> l = Arrays.asList (types);
if (types != null && types.length > 1) {
if (l.contains (UpdateManager.TYPE.MODULE) && l.contains (UpdateManager.TYPE.KIT_MODULE)) {
throw new IllegalArgumentException ("Cannot mix types MODULE and KIT_MODULE into once list.");
}
} else if (types == null || types.length == 0) {
l = Arrays.asList (DEFAULT_TYPES);
}
return l;
}
示例11: testIncompleteFeature
import org.netbeans.api.autoupdate.UpdateManager; //导入依赖的package包/类
public void testIncompleteFeature() throws OperationException {
List<UpdateUnit> features = UpdateManager.getDefault().getUpdateUnits(UpdateManager.TYPE.FEATURE);
List<UpdateUnit> modules = UpdateManager.getDefault().getUpdateUnits(UpdateManager.TYPE.MODULE);
assertNotNull("A feature found.", features);
assertEquals("Only once feature there.", 1, features.size());
UpdateUnit feature = features.get(0);
assertNotNull(feature + " is installed.", feature.getInstalled());
assertFalse("Not all modules are enabled as such the feature shall be in "
+ "disabled state:\n" + modules, feature.getInstalled().isEnabled());
}
示例12: testSelf
import org.netbeans.api.autoupdate.UpdateManager; //导入依赖的package包/类
public void testSelf () throws Exception {
List<UpdateUnit> units = UpdateManager.getDefault ().getUpdateUnits (UpdateManager.TYPE.CUSTOM_HANDLED_COMPONENT);
assertNotNull (units);
assertFalse (units.isEmpty ());
UpdateUnit toInstall = UpdateManagerImpl.getInstance ().getUpdateUnit (moduleCodeNameBaseForTest ());
assertFalse (toInstall + " has available elements.", toInstall.getAvailableUpdates ().isEmpty ());
UpdateElement toInstallElement = toInstall.getAvailableUpdates ().get (0);
installNativeComponent (toInstall, toInstallElement);
assertTrue ("Custom installer was called.", installerCalled);
}
示例13: testRequiresDependency
import org.netbeans.api.autoupdate.UpdateManager; //导入依赖的package包/类
@RandomlyFails // NB-Core-Build #2131
public void testRequiresDependency () throws IOException {
String content = generateInfo (NbmAdvancedTestCase.generateModuleElementWithRequires ("o.n.m.requiresA", "1.0", "tokenA"));
File requiresA = generateNBM ("o.n.m.requiresA", content);
content = generateInfo (NbmAdvancedTestCase.generateModuleElementWithProviders ("o.n.m.providesA", "1.0", "tokenA"));
File providesA = generateNBM ("o.n.m.providesA", content);
List<UpdateUnit> units = UpdateUnitProviderFactory.getDefault ().create (
"test",
new File[] { requiresA, providesA }).getUpdateUnits (UpdateManager.TYPE.MODULE);
assertNotNull ("Update units found.", units);
assertEquals ("Two units.", 2, units.size ());
Collection<UpdateElement> toInstall = new HashSet<UpdateElement> (units.size ());
for (UpdateUnit u : units) {
assertFalse (u + " has available updates.", u.getAvailableUpdates ().isEmpty ());
toInstall.add (u.getAvailableUpdates ().get (0));
}
OperationContainer<InstallSupport> oc = OperationContainer.createForInstall ();
oc.add (toInstall);
assertTrue ("valid items in install container.", oc.listInvalid ().isEmpty ());
assertEquals ("Two items.", 2, oc.listAll ().size ());
for (OperationContainer.OperationInfo<InstallSupport> info : oc.listAll ()) {
assertTrue (info.getUpdateElement () + " doesn't requires others.", info.getRequiredElements ().isEmpty ());
assertEquals (info.getUpdateElement () + " doesn't have any broken dependencies.",
Collections.emptySet (),
info.getBrokenDependencies ());
assertTrue (info.getUpdateElement () + " doesn't have any broken dependencies.", info.getBrokenDependencies ().isEmpty ());
}
}
示例14: refreshUnitsInBackground
import org.netbeans.api.autoupdate.UpdateManager; //导入依赖的package包/类
private void refreshUnitsInBackground(List<UpdateUnit> newUnits) {
//ensure exclusivity between this refreshUnits code(which can run even after this dialog is disposed) and uninitialization code
synchronized(initLock) {
//return immediatelly if uninialization(after removeNotify) was alredy called
if (units == null) {
return;
}
//TODO: REVIEW THIS CODE - problem is that is called from called from AWT thread
//UpdateManager.getDefault().getUpdateUnits() should never be called fromn AWT because it may cause
//long terming starvation because in fact impl. of this method calls AutoUpdateCatalogCache.getCatalogURL
//which is synchronized and may wait until cache is created
//even more AutoUpdateCatalog.getUpdateItems () can at first start call refresh and thus writeToCache again
units = newUnits;
InstalledTableModel installTableModel = (InstalledTableModel)installedTable.getModel();
UnitCategoryTableModel updateTableModel = ((UnitCategoryTableModel)updateTable.getModel());
UnitCategoryTableModel availableTableModel = ((UnitCategoryTableModel)availableTable.getModel());
LocallyDownloadedTableModel localTableModel = ((LocallyDownloadedTableModel)localTable.getModel());
updateTableModel.setUnits(UpdateManager.getDefault().getUpdateUnits(UpdateManager.TYPE.MODULE));
List<UpdateUnit> features = UpdateManager.getDefault().getUpdateUnits(UpdateManager.TYPE.FEATURE);
if (isDetailView() && !features.isEmpty()) {
installTableModel.setUnits(units);
} else {
installTableModel.setUnits(units, features);
}
availableTableModel.setUnits(units);
localTableModel.setUnits(units);
}
}
示例15: updateUnitsChanged
import org.netbeans.api.autoupdate.UpdateManager; //导入依赖的package包/类
public void updateUnitsChanged () {
refreshUnitsInBackground(UpdateManager.getDefault().getUpdateUnits(Utilities.getUnitTypes()));
if (! SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
refreshUnitsInAWT();
}
});
} else {
refreshUnitsInAWT();
}
}