1 11 package org.eclipse.ui.internal.cheatsheets; 12 13 import org.eclipse.core.expressions.EvaluationContext; 14 import org.eclipse.core.runtime.Platform; 15 import org.eclipse.ui.PlatformUI; 16 17 21 public final class CheatSheetEvaluationContext { 22 23 private static final String VARIABLE_PLATFORM = "platform"; private static final String VARIABLE_WORKBENCH = "workbench"; 26 private static EvaluationContext context; 27 28 31 public static EvaluationContext getContext() { 32 if (context == null) { 33 context = new EvaluationContext(null, Platform.class) { 34 public Object getVariable(String name) { 35 if (VARIABLE_PLATFORM.equals(name)) { 36 return Platform.class; 37 } 38 else if (VARIABLE_WORKBENCH.equals(name)) { 39 return PlatformUI.getWorkbench(); 40 } 41 return null; 42 } 43 }; 44 } 45 return context; 46 } 47 48 51 private CheatSheetEvaluationContext() { 52 } 53 } 54 | Popular Tags |