use of org.eclipse.equinox.internal.p2.ui.model.AvailableUpdateElement in project translationstudio8 by heartsome.
the class UpdateDescriptionPage method getUpdateDescDetailText.
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 = "";
// }
// }
}
use of org.eclipse.equinox.internal.p2.ui.model.AvailableUpdateElement in project translationstudio8 by heartsome.
the class UpdateWizard method initializeResolutionModelElements.
protected void initializeResolutionModelElements(Object[] selectedElements) {
root = new IUElementListRoot();
ArrayList<AvailableUpdateElement> list = new ArrayList<AvailableUpdateElement>(selectedElements.length);
for (int i = 0; i < selectedElements.length; i++) {
if (selectedElements[i] instanceof AvailableUpdateElement) {
AvailableUpdateElement element = (AvailableUpdateElement) selectedElements[i];
AvailableUpdateElement newElement = new AvailableUpdateElement(root, element.getIU(), element.getIUToBeUpdated(), getProfileId(), shouldShowProvisioningPlanChildren());
list.add(newElement);
} else if (selectedElements[i] instanceof Update) {
Update update = (Update) selectedElements[i];
AvailableUpdateElement newElement = new AvailableUpdateElement(root, update.replacement, update.toUpdate, getProfileId(), shouldShowProvisioningPlanChildren());
list.add(newElement);
}
}
root.setChildren(list.toArray());
}
Aggregations