Java Code Examples for org.eclipse.core.variables.IDynamicVariable#getName()

The following examples show how to use org.eclipse.core.variables.IDynamicVariable#getName() . 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: SelectedFileVariableResolver.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
@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 2
Source File: ProjectVariableResolver.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
@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 3
Source File: MainModuleVariableResolver.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
@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 4
Source File: PrjFileVariableResolver.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
@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 5
Source File: ExeFileVariableResolve.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
@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 6
Source File: DynamicVariableResolver.java    From EasyShell with Eclipse Public License 2.0 5 votes vote down vote up
@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);
    }
}