/** * Based on the current selection save the last used values$this to make sure you can create the * same sketch quickly again */ private void saveAllLastUseds() { // String boardFile = this.mControlBoardsTxtFile.getText().trim(); String boardName = this.mcontrolBoardName.getText().trim(); String uploadPort = this.mControlUploadPort.getValue(); InstancePreferences.setLastUsedBoardsFile(boardFile); InstancePreferences.SetLastUsedArduinoBoard(boardName); InstancePreferences.SetLastUsedUploadPort(uploadPort); Map<String, String> options = new HashMap<>(); for (LabelCombo curLabelCombo : BoardSelectionPage.this.mBoardOptionCombos) { options.put(curLabelCombo.getMenuName(), curLabelCombo.getValue()); } InstancePreferences.setLastUsedMenuOption(options); }
private void setValues(ICConfigurationDescription confdesc) { String boardFile = InstancePreferences.getLastUsedBoardsFile(); String boardName = InstancePreferences.getLastUsedArduinoBoardName(); String uploadPort = InstancePreferences.getLastUsedUploadPort(); if (confdesc != null) { boardFile = Common.getBuildEnvironmentVariable(confdesc, Const.ENV_KEY_JANTJE_BOARDS_FILE, boardFile); boardName = Common.getBuildEnvironmentVariable(confdesc, Const.ENV_KEY_JANTJE_BOARD_NAME, boardName); uploadPort = Common.getBuildEnvironmentVariable(confdesc, Const.ENV_KEY_JANTJE_COM_PORT, uploadPort); } this.mControlBoardsTxtFile.setText(boardFile); // if no boards file is selected select the first if (this.mControlBoardsTxtFile.getText().isEmpty()) { this.mControlBoardsTxtFile.setText(this.mControlBoardsTxtFile.getItem(0)); } int selectedBoardFile = this.mControlBoardsTxtFile.getSelectionIndex(); this.mcontrolBoardName.setItems(this.mAllBoardsFiles[selectedBoardFile].GetArduinoBoards()); this.mcontrolBoardName.setText(boardName); // BoardModifyListener.handleEvent(null); this.mControlUploadPort.setValue(uploadPort); // set the options in the combo boxes before setting the value Map<String, String> options = InstancePreferences.getLastUsedMenuOption(); for (LabelCombo curLabelCombo : this.mBoardOptionCombos) { curLabelCombo.setItems( this.mAllBoardsFiles[selectedBoardFile].getMenuItemNames( curLabelCombo.getMenuName(), boardName)); if (confdesc != null) { curLabelCombo.getStoredValue(confdesc); } else { String value = options.get(curLabelCombo.getMenuName()); if (value != null) { curLabelCombo.setValue(value); } } } }