private void processCheatSheetElement(IPluginElement parentElement, String generatedID) { // Get the id attribute IPluginAttribute idAttribute = parentElement.getAttribute(ICompCSConstants.ATTRIBUTE_ID); // Check for the generated ID for this cheat sheet // If a cheat sheet exists with the generated ID already, read its // description and populate the description text accordingly if ((idAttribute != null) && PDETextHelper.isDefined(idAttribute.getValue()) && generatedID.equals(idAttribute.getValue())) { // Matching cheat sheet extension found // Process children if any if (parentElement.getChildCount() > 0) { // Update the description text widget updateUIDescriptionText(parentElement); } updateUICategoryComboAttribute(parentElement); } }
/** * Process cheatsheet elements with a category attribute * * @param parentElement */ private void updateUICategoryComboAttribute(IPluginElement element) { // Get the category attribute IPluginAttribute categoryAttribute = element.getAttribute(F_CS_ELEMENT_CATEGORY); // Process the category attribute if ((categoryAttribute != null) && PDETextHelper.isDefined(categoryAttribute.getValue())) { String id = categoryAttribute.getValue(); // Check to see if the category ID has been defined if (fCategoryTrackerUtil.containsCategoryID(id)) { // Update the category combo selection String name = fCategoryTrackerUtil.getCategoryName(id); fCategoryCombo.setText(name); } else { // Add the category ID to the combo box (no assoicated name) // This can only happen if the category is defined outside of // the plug-in the cheat sheet is stored in fCategoryCombo.add(id); fCategoryCombo.setText(id); fCategoryTrackerUtil.associate(id, id, CSCategoryTrackerUtil.F_TYPE_OLD_CATEGORY); } } }
/** * Process category elements * * @param parentElement */ private void updateUICategoryComboElement(IPluginElement parentElement) { // Get the id attribute IPluginAttribute idAttribute = parentElement.getAttribute(ICompCSConstants.ATTRIBUTE_ID); // Get the name attribute IPluginAttribute nameAttribute = parentElement.getAttribute(ICompCSConstants.ATTRIBUTE_NAME); // Add the category to the combo box only if // (1) the category name is defined // (2) the category has not already been added to the combo box if ((nameAttribute != null) && PDETextHelper.isDefined(nameAttribute.getValue()) && (idAttribute != null) && PDETextHelper.isDefined(idAttribute.getValue()) && (fCategoryTrackerUtil.containsCategoryName(nameAttribute.getValue()) == false)) { // TODO: MP: LOW: CompCS: Reference translated value fCategoryCombo.add(nameAttribute.getValue()); // Assocate the category ID with the category name fCategoryTrackerUtil.associate( idAttribute.getValue(), nameAttribute.getValue(), CSCategoryTrackerUtil.F_TYPE_OLD_CATEGORY); } }