1 7 8 package com.memoire.vainstall.builder.action; 9 10 import com.memoire.vainstall.VAGlobals; 11 import com.memoire.vainstall.builder.*; 12 import com.memoire.vainstall.builder.util.*; 13 14 import java.io.File ; 15 import java.util.Hashtable ; 16 17 import javax.swing.JOptionPane ; 18 19 30 public class LastOpenProductAction extends AbstractVAIBuilderAction { 31 32 private int menuNumber = 0; 33 34 public LastOpenProductAction() { 35 super(); 36 } 37 38 43 public void initialize(VAIBuilderController controller, int number) { 44 45 initialize(controller); 46 47 menuNumber = number; 48 } 49 50 53 public void runnit() { 54 55 String fullName = (String )getModel().getLastOpenedProjectList().get(menuNumber); 56 57 String projectDirectory = fullName.substring(0,fullName.lastIndexOf(File.separator)); 58 59 Hashtable list = getController().getProductControllerList(); 61 VAIProductController product = (VAIProductController)list.get(projectDirectory); 62 if (product != null) { 63 try { 64 product.getFrame().setVisible(true); 65 product.getFrame().setSelected(true); 66 product.getFrame().setMaximum(true); 67 } catch(Exception exc) { 68 exc.printStackTrace(); 69 return; 70 } 71 return; 72 } 73 74 VAIProductController productController = new VAIProductController(); 76 productController.getModel().setProductDirectory(projectDirectory); 77 try { 78 productController.getModel().load(); 79 } catch (VAIBuilderException exc) { 80 JOptionPane.showMessageDialog(getController().getFrame(), 81 exc.getMessageAsHtml(), 82 VAGlobals.NAME, 83 JOptionPane.ERROR_MESSAGE); 84 return; 85 } 86 getController().addProduct(projectDirectory,productController); 87 88 } 89 90 } 91 | Popular Tags |