1 11 12 package org.eclipse.jdt.internal.debug.ui.classpath; 13 14 import java.util.Iterator ; 15 16 public class ClasspathGroup extends AbstractClasspathEntry { 17 private String name; 18 19 private boolean canBeRemoved= true; 20 21 public ClasspathGroup(String name, IClasspathEntry parent, boolean canBeRemoved) { 22 this.parent= parent; 23 this.name= name; 24 this.canBeRemoved= canBeRemoved; 25 } 26 27 public void addEntry(IClasspathEntry entry, Object beforeEntry) { 28 if (!childEntries.contains(entry)) { 29 int index = -1; 30 if (beforeEntry != null) { 31 index = childEntries.indexOf(beforeEntry); 32 } 33 if (index >= 0) { 34 childEntries.add(index, entry); 35 } else { 36 childEntries.add(entry); 37 } 38 } 39 } 40 41 public void removeEntry(IClasspathEntry entry) { 42 childEntries.remove(entry); 43 } 44 45 public boolean contains(IClasspathEntry entry) { 46 return childEntries.contains(entry); 47 } 48 49 public String toString() { 50 return name; 51 } 52 53 public void removeAll() { 54 Iterator iter= childEntries.iterator(); 55 while (iter.hasNext()) { 56 Object entry = iter.next(); 57 if (entry instanceof ClasspathGroup) { 58 ((ClasspathGroup)entry).removeAll(); 59 } 60 } 61 childEntries.clear(); 62 } 63 64 public boolean canBeRemoved() { 65 return canBeRemoved; 66 } 67 68 71 public boolean isEditable() { 72 return false; 73 } 74 } 75 | Popular Tags |