Package q_impress.pmi.lib.services.loadsave

Examples of q_impress.pmi.lib.services.loadsave.SavingService


    }
   
    IContainer container = (IContainer) resource;
    IFile file = container.getFile(new Path(filename));
   
    SavingService savingService = new SavingService();
    ModelingProject project = new ModelingProject();
    project.setName(file.getName());
   
   
    ByteArrayOutputStream outStream = new ByteArrayOutputStream();
    ByteArrayInputStream inStream = null;
    try {
     
      savingService.setOutStream(outStream);
      savingService.setTarget(project);
      savingService.initialize();
      savingService.invoke();
     
      inStream = new ByteArrayInputStream(outStream.toByteArray());
     
      if (file.exists()) {
        file.setContents(inStream, true, true, null);
View Full Code Here


      throw new ExecutionException("Unable to add XMI resource to model.", e);
    }
   
    // save the project
    ByteArrayOutputStream outStream = new ByteArrayOutputStream();
    SavingService savingService = new SavingService();
    try {
     
      savingService.setOutStream(outStream);
      savingService.setTarget(project);
      savingService.initialize();
      savingService.invoke();
     
      inStream = new ByteArrayInputStream(outStream.toByteArray());
      targetModelResource.setContents(inStream, true, true, null);
    } catch (ServiceException e) {
      throw new ExecutionException("Unable to create model.", e);
View Full Code Here

    // now try to save the project
    String filename = "/tmp/test.pmi";
    try {
      FileOutputStream stream = new FileOutputStream(filename);
      try {
        SavingService savingService = new SavingService();
        savingService.setOutStream(stream);
        savingService.setTarget(project);
        try {
          savingService.initialize();
          savingService.invoke();
        } catch (ServiceException e) {
          e.printStackTrace();
          assertTrue(false);
        }
      } finally {
View Full Code Here

      throwCoreException("Unable to add task", e);
    }
  }
 
  private void saveTargetProject(String projectFileName, ModelingProject project, IProgressMonitor monitor) throws CoreException {
    SavingService service = new SavingService();
    ByteArrayOutputStream outStream = new ByteArrayOutputStream();
    InputStream inStream = null;
    try {
      service.setTarget(project);
      service.setOutStream(outStream);
      service.initialize();
      service.invoke();
     
      inStream = new ByteArrayInputStream(outStream.toByteArray());
      ((IFile)ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(projectFileName))).setContents(inStream, true, false, monitor);
    } catch (ServiceException e) {
      throwCoreException("Unable to save modeling project.", e);
View Full Code Here

   
    if (element instanceof ModelingProjectEditorInput) {
      ModelingProject project = ((ModelingProjectEditorInput) element).getProject();
      ByteArrayOutputStream outStream = new ByteArrayOutputStream();
      try {
        SavingService service = new SavingService();
        service.setOutStream(outStream);
        service.setTarget(project);
        service.initialize();
        service.invoke();
       
        Document doc = new Document();
        doc.set(outStream.toString());
        return doc;
      } catch (ServiceException e) {
View Full Code Here

   
    monitor.beginTask("Saving performance model", 2);
   
    ByteArrayOutputStream outStream = new ByteArrayOutputStream();
    try {
      SavingService service = new SavingService();
      service.setOutStream(outStream);
      service.setTarget(this.projectInput.getProject());
      service.initialize();
      service.invoke();
     
      monitor.worked(1);
     
      monitor.setTaskName("Persisting model on file");
      ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());
View Full Code Here

      throwCoreException("Unable to add task", e);
    }
  }
 
  private void saveTargetProject(String projectFileName, ModelingProject project, IProgressMonitor monitor) throws CoreException {
    SavingService service = new SavingService();
    ByteArrayOutputStream outStream = new ByteArrayOutputStream();
    InputStream inStream = null;
    try {
      service.setTarget(project);
      service.setOutStream(outStream);
      service.initialize();
      service.invoke();
     
      inStream = new ByteArrayInputStream(outStream.toByteArray());
      ((IFile)ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(projectFileName))).setContents(inStream, true, false, monitor);
    } catch (ServiceException e) {
      throwCoreException("Unable to save modeling project.", e);
View Full Code Here

TOP

Related Classes of q_impress.pmi.lib.services.loadsave.SavingService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.