Ejemplo n.º 1
0
  public void resetWorksapce() {
    /*
     * workspace = new Workspace(); workspace.reset(); workspace.setl
     */

    // Style list
    List<String[]> list = new ArrayList<String[]>();
    String[][] styles = {};

    //		{ "//BlockGenus[@name[starts-with(.,\"Tinker\")]]/@color", "128 0 0" },
    //		{ "//BlockGenus[@name[starts-with(.,\"df_\")]]/@color",	"0 128 0" } };

    for (String[] style : styles) {
      list.add(style);
    }
    workspaceController.resetWorkspace();
    workspaceController.resetLanguage();
    workspaceController.setLangResourceBundle(
        ResourceBundle.getBundle("com/ardublock/block/ardublock"));
    workspaceController.setStyleList(list);
    workspaceController.setLangDefDtd(this.getClass().getResourceAsStream(LANG_DTD_PATH));
    workspaceController.setLangDefStream(this.getClass().getResourceAsStream(ARDUBLOCK_LANG_PATH));
    workspaceController.loadFreshWorkspace();

    loadDefaultArdublockProgram();

    saveFilePath = null;
    saveFileName = "untitled";
    workspaceEmpty = true;
  }
Ejemplo n.º 2
0
  private Context() {
    /*
     * workspace = new Workspace(); workspace.reset(); workspace.setl
     */

    // Style list
    List<String[]> list = new ArrayList<String[]>();
    String[][] styles = {};

    //		{ "//BlockGenus[@name[starts-with(.,\"Tinker\")]]/@color", "128 0 0" },
    //		{ "//BlockGenus[@name[starts-with(.,\"df_\")]]/@color",	"0 128 0" } };

    for (String[] style : styles) {
      list.add(style);
    }

    workspaceController = new WorkspaceController();
    workspaceController.resetWorkspace();
    workspaceController.resetLanguage();
    workspaceController.setLangResourceBundle(
        ResourceBundle.getBundle("com/ardublock/block/ardublock"));
    workspaceController.setStyleList(list);
    workspaceController.setLangDefDtd(this.getClass().getResourceAsStream(LANG_DTD_PATH));
    workspaceController.setLangDefStream(this.getClass().getResourceAsStream(ARDUBLOCK_LANG_PATH));
    workspaceController.loadFreshWorkspace();
    workspace = workspaceController.getWorkspace();
    workspaceChanged = false;
    highlightBlockSet = new HashSet<RenderableBlock>();
    ofls = new HashSet<OpenblocksFrameListener>();
    this.workspace = workspaceController.getWorkspace();

    isInArduino = false;

    // determine OS
    String osName = System.getProperty("os.name");
    osName = osName.toLowerCase();
    if (osName.contains("win")) {
      osType = Context.OsType.WINDOWS;
    } else {
      if (osName.contains("linux")) {
        osType = Context.OsType.LINUX;
      } else {
        if (osName.contains("mac")) {
          osType = Context.OsType.MAC;
        } else {
          osType = Context.OsType.UNKNOWN;
        }
      }
    }
    //
  }