1 11 12 16 17 package org.eclipse.ui.internal.cheatsheets.state; 18 19 import java.util.Hashtable ; 20 import java.util.Properties ; 21 22 import org.eclipse.core.runtime.IStatus; 23 import org.eclipse.ui.internal.cheatsheets.data.CheatSheetSaveHelper; 24 import org.eclipse.ui.internal.cheatsheets.data.IParserTags; 25 import org.eclipse.ui.internal.cheatsheets.registry.CheatSheetElement; 26 import org.eclipse.ui.internal.cheatsheets.views.CheatSheetManager; 27 28 32 33 public class DefaultStateManager implements ICheatSheetStateManager { 34 35 private CheatSheetSaveHelper saveHelper = new CheatSheetSaveHelper(); 36 private Properties props; 37 private CheatSheetElement element; 38 private boolean propertiesRead = false; 39 40 public Properties getProperties() { 41 if (!propertiesRead) { 42 props = saveHelper.loadState(element.getID()); 43 propertiesRead = true; 44 } 45 return props; 46 } 47 48 public CheatSheetManager getCheatSheetManager() { 49 CheatSheetManager result = new CheatSheetManager(element); 50 if (getProperties() != null) { 51 result.setData((Hashtable ) getProperties().get(IParserTags.MANAGERDATA)); 52 } 53 return result; 54 } 55 56 public void setElement(CheatSheetElement element) { 57 this.element = element; 58 } 59 60 public IStatus saveState(Properties properties, CheatSheetManager manager) { 61 return saveHelper.saveState(properties, manager); 62 } 63 } 64 | Popular Tags |