Project

General

Profile

« Previous | Next » 

Revision a7d59765

Added by Cherian Mathew over 8 years ago

Correct update operation initialisation

View differences:

eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/update/UpdateHandler.java
20 20
import org.eclipse.equinox.p2.core.IProvisioningAgent;
21 21
import org.eclipse.equinox.p2.core.ProvisionException;
22 22
import org.eclipse.equinox.p2.operations.ProvisioningJob;
23
import org.eclipse.equinox.p2.operations.RepositoryTracker;
24 23
import org.eclipse.equinox.p2.operations.UpdateOperation;
25 24
import org.eclipse.equinox.p2.repository.IRepositoryManager;
26 25
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
......
47 46
        if (hasNoRepos) {
48 47
            return;
49 48
        }
50
        UpdateOperation operation = getProvisioningUI().getUpdateOperation(null, null);
49
        UpdateOperation operation = new UpdateOperation(ProvisioningUI.getDefaultUI().getSession());
51 50

  
52 51
        // check for updates
53 52
        IStatus status = checkForUpdates(operation);
54 53

  
55
        if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
56
            MessagingUtils.informationDialog("Checking for updates", status);
57
            return;
58
        }
59 54

  
60 55
        if (status.isOK() && status.getSeverity() != IStatus.ERROR) {
61 56

  
......
85 80
                    }
86 81
                }
87 82
            }
83
        } else {
84
            MessagingUtils.informationDialog("Checking for updates", status);
88 85
        }
89 86
    }
90 87

  
......
124 121
            bundleContext.ungetService(reference);
125 122
        }
126 123
    }
127

  
128

  
129
    @Override
130
    protected boolean preloadRepositories() {
131
        hasNoRepos = false;
132
        RepositoryTracker repoMan = getProvisioningUI().getRepositoryTracker();
133
        if (repoMan.getKnownRepositories(getProvisioningUI().getSession()).length == 0) {
134
            hasNoRepos = true;
135
            return false;
136
        }
137
        return super.preloadRepositories();
138
    }
139 124
}

Also available in: Unified diff