Пример #1
0
  /**
   * Method to get the mapper script type and load the default mapper script
   *
   * @return
   */
  private String getMapperScriptType() {
    String mapperScriptType = "";

    if (beanShellRadioButton.isSelected()) {
      defaultMapperScript = ScriptUtil.getTextForBeanShellScript();
      mapperScriptType = ASpaceMapper.BEANSHELL_SCRIPT;
    } else if (jrubyRadioButton.isSelected()) {
      defaultMapperScript = ScriptUtil.getTextForJRubyScript();
      mapperScriptType = ASpaceMapper.JRUBY_SCRIPT;
    } else if (pythonRadioButton.isSelected()) {
      defaultMapperScript = ScriptUtil.getTextForJythonScript();
      mapperScriptType = ASpaceMapper.JYTHON_SCRIPT;
    } else {
      defaultMapperScript = ScriptUtil.getTextForJavascriptScript();
      mapperScriptType = ASpaceMapper.JAVASCRIPT_SCRIPT;
    }

    System.out.println("Mapper Script Type: " + mapperScriptType);

    return mapperScriptType;
  }
Пример #2
0
  /** Method to open up the code viewer dialog */
  private void editScriptButtonActionPerformed() {
    if (beanShellRadioButton.isSelected()) {
      if (mapperScript.isEmpty()) {
        mapperScript = ScriptUtil.getTextForBeanShellScript();
      }

      if (codeViewerDialogBeanshell == null) {
        codeViewerDialogBeanshell =
            new CodeViewerDialog(
                this, SyntaxConstants.SYNTAX_STYLE_JAVA, mapperScript, true, false);
      } else {
        codeViewerDialogBeanshell.setCurrentScript(mapperScript);
      }

      codeViewerDialogBeanshell.setScriptFile(scriptFile);

      codeViewerDialogBeanshell.setTitle("BeanShell Mapper Script Editor");
      codeViewerDialogBeanshell.pack();
      codeViewerDialogBeanshell.setVisible(true);
    } else if (jrubyRadioButton.isSelected()) {
      if (mapperScript.isEmpty()) {
        mapperScript = ScriptUtil.getTextForJRubyScript();
      }

      // must be a python script
      if (codeViewerDialogJruby == null) {
        codeViewerDialogJruby =
            new CodeViewerDialog(
                this, SyntaxConstants.SYNTAX_STYLE_RUBY, mapperScript, true, false);
      } else {
        codeViewerDialogJruby.setCurrentScript(mapperScript);
      }

      codeViewerDialogJruby.setScriptFile(scriptFile);

      codeViewerDialogJruby.setTitle("JRuby Mapper Script Editor");
      codeViewerDialogJruby.pack();
      codeViewerDialogJruby.setVisible(true);
    } else if (pythonRadioButton.isSelected()) {
      if (mapperScript.isEmpty()) {
        mapperScript = ScriptUtil.getTextForJythonScript();
      }

      // must be a python script
      if (codeViewerDialogJython == null) {
        codeViewerDialogJython =
            new CodeViewerDialog(
                this, SyntaxConstants.SYNTAX_STYLE_PYTHON, mapperScript, true, false);
      } else {
        codeViewerDialogJython.setCurrentScript(mapperScript);
      }

      codeViewerDialogJython.setScriptFile(scriptFile);

      codeViewerDialogJython.setTitle("Jython Mapper Script Editor");
      codeViewerDialogJython.pack();
      codeViewerDialogJython.setVisible(true);
    } else {
      if (mapperScript.isEmpty()) {
        mapperScript = ScriptUtil.getTextForJavascriptScript();
      }

      // must be a javascript
      if (codeViewerDialogJavascript == null) {
        codeViewerDialogJavascript =
            new CodeViewerDialog(
                this, SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT, mapperScript, true, false);
      } else {
        codeViewerDialogJavascript.setCurrentScript(mapperScript);
      }

      codeViewerDialogJavascript.setScriptFile(scriptFile);

      codeViewerDialogJavascript.setTitle("Javascript Mapper Script Editor");
      codeViewerDialogJavascript.pack();
      codeViewerDialogJavascript.setVisible(true);
    }
  }