当前位置: 首页>>代码示例>>Java>>正文


Java IDynamicVariable.getValue方法代码示例

本文整理汇总了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());
}
 
开发者ID:apache,项目名称:karaf-eik,代码行数:25,代码来源:NewKarafProjectOperation.java

示例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;
}
 
开发者ID:anb0s,项目名称:eclox,代码行数:37,代码来源:Doxygen.java

示例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);
    }
}
 
开发者ID:apache,项目名称:karaf-eik,代码行数:45,代码来源:KarafPlatformResourcesBuildUnit.java

示例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));
}
 
开发者ID:GoClipse,项目名称:goclipse,代码行数:58,代码来源:StringSubstitutionEngine.java


注:本文中的org.eclipse.core.variables.IDynamicVariable.getValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。