本文整理汇总了Java中org.eclipse.core.variables.IDynamicVariable.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java IDynamicVariable.getValue方法的具体用法?Java IDynamicVariable.getValue怎么用?Java IDynamicVariable.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.variables.IDynamicVariable
的用法示例。
在下文中一共展示了IDynamicVariable.getValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createKarafPlatformResources
import org.eclipse.core.variables.IDynamicVariable; //导入方法依赖的package包/类
private void createKarafPlatformResources(final IProgressMonitor monitor) throws CoreException {
newKarafProject.getProjectHandle().getFolder(".bin").create(true, true, monitor);
newKarafProject.getProjectHandle().getFolder(".bin/platform").create(true, true, monitor);
newKarafProject.getProjectHandle().getFolder(".bin/platform/etc").createLink(workingPlatformModel.getParentKarafModel().getConfigurationDirectory(), 0, monitor);
newKarafProject.getProjectHandle().getFolder(".bin/platform/deploy").createLink(workingPlatformModel.getParentKarafModel().getUserDeployedDirectory(), 0, monitor);
newKarafProject.getProjectHandle().getFolder(".bin/platform/lib").createLink(workingPlatformModel.getParentKarafModel().getRootDirectory().append("lib"), 0, monitor);
newKarafProject.getProjectHandle().getFolder(".bin/platform/system").createLink(workingPlatformModel.getParentKarafModel().getPluginRootDirectory(), 0, monitor);
newKarafProject.getProjectHandle().getFolder(".bin/runtime").create(true, true, monitor);
// TODO: Is this the right way to add the current installation?
final IDynamicVariable eclipseHomeVariable = VariablesPlugin.getDefault().getStringVariableManager().getDynamicVariable("eclipse_home");
final String eclipseHome = eclipseHomeVariable.getValue("");
newKarafProject.getProjectHandle().getFolder(".bin/platform/eclipse").create(true, true, monitor);
newKarafProject.getProjectHandle().getFolder(".bin/platform/eclipse/dropins").createLink(new Path(eclipseHome).append("dropins"), 0, monitor);
newKarafProject.getProjectHandle().getFolder(".bin/platform/eclipse/plugins").createLink(new Path(eclipseHome).append("plugins"), 0, monitor);
newKarafProject.getProjectHandle().setPersistentProperty(
new QualifiedName(KarafUIPluginActivator.PLUGIN_ID, "karafProject"),
"true");
newKarafProject.getProjectHandle().setPersistentProperty(
new QualifiedName(KarafUIPluginActivator.PLUGIN_ID, "karafModel"),
karafPlatformModel.getRootDirectory().toString());
}
示例2: resolveOneVariable
import org.eclipse.core.variables.IDynamicVariable; //导入方法依赖的package包/类
private String resolveOneVariable(String key, IStringVariableManager variableManager, boolean dynamicAllowed) {
if (key != null) {
if (variableManager == null) {
variableManager = VariablesPlugin.getDefault().getStringVariableManager();
}
if (variableManager != null) {
// static variable
IValueVariable staticVar = variableManager.getValueVariable(key);
if (staticVar != null) {
return staticVar.getValue();
}
// dynamic variable
else if (dynamicAllowed) {
String varName = key;
String valuePar = null;
// check if parameterized and get parameter
int index = key.indexOf(':');
if (index > 1) {
varName = key.substring(0, index);
if (key.length() > index + 1)
valuePar = key.substring(index + 1);
}
// get dynamic variable
IDynamicVariable dynVar = variableManager.getDynamicVariable(varName);
if (dynVar == null)
return null;
try {
return dynVar.getValue(valuePar);
} catch (CoreException e) {
return null;
}
}
}
}
return null;
}
示例3: build
import org.eclipse.core.variables.IDynamicVariable; //导入方法依赖的package包/类
@Override
public void build(final int kind, @SuppressWarnings("rawtypes") final Map args, final IProgressMonitor monitor) throws CoreException {
final IKarafProject newKarafProject = getKarafProject();
final IProject project = newKarafProject.getProjectHandle();
for (final String folderName : new String[] { ".bin", ".bin/platform", ".bin/runtime" }) {
final IFolder folder = project.getFolder(folderName);
if (!folder.exists()) {
folder.create(true, true, monitor);
}
}
if (!project.getFolder(".bin/platform/etc").exists()) {
project.getFolder(".bin/platform/etc").createLink(getKarafPlatformModel().getConfigurationDirectory(), 0, monitor);
}
if (!project.getFolder(".bin/platform/deploy").exists()) {
project.getFolder(".bin/platform/deploy").createLink(getKarafPlatformModel().getUserDeployedDirectory(), 0, monitor);
}
if (!project.getFolder(".bin/platform/lib").exists()) {
project.getFolder(".bin/platform/lib").createLink(getKarafPlatformModel().getRootDirectory().append("lib"), 0, monitor);
}
if (!project.getFolder(".bin/platform/system").exists()) {
project.getFolder(".bin/platform/system").createLink(getKarafPlatformModel().getPluginRootDirectory(), 0, monitor);
}
// TODO: Is this the right way to add the current installation?
final IDynamicVariable eclipseHomeVariable = VariablesPlugin.getDefault().getStringVariableManager().getDynamicVariable("eclipse_home");
final String eclipseHome = eclipseHomeVariable.getValue("");
if (!project.getFolder(".bin/platform/eclipse").exists()) {
project.getFolder(".bin/platform/eclipse").create(true, true, monitor);
}
if (!project.getFolder(".bin/platform/eclipse/dropins").exists()) {
project.getFolder(".bin/platform/eclipse/dropins").createLink(new Path(eclipseHome).append("dropins"), 0, monitor);
}
if (!project.getFolder(".bin/platform/eclipse/plugins").exists()) {
project.getFolder(".bin/platform/eclipse/plugins").createLink(new Path(eclipseHome).append("plugins"), 0, monitor);
}
}
示例4: resolve
import org.eclipse.core.variables.IDynamicVariable; //导入方法依赖的package包/类
/**
* 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));
}