1 11 12 package org.eclipse.ui.internal.util; 13 14 import org.eclipse.core.runtime.IConfigurationElement; 15 16 import org.eclipse.ui.IMemento; 17 18 public final class OldConfigurationElementMemento implements IMemento { 19 20 private IConfigurationElement configurationElement; 21 22 public OldConfigurationElementMemento(IConfigurationElement configurationElement) { 23 if (configurationElement == null) 24 throw new NullPointerException (); 25 26 this.configurationElement = configurationElement; 27 } 28 29 public IMemento createChild(String type) { 30 return null; 31 } 32 33 public IMemento createChild(String type, String id) { 34 return null; 35 } 36 37 public IMemento getChild(String type) { 38 IConfigurationElement[] configurationElements = 39 configurationElement.getChildren(type); 40 41 if (configurationElements != null && configurationElements.length >= 1) 42 return new OldConfigurationElementMemento(configurationElements[0]); 43 44 return null; 45 } 46 47 public IMemento[] getChildren(String type) { 48 IConfigurationElement[] configurationElements = 49 configurationElement.getChildren(type); 50 51 if (configurationElements != null 52 && configurationElements.length >= 1) { 53 IMemento mementos[] = 54 new OldConfigurationElementMemento[configurationElements 55 .length]; 56 57 for (int i = 0; i < configurationElements.length; i++) 58 mementos[i] = 59 new OldConfigurationElementMemento(configurationElements[i]); 60 61 return mementos; 62 } 63 64 return new IMemento[0]; 65 } 66 67 public Float getFloat(String key) { 68 String string = configurationElement.getAttribute(key); 69 70 if (string != null) 71 try { 72 return new Float (string); 73 } catch (NumberFormatException eNumberFormat) { 74 } 75 76 return null; 77 } 78 79 public String getID() { 80 return configurationElement.getAttribute(TAG_ID); 81 } 82 83 public Integer getInteger(String key) { 84 String string = configurationElement.getAttribute(key); 85 86 if (string != null) 87 try { 88 return new Integer (string); 89 } catch (NumberFormatException eNumberFormat) { 90 } 91 92 return null; 93 } 94 95 public String getString(String key) { 96 return configurationElement.getAttribute(key); 97 } 98 99 public String getTextData() { 100 return configurationElement.getValue(); 101 } 102 103 public void putFloat(String key, float value) { 104 } 105 106 public void putInteger(String key, int value) { 107 } 108 109 public void putMemento(IMemento memento) { 110 } 111 112 public void putString(String key, String value) { 113 } 114 115 public void putTextData(String data) { 116 } 117 } 118 | Popular Tags |