1 11 package org.eclipse.help.ui.internal.views; 12 13 import org.eclipse.jface.preference.IPreferenceStore; 14 15 public class HistoryScopeSet extends ScopeSet { 16 private static final String KEY_EXPRESSION = "expression"; public static final String EXT = ".hist"; 19 public HistoryScopeSet(String expression) { 20 this(expression, expression); 21 } 22 23 public HistoryScopeSet(String name, String expression) { 24 super(name); 25 if (expression!=null) 26 setExpression(expression); 27 } 28 29 public HistoryScopeSet(HistoryScopeSet set) { 30 super(set); 31 setExpression(set.getExpression()); 32 } 33 34 public void copyFrom(ScopeSet set) { 35 String expression = getExpression(); 36 super.copyFrom(set); 37 setExpression(expression); 38 } 39 40 public String getExpression() { 41 IPreferenceStore store = getPreferenceStore(); 42 return store.getString(KEY_EXPRESSION); 43 } 44 45 public boolean isImplicit() { 46 return true; 47 } 48 49 protected String getExtension() { 50 return EXT; 51 } 52 53 protected String encodeFileName(String name) { 54 StringBuffer buf = new StringBuffer (); 55 for (int i = 0; i < name.length(); i++) { 56 char c = name.charAt(i); 57 switch (c) { 58 case '\"': 59 buf.append("QUOTE"); break; 61 case ' ': 62 buf.append("_"); break; 64 case '?': 65 buf.append("QUESTION"); break; 67 case '*': 68 buf.append("STAR"); break; 70 default: 71 buf.append(c); 72 break; 73 } 74 } 75 return buf.toString(); 76 } 77 78 public void setExpression(String expression) { 79 IPreferenceStore store = getPreferenceStore(); 80 store.setValue(KEY_EXPRESSION, expression); 81 } 82 } 83 | Popular Tags |