Search in sources :

Example 1 with CI_MANAGEMENT

use of org.eclipse.m2e.core.ui.internal.editing.PomEdits.CI_MANAGEMENT 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);
    });
}
Also used : Notification(org.eclipse.emf.common.notify.Notification) MavenModuleWizard(org.eclipse.m2e.core.ui.internal.wizards.MavenModuleWizard) DND(org.eclipse.swt.dnd.DND) CoreException(org.eclipse.core.runtime.CoreException) DropTargetEvent(org.eclipse.swt.dnd.DropTargetEvent) RELATIVE_PATH(org.eclipse.m2e.core.ui.internal.editing.PomEdits.RELATIVE_PATH) Document(org.w3c.dom.Document) Composite(org.eclipse.swt.widgets.Composite) SCM(org.eclipse.m2e.core.ui.internal.editing.PomEdits.SCM) PomEdits.removeChild(org.eclipse.m2e.core.ui.internal.editing.PomEdits.removeChild) Text(org.eclipse.swt.widgets.Text) M2EUIUtils(org.eclipse.m2e.core.ui.internal.util.M2EUIUtils) IEditorInput(org.eclipse.ui.IEditorInput) PlatformUI(org.eclipse.ui.PlatformUI) Set(java.util.Set) Status(org.eclipse.core.runtime.Status) ResourceTransfer(org.eclipse.ui.part.ResourceTransfer) Transfer(org.eclipse.swt.dnd.Transfer) Window(org.eclipse.jface.window.Window) NAME(org.eclipse.m2e.core.ui.internal.editing.PomEdits.NAME) PomEdits.createElementWithText(org.eclipse.m2e.core.ui.internal.editing.PomEdits.createElementWithText) MavenImages(org.eclipse.m2e.core.ui.internal.MavenImages) PomEdits.removeIfNoChildElement(org.eclipse.m2e.core.ui.internal.editing.PomEdits.removeIfNoChildElement) Path(org.eclipse.core.runtime.Path) SWT(org.eclipse.swt.SWT) CI_MANAGEMENT(org.eclipse.m2e.core.ui.internal.editing.PomEdits.CI_MANAGEMENT) DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) Operation(org.eclipse.m2e.core.ui.internal.editing.PomEdits.Operation) SelectionListener(org.eclipse.swt.events.SelectionListener) ISSUE_MANAGEMENT(org.eclipse.m2e.core.ui.internal.editing.PomEdits.ISSUE_MANAGEMENT) URL(org.eclipse.m2e.core.ui.internal.editing.PomEdits.URL) PARENT(org.eclipse.m2e.core.ui.internal.editing.PomEdits.PARENT) StringLabelProvider(org.eclipse.m2e.editor.composites.StringLabelProvider) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) PomEdits(org.eclipse.m2e.core.ui.internal.editing.PomEdits) PomEdits.getChild(org.eclipse.m2e.core.ui.internal.editing.PomEdits.getChild) ArrayList(java.util.ArrayList) IContainer(org.eclipse.core.resources.IContainer) IMavenConstants(org.eclipse.m2e.core.internal.IMavenConstants) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent) INCEPTION_YEAR(org.eclipse.m2e.core.ui.internal.editing.PomEdits.INCEPTION_YEAR) VERSION(org.eclipse.m2e.core.ui.internal.editing.PomEdits.VERSION) MavenRepositorySearchDialog(org.eclipse.m2e.core.ui.internal.dialogs.MavenRepositorySearchDialog) IFile(org.eclipse.core.resources.IFile) GridData(org.eclipse.swt.layout.GridData) OpenPomAction(org.eclipse.m2e.core.ui.internal.actions.OpenPomAction) LinkedHashSet(java.util.LinkedHashSet) Section(org.eclipse.ui.forms.widgets.Section) DefaultArtifact(org.apache.maven.artifact.DefaultArtifact) DefaultArtifactHandler(org.apache.maven.artifact.handler.DefaultArtifactHandler) FileEditorInput(org.eclipse.ui.part.FileEditorInput) StackLayout(org.eclipse.swt.custom.StackLayout) ListEditorContentProvider(org.eclipse.m2e.editor.composites.ListEditorContentProvider) FormUtils.setText(org.eclipse.m2e.editor.pom.FormUtils.setText) PROPERTIES(org.eclipse.m2e.core.ui.internal.editing.PomEdits.PROPERTIES) Plugin(org.apache.maven.model.Plugin) ModifyListener(org.eclipse.swt.events.ModifyListener) DocumentBuilder(javax.xml.parsers.DocumentBuilder) MODULES(org.eclipse.m2e.core.ui.internal.editing.PomEdits.MODULES) MavenEditorImages(org.eclipse.m2e.editor.MavenEditorImages) GridLayout(org.eclipse.swt.layout.GridLayout) ArtifactKey(org.eclipse.m2e.core.embedder.ArtifactKey) LoggerFactory(org.slf4j.LoggerFactory) Hyperlink(org.eclipse.ui.forms.widgets.Hyperlink) JarFile(java.util.jar.JarFile) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) MavenModuleSelectionDialog(org.eclipse.m2e.editor.dialogs.MavenModuleSelectionDialog) PomEdits.getTextValue(org.eclipse.m2e.core.ui.internal.editing.PomEdits.getTextValue) IStatus(org.eclipse.core.runtime.IStatus) PomEdits.performOnDOMDocument(org.eclipse.m2e.core.ui.internal.editing.PomEdits.performOnDOMDocument) DropTargetAdapter(org.eclipse.swt.dnd.DropTargetAdapter) MavenPluginActivator(org.eclipse.m2e.core.internal.MavenPluginActivator) IPath(org.eclipse.core.runtime.IPath) ARTIFACT_ID(org.eclipse.m2e.core.ui.internal.editing.PomEdits.ARTIFACT_ID) OperationTuple(org.eclipse.m2e.core.ui.internal.editing.PomEdits.OperationTuple) TAG(org.eclipse.m2e.core.ui.internal.editing.PomEdits.TAG) Artifact(org.apache.maven.artifact.Artifact) ListEditorComposite(org.eclipse.m2e.editor.composites.ListEditorComposite) PomEdits.setText(org.eclipse.m2e.core.ui.internal.editing.PomEdits.setText) CCombo(org.eclipse.swt.custom.CCombo) Messages(org.eclipse.m2e.editor.internal.Messages) PomEdits.format(org.eclipse.m2e.core.ui.internal.editing.PomEdits.format) NLS(org.eclipse.osgi.util.NLS) WidthGroup(org.eclipse.m2e.core.ui.internal.wizards.WidthGroup) Display(org.eclipse.swt.widgets.Display) IManagedForm(org.eclipse.ui.forms.IManagedForm) MODULE(org.eclipse.m2e.core.ui.internal.editing.PomEdits.MODULE) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) List(java.util.List) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) PomEdits.textEquals(org.eclipse.m2e.core.ui.internal.editing.PomEdits.textEquals) WizardDialog(org.eclipse.jface.wizard.WizardDialog) SYSTEM(org.eclipse.m2e.core.ui.internal.editing.PomEdits.SYSTEM) Label(org.eclipse.swt.widgets.Label) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) PomEdits.findChilds(org.eclipse.m2e.core.ui.internal.editing.PomEdits.findChilds) ArtifactHandler(org.apache.maven.artifact.handler.ArtifactHandler) CONNECTION(org.eclipse.m2e.core.ui.internal.editing.PomEdits.CONNECTION) ORGANIZATION(org.eclipse.m2e.core.ui.internal.editing.PomEdits.ORGANIZATION) Image(org.eclipse.swt.graphics.Image) PACKAGING(org.eclipse.m2e.core.ui.internal.editing.PomEdits.PACKAGING) HashSet(java.util.HashSet) ProposalUtil(org.eclipse.m2e.core.ui.internal.util.ProposalUtil) JarEntry(java.util.jar.JarEntry) DESCRIPTION(org.eclipse.m2e.core.ui.internal.editing.PomEdits.DESCRIPTION) GROUP_ID(org.eclipse.m2e.core.ui.internal.editing.PomEdits.GROUP_ID) Node(org.w3c.dom.Node) ArtifactRepository(org.apache.maven.artifact.repository.ArtifactRepository) PomEdits.findChild(org.eclipse.m2e.core.ui.internal.editing.PomEdits.findChild) FormUtils.nvl(org.eclipse.m2e.editor.pom.FormUtils.nvl) ICellModifier(org.eclipse.jface.viewers.ICellModifier) Packaging(org.eclipse.m2e.core.ui.internal.search.util.Packaging) Logger(org.slf4j.Logger) NodeList(org.w3c.dom.NodeList) Job(org.eclipse.core.runtime.jobs.Job) IMavenProjectFacade(org.eclipse.m2e.core.project.IMavenProjectFacade) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) Action(org.eclipse.jface.action.Action) PomEdits.childAt(org.eclipse.m2e.core.ui.internal.editing.PomEdits.childAt) ScrolledForm(org.eclipse.ui.forms.widgets.ScrolledForm) Element(org.w3c.dom.Element) ToolBarManager(org.eclipse.jface.action.ToolBarManager) IndexedArtifactFile(org.eclipse.m2e.core.internal.index.IndexedArtifactFile) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter) DEV_CONNECTION(org.eclipse.m2e.core.ui.internal.editing.PomEdits.DEV_CONNECTION) Control(org.eclipse.swt.widgets.Control) OperationTuple(org.eclipse.m2e.core.ui.internal.editing.PomEdits.OperationTuple) PomEdits.removeIfNoChildElement(org.eclipse.m2e.core.ui.internal.editing.PomEdits.removeIfNoChildElement) Element(org.w3c.dom.Element) ArrayList(java.util.ArrayList) List(java.util.List) NodeList(org.w3c.dom.NodeList) CoreException(org.eclipse.core.runtime.CoreException)

Aggregations

ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 List (java.util.List)1 Set (java.util.Set)1 JarEntry (java.util.jar.JarEntry)1 JarFile (java.util.jar.JarFile)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)1 Artifact (org.apache.maven.artifact.Artifact)1 DefaultArtifact (org.apache.maven.artifact.DefaultArtifact)1 ArtifactHandler (org.apache.maven.artifact.handler.ArtifactHandler)1 DefaultArtifactHandler (org.apache.maven.artifact.handler.DefaultArtifactHandler)1 ArtifactRepository (org.apache.maven.artifact.repository.ArtifactRepository)1 Plugin (org.apache.maven.model.Plugin)1 IContainer (org.eclipse.core.resources.IContainer)1 IFile (org.eclipse.core.resources.IFile)1 CoreException (org.eclipse.core.runtime.CoreException)1 IPath (org.eclipse.core.runtime.IPath)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1