Package org.woped.file

Examples of org.woped.file.PNMLImport


          IStatusBar[] iSB = new IStatusBar[iVC.length];
          for (int i = 0; i < iSB.length; i++) {
              iSB[i] = (IStatusBar) iVC[i];
          }

          PNMLImport pr = new PNMLImport(medi);
          OLDPNMLImport2 oldpr = new OLDPNMLImport2(medi);
          IEditor edit = null;
          IMetricsConfiguration metricsConfig = ConfigurationManager.getMetricsConfiguration();
      try{
        // Write top line with variable and algorithm names
        write = new BufferedWriter(new FileWriter(saveFile));
        List<String> metricsList = MetricsUIRequestHandler.getLayeredAlgoNames("ALL_METRICS");
        write.write("File name");
        for(String s:metricsList)
          write.write(","+s);
        write.write("\r\n");
       
        // Loop over all selected files to analyze them
        for(File f:filesToCheck){
          write.write(f.getName());
          if(pr.run(new FileInputStream(f),false))
            edit = pr.getEditor()[0];
          else if(oldpr.run(new FileInputStream(f),false))
            edit = oldpr.getEditor()[0];
          else continue;
          MetricsUIRequestHandler ui = new MetricsUIRequestHandler(edit);
          for(String metric:metricsList){
View Full Code Here


     * @param file
     * @param filter
     */
    private IEditor openFile(File file, int filter) {
        IEditor editor = null;
        final PNMLImport pr;

        getMediator().getUi().getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        if (filter == FileFilterImpl.PNMLFilter || filter == FileFilterImpl.SAMPLEFilter) {

            IViewController[] iVC = getMediator().findViewController(IStatusBar.TYPE);
            IStatusBar[] iSB = new IStatusBar[iVC.length];
            for (int i = 0; i < iSB.length; i++) {
                iSB[i] = (IStatusBar) iVC[i];
            }

            pr = new PNMLImport((ApplicationMediator) getMediator());

        } else
            if (filter == FileFilterImpl.OLDPNMLFilter) {
                pr = new OLDPNMLImport2((ApplicationMediator) getMediator());
            } else {
                pr = null;
            }
        if (pr != null) {
            boolean loadSuccess = false;
            InputStream is;

            // TODO Generate Thread
            try {
                is = new FileInputStream(file.getAbsolutePath());
                loadSuccess = pr.run(is);
            } catch (FileNotFoundException e) {
                String jarPath = file.getPath().replace('\\', '/');

                is = this.getClass().getResourceAsStream(jarPath);
                loadSuccess = pr.run(is);

                /*
                 * if (!loadSuccess) LoggerManager.error(Constants.FILE_LOGGER, "Could not open InputStream. " + file.getAbsolutePath());
                 */
                // }
            }
            if (loadSuccess) {
                editor = pr.getEditor()[pr.getEditor().length - 1];
                for (int i = 0; i < pr.getEditor().length; i++) {
                    if (editor instanceof EditorVC) {
                        ((EditorVC) pr.getEditor()[i]).setDefaultFileType(filter);
                        ((EditorVC) pr.getEditor()[i]).setName(file.getName());
                        ((EditorVC) pr.getEditor()[i]).setFilePath(file.getAbsolutePath());
                    }
                    // add recent
                  String abspath = file.getAbsolutePath();
                    if (filter == FileFilterImpl.PNMLFilter) {
                        ConfigurationManager.getConfiguration().addRecentFile(file.getName(), file.getAbsolutePath());
View Full Code Here

        return editor;
    }
   
  private IEditor importApromore() {
    IEditor editor = null;
    final PNMLImport pr;

    pr = new PNMLImport((ApplicationMediator) getMediator());
    boolean loadSuccess = false;

    InputStream is;

    ImportFrame aImp = new ImportFrame();
    if (aImp.getElement() == null)
    { 
          getMediator().getUi().getComponent().setCursor(Cursor.getDefaultCursor());
      return null;
    }
      ApromoreAccessObject aao = new ApromoreAccessObject();//"proxy.dhbw-karlsruhe.de", 8080);
   
    try {
      is = aao.getPNML(aImp.getElement()).getInputStream();
            loadSuccess = pr.run(is);
                } catch (NullPointerException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }


    if (loadSuccess) {
      editor = pr.getEditor()[pr.getEditor().length - 1];
      for (int i = 0; i < pr.getEditor().length; i++) {

        // add Editor
        LoggerManager.info(Constants.FILE_LOGGER,
            "Petrinet loaded from Apromore");
       
       
        ((EditorVC) pr.getEditor()[i]).setApromoreSettings(aImp.getEditSession());
      }
    } else {
      String arg[] = { "Apromore" };
      JOptionPane.showMessageDialog(null,
          Messages.getString("File.Error.FileOpen.Text", arg),
View Full Code Here

TOP

Related Classes of org.woped.file.PNMLImport

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.