Package q_impress.pmi.lib.services.loadsave

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


 
  private ModelingProject loadModel(ILaunchConfiguration configuration) throws CoreException {
    String modelFilePath = configuration.getAttribute(VAR_ROOT_MODEL_PATH, "");
    IFile modelFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(modelFilePath));
    if (modelFile.exists()) {
      LoadingService service = new LoadingService();
      InputStream inStream = null;
      try {
        inStream = modelFile.getContents();
        service.setInStream(inStream);
        service.setLocationSolver(new WorkspaceLocationSolver());
        service.initialize();
        service.invoke();
       
        if (service.getLoadedResource() instanceof ModelingProject) return (ModelingProject) service.getLoadedResource();
        else throw new CoreException(new Status(Status.ERROR, "q_impress", "Unable to load model, invalid file."));
      } catch (CoreException e) {
        throw new CoreException(new Status(Status.ERROR, "q_impress", "Unable to load model.", e));
      } catch (ServiceException e) {
        throw new CoreException(new Status(Status.ERROR, "q_impress", "Unable to load model.", e));
View Full Code Here


   
    // extract model root
    targetModelContainer = targetModelResource.getParent();
   
    // now try to load the modeling project
    LoadingService loadingService = new LoadingService();
    ModelingProject project = null;
    InputStream inStream = null;
    try {
      inStream = ((IFile)targetModelResource).getContents();
      loadingService.setInStream(inStream);
      loadingService.setLocationSolver(new WorkspaceLocationSolver());
      loadingService.initialize();
      loadingService.invoke();
      q_impress.pmi.lib.project.IResource tempRes = loadingService.getLoadedResource();
      if (!(tempRes instanceof ModelingProject)) throw new ExecutionException("Invalid model file.");
      else project = (ModelingProject) tempRes;
    } catch (CoreException e) {
      throw new ExecutionException("Unable to load model.", e);
    } catch (ServiceException e) {
View Full Code Here

        IFile res = (IFile) result[0];
       
        modelFileText.setText(res.getFullPath().toString());
       
        // try to load the model
        LoadingService service = new LoadingService();
        InputStream inStream = null;
        try {
          inStream = res.getContents();
          service.setInStream(inStream);
          service.setLocationSolver(new WorkspaceLocationSolver());
          service.initialize();
          service.invoke();
         
          if (service.getLoadedResource() instanceof ModelingProject) model = (ModelingProject) service.getLoadedResource();
          else model = null;
        } catch (CoreException e) {
          model = null;
        } catch (ServiceException e) {
          model = null;
View Full Code Here

    // try to load the project
    String filename = "/tmp/test.pmi";
    try {
      FileInputStream stream = new FileInputStream(filename);
      try {
        LoadingService loadingService = new LoadingService();
        loadingService.setInStream(stream);
        try {
          loadingService.initialize();
          loadingService.invoke();
          IResource prj = loadingService.getLoadedResource();
          int a = 1;
          a++;
        } catch (ServiceException e) {
          e.printStackTrace();
          assertTrue(false);
View Full Code Here

        IFile res = (IFile) result[0];
       
        projectPathText.setText(res.getFullPath().toString());
       
        // try to load the model
        LoadingService service = new LoadingService();
        InputStream inStream = null;
        try {
          inStream = res.getContents();
          service.setInStream(inStream);
          service.setLocationSolver(new WorkspaceLocationSolver());
          service.initialize();
          service.invoke();
         
          if (service.getLoadedResource() instanceof ModelingProject) project = (ModelingProject) service.getLoadedResource();
          else project = null;
        } catch (CoreException e) {
          project = null;
        } catch (ServiceException e) {
          project = null;
View Full Code Here

    IFileEditorInput specificInput = (IFileEditorInput) input;
    InputStream inStream = null;
    try {
      inStream = specificInput.getFile().getContents();
     
      LoadingService service = new LoadingService();
      service.setInStream(inStream);
      service.setLocationSolver(new WorkspaceLocationSolver());
      service.initialize();
      service.invoke();
     
      IResource loadedRes = service.getLoadedResource();
      if (!(loadedRes instanceof ModelingProject)) throw new PartInitException(new Status(IStatus.ERROR, "q_impress", "Invalid input for editor."));
      else {
        this.setInput(new ModelingProjectEditorInput((ModelingProject) loadedRes, this.originalInput));
        this.projectInput = (ModelingProjectEditorInput) this.getEditorInput();
      }
View Full Code Here

        IFile res = (IFile) result[0];
       
        projectPathText.setText(res.getFullPath().toString());
       
        // try to load the model
        LoadingService service = new LoadingService();
        InputStream inStream = null;
        try {
          inStream = res.getContents();
          service.setInStream(inStream);
          service.setLocationSolver(new WorkspaceLocationSolver());
          service.initialize();
          service.invoke();
         
          if (service.getLoadedResource() instanceof ModelingProject) project = (ModelingProject) service.getLoadedResource();
          else project = null;
        } catch (CoreException e) {
          project = null;
        } catch (ServiceException e) {
          project = null;
View Full Code Here

TOP

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

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.