public ExportArchitectureDialog(MainController mainController) {
   super(mainController.getMainGui(), true);
   this.mainController = mainController;
   setTitle(controlService.getTranslatedString("ExportArchitecture"));
   setup();
   addComponents();
   setListeners();
   this.setVisible(true);
 }
  @BeforeClass
  public static void beforeClass() {
    try {
      setLog4jConfiguration();
      workspacePath = TestResourceFinder.findHusacctWorkspace("java", workspace);
      logger.info(String.format("Running HUSACCT using workspace: " + workspacePath));

      // Import analysed model
      controlService = (ControlServiceImpl) ServiceProvider.getInstance().getControlService();
      mainController = controlService.getMainController();
      workspaceController = mainController.getWorkspaceController();
      workspaceController.closeWorkspace();
      loadWorkspace(workspacePath);
      analyseStatisticsBeforeReconstruction = getAnalyseStatistics();
      exportFilePath = TestResourceFinder.findHusacctExportFile("java", exportFile);
      importAnalysisModel();
      analyseStatisticsAfterReconstruction = getAnalyseStatistics();

      logger.info(String.format("Start: Architecture Reconstruction"));
      analyseStatisticsBeforeReconstruction = getAnalyseStatistics();
      reconstructArchitecture();
      analyseStatisticsAfterReconstruction = getAnalyseStatistics();
      logger.info(String.format("Finished: Architecture Reconstruction"));

      checkConformance(); // checkConformance() starts a different Thread, and needs some time
      boolean isValidating = true;
      controlService = (ControlServiceImpl) ServiceProvider.getInstance().getControlService();
      mainController = controlService.getMainController();
      while (isValidating) {
        try {
          Thread.sleep((long) 10);
        } catch (InterruptedException e) {
        }
        isValidating = mainController.getStateController().isValidating();
      }

    } catch (Exception e) {
      String errorMessage = "Exception: " + e.getMessage();
      logger.warn(errorMessage);
    }
  }
Beispiel #3
0
  private void setListeners() {
    defineArchitectureItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mainController.getViewController().showDefineArchitecture();
          }
        });

    definedArchitectureDiagramItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mainController.getViewController().showDefinedArchitectureDiagram();
          }
        });

    importArchitectureItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mainController.getImportController().showImportArchitectureGui();
          }
        });

    exportArchitectureItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mainController.getExportController().showExportArchitectureGui();
          }
        });

    mainController
        .getStateController()
        .addStateChangeListener(
            new IStateChangeListener() {
              public void changeState(List<States> states) {
                defineArchitectureItem.setEnabled(false);
                definedArchitectureDiagramItem.setEnabled(false);
                importArchitectureItem.setEnabled(false);
                exportArchitectureItem.setEnabled(false);

                if (states.contains(States.OPENED)) {
                  defineArchitectureItem.setEnabled(true);
                  importArchitectureItem.setEnabled(true);
                }

                if (states.contains(States.DEFINED) || states.contains(States.MAPPED)) {
                  exportArchitectureItem.setEnabled(true);
                  definedArchitectureDiagramItem.setEnabled(true);
                }
              }
            });

    final DefineMenu defineMenu = this;
    localeService.addServiceListener(
        new IServiceListener() {
          public void update() {
            defineMenu.setText(localeService.getTranslatedString("Define"));
            defineArchitectureItem.setText(localeService.getTranslatedString("DefineArchitecture"));
            definedArchitectureDiagramItem.setText(
                localeService.getTranslatedString("DefinedArchitectureDiagram"));
            exportArchitectureItem.setText(localeService.getTranslatedString("ExportArchitecture"));
            importArchitectureItem.setText(localeService.getTranslatedString("ImportArchitecture"));
            defineArchitectureItem.setMnemonic(getMnemonicKeycode("DefineArchitectureMnemonic"));
            definedArchitectureDiagramItem.setMnemonic(
                getMnemonicKeycode("DefinedArchitectureDiagramMnemonic"));
            importArchitectureItem.setMnemonic(getMnemonicKeycode("ImportArchitectureMnemonic"));
            exportArchitectureItem.setMnemonic(getMnemonicKeycode("ExportArchitectureMnemonic"));
          }
        });
  }
 private static void importAnalysisModel() {
   File file = new File(exportFilePath);
   controlService = (ControlServiceImpl) ServiceProvider.getInstance().getControlService();
   mainController = controlService.getMainController();
   mainController.getExportImportController().importAnalysisModel(file);
 }