Search in sources :

Example 1 with MManifest

use of org.obeonetwork.dsl.manifest.MManifest in project InformationSystem by ObeoNetwork.

the class ExportProjectAsLibraryWizardModel method setSelectedModelingProject.

public void setSelectedModelingProject(ModelingProject selectedModelingProject) {
    this.selectedModelingProject = selectedModelingProject;
    // Initialize values for other fields
    if (selectedModelingProject != null) {
        Session session = selectedModelingProject.getSession();
        List<MManifest> previousManifests = new ManifestServices().getExportedManifests(session);
        String projectId = selectedModelingProject.getProject().getName();
        if (!previousManifests.isEmpty()) {
            projectId = previousManifests.get(previousManifests.size() - 1).getProjectId();
        }
        setProjectId(projectId);
        setPreviousVersions(previousManifests);
    }
}
Also used : ManifestServices(org.obeonetwork.tools.projectlibrary.extension.ManifestServices) MManifest(org.obeonetwork.dsl.manifest.MManifest) Session(org.eclipse.sirius.business.api.session.Session)

Example 2 with MManifest

use of org.obeonetwork.dsl.manifest.MManifest in project InformationSystem by ObeoNetwork.

the class ImportLibraryIntoProjectFileSelectionPage method extractInfoFromManifest.

private void extractInfoFromManifest(Manifest manifest) {
    if (manifest != null) {
        MManifest manifestModel = manifestServices.getModelFromMarManifest(manifest);
        txtProjectId.setText(manifestModel.getProjectId());
        txtVersion.setText(manifestModel.getVersion());
        txtComment.setText(manifestModel.getComment());
        if (manifestModel.getCreationDate() != null) {
            txtCreationDate.setText(DATE_FORMAT.format(manifestModel.getCreationDate()));
        }
        wizard.getModel().getDependencies().addAll(manifestModel.getDependencies());
        wizard.getModel().setValidMarFile(true);
    } else {
        txtProjectId.setText(null);
        txtVersion.setText(null);
        txtComment.setText(null);
        txtCreationDate.setText(null);
        wizard.getModel().getDependencies().clear();
        wizard.getModel().getExistingDependenciesRows().clear();
        wizard.getModel().setValidMarFile(false);
    }
    computeDependenciesTable();
}
Also used : MManifest(org.obeonetwork.dsl.manifest.MManifest)

Example 3 with MManifest

use of org.obeonetwork.dsl.manifest.MManifest in project InformationSystem by ObeoNetwork.

the class ImportLibraryIntoProjectFileSelectionPage method computeDependenciesTable.

private void computeDependenciesTable() {
    List<DependencyRow> rows = new ArrayList<>();
    for (MManifest dependency : wizard.getModel().getDependencies()) {
        DependencyRow row = new DependencyRow();
        row.setId(dependency.getProjectId());
        row.setVersion(dependency.getVersion());
        String existingVersion = getExistingVersion(dependency.getProjectId());
        if (existingVersion != null) {
            row.setExistingVersion(existingVersion);
        }
        rows.add(row);
    }
    wizard.getModel().setExistingDependenciesRows(rows);
}
Also used : DependencyRow(org.obeonetwork.tools.projectlibrary.ui.wizard.imp.ImportLibraryIntoProjectWizardModel.DependencyRow) MManifest(org.obeonetwork.dsl.manifest.MManifest) ArrayList(java.util.ArrayList)

Example 4 with MManifest

use of org.obeonetwork.dsl.manifest.MManifest in project InformationSystem by ObeoNetwork.

the class ProjectLibraryImporter method getProjectName.

private String getProjectName(final File marFile) {
    String name = "";
    Manifest manifest = null;
    try {
        manifest = manifestServices.getManifestFromArchive(marFile);
    } catch (IOException e2) {
        // TODO Auto-generated catch block
        e2.printStackTrace();
    }
    if (manifest != null) {
        MManifest manifestModel = manifestServices.getModelFromMarManifest(manifest);
        name = manifestModel.getProjectId() + "-" + manifestModel.getVersion();
    }
    return name;
}
Also used : MManifest(org.obeonetwork.dsl.manifest.MManifest) IOException(java.io.IOException) Manifest(java.util.jar.Manifest) MManifest(org.obeonetwork.dsl.manifest.MManifest)

Example 5 with MManifest

use of org.obeonetwork.dsl.manifest.MManifest in project InformationSystem by ObeoNetwork.

the class ManifestServices method getNewManifest.

public MManifest getNewManifest(String id, String version, String comment) {
    MManifest manifest = ManifestFactory.eINSTANCE.createMManifest();
    manifest.setProjectId(id);
    try {
        manifest.setVersion(version);
    } catch (BadVersionStringException e) {
        return null;
    }
    if (comment == null) {
        manifest.setComment("");
    } else {
        manifest.setComment(comment);
    }
    manifest.setCreationDate(new Date());
    return manifest;
}
Also used : MManifest(org.obeonetwork.dsl.manifest.MManifest) BadVersionStringException(org.obeonetwork.dsl.manifest.BadVersionStringException) Date(java.util.Date)

Aggregations

MManifest (org.obeonetwork.dsl.manifest.MManifest)8 Manifest (java.util.jar.Manifest)3 IOException (java.io.IOException)2 Attributes (java.util.jar.Attributes)2 Session (org.eclipse.sirius.business.api.session.Session)2 BadVersionStringException (org.obeonetwork.dsl.manifest.BadVersionStringException)2 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 ParseException (java.text.ParseException)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 Matcher (java.util.regex.Matcher)1 IProject (org.eclipse.core.resources.IProject)1 ManifestServices (org.obeonetwork.tools.projectlibrary.extension.ManifestServices)1 DependencyRow (org.obeonetwork.tools.projectlibrary.ui.wizard.imp.ImportLibraryIntoProjectWizardModel.DependencyRow)1