Search in sources :

Example 1 with PackageInfoDialog

use of bndtools.editor.contents.PackageInfoDialog in project bndtools by bndtools.

the class ExportPatternsListPart method doAddClauses.

@Override
protected void doAddClauses(Collection<? extends ExportedPackage> pkgs, int index, boolean select) {
    List<FileVersionTuple> missingPkgInfoDirs;
    try {
        missingPkgInfoDirs = new ArrayList<FileVersionTuple>(findSourcePackagesWithoutPackageInfo(pkgs));
    } catch (Exception e) {
        ErrorDialog.openError(getManagedForm().getForm().getShell(), "Error", null, new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Error finding source package for exported 1packages.", e));
        missingPkgInfoDirs = Collections.emptyList();
    }
    List<FileVersionTuple> generatePkgInfoDirs = new ArrayList<FileVersionTuple>(missingPkgInfoDirs.size());
    BndPreferences prefs = new BndPreferences();
    boolean noAskPackageInfo = prefs.getNoAskPackageInfo();
    if (noAskPackageInfo || missingPkgInfoDirs.isEmpty()) {
        generatePkgInfoDirs.addAll(missingPkgInfoDirs);
    } else {
        PackageInfoDialog dlg = new PackageInfoDialog(getSection().getShell(), missingPkgInfoDirs);
        if (dlg.open() == Window.CANCEL)
            return;
        prefs.setNoAskPackageInfo(dlg.isDontAsk());
        generatePkgInfoDirs.addAll(dlg.getSelectedPackageDirs());
    }
    try {
        generatePackageInfos(generatePkgInfoDirs);
    } catch (CoreException e) {
        ErrorDialog.openError(getManagedForm().getForm().getShell(), "Error", null, new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Error generated packageinfo files.", e));
    }
    // Actually add the new exports
    super.doAddClauses(pkgs, index, select);
}
Also used : MultiStatus(org.eclipse.core.runtime.MultiStatus) IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) BndPreferences(bndtools.preferences.BndPreferences) FileVersionTuple(bndtools.editor.contents.PackageInfoDialog.FileVersionTuple) CoreException(org.eclipse.core.runtime.CoreException) ArrayList(java.util.ArrayList) PackageInfoDialog(bndtools.editor.contents.PackageInfoDialog) CoreException(org.eclipse.core.runtime.CoreException) InvocationTargetException(java.lang.reflect.InvocationTargetException) UnsupportedEncodingException(java.io.UnsupportedEncodingException)

Aggregations

PackageInfoDialog (bndtools.editor.contents.PackageInfoDialog)1 FileVersionTuple (bndtools.editor.contents.PackageInfoDialog.FileVersionTuple)1 BndPreferences (bndtools.preferences.BndPreferences)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ArrayList (java.util.ArrayList)1 CoreException (org.eclipse.core.runtime.CoreException)1 IStatus (org.eclipse.core.runtime.IStatus)1 MultiStatus (org.eclipse.core.runtime.MultiStatus)1 Status (org.eclipse.core.runtime.Status)1