Beispiel #1
0
 /**
  * Action!
  *
  * @see org.scilab.modules.gui.events.callback.CallBack#callBack()
  */
 @Override
 public void callBack() {
   try {
     asynchronousScilabExec(null, "clear('" + getSelectedVariable() + "'); updatebrowsevar()");
   } catch (InterpreterException e1) {
     System.err.println(
         "An error in the interpreter has been catched: " + e1.getLocalizedMessage());
   }
 }
  /**
   * Start the variable editor
   *
   * @param variableVisibility the visibility of the variable
   * @param variableName The variable name
   */
  public void startEditVar(String variableVisibility, String variableName) {
    // Global variables are not editable yet
    if (variableVisibility.equals("global")) {
      ScilabModalDialog.show(
          getBrowserTab(),
          UiDataMessages.GLOBAL_NOT_EDITABLE,
          UiDataMessages.VARIABLE_EDITOR,
          IconType.ERROR_ICON);
      return;
    }

    try {
      asynchronousScilabExec(
          null,
          "if exists(\""
              + variableName
              + "\") == 1 then "
              + "  try "
              + "    editvar(\""
              + variableName
              + "\"); "
              + "  catch "
              + "    messagebox(\"Variables of type \"\"\" + typeof ("
              + variableName
              + ") + \"\"\" can not be edited.\""
              + ",\""
              + UiDataMessages.VARIABLE_EDITOR
              + "\", \"error\", \"modal\");"
              + "    clear ans;" // clear return value of messagebox
              + "  end "
              + "else "
              + "  messagebox(\"Variable \"\""
              + variableName
              + "\"\" no more exists.\""
              + ",\""
              + UiDataMessages.VARIABLE_EDITOR
              + "\", \"error\", \"modal\");"
              + "  clear ans;" // clear return value of messagebox
              + "  browsevar();" // Reload browsevar to remove cleared variables
              + "end");
    } catch (InterpreterException e1) {
      System.err.println(
          "An error in the interpreter has been catched: " + e1.getLocalizedMessage());
    }
  }