org.eclipse.core.variables.IDynamicVariable Java Examples
The following examples show how to use
org.eclipse.core.variables.IDynamicVariable.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SdkVariableResolver.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
@Override public String resolveValue(IDynamicVariable variable, String argument) throws CoreException { IResource resource = VariableResolverUtils.getFirstSelectedResource(); if (resource != null) { XdsProjectSettings xdsProjectSettings = XdsProjectSettingsManager.getXdsProjectSettings(resource.getProject()); Sdk sdk = xdsProjectSettings.getProjectSdk(); if (sdk != null) { if (XDS_HOME_VAR.equals(variable.getName())) { return sdk.getSdkHomePath(); } } } return null; }
Example #2
Source File: SelectedFileVariableResolver.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
@Override public String resolveValue(IDynamicVariable variable, String argument) throws CoreException { IFile file = VariableResolverUtils.getSelectedFile(); if (file != null) { String var_name = variable.getName(); if (SELECTED_FILE_LOC.equals(var_name)) { return ResourceUtils.getAbsolutePath(file); } if (SELECTED_FILE_BASELOC.equals(var_name)) { return ResourceUtils.getAbsolutePath(file.getParent()); } if (SELECTED_FILE_NAME.equals(var_name)) { return file.getName(); } if (SELECTED_FILE_BASENAME.equals(var_name)) { return FilenameUtils.getBaseName(file.getName()); } if (SELECTED_FILE_EXT.equals(var_name)) { return FilenameUtils.getExtension(file.getName()); } } return null; }
Example #3
Source File: ProjectVariableResolver.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
@Override public String resolveValue(IDynamicVariable variable, String argument) throws CoreException { IResource resource = VariableResolverUtils.getFirstSelectedResource(); if (resource != null) { IProject project = resource.getProject(); String var_name = variable.getName(); if (PROJECT_LOC.equals(var_name)) { return ResourceUtils.getAbsolutePath(project); } if (PROJECT_BASELOC.equals(var_name)) { return ResourceUtils.getAbsolutePath(project.getParent()); } if (PROJECT_NAME.equals(var_name)) { return project.getName(); } } return null; }
Example #4
Source File: MainModuleVariableResolver.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
@Override public String resolveValue(IDynamicVariable variable, String argument) throws CoreException { IFile file = VariableResolverUtils.getMainModule(); if (file != null) { String var_name = variable.getName(); if (MAINMODULE_LOC.equals(var_name)) { return ResourceUtils.getAbsolutePath(file); } if (MAINMODULE_BASELOC.equals(var_name)) { return ResourceUtils.getAbsolutePath(file.getParent()); } if (MAINMODULE_NAME.equals(var_name)) { return file.getName(); } if (MAINMODULE_BASENAME.equals(var_name)) { return FilenameUtils.getBaseName(file.getName()); } if (MAINMODULE_EXT.equals(var_name)) { return FilenameUtils.getExtension(file.getName()); } } return null; }
Example #5
Source File: PrjFileVariableResolver.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
@Override public String resolveValue(IDynamicVariable variable, String argument) throws CoreException { IFile file = VariableResolverUtils.getPrjFile(); if (file != null) { String var_name = variable.getName(); if (PRJFILE_LOC.equals(var_name)) { return ResourceUtils.getAbsolutePath(file); } if (PRJFILE_BASELOC.equals(var_name)) { return ResourceUtils.getAbsolutePath(file.getParent()); } if (PRJFILE_NAME.equals(var_name)) { return file.getName(); } if (PRJFILE_BASENAME.equals(var_name)) { return FilenameUtils.getBaseName(file.getName()); } if (PRJFILE_EXT.equals(var_name)) { return FilenameUtils.getExtension(file.getName()); } } return null; }
Example #6
Source File: ExeFileVariableResolve.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
@Override public String resolveValue(IDynamicVariable variable, String argument) throws CoreException { IFile file = VariableResolverUtils.getApplicationExecutable(); if (file != null) { String var_name = variable.getName(); if (EXEFILE_LOC.equals(var_name)) { return ResourceUtils.getAbsolutePath(file); } if (EXEFILE_BASELOC.equals(var_name)) { return ResourceUtils.getAbsolutePath(file.getParent()); } if (EXEFILE_NAME.equals(var_name)) { return file.getName(); } if (EXEFILE_BASENAME.equals(var_name)) { return FilenameUtils.getBaseName(file.getName()); } if (EXEFILE_EXT.equals(var_name)) { return FilenameUtils.getExtension(file.getName()); } } return null; }
Example #7
Source File: UniqueIdVariableResolver.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
public String resolveValue(IDynamicVariable variable, String argument) throws CoreException { /* * TODO: Generally, a unique ID would work, but the current logic for * referencing back to a launch config searches each launch config's * command-line args for this string. Having it too short (e.g. based off an * AtomicInteger) causes that to fail. Instead of causing churn on that * code, we revert back to using nanoTime as the unique ID. */ return String.valueOf(System.nanoTime()); }
Example #8
Source File: GwtRemoteUiServerPortVariableResolver.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
public String resolveValue(IDynamicVariable variable, String argument) throws CoreException { try { return String.valueOf(RemoteUIServer.getInstance().getPort()); } catch (Throwable e) { CorePluginLog.logError(e, "Could not get remote UI server's port"); // We can pass an invalid value which will cause GWT's Swing UI to be used return "-1"; } }
Example #9
Source File: DynamicVariableResolver.java From EasyShell with Eclipse Public License 2.0 | 5 votes |
@Override public String resolveValue(IDynamicVariable variable, String argument) throws CoreException { String variableName = variable.getName(); if (variableName.equals("easyshell")) { return handleOwnVariable(argument); } else { return handleEclipseVariable(variableName, argument); } }
Example #10
Source File: EditSdkToolPage.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
private String selectVar() { StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell()); dialog.addVariableFilter(new StringVariableSelectionDialog.VariableFilter() { @Override public boolean isFiltered(IDynamicVariable var) { return !var.getName().startsWith("xds_"); //$NON-NLS-1$ } }); dialog.open(); return dialog.getVariableExpression(); }
Example #11
Source File: VariablesResolver.java From goclipse with Eclipse Public License 1.0 | 5 votes |
@Override public IDynamicVariable getDynamicVariable(String name) { IDynamicVariable variable = dynamicVariables.get(name); if(variable != null) { return variable; } return super.getDynamicVariable(name); }
Example #12
Source File: VariablesResolver.java From goclipse with Eclipse Public License 1.0 | 5 votes |
@Override public IDynamicVariable[] getDynamicVariables() { HashMap2<String, IDynamicVariable> newMap = dynamicVariables.copyToHashMap(); IDynamicVariable[] parentVars = super.getDynamicVariables(); for (IDynamicVariable parentVar : parentVars) { // Do not put vars that have same name newMap.putIfAbsent(parentVar.getName(), parentVar); } return newMap.getValuesView().toArray(IDynamicVariable.class); }
Example #13
Source File: VariablesResolver.java From goclipse with Eclipse Public License 1.0 | 5 votes |
@Override public IStringVariable[] getVariables() { IValueVariable[] valueVars = getValueVariables(); IDynamicVariable[] dynVars = getDynamicVariables(); ArrayList2<IStringVariable> variables = new ArrayList2<>(valueVars.length + dynVars.length); variables.addElements(dynVars); variables.addElements(valueVars); return variables.toArray(IStringVariable.class); }
Example #14
Source File: ForwardingVariableManager.java From goclipse with Eclipse Public License 1.0 | 4 votes |
@Override public IDynamicVariable getDynamicVariable(String name) { return parentVarMgr.getDynamicVariable(name); }
Example #15
Source File: ForwardingVariableManager.java From goclipse with Eclipse Public License 1.0 | 4 votes |
@Override public IDynamicVariable[] getDynamicVariables() { return parentVarMgr.getDynamicVariables(); }
Example #16
Source File: StringSubstitutionEngine.java From goclipse with Eclipse Public License 1.0 | 4 votes |
/** * Resolve and return the value of the given variable reference, * possibly <code>null</code>. * * @param var the {@link VariableReference} to try and resolve * @param reportUndefinedVariables whether to report undefined variables as * an error * @param resolveVariables whether to resolve the variables value or just to validate that this variable is valid * @param manager variable registry * @return variable value, possibly <code>null</code> * @exception CoreException if unable to resolve a value */ private String resolve(VariableReference var, boolean reportUndefinedVariables, boolean resolveVariables, IStringVariableManager manager) throws CoreException { String text = var.getText(); int pos = text.indexOf(VARIABLE_ARG); String name = null; String arg = null; if (pos > 0) { name = text.substring(0, pos); pos++; if (pos < text.length()) { arg = text.substring(pos); } } else { name = text; } IValueVariable valueVariable = manager.getValueVariable(name); if (valueVariable == null) { IDynamicVariable dynamicVariable = manager.getDynamicVariable(name); if (dynamicVariable == null) { // no variables with the given name if (reportUndefinedVariables) { throw new CoreException(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, NLS.bind(VariablesMessages.StringSubstitutionEngine_3, new String[]{name}), null)); } // leave as is return getOriginalVarText(var); } if (resolveVariables) { fSubs = true; return dynamicVariable.getValue(arg); } //leave as is return getOriginalVarText(var); } if (arg == null) { if (resolveVariables) { fSubs = true; return valueVariable.getValue(); } //leave as is return getOriginalVarText(var); } // error - an argument specified for a value variable throw new CoreException(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, NLS.bind(VariablesMessages.StringSubstitutionEngine_4, new String[]{valueVariable.getName()}), null)); }
Example #17
Source File: VariablesResolver.java From goclipse with Eclipse Public License 1.0 | 4 votes |
public void putDynamicVar(IDynamicVariable dynamicVariable) { dynamicVariables.put(dynamicVariable.getName(), dynamicVariable); }
Example #18
Source File: VariablesResolver.java From goclipse with Eclipse Public License 1.0 | 4 votes |
public void putDynamicVar(IDynamicVariable dynamicVariable) { varMgr.putDynamicVar(dynamicVariable); }
Example #19
Source File: MockStringVariableManager.java From Pydev with Eclipse Public License 1.0 | 4 votes |
@Override public IDynamicVariable getDynamicVariable(String name) { throw new AssertionFailedError("Unexpected method call in MockStringVariableManager"); }
Example #20
Source File: MockStringVariableManager.java From Pydev with Eclipse Public License 1.0 | 4 votes |
@Override public IDynamicVariable[] getDynamicVariables() { throw new AssertionFailedError("Unexpected method call in MockStringVariableManager"); }