private void updateUIDescriptionText(IPluginElement parentElement) { IPluginObject pluginObject = parentElement.getChildren()[0]; if (pluginObject instanceof IPluginElement) { IPluginElement element = (IPluginElement) pluginObject; if (element.getName().equals(F_CS_ELEMENT_DESCRIPTION) && PDETextHelper.isDefinedAfterTrim(element.getText())) { // Triggers listener to update data description on load fDescriptionText.setText(element.getText().trim()); } } }
/** * 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); } }
private void updateFieldTemplateEnablement() { // Get the splash info if any ISplashInfo info = getSplashInfo(); // Enable section under the following conditions: // (1) Product ID is defined // (2) Progress geometry is NOT defined // (3) Progress geometry is defined and splash handler type is defined if ((PDETextHelper.isDefined(getProduct().getProductId()) == false) || ((info.isDefinedGeometry() == true) && (info.isDefinedSplashHandlerType() == false))) { fFieldTemplateCombo.setEnabled(false); } else { fFieldTemplateCombo.setEnabled(true); } }
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); } }
private void handleWidgetSelectedCategoryButton() { // Create a dialog allowing the user to input the category name NewCategoryNameDialog dialog = new NewCategoryNameDialog(PDEUserAssistanceUIPlugin.getActiveWorkbenchShell()); dialog.create(); dialog.getShell().setText(CSWizardMessages.RegisterCSWizardPage_descTooltip); if (dialog.open() == Window.OK) { String newCategoryName = dialog.getNameText(); if (PDETextHelper.isDefinedAfterTrim(newCategoryName)) { String trimmedText = newCategoryName.trim(); fCategoryCombo.add(trimmedText); fCategoryCombo.setText(trimmedText); fCategoryCombo.setFocus(); String id = generateCategoryID(trimmedText); fCategoryTrackerUtil.associate(id, trimmedText, CSCategoryTrackerUtil.F_TYPE_NEW_CATEGORY); } } }
private void updateFieldProgressEnablement() { // Get the splash info if any ISplashInfo info = getSplashInfo(); // Enable section under the following conditions: // (1) Product ID is defined // (2) Progress geometry is defined // (3) Splash handler type is NOT defined if ((PDETextHelper.isDefined(getProduct().getProductId()) == false) || ((info.isDefinedGeometry() == false) && (info.isDefinedSplashHandlerType() == true))) { fAddBarButton.setEnabled(false); fAddMessageButton.setEnabled(false); updateFieldProgressBarEnablement(false); updateFieldProgressMessageEnablement(false); } else { fAddBarButton.setEnabled(isEditable()); fAddMessageButton.setEnabled(isEditable()); updateFieldProgressBarEnablement(isEditable()); updateFieldProgressMessageEnablement(isEditable()); } }
/** * 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); } } }