Package q_impress.pmi.lib.project

Examples of q_impress.pmi.lib.project.ModelingProject


    setTabs(tabs);
  }
 
  @Override
  public void setModel(ModelingProject model) {
    ModelingProject oldModel = model;
    this.model = model;
    fireModelChangeEvent(new PropertyChangeEvent(this, "model", oldModel, model));
  }
View Full Code Here


   
    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 {
View Full Code Here

  @Override
  public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
    throws CoreException {
   
    // load the root model
    ModelingProject rootModel = loadModel(configuration);
   
    // set total working units
    int totalWorkUnits = getPrismTasksCount(rootModel);
    monitor.beginTask("Launching Prism Models", totalWorkUnits);
   
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) {
      throw new ExecutionException("Unable to load model.", e);
    } finally {
      if (inStream != null) {
        try {
          inStream.close();
        } catch (IOException e) {} // never happens
      }
    }
   
    if (doBundling == true) { // do bundling
      IPath copyPath = targetModelContainer.getFullPath().append(Constants.UML_MODELS_DIR).append(umlResource.getName());
     
      try {
        umlResource.copy(copyPath, true, null);
      } catch (CoreException e) {
        throw new ExecutionException("Unable to bundle XMI resource.", e);
      }
    }
   
    // create the new XMI resource and add it to model
    UmlResource newPmiRes = new UmlResource();
    newPmiRes.setName(umlResource.getName().substring(0, umlResource.getName().indexOf(".")));
    newPmiRes.setLocation(umlResource.getFullPath().toPortableString());
    try {
      project.addResource(newPmiRes);
    } catch (ResourceException e) {
      throw new ExecutionException("Unable to add XMI resource to model.", e);
    }
   
    // save the project
View Full Code Here

    gd.horizontalSpan = 2;
    l.setData(gd);
  }
 
  private void handleProjectBrowse() {
    ModelingProject model = null;
   
    ResourceSelectionDialog dialog = new ResourceSelectionDialog(getShell(),
        ResourcesPlugin.getWorkspace().getRoot(), "Select a modeling project");
   
    if (dialog.open() == ContainerSelectionDialog.OK) {
View Full Code Here

public class LoadSaveTests {

  @Test
  public void testSave() {
    IModelingProject project = new ModelingProject();
    project.setName("test-project");
    project.setConfigProperty("dummy-prop", "myvalue");
   
    UmlResource resource = new UmlResource();
    resource.setName("xmi.1");
    resource.setLocation("/home/goldivan/Documenti/poli/gallotti/Examples_Input/CaseStudyPolimi(ATOP).uml");
    resource.setConfigProperty("isXmiValid", "true");
    try {
      project.addResource(resource);
    } catch (ResourceException e) {
      e.printStackTrace();
      assertTrue(false);
    }
   
View Full Code Here

      super(section);
    }

    @Override
    public void refresh() {
      ModelingProject prj = getInputProject();
     
      textName.setText(prj.getName());
      try {
        textVersion.setText(prj.getConfigProperty("version"));
      } catch (ConfigurationException e) {
        textVersion.setText("");
      }
     
      metadataTableViewer.refresh();
View Full Code Here

          new IStructuredContentProvider() {

            @Override
            public Object[] getElements(Object inputElement) {
              if (inputElement instanceof ModelingProject) {
                ModelingProject prj = (ModelingProject)inputElement;
                return prj.getAllResources(UmlResource.class).values().toArray();
              }
             
              if (inputElement instanceof UmlResource) return new Object[0];
              return new Object[0];
            }
View Full Code Here

      res = fileProvider.getDocument(element);
      return res;
    }
   
    if (element instanceof ModelingProjectEditorInput) {
      ModelingProject project = ((ModelingProjectEditorInput) element).getProject();
      ByteArrayOutputStream outStream = new ByteArrayOutputStream();
      try {
        SavingService service = new SavingService();
        service.setOutStream(outStream);
        service.setTarget(project);
View Full Code Here

    gd.heightHint = 250;
    tasksListViewer.getControl().setLayoutData(gd);
    tasksListViewer.setContentProvider(new ArrayContentProvider(){
      @Override
      public Object[] getElements(Object inputElement) {
        ModelingProject prj = (ModelingProject) inputElement;
        return prj.getAllResources(AbstractTask.class).values().toArray();
      }
    });
    tasksListViewer.setLabelProvider(new LabelProvider(){
      @Override
      public String getText(Object element) {
View Full Code Here

TOP

Related Classes of q_impress.pmi.lib.project.ModelingProject

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.