private void loadValue(IStringVariable var) throws CdtVariableException { if (var instanceof IDynamicVariable) { IDynamicVariable dynamicVar = (IDynamicVariable) var; if (fArgument == null || dynamicVar.supportsArgument()) { try { fStringValue = dynamicVar.getValue(fArgument); } catch (CoreException e) { fStringValue = null; } } else fStringValue = null; } else if (var instanceof IValueVariable) { if (fArgument == null) fStringValue = ((IValueVariable) var).getValue(); else fStringValue = null; } }
private void assertVariable(String expected, String variableName, String argument) throws CoreException { IResource findMember = project.findMember(TEST_FILE); SWTBotView explorerView = TestUtil.showExplorerView(); final ISelectionProvider selectionProvider = explorerView.getViewReference().getView(true).getSite().getSelectionProvider(); final StructuredSelection structuredSelection = new StructuredSelection(findMember); PlatformUI.getWorkbench() .getDisplay() .syncExec( new Runnable() { @Override public void run() { selectionProvider.setSelection(structuredSelection); } }); IDynamicVariable dynamicVariable = VariablesPlugin.getDefault().getStringVariableManager().getDynamicVariable(variableName); String value = dynamicVariable.getValue(argument); assertEquals(expected, value); }
public ICdtVariable[] getVariables() { // if(contextType != DefaultMacroContextInfo.CONTEXT_WORKSPACE) // return null; IStringVariableManager mngr = VariablesPlugin.getDefault().getStringVariableManager(); IDynamicVariable vars[] = mngr.getDynamicVariables(); Map<String, IStringVariable> map = new HashMap<String, IStringVariable>(); for (IDynamicVariable var : vars) { final String name = var.getName(); if (!isDeadlockProneVariable(name)) { map.put(name, var); } } IValueVariable valVars[] = mngr.getValueVariables(); for (IValueVariable valVar : valVars) map.put(valVar.getName(), valVar); Collection<IStringVariable> collection = map.values(); EclipseVarMacro macros[] = new EclipseVarMacro[collection.size()]; Iterator<IStringVariable> iter = collection.iterator(); for (int i = 0; i < macros.length; i++) macros[i] = new EclipseVarMacro(iter.next()); return macros; }