Package org.apache.oodt.cas.workflow.gui.menu

Examples of org.apache.oodt.cas.workflow.gui.menu.FileMenu


    }
  }

  public JMenuBar generateMenuBar() {
    JMenuBar bar = new JMenuBar();
    FileMenu fileMenu = new FileMenu();
    bar.add(fileMenu);
    fileMenu.getExit().addActionListener(new ActionListener() {
     
      @Override
      public void actionPerformed(ActionEvent event) {
        System.exit(1);       
      }
    });
   
    fileMenu.getOpenWorkspace().addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent event) {
        try {
          JFileChooser chooser = new JFileChooser(new File(".")) {
            boolean acceptFile(File f) {
              return f.isDirectory();
            }
          };
          chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
          int value = chooser.showOpenDialog(WorkflowGUI.this);
          if (value == JFileChooser.APPROVE_OPTION) {
            workspace = chooser.getSelectedFile();
            updateWorkspaceText();
            perspective.reset();
            loadProjects();
          }
        } catch (Exception e1) {
          e1.printStackTrace();
        }
      }
    });
    fileMenu.getImport().addActionListener(new ActionListener() {

      public void actionPerformed(ActionEvent event) {
        try {
          if (workspace == null)
            return;
          JFileChooser chooser = new JFileChooser(new File("."));
          int value = chooser.showOpenDialog(WorkflowGUI.this);
          if (value == JFileChooser.APPROVE_OPTION) {
            File file = chooser.getSelectedFile();
            XmlWorkflowModelRepositoryFactory factory = new XmlWorkflowModelRepositoryFactory();
            factory.setWorkspace(workspace.getAbsolutePath());
            View activeView = perspective.getActiveView();

            if (activeView != null) {
              // TODO: add code for import
            }
          }
        } catch (Exception e) {
          e.printStackTrace();
        }
      }

    });
    fileMenu.getNewWorkspace().addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent event) {
        JFileChooser chooser = new JFileChooser(new File(".")) {
          boolean acceptFile(File f) {
            return f.isDirectory();
          }
        };
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        int value = chooser.showOpenDialog(WorkflowGUI.this);
        if (value == JFileChooser.APPROVE_OPTION) {
          workspace = chooser.getSelectedFile();
          updateWorkspaceText();
          perspective.reset();
          loadProjects();
          perspective.refresh();
        }
      }
    });

    fileMenu.getNewProject().addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent event) {
        // TODO: add new project code
      }
    });
    fileMenu.getSave().addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent event) {
        try {
          repo.save();
        } catch (Exception e) {
          e.printStackTrace();
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.workflow.gui.menu.FileMenu

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.