org.eclipse.equinox.p2.operations.Update Java Examples
The following examples show how to use
org.eclipse.equinox.p2.operations.Update.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UpdateManager.java From developer-studio with Apache License 2.0 | 6 votes |
private void setPossibleUpdates(Update[] possibleUpdates, Map<String, EnhancedFeature> allFeaturesInUpdateRepo) { availableUpdates = new HashMap<String, Update>(); featuresWithPossibleUpdates = new HashMap<String, EnhancedFeature>(); for (Update update : possibleUpdates) { String id = update.replacement.getId(); String oldVersion = update.toUpdate.getVersion().toString(); String newVersion = update.replacement.getVersion().toString(); EnhancedFeature updatebleFeature = allFeaturesInUpdateRepo.get(id); updatebleFeature.setCurrentVersion(oldVersion); updatebleFeature.setVersion(newVersion); updatebleFeature.setUpdateFeature(true); if (isNewVersionCompatible(oldVersion, update.replacement.getVersion())) { availableUpdates.put(id, update); featuresWithPossibleUpdates.put(id, updatebleFeature); } } }
Example #2
Source File: UpdateManager.java From developer-studio with Apache License 2.0 | 5 votes |
/** * Set selected updates to install. * * @param selectedFeaturesList * selected updates to install. */ public void setSelectedUpdates(List<EnhancedFeature> selectedFeaturesList) { selectedUpdates = new Update[selectedFeaturesList.size()]; int count = 0; for (EnhancedFeature selectedFeature : selectedFeaturesList) { selectedUpdates[count] = availableUpdates.get(selectedFeature.getId()); count++; } }
Example #3
Source File: UpdateDescriptionPage.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
private String getUpdateDescDetailText() { StringBuffer descBf = new StringBuffer(); Update[] updates = operation.getSelectedUpdates(); if (updates.length == 0) { // no udpates; setPageComplete(false); return P2UpdateUtil.UPDATE_PROMPT_INFO_NO_UPDATE; } Update update = updates[0]; AvailableUpdateElement newElement = new AvailableUpdateElement(null, update.replacement, update.toUpdate, ui.getProfileId(), ProvUI.getQueryContext(ui.getPolicy()).getShowProvisioningPlanChildren()); descBf.append(P2UpdateUtil.UI_WIZARD_DESC_PAGE_DESC_DETAIL).append(newElement.getIU().getVersion()) .append("\n\n"); newElement.setQueryable(operation.getProvisioningPlan().getAdditions()); Object[] children = newElement.getChildren(newElement); StringBuffer temp = new StringBuffer(); if (children != null && children.length != 0) { AvailableIUElement c = (AvailableIUElement) children[0]; String detail = c.getIU().getProperty(IInstallableUnit.PROP_DESCRIPTION, null); if (detail == null) detail = ""; temp.append(detail); } String descResult = ""; if(temp.length() != 0){ String lang = CommonFunction.getSystemLanguage(); String szh = "[-zh-]"; String sen = "[-en-]"; if(lang.equals("en")){ descResult = temp.substring(sen.length() + 1, temp.indexOf(szh) - 1); }else if(lang.equals("zh")){ descResult = temp.substring(temp.indexOf(szh) + szh.length() + 1, temp.length()); } } return descBf.append(descResult).toString(); // String detail = ""; // Object[] elements = root.getChildren(root); // if(elements.length > 0){ // AvailableUpdateElement element = (AvailableUpdateElement) elements[0]; // Object[] children = element.getChildren(element); // if(children != null && children.length != 0){ // AvailableIUElement c = (AvailableIUElement) children[0]; // IInstallableUnit selectedIU = ElementUtils.elementToIU(c); // detail = selectedIU.getProperty(IInstallableUnit.PROP_DESCRIPTION, null); // if (detail == null) // detail = ""; // } // } }
Example #4
Source File: UpdateDescriptionPage.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
private String getUpdateDescDetailText() { StringBuffer descBf = new StringBuffer(); Update[] updates = operation.getSelectedUpdates(); if (updates.length == 0) { // no udpates; setPageComplete(false); return P2UpdateUtil.UPDATE_PROMPT_INFO_NO_UPDATE; } Update update = updates[0]; AvailableUpdateElement newElement = new AvailableUpdateElement(null, update.replacement, update.toUpdate, ui.getProfileId(), ProvUI.getQueryContext(ui.getPolicy()).getShowProvisioningPlanChildren()); descBf.append(P2UpdateUtil.UI_WIZARD_DESC_PAGE_DESC_DETAIL).append(newElement.getIU().getVersion()) .append("\n\n"); newElement.setQueryable(operation.getProvisioningPlan().getAdditions()); Object[] children = newElement.getChildren(newElement); StringBuffer temp = new StringBuffer(); if (children != null && children.length != 0) { AvailableIUElement c = (AvailableIUElement) children[0]; String detail = c.getIU().getProperty(IInstallableUnit.PROP_DESCRIPTION, null); if (detail == null) detail = ""; temp.append(detail); } String descResult = ""; if (temp.length() != 0) { String lang = CommonFunction.getSystemLanguage(); String szh = "[-zh-]"; String sen = "[-en-]"; try { if (lang.equals("en")) { descResult = temp.substring(sen.length() + 1, temp.indexOf(szh) - 1); } else if (lang.equals("zh")) { descResult = temp.substring(temp.indexOf(szh) + szh.length() + 1, temp.length()); } } catch (StringIndexOutOfBoundsException e) { e.printStackTrace(); descResult = temp.toString(); } } return descBf.append(descResult).toString(); // String detail = ""; // Object[] elements = root.getChildren(root); // if(elements.length > 0){ // AvailableUpdateElement element = (AvailableUpdateElement) elements[0]; // Object[] children = element.getChildren(element); // if(children != null && children.length != 0){ // AvailableIUElement c = (AvailableIUElement) children[0]; // IInstallableUnit selectedIU = ElementUtils.elementToIU(c); // detail = selectedIU.getProperty(IInstallableUnit.PROP_DESCRIPTION, null); // if (detail == null) // detail = ""; // } // } }