From 7345aae0a500d10da53260310cd2ba80ad4bb853 Sun, 19 Feb 2012 23:01:06 +0100 From: zour Date: Sun, 19 Feb 2012 23:00:01 +0100 Subject: [PATCH] Additional changes (1) Bug 360894 - [patch] Extensions tree viewer should also be filtered by leaf item's attributes diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java index 978d594..ac25028 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java @@ -1429,6 +1429,7 @@ public static String Actions_delete_label; public static String Actions_filter_relatedPluginElements; public static String Actions_search_relatedPluginElements; + public static String Actions_search_targetplatform; public static String Actions_synchronizeVersions_label; public static String Menus_new_label; diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/actions/SearchExtensionsAction.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/actions/SearchExtensionsAction.java index aec84c0..959a13a 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/actions/SearchExtensionsAction.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/actions/SearchExtensionsAction.java @@ -11,8 +11,7 @@ package org.eclipse.pde.internal.ui.editor.actions; import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.*; import org.eclipse.pde.internal.core.search.PluginSearchInput; import org.eclipse.pde.internal.core.search.PluginSearchScope; import org.eclipse.pde.internal.ui.PDEPluginImages; @@ -30,31 +29,26 @@ */ public class SearchExtensionsAction extends Action { - protected FormFilteredTree fFilteredTree; + private FormFilteredTree fFilteredTree; + private boolean fUseCurrentFilter; - private IStructuredSelection fSelection; - private String fFilterRelatedText; - - public SearchExtensionsAction(FormFilteredTree filteredTree, String actionText) { - this(filteredTree.getViewer().getSelection(), actionText); - fFilteredTree = filteredTree; - } - - public SearchExtensionsAction(ISelection selection, String actionText) { + /** + * @param filteredTree the extensions section tree + * @param actionText description + * @param useCurrentFilter when true the search is performed with the current filtering applied to the tree, + * otherwise the filter text is generated from the current selection + */ + public SearchExtensionsAction(FormFilteredTree filteredTree, String actionText, boolean useCurrentFilter) { setImageDescriptor(PDEPluginImages.DESC_SEARCH_EXTENSIONS); setDisabledImageDescriptor(PDEPluginImages.DESC_SEARCH_EXTENSIONS_DISABLED); setText(actionText); - if (selection != null && selection instanceof IStructuredSelection) { - fSelection = (IStructuredSelection) selection; - } + fFilteredTree = filteredTree; + fUseCurrentFilter = useCurrentFilter; } public void run() { - if (fSelection != null) { - this.fFilterRelatedText = ExtensionsFilterUtil.getFilterRelatedPattern(fSelection); - NewSearchUI.activateSearchResultView(); - NewSearchUI.runQueryInBackground(createSearchQuery()); - } + NewSearchUI.activateSearchResultView(); + NewSearchUI.runQueryInBackground(createSearchQuery()); } protected ISearchQuery createSearchQuery() { @@ -68,13 +62,23 @@ } private String getFilterText() { - if (fFilterRelatedText != null && fFilterRelatedText.length() > 0) { - return fFilterRelatedText; - } if (fFilteredTree != null) { - return fFilteredTree.getFilterControl().getText(); + if (fUseCurrentFilter && fFilteredTree.isFiltered()) { + return fFilteredTree.getFilterControl().getText(); + } + return ExtensionsFilterUtil.getFilterRelatedPattern(getSelection()); } return new String(); } + private IStructuredSelection getSelection() { + if (fFilteredTree != null && fFilteredTree.getViewer() != null) { + ISelection selection = fFilteredTree.getViewer().getSelection(); + if (selection != null && selection instanceof IStructuredSelection) { + return (IStructuredSelection) selection; + } + } + return new StructuredSelection(); + } + } \ No newline at end of file diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionsSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionsSection.java index 46b9e7b..c41b1ef 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionsSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionsSection.java @@ -20,6 +20,7 @@ import org.eclipse.core.runtime.jobs.JobChangeAdapter; import org.eclipse.jface.action.*; import org.eclipse.jface.dialogs.IMessageProvider; +import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; @@ -54,6 +55,8 @@ import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.BidiUtil; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.*; import org.eclipse.ui.actions.ActionContext; import org.eclipse.ui.actions.ActionFactory; @@ -64,11 +67,12 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListener, IPropertyChangeListener { private static final int REFRESHJOB_DELAY_TIME = 1200; // milliseconds to wait private static final int ACCELERATED_SCROLLING = 15; // lines to skip - private static final int BUTTON_MOVE_DOWN = 4; - private static final int BUTTON_MOVE_UP = 3; - private static final int BUTTON_EDIT = 2; - private static final int BUTTON_REMOVE = 1; - private static final int BUTTON_ADD = 0; + private static final int BUTTON_MOVE_DOWN = 5; + private static final int BUTTON_MOVE_UP = 4; + private static final int BUTTON_EDIT = 3; + private static final int BUTTON_REMOVE = 2; + private static final int BUTTON_ADD = 1; + private static final int BUTTON_SEARCH = 0; private TreeViewer fExtensionTree; private Image fExtensionImage; private Image fGenericElementImage; @@ -80,6 +84,7 @@ private CollapseAction fCollapseAction; private ToggleExpandStateAction fExpandAction; private FilterRelatedExtensionsAction fFilterRelatedAction; + private SearchExtensionsAction fSearchToolbarAction; private SearchExtensionsAction fSearchAction; private boolean fBypassFilterDelay = false; @@ -149,7 +154,7 @@ } public ExtensionsSection(PDEFormPage page, Composite parent) { - super(page, parent, Section.DESCRIPTION, new String[] {PDEUIMessages.ManifestEditor_DetailExtension_new, PDEUIMessages.ManifestEditor_DetailExtension_remove, PDEUIMessages.ManifestEditor_DetailExtension_edit, PDEUIMessages.ManifestEditor_DetailExtension_up, PDEUIMessages.ManifestEditor_DetailExtension_down}); + super(page, parent, Section.DESCRIPTION, new String[] {PDEUIMessages.Actions_search_targetplatform, PDEUIMessages.ManifestEditor_DetailExtension_new, PDEUIMessages.ManifestEditor_DetailExtension_remove, PDEUIMessages.ManifestEditor_DetailExtension_edit, PDEUIMessages.ManifestEditor_DetailExtension_up, PDEUIMessages.ManifestEditor_DetailExtension_down}); fHandleDefaultButton = false; } @@ -237,6 +242,13 @@ Composite container = createClientContainer(section, 2, toolkit); TreePart treePart = getTreePart(); createViewerPartControl(container, SWT.MULTI, 2, toolkit); + // fix layout to place search button right to the filter text + Control searchButton = treePart.getButton(BUTTON_SEARCH); + ((GridLayout) searchButton.getParent().getLayout()).marginHeight = 2; + searchButton.setLayoutData(GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.BEGINNING).grab(false, false).hint(SWT.DEFAULT, 19).create()); + searchButton.setToolTipText(PDEUIMessages.ExtensionsPage_searchWithExtensionsFilter); + Control addButton = treePart.getButton(BUTTON_ADD); + ((GridData) addButton.getLayoutData()).verticalIndent = 16; fExtensionTree = treePart.getTreeViewer(); fExtensionTree.setContentProvider(new ExtensionContentProvider()); fExtensionTree.setLabelProvider(new ExtensionLabelProvider()); @@ -283,9 +295,11 @@ // Add action to filter tree with some of the selection's attributes fFilterRelatedAction = new FilterRelatedExtensionsAction(fExtensionTree, fFilteredTree, this, false); toolBarManager.add(fFilterRelatedAction); + // Add action to search workspace for related elements according to tree selection + fSearchToolbarAction = new SearchExtensionsAction(fFilteredTree, PDEUIMessages.Actions_search_relatedPluginElements, false); + toolBarManager.add(fSearchToolbarAction); // Add action to search all workspace plugins with current filtering applied to the tree viewer - fSearchAction = new SearchExtensionsAction(fFilteredTree, PDEUIMessages.ExtensionsPage_searchWithExtensionsFilter); - toolBarManager.add(fSearchAction); + fSearchAction = new SearchExtensionsAction(fFilteredTree, PDEUIMessages.ExtensionsPage_searchWithExtensionsFilter, true); // Add separator Separator separator = new Separator(); toolBarManager.add(separator); @@ -324,6 +338,9 @@ protected void buttonSelected(int index) { switch (index) { + case BUTTON_SEARCH : + fSearchAction.run(); + break; case BUTTON_ADD : handleNew(); break; @@ -437,7 +454,7 @@ if (ExtensionsFilterUtil.isFilterRelatedEnabled(ssel)) { FilterRelatedExtensionsAction filterRelatedAction = new FilterRelatedExtensionsAction(fExtensionTree, fFilteredTree, this, true); manager.add(filterRelatedAction); - SearchExtensionsAction searchRelatedAction = new SearchExtensionsAction(ssel, PDEUIMessages.Actions_search_relatedPluginElements); + SearchExtensionsAction searchRelatedAction = new SearchExtensionsAction(fFilteredTree, PDEUIMessages.Actions_search_relatedPluginElements, false); manager.add(searchRelatedAction); manager.add(new Separator()); } @@ -584,7 +601,7 @@ Text filterControl = fFilteredTree.getFilterControl(); if (filterControl != null && attributeValue != null) { String trimmedValue = attributeValue.trim(); - if (trimmedValue.length() > 0 && ExtensionsFilterUtil.isNotBoolean(trimmedValue)) { + if (trimmedValue.length() > 0 && !ExtensionsFilterUtil.isBoolean(trimmedValue)) { if (trimmedValue.startsWith("%")) {//$NON-NLS-1$ IPluginModelBase model = getPluginModelBase(); trimmedValue = ((model != null) ? model.getResourceString(trimmedValue) : trimmedValue).replaceAll("\"", ""); //$NON-NLS-1$ //$NON-NLS-2$ @@ -1294,16 +1311,21 @@ } private void updateButtons(Object item) { + boolean filterRelatedEnabled = false; + if (fExtensionTree != null) { + filterRelatedEnabled = ExtensionsFilterUtil.isFilterRelatedEnabled((IStructuredSelection) fExtensionTree.getSelection()); + } if (fExpandAction != null) { fExpandAction.setEnabled(ToggleExpandStateAction.isExpandable((IStructuredSelection) fExtensionTree.getSelection())); } if (fFilterRelatedAction != null) { - fFilterRelatedAction.setEnabled(ExtensionsFilterUtil.isFilterRelatedEnabled((IStructuredSelection) fExtensionTree.getSelection())); + fFilterRelatedAction.setEnabled(filterRelatedEnabled); } - if (fSearchAction != null) { + if (fSearchToolbarAction != null && fSearchAction != null) { Text filterControl = fFilteredTree.getFilterControl(); boolean searchEnabled = filterControl != null && filterControl.getText().length() > 0; - fSearchAction.setEnabled(searchEnabled); + getTreePart().setButtonEnabled(BUTTON_SEARCH, searchEnabled); + fSearchToolbarAction.setEnabled(filterRelatedEnabled); } if (getPage().getModel().isEditable() == false) diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties index 2e77bce..1dac715 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties @@ -1191,6 +1191,7 @@ Actions_delete_label = &Delete Actions_filter_relatedPluginElements=&Filter Related Actions_search_relatedPluginElements=Search &Related +Actions_search_targetplatform=Search Actions_synchronizeVersions_label = S&ynchronize Versions... Menus_new_label = &New @@ -1541,7 +1542,7 @@ ExtensionsPage_tabName=Extensions ExtensionsPage_sortAlpha=Sort the Extensions alphabetically ExtensionsPage_toggleExpandState=Toggle Expand State -ExtensionsPage_searchWithExtensionsFilter=Extension Element Search +ExtensionsPage_searchWithExtensionsFilter=Search with current filter ExtensionDetails_title=Extension Details ExtensionDetails_desc=Set the properties of the selected extension. Required fields are denoted by "*". ExtensionDetails_id=ID diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/search/ExtensionsPatternFilter.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/search/ExtensionsPatternFilter.java index dd46b14..7197861 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/search/ExtensionsPatternFilter.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/search/ExtensionsPatternFilter.java @@ -46,8 +46,9 @@ protected final Set fFoundAnyElementsCache = new HashSet(); /** - * Check if the leaf element is a match with the filter text. The - * default behavior checks that the label of the element is a match. + * Check if the leaf element is a match with the filter text. The default behavior + * checks that the element name or extension point is a match employing wildcards. + * An implicit wild card is added at the end always (default behaviour). * * Subclasses should override this method. * @@ -58,11 +59,10 @@ * @return true if the given element's label matches the filter text */ protected boolean isLeafMatch(Viewer viewer, Object element) { - // match label; default behaviour - if (viewer != null && super.isLeafMatch(viewer, element)) { + // match element name or extension point with wildcards; modified default behaviour + if (isNameMatch(element)) { return true; } - // match all splitted attribute's values of IPluginElement against splitted filter patterns if (element instanceof IPluginElement) { return doIsLeafMatch((IPluginElement) element); @@ -106,6 +106,21 @@ return false; } + protected boolean isNameMatch(Object element) { + if (element != null) { + if (element instanceof IPluginElement) { + if (super.wordMatches(((IPluginElement) element).getName())) { + return true; + } + } else if (element instanceof IPluginExtension) { + if (super.wordMatches(((IPluginExtension) element).getPoint())) { + return true; + } + } + } + return false; + } + private boolean matchWithAttributes(IPluginElement pluginElement, String valuePattern, List attributeList, boolean quoted) { for (int k = 0; k < attributeList.size(); k++) { String attribute = (String) attributeList.get(k); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/util/AcceleratedTreeScrolling.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/util/AcceleratedTreeScrolling.java index 652079d..52c4ff0 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/util/AcceleratedTreeScrolling.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/util/AcceleratedTreeScrolling.java @@ -68,20 +68,22 @@ if (index == 0) { return parentItem; } - TreeItem nextItem = parentItem == null ? tree.getItem(index - 1) : parentItem.getItem(index - 1); - int count = nextItem.getItemCount(); - while (count > 0 && nextItem.getExpanded()) { - nextItem = nextItem.getItem(count - 1); - count = nextItem.getItemCount(); + TreeItem previousItem = parentItem == null ? tree.getItem(index - 1) : parentItem.getItem(index - 1); + int count = previousItem.getItemCount(); + while (count > 0 && previousItem.getExpanded()) { + previousItem = previousItem.getItem(count - 1); + count = previousItem.getItemCount(); } - return nextItem; + return previousItem; } TreeItem NextItem(Tree tree, TreeItem item) { if (item == null) return null; if (item.getExpanded()) { - return item.getItem(0); + if (item.getItemCount() > 0) { + return item.getItem(0); + } } TreeItem childItem = item; TreeItem parentItem = childItem.getParentItem(); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/util/ExtensionsFilterUtil.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/util/ExtensionsFilterUtil.java index 75a5a95..ad4aa17 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/util/ExtensionsFilterUtil.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/util/ExtensionsFilterUtil.java @@ -37,15 +37,17 @@ public static final String ELEMENT_AR_BINDING = "org.eclipse.ui.activities.activityRequirementBinding"; //$NON-NLS-1$ public static final String ELEMENT_CA_BINDING = "org.eclipse.ui.activities.categoryActivityBinding"; //$NON-NLS-1$ public static final String ELEMENT_COMMAND = "org.eclipse.ui.commands.command"; //$NON-NLS-1$ - public static final String ELEMENT_EQUALS = "org.eclipse.ui.handlers.equals"; //$NON-NLS-1$ + public static final String ELEMENT_EQUALS = "equals"; //$NON-NLS-1$ public static final String ELEMENT_HELP_TOC = "org.eclipse.help.toc.toc"; //$NON-NLS-1$ - public static final String ELEMENT_INSTANCEOF = "org.eclipse.ui.handlers.instanceof"; //$NON-NLS-1$ + public static final String ELEMENT_INSTANCEOF = "instanceof"; //$NON-NLS-1$ public static final String ELEMENT_MENU_COMMAND = "org.eclipse.ui.menus.command"; //$NON-NLS-1$ + public static final String ELEMENT_PARAMETER = "parameter"; //$NON-NLS-1$ public static final String ELEMENT_PATTERNBINDING = "org.eclipse.ui.activities.activityPatternBinding"; //$NON-NLS-1$ public static final String ELEMENT_PROPERTYTESTER = "org.eclipse.core.expressions.propertyTesters.propertyTester"; //$NON-NLS-1$ + public static final String ELEMENT_VARIABLE = "variable"; //$NON-NLS-1$ public static final String[] HIGH_PRIORITY_ELEMENTS = new String[] {ELEMENT_COMMAND, ELEMENT_MENU_COMMAND, ELEMENT_INSTANCEOF, ELEMENT_EQUALS}; - public static final String[] LOW_PRIORITY_ELEMENTS = new String[] {ELEMENT_CA_BINDING, ELEMENT_AR_BINDING, ELEMENT_HELP_TOC}; + public static final String[] LOW_PRIORITY_ELEMENTS = new String[] {ELEMENT_PARAMETER, ELEMENT_CA_BINDING, ELEMENT_AR_BINDING, ELEMENT_VARIABLE, ELEMENT_HELP_TOC}; public static final Map CUSTOM_RELATIONS; @@ -54,6 +56,8 @@ CUSTOM_RELATIONS.put(ELEMENT_COMMAND, new String[] {ATTRIBUTE_ID, ATTRIBUTE_DEFAULTHANDLER}); CUSTOM_RELATIONS.put(ELEMENT_INSTANCEOF, new String[] {ATTRIBUTE_VALUE}); CUSTOM_RELATIONS.put(ELEMENT_EQUALS, new String[] {ATTRIBUTE_VALUE}); + CUSTOM_RELATIONS.put(ELEMENT_PARAMETER, new String[] {ATTRIBUTE_NAME}); + CUSTOM_RELATIONS.put(ELEMENT_VARIABLE, new String[] {ATTRIBUTE_NAME}); CUSTOM_RELATIONS.put(ELEMENT_MENU_COMMAND, new String[] {ATTRIBUTE_COMMANDID, ATTRIBUTE_ID}); CUSTOM_RELATIONS.put(ELEMENT_CA_BINDING, new String[] {ATTRIBUTE_ACTIVITYID, ATTRIBUTE_CATEGORYID}); CUSTOM_RELATIONS.put(ELEMENT_AR_BINDING, new String[] {ATTRIBUTE_REQUIREDACTIVITYID, ATTRIBUTE_ACTIVITYID}); @@ -71,7 +75,7 @@ public static boolean add(Set pattern, String value) { if (value != null && value.length() > 0) { String trimmed = value.trim(); - if (isNotBoolean(trimmed)) { + if (!isBoolean(trimmed)) { return pattern.add(trimmed); } } @@ -203,10 +207,12 @@ private static boolean addMatchingElements(Set customAttributes, IPluginElement pluginElement, String elementName, final String[] elements) { boolean elementMatch = false; - for (int i = 0; i < elements.length; i++) { - if (elements[i].equals(elementName)) { - addAll(customAttributes, pluginElement, elements[i]); - elementMatch = true; + if (elementName != null) { + for (int i = 0; i < elements.length; i++) { + if (elementName.endsWith(elements[i])) { + addAll(customAttributes, pluginElement, elements[i]); + elementMatch = true; + } } } return elementMatch; @@ -232,23 +238,26 @@ public static List handlePropertyTester(IPluginElement pluginElement) { List propertyTestAttributes = new ArrayList(); - String elementName = getElementPath(pluginElement); - boolean elementMatch = false; - if (elementName == null) { - // workaround for non-editable plugins of the target platform - if (ELEMENT_PROPERTYTESTER.endsWith(pluginElement.getName())) { - elementMatch = true; - } - } else if (ELEMENT_PROPERTYTESTER.equalsIgnoreCase(elementName)) { - elementMatch = true; - } - if (elementMatch) { + if (isElementNameMatch(pluginElement, ELEMENT_PROPERTYTESTER)) { Set attributes = handlePropertyTester(new HashSet(), pluginElement); for (Iterator iterator = attributes.iterator(); iterator.hasNext();) { propertyTestAttributes.add(iterator.next()); } } return propertyTestAttributes; + } + + public static boolean isElementNameMatch(IPluginElement pluginElement, String expected) { + String elementName = getElementPath(pluginElement); + if (elementName == null) { + // workaround for non-editable plugins of the target platform + if (expected.endsWith(pluginElement.getName())) { + return true; + } + } else if (elementName.endsWith(expected)) { + return true; + } + return false; } public static boolean isFilterRelatedEnabled(IPluginElement pluginElement) { @@ -260,13 +269,22 @@ } } // test for custom relations - Object attributes = CUSTOM_RELATIONS.get(getElementPath(pluginElement)); - if (attributes != null) { - String[] attributesArray = (String[]) attributes; - for (int i = 0; i < attributesArray.length; i++) { - IPluginAttribute attribute = pluginElement.getAttribute(attributesArray[i]); - if (attribute != null) { - return true; + String elementName = getElementPath(pluginElement); + if (elementName != null) { + Set keySet = CUSTOM_RELATIONS.keySet(); + for (Iterator iterator = keySet.iterator(); iterator.hasNext();) { + String key = (String) iterator.next(); + if (elementName.endsWith(key)) { + Object attributes = CUSTOM_RELATIONS.get(key); + if (attributes != null) { + String[] attributesArray = (String[]) attributes; + for (int i = 0; i < attributesArray.length; i++) { + IPluginAttribute attribute = pluginElement.getAttribute(attributesArray[i]); + if (attribute != null) { + return true; + } + } + } } } } @@ -287,8 +305,8 @@ return createFilterRelatedAction; } - public static boolean isNotBoolean(String bool) { - return !bool.equalsIgnoreCase(Boolean.TRUE.toString()) && !bool.equalsIgnoreCase(Boolean.FALSE.toString()); + public static boolean isBoolean(String bool) { + return bool.equalsIgnoreCase(Boolean.TRUE.toString()) || bool.equalsIgnoreCase(Boolean.FALSE.toString()); } } \ No newline at end of file