use of org.eclipse.m2e.core.ui.internal.editing.PomEdits.INCEPTION_YEAR in project m2e-core by eclipse-m2e.
the class OverviewPage method loadThis.
private void loadThis(final int mask) {
Display.getDefault().asyncExec(() -> {
removeNotifyListener(parentGroupIdText);
removeNotifyListener(parentArtifactIdText);
removeNotifyListener(parentVersionText);
removeNotifyListener(parentRelativePathText);
removeNotifyListener(artifactGroupIdText);
removeNotifyListener(artifactIdText);
removeNotifyListener(artifactVersionText);
removeNotifyListener(artifactPackagingCombo);
removeNotifyListener(projectNameText);
removeNotifyListener(projectDescriptionText);
removeNotifyListener(projectUrlText);
removeNotifyListener(inceptionYearText);
removeNotifyListener(organizationNameText);
removeNotifyListener(organizationUrlText);
removeNotifyListener(scmUrlText);
removeNotifyListener(scmConnectionText);
removeNotifyListener(scmDevConnectionText);
removeNotifyListener(scmTagText);
removeNotifyListener(ciManagementUrlCombo);
removeNotifyListener(ciManagementSystemCombo);
removeNotifyListener(issueManagementUrlCombo);
removeNotifyListener(issueManagementSystemCombo);
try {
performOnDOMDocument(new OperationTuple(getPomEditor().getDocument(), document -> {
Element root = document.getDocumentElement();
String pack = nvl(getTextValue(findChild(root, PACKAGING)));
// $NON-NLS-1$ //$NON-NLS-2$
pack = "".equals(pack) ? "jar" : pack;
if ((mask & RELOAD_BASE) != 0) {
setText(artifactGroupIdText, nvl(getTextValue(findChild(root, GROUP_ID))));
setText(artifactIdText, nvl(getTextValue(findChild(root, ARTIFACT_ID))));
setText(artifactVersionText, nvl(getTextValue(findChild(root, VERSION))));
setText(artifactPackagingCombo, pack);
String name = getTextValue(findChild(root, NAME));
setText(projectNameText, nvl(name));
String desc = getTextValue(findChild(root, DESCRIPTION));
setText(projectDescriptionText, nvl(desc));
String url = getTextValue(findChild(root, URL));
setText(projectUrlText, nvl(url));
String incep = getTextValue(findChild(root, INCEPTION_YEAR));
setText(inceptionYearText, nvl(incep));
boolean expandProjectSection = name != null || desc != null || url != null || incep != null;
projectSectionData.grabExcessVerticalSpace = expandProjectSection;
projectSection.setExpanded(expandProjectSection);
}
if ((mask & RELOAD_PARENT) != 0) {
// parent section
Element parent = findChild(root, PARENT);
String parentGrId = getTextValue(findChild(parent, GROUP_ID));
String parentArtId = getTextValue(findChild(parent, ARTIFACT_ID));
String parentVers = getTextValue(findChild(parent, VERSION));
setText(parentGroupIdText, nvl(parentGrId));
setText(parentArtifactIdText, nvl(parentArtId));
setText(parentVersionText, nvl(parentVers));
setText(parentRelativePathText, nvl(getTextValue(findChild(parent, RELATIVE_PATH))));
parentSelectAction.setEnabled(!isReadOnly());
// only enable when all 3 coordinates are actually present.
parentOpenAction.setEnabled(root != null && parentGrId != null && parentArtId != null && parentVers != null);
parentSection.setExpanded(parent != null);
}
if ((mask & RELOAD_ORG) != 0) {
// organization section
Element org = findChild(root, ORGANIZATION);
setText(organizationNameText, nvl(getTextValue(findChild(org, NAME))));
setText(organizationUrlText, nvl(getTextValue(findChild(org, URL))));
organizationSection.setExpanded(org != null);
}
if ((mask & RELOAD_SCM) != 0) {
// scm section
Element scm = findChild(root, SCM);
setText(scmUrlText, nvl(getTextValue(findChild(scm, URL))));
setText(scmConnectionText, nvl(getTextValue(findChild(scm, CONNECTION))));
setText(scmDevConnectionText, nvl(getTextValue(findChild(scm, DEV_CONNECTION))));
setText(scmTagText, nvl(getTextValue(findChild(scm, TAG))));
scmSection.setExpanded(scm != null);
}
if ((mask & RELOAD_CI) != 0) {
// ci section
Element ci = findChild(root, CI_MANAGEMENT);
setText(ciManagementSystemCombo, nvl(getTextValue(findChild(ci, SYSTEM))));
setText(ciManagementUrlCombo, nvl(getTextValue(findChild(ci, URL))));
ciManagementSection.setExpanded(ci != null);
}
if ((mask & RELOAD_IM) != 0) {
// issue management
Element im = findChild(root, ISSUE_MANAGEMENT);
setText(issueManagementSystemCombo, nvl(getTextValue(findChild(im, SYSTEM))));
setText(issueManagementUrlCombo, nvl(getTextValue(findChild(im, URL))));
issueManagementSection.setExpanded(im != null);
}
if ((mask & RELOAD_MODULES) != 0) {
// modules section..
List<Element> moduleEls = findChilds(findChild(root, MODULES), MODULE);
List<String> modules = new ArrayList<>();
for (Element moduleEl : moduleEls) {
String text = getTextValue(moduleEl);
if (text != null) {
modules.add(text);
}
}
loadModules(modules, pack);
// #335337 no editing of packaging when there are modules, results in error anyway
artifactPackagingCombo.setEnabled(modules.isEmpty());
}
if ((mask & RELOAD_PROPERTIES) != 0) {
propertiesSection.refresh();
Element props = findChild(root, PROPERTIES);
propertiesSection.setExpanded(props != null);
// TODO used to check teh model's empty state as well, not done now..
}
}, true));
} catch (Exception e) {
LOG.error("Failed to populate overview panel", e);
}
addNotifyListener(artifactGroupIdText);
addNotifyListener(artifactIdText);
addNotifyListener(artifactVersionText);
addNotifyListener(artifactPackagingCombo);
addNotifyListener(projectNameText);
addNotifyListener(projectDescriptionText);
addNotifyListener(projectUrlText);
addNotifyListener(inceptionYearText);
addNotifyListener(parentGroupIdText);
addNotifyListener(parentArtifactIdText);
addNotifyListener(parentVersionText);
addNotifyListener(parentRelativePathText);
addNotifyListener(organizationNameText);
addNotifyListener(organizationUrlText);
addNotifyListener(scmUrlText);
addNotifyListener(scmConnectionText);
addNotifyListener(scmDevConnectionText);
addNotifyListener(scmTagText);
addNotifyListener(ciManagementUrlCombo);
addNotifyListener(ciManagementSystemCombo);
addNotifyListener(issueManagementUrlCombo);
addNotifyListener(issueManagementSystemCombo);
});
}
Aggregations