Package org.eclipse.cdt.core.envvar

Examples of org.eclipse.cdt.core.envvar.IEnvironmentVariableManager


      } else {
    // this should not happen
      }

      // set warning levels default on
      IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
      IContributedEnvironment contribEnv = envManager.getContributedEnvironment();
      IEnvironmentVariable var = new EnvironmentVariable(ArduinoConst.ENV_KEY_JANTJE_WARNING_LEVEL, ArduinoConst.ENV_KEY_WARNING_LEVEL_ON);
      contribEnv.addVariable(var, cfgd.getConfiguration());

      prjDesc.setActiveConfiguration(defaultConfigDescription);
      prjDesc.setCdtProjectCreated();
View Full Code Here


     *            the info of the selected board to set the variables for
     */

    public static void setTheEnvironmentVariables(IProject project, ICConfigurationDescription confDesc, boolean debugCompilerSettings) {

  IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
  IContributedEnvironment contribEnv = envManager.getContributedEnvironment();

  IPath boardFileName = new Path(Common.getBuildEnvironmentVariable(confDesc, ArduinoConst.ENV_KEY_JANTJE_BOARDS_FILE,
    ArduinoInstancePreferences.getLastUsedBoardsFile()));
  // TODO arduino specification makes it possible to have more than 1 platformfile lets for now assume there is only 1
  IPath platformFilename = new Path(Common.getBuildEnvironmentVariable(confDesc, ArduinoConst.ENV_KEY_JANTJE_PLATFORM_FILE, ""));
View Full Code Here

    false, false, 2, 1));
  myWarningLevel.addListener(UPDATE, new Listener() {
      @Override
      public void handleEvent(Event e) {
    if (getResDesc().getConfiguration() != null) {
        IEnvironmentVariableManager envManager = CCorePlugin
          .getDefault().getBuildEnvironmentManager();
        IContributedEnvironment contribEnv = envManager
          .getContributedEnvironment();
        if (myWarningLevel.getSelection() == true) {
      IEnvironmentVariable var = new EnvironmentVariable(
        ArduinoConst.ENV_KEY_JANTJE_WARNING_LEVEL,
        ArduinoConst.ENV_KEY_WARNING_LEVEL_ON);
      contribEnv.addVariable(var, getResDesc()
        .getConfiguration());
        } else {
      IEnvironmentVariable var = new EnvironmentVariable(
        ArduinoConst.ENV_KEY_JANTJE_WARNING_LEVEL,
        ArduinoConst.ENV_KEY_WARNING_LEVEL_OFF);
      contribEnv.addVariable(var, getResDesc()
        .getConfiguration());
        }
    }
      }
  });

  // checkbox show alternative size
  mySizeCommand = new Button(usercomp, SWT.CHECK);
  mySizeCommand.setText("Use alternative size command?");
  mySizeCommand.setEnabled(true);
  mySizeCommand.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING,
    false, false, 2, 1));
  mySizeCommand.addListener(UPDATE, new Listener() {
      @Override
      public void handleEvent(Event e) {
    if (getResDesc().getConfiguration() != null) {
        IEnvironmentVariableManager envManager = CCorePlugin
          .getDefault().getBuildEnvironmentManager();
        IContributedEnvironment contribEnv = envManager
          .getContributedEnvironment();
        if (mySizeCommand.getSelection() == true) {
      IEnvironmentVariable var = new EnvironmentVariable(
        ArduinoConst.ENV_KEY_JANTJE_SIZE_SWITCH,
        "${" + ArduinoConst.ENV_KEY_JANTJE_SIZE_COMMAND
          + "}");
      contribEnv.addVariable(var, getResDesc()
        .getConfiguration());
        } else {
      IEnvironmentVariable var = new EnvironmentVariable(
        ArduinoConst.ENV_KEY_JANTJE_SIZE_SWITCH,
        "${" + ArduinoConst.ENV_KEY_recipe_size_pattern
          + "}");
      contribEnv.addVariable(var, getResDesc()
        .getConfiguration());
        }
    }
      }
  });

  createLine(usercomp, 2);
  // edit field add to C & C++ command line
  Label label = new Label(usercomp, SWT.LEFT);
  label.setText("append to C and C++ ");
  label.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false,
    false, 1, 1));
  myCCppCommand = new Text(usercomp, SWT.SINGLE);
  myCCppCommand.setText("");
  myCCppCommand
    .setMessage("This command is added to the C and C++ compile command.");
  myCCppCommand.setEnabled(true);
  myCCppCommand.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING,
    false, false, 1, 1));
  myCCppCommand.addModifyListener(new ModifyListener() {

      @Override
      public void modifyText(ModifyEvent e) {
    if (getResDesc().getConfiguration() != null) {
        IEnvironmentVariableManager envManager = CCorePlugin
          .getDefault().getBuildEnvironmentManager();
        IContributedEnvironment contribEnv = envManager
          .getContributedEnvironment();

        IEnvironmentVariable var = new EnvironmentVariable(
          ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_COMPILE_OPTIONS,
          myCCppCommand.getText());
        contribEnv
          .addVariable(var, getResDesc().getConfiguration());
    }

      }
  });

  // edit field add to C++ command line
  label = new Label(usercomp, SWT.LEFT);
  label.setText("append to C++ ");
  label.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false,
    false, 1, 1));
  myCppCommand = new Text(usercomp, SWT.SINGLE);
  myCppCommand.setText("");
  myCppCommand
    .setMessage("This command is added to the C++ compile command.");
  myCppCommand.setEnabled(true);
  myCppCommand.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING,
    false, false, 1, 1));
  myCppCommand.addModifyListener(new ModifyListener() {

      @Override
      public void modifyText(ModifyEvent e) {
    if (getResDesc().getConfiguration() != null) {
        IEnvironmentVariableManager envManager = CCorePlugin
          .getDefault().getBuildEnvironmentManager();
        IContributedEnvironment contribEnv = envManager
          .getContributedEnvironment();

        IEnvironmentVariable var = new EnvironmentVariable(
          ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_CPP_COMPILE_OPTIONS,
          myCppCommand.getText());
        contribEnv
          .addVariable(var, getResDesc().getConfiguration());
    }

      }
  });

  // edit field add to C command line
  label = new Label(usercomp, SWT.LEFT);
  label.setText("append to C ");
  label.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false,
    false, 1, 1));
  myCCommand = new Text(usercomp, SWT.SINGLE);
  myCCommand.setText("");
  myCCommand
    .setMessage("This command is added to the C compile command.");
  myCCommand.setEnabled(true);
  myCCommand.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING,
    false, false, 1, 1));
  myCCommand.addModifyListener(new ModifyListener() {

      @Override
      public void modifyText(ModifyEvent e) {
    if (getResDesc().getConfiguration() != null) {
        IEnvironmentVariableManager envManager = CCorePlugin
          .getDefault().getBuildEnvironmentManager();
        IContributedEnvironment contribEnv = envManager
          .getContributedEnvironment();

        IEnvironmentVariable var = new EnvironmentVariable(
          ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_C_COMPILE_OPTIONS,
          myCCommand.getText());
View Full Code Here

  setValues(getResDesc().getConfiguration());
  setVisible(true);
    }

    private void setValues(ICConfigurationDescription confDesc) {
  IEnvironmentVariableManager envManager = CCorePlugin.getDefault()
    .getBuildEnvironmentManager();
  IContributedEnvironment contribEnv = envManager
    .getContributedEnvironment();
  IEnvironmentVariable var = contribEnv.getVariable(
    ArduinoConst.ENV_KEY_JANTJE_WARNING_LEVEL, confDesc);
  if (var == null)
      myWarningLevel.setSelection(false);
View Full Code Here

  ArduinoInstancePreferences.SetLastUsedUploadPort(uploadPort);
  ArduinoInstancePreferences.SetLastUsedUploadProgrammer(uploadProg);
  ArduinoInstancePreferences.setLastUsedMenuOption(""); // TOFIX implement
                    // the options
  if (confdesc != null) {
      IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
      IContributedEnvironment contribEnv = envManager.getContributedEnvironment();

      // Set the path variables
      IProject project = confdesc.getProjectDescription().getProject();
      IPath platformPath = new Path(new File(mControlBoardsTxtFile.getText().trim()).getParent()).append(ArduinoConst.PLATFORM_FILE_NAME);
View Full Code Here

  String compilerCommand = "";
  // ArduinoProperties arduinoProperties = new
  // ArduinoProperties(currentProject);
  ICProjectDescription prjDesc = CoreModel.getDefault().getProjectDescription(currentProject);

  IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
  // IContributedEnvironment contribEnv =
  // envManager.getContributedEnvironment();
  ICConfigurationDescription confDesc = prjDesc.getActiveConfiguration();
  // Bug fix for CDT 8.1 fixed in 8.2
  IFolder buildFolder = currentProject.getFolder(confDesc.getName());
  if (!buildFolder.exists()) {
      try {
    buildFolder.create(true, true, null);
      } catch (CoreException e) {
    Common.log(new Status(IStatus.ERROR, ArduinoConst.CORE_PLUGIN_ID, "failed to create folder " + confDesc.getName(), e));
      }
  }
  // End of Bug fix for CDT 8.1 fixed in 8.2
  if (languageId.equals("org.eclipse.cdt.core.gcc")) {
      compilerCommand = envManager.getVariable(ArduinoConst.ENV_KEY_recipe_c_o_pattern, confDesc, true).getValue().replace(" -o ", " ");
      IEnvironmentVariable op1 = envManager.getVariable(ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_COMPILE_OPTIONS, confDesc, true);
      IEnvironmentVariable op2 = envManager.getVariable(ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_C_COMPILE_OPTIONS, confDesc, true);
      if (op1 != null) {
    compilerCommand = compilerCommand + " " + op1.getValue();
      }
      if (op2 != null) {
    compilerCommand = compilerCommand + " " + op2.getValue();
      }
      compilerCommand = compilerCommand + " -D__IN_ECLIPSE__=1";
  } else if (languageId.equals("org.eclipse.cdt.core.g++")) {
      compilerCommand = envManager.getVariable(ArduinoConst.ENV_KEY_recipe_cpp_o_pattern, confDesc, true).getValue().replace(" -o ", " ");
      IEnvironmentVariable op1 = envManager.getVariable(ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_COMPILE_OPTIONS, confDesc, true);
      IEnvironmentVariable op2 = envManager.getVariable(ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_CPP_COMPILE_OPTIONS, confDesc, true);
      if (op1 != null) {
    compilerCommand = compilerCommand + " " + op1.getValue();
      }
      if (op2 != null) {
    compilerCommand = compilerCommand + " " + op2.getValue();
View Full Code Here

    }

    static public String getBuildEnvironmentVariable(ICConfigurationDescription configurationDescription, String EnvName, String defaultvalue,
      boolean expanded) {

  IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
  try {
      return envManager.getVariable(EnvName, configurationDescription, expanded).getValue();
  } catch (Exception e) {// ignore all errors and return the default value
  }
  return defaultvalue;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.cdt.core.envvar.IEnvironmentVariableManager

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.