Package com.alphacsp.cit

Examples of com.alphacsp.cit.Environment


    public String getDescription() {
        return "Change the current directory";
    }

    public void execute(ExecutionContext executionContext) throws CommandExecutionException {
        Environment environment = executionContext.getEnvironment();
        List<String> parameters = executionContext.getParameters();

        FileValue pwd = environment.pwd();

        if (parameters.isEmpty()) {
            environment.cd();
        } else {
            String newFolder = parameters.get(0);
            FileValue newPwd = pwd.child(newFolder);
            File newFolderFile = newPwd.getAsFile();
            if (! newFolderFile.exists()) {
                throw new CommandExecutionException("No such directory: " + newFolderFile);
            }
            if (! newFolderFile.isDirectory()) {
                throw new CommandExecutionException(newFolderFile + "is not a directory");
            }
            environment.cd(newFolderFile.getAbsolutePath());
        }

    }
View Full Code Here


    public String getDescription() {
        return "Prints the environment variables";
    }

    public void execute(ExecutionContext context) {
        Environment environment = context.getEnvironment();
        context.println();
        context.println("Environment:");
        context.println();

        Stringifier<Map> mapStringifier = new MapStringifier<Map>();
        String result = mapStringifier.stringify(environment.getVars());
        context.println(result);
    }
View Full Code Here

        List<String> parameters = executionContext.getParameters();
        List<String> commands = new ArrayList<String>();
        commands.add(editor.getAsText());
        commands.addAll(parameters);
        DefaultProcessLauncher processLauncher = new DefaultProcessLauncher();
        Environment environment = executionContext.getEnvironment();
        processLauncher.setWorkingDir(environment.pwd().getAsFile());
        processLauncher.addCommands(commands);
        processLauncher.addEnvironmentVariables(environment.getVars());
        processLauncher.exec();
    }
View Full Code Here

* @author Yoav Hakman
*/
public class InitialPwdCalculation implements Calculation {

    public String calculate(EnvironmentVariableContext context) {
        Environment environment = context.getEnvironment();
        return environment.getProjectHome().getAsText();
    }
View Full Code Here

/**
* @author Yoav Hakman
*/
public class ProjectHomeCalculation implements Calculation{
    public String calculate(EnvironmentVariableContext context) {
        Environment environment = context.getEnvironment();
        StringBuilder buff = new StringBuilder();
        buff.append(environment.getProjectName().getAsText());
        buff.append('.');
        buff.append(environment.getProjectVersion().getAsText());
        return environment.getWorkspaceHome().child(buff.toString()).getAsText();
    }
View Full Code Here

TOP

Related Classes of com.alphacsp.cit.Environment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.