1 11 package org.eclipse.pde.internal.ui.nls; 12 13 import java.util.ArrayList ; 14 import java.util.Collection ; 15 import java.util.Hashtable ; 16 17 import org.eclipse.core.resources.IFile; 18 import org.eclipse.pde.core.plugin.IPluginModelBase; 19 20 public class ModelChangeTable { 21 22 private Hashtable fChangeTable = new Hashtable (); 23 private int fTotalModelChanges = 0; 24 private ArrayList fPreSelected = new ArrayList (); 25 26 public void addToChangeTable(IPluginModelBase model, IFile file, Object change, boolean selected) { 27 if (change == null) return; 28 ModelChange modelChange; 29 if (fChangeTable.containsKey(model)) 30 modelChange = (ModelChange)fChangeTable.get(model); 31 else { 32 modelChange = new ModelChange(model, selected); 33 fChangeTable.put(model, modelChange); 34 fTotalModelChanges += 1; 35 if (selected) 36 fPreSelected.add(modelChange); 37 } 38 modelChange.addChange(file, new ModelChangeElement(modelChange, change)); 39 } 40 41 public Collection getAllModelChanges() { 42 return fChangeTable.values(); 43 } 44 45 public ModelChange getModelChange(IPluginModelBase modelKey) { 46 if (fChangeTable.containsKey(modelKey)) 47 return (ModelChange)fChangeTable.get(modelKey); 48 return null; 49 } 50 51 public Object [] getPreSelected() { 52 return fPreSelected.toArray(); 53 } 54 public boolean hasPreSelected() { 55 return fPreSelected.size() > 0; 56 } 57 public boolean isEmpty() { 58 return fChangeTable.size() == 0; 59 } 60 } 61 | Popular Tags |