private void editAttributeEntry(CPElementAttribute elem) {
   String key = elem.getKey();
   if (key.equals(CPElement.EXCLUSION)) {
     CPElement selElement = elem.getParent();
     ExclusionPatternDialog dialog = new ExclusionPatternDialog(getShell(), selElement);
     if (dialog.open() == Window.OK) {
       selElement.setAttribute(CPElement.EXCLUSION, dialog.getExclusionPattern());
       updatePathOnResourceGroups(selElement, fIncludeSymPathsList.getElements());
       fIncludeSymPathsList.refresh();
       updateStatus();
     }
   }
 }
 private boolean canRemove(List<?> selected) {
   if (selected.size() != 1) {
     return false;
   }
   Object elem = selected.get(0);
   if (elem instanceof CPElement) {
     CPElement element = (CPElement) elem;
     if (element.getParentContainer() == null) {
       return element.getEntryKind() == IPathEntry.CDT_INCLUDE
           || element.getEntryKind() == IPathEntry.CDT_MACRO;
     }
   } else if (elem instanceof CPElementAttribute) {
     CPElementAttribute attrib = (CPElementAttribute) elem;
     if (attrib.getKey().equals(CPElement.EXCLUSION)) {
       if (((IPath[]) attrib.getValue()).length > 0) {
         return true;
       }
     }
   }
   return false;
 }
 private void removeEntry() {
   List<?> selected = getSelection();
   Object elem = selected.get(0);
   if (elem instanceof CPElement) {
     CPElement element = (CPElement) elem;
     CPElementGroup parent = element.getParent();
     if (removePathFromResourceGroups(element, fIncludeSymPathsList.getElements()) == null) {
       updatePathOnResourceGroups(element.getInherited(), fIncludeSymPathsList.getElements());
     }
     fIncludeSymPathsList.refresh();
     fIncludeSymPathsList.selectElements(new StructuredSelection(parent));
   } else if (elem instanceof CPElementAttribute) {
     CPElementAttribute attrib = (CPElementAttribute) elem;
     String key = attrib.getKey();
     Object value = key.equals(CPElement.EXCLUSION) ? new Path[0] : null;
     attrib.getParent().setAttribute(key, value);
     updatePathOnResourceGroups(attrib.getParent(), fIncludeSymPathsList.getElements());
     fIncludeSymPathsList.refresh();
   }
   updateStatus();
 }
 public String getCPElementAttributeText(CPElementAttribute attrib) {
   String notAvailable = CPathEntryMessages.CPElementLabelProvider_none;
   StringBuffer buf = new StringBuffer();
   String key = attrib.getKey();
   if (key.equals(CPElement.SOURCEATTACHMENT)) {
     buf.append(CPathEntryMessages.CPElementLabelProvider_source_attachment_label);
     IPath path = (IPath) attrib.getValue();
     if (path != null && !path.isEmpty()) {
       buf.append(getPathString(path, path.getDevice() != null));
     } else {
       buf.append(notAvailable);
     }
   } else if (key.equals(CPElement.SOURCEATTACHMENTROOT)) {
     buf.append(CPathEntryMessages.CPElementLabelProvider_source_attachment_root_label);
     IPath path = (IPath) attrib.getValue();
     if (path != null && !path.isEmpty()) {
       buf.append(path.toString());
     } else {
       buf.append(notAvailable);
     }
   }
   if (key.equals(CPElement.EXCLUSION)) {
     buf.append(CPathEntryMessages.CPElementLabelProvider_exclusion_filter_label);
     IPath[] patterns = (IPath[]) attrib.getValue();
     if (patterns != null && patterns.length > 0) {
       for (int i = 0; i < patterns.length; i++) {
         if (i > 0) {
           buf.append(CPathEntryMessages.CPElementLabelProvider_exclusion_filter_separator);
         }
         buf.append(patterns[i].toString());
       }
     } else {
       buf.append(notAvailable);
     }
   }
   return buf.toString();
 }