1 11 package org.eclipse.ui.internal.cheatsheets.registry; 12 13 import java.util.Map ; 14 import java.util.TreeMap ; 15 16 import org.eclipse.core.commands.IParameterValues; 17 18 23 public class CheatSheetParameterValues implements IParameterValues { 24 25 public Map getParameterValues() { 26 Map values = new TreeMap (); 27 28 CheatSheetCollectionElement cheatSheetCollection = (CheatSheetCollectionElement) CheatSheetRegistryReader 29 .getInstance().getCheatSheets(); 30 populateValues(values, cheatSheetCollection); 31 32 return values; 33 } 34 35 private void populateValues(Map values, 36 CheatSheetCollectionElement cheatSheetCollection) { 37 38 Object [] cheatsheets = cheatSheetCollection.getCheatSheets(); 39 for (int i = 0; i < cheatsheets.length; i++) { 40 Object cheatsheet = cheatsheets[i]; 41 if (cheatsheet instanceof CheatSheetElement) { 42 CheatSheetElement element = (CheatSheetElement) cheatsheet; 43 values.put(element.getLabel(null), element.getID()); 44 } 45 } 46 47 Object [] children = cheatSheetCollection.getChildren(); 48 for (int i = 0; i < children.length; i++) { 49 Object child = children[i]; 50 if (child instanceof CheatSheetCollectionElement) { 51 populateValues(values, (CheatSheetCollectionElement) child); 52 } 53 } 54 } 55 56 } 57 | Popular Tags |