eclipse / amalgam

Eclipse Public License 1.0
0 stars 4 forks source link

Unclear cause of failure in discovery if installation fails #135

Open eclipse-amalgam-bot opened 3 years ago

eclipse-amalgam-bot commented 3 years ago

When an installation via the discovery fails (typically due to a missing dependency in the base eclipse), the discovery dialog does not help the user in finding the cause.

It reports only the top IStatus.getMessages() where actually the real cause in hidden in the children.

The best message I can get is:

java.lang.RuntimeException: Operation details at org.eclipse.amalgam.discovery.ui.common.internal.PrepareInstallProfileJob.resolve(PrepareInstallProfileJob.java:143) at org.eclipse.amalgam.discovery.ui.common.internal.PrepareInstallProfileJob.run(PrepareInstallProfileJob.java:104) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)

where actually I would expect something like : Your original request has been modified. "Timesquare" will be ignored because it is already installed. Cannot complete the install because one or more required items could not be found. Software being installed: GEMOC Execution Engine CCSL Java 2.3.0.201802271040 (org.eclipse.gemoc.execution.concurrent.ccsljavaxdsml.feature.feature.group 2.3.0.201802271040) Missing requirement: Acceleo Ecltoqvto Module Runtime Plug-in 1.0.0.201802271040 (org.eclipse.gemoc.moccml.mapping.ecltoqvto 1.0.0.201802271040) requires 'bundle org.eclipse.ocl.xtext.completeocl 0.0.0' but it could not be found Cannot satisfy dependency: From: GEMOC Execution Engine CCSL Java 2.3.0.201802271040 (org.eclipse.gemoc.execution.concurrent.ccsljavaxdsml.feature.feature.group 2.3.0.201802271040) To: org.eclipse.gemoc.execution.concurrent.ccsljavaxdsml.ui [2.3.0.201802271040] Cannot satisfy dependency: From: Gemoc Language Workbench UI 2.3.0.201802271040 (org.eclipse.gemoc.execution.concurrent.ccsljavaxdsml.ui 2.3.0.201802271040)

I can reproduce this in GEMOC project, which reuse the amalgam discovery https://github.com/eclipse/gemoc-studio/tree/master/gemoc_studio/plugins/org.eclipse.gemoc.gemoc_studio.branding/src/main/java/org/eclipse/gemoc/gemoc_studio/branding/handlers which simply declare a new discovery with a new url

but this is probably the case in modeling too.

I've tried to workaround the issue in GEMOC, but cannot do it properly because most of the classes are either not exported or the field are private.

The change in amalgam is quite easy : in class org.eclipse.amalgam.discovery.ui.common.internal.DiscoveryUiUtil.java

simply improve the displayStatus method by drilling down in the multistatus. For example with a code like:

replace String message = status.getMessage(); by String message = getFullMessage(status);

and add

public static String getFullMessage(IStatus status) {
    if(status.isMultiStatus()) {
        StringBuilder sb = new StringBuilder();
        sb.append(status.getMessage());
        for ( IStatus subStatus : status.getChildren()) {
            sb.append("\n");
            sb.append(getFullMessage(subStatus));
        }
        return sb.toString();
    } else {
        return status.getMessage();
    }
}

🆔 ECLIPSE-531789 👷 didier.vojtisek 📅 2018-02-28

eclipse-amalgam-bot commented 3 years ago

didier.vojtisek commented on 2018-02-28

even better solution:

add in org.eclipse.amalgam.discovery.ui.common.internal.PrepareInstallProfileJob#L166 (just before throwing the RuntimeException the following line: DiscoveryUIPlugin.getDefault().getLog().log(operationStatus);

this will add a nice message in the error log

didier.vojtisek commented on 2018-03-01

patch available in gerrit https://git.eclipse.org/r/#/c/118366/

didier.vojtisek commented on 2018-12-21

Hi Is there any news about a review of the patch I proposed in gerrit ?