Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Created make targets not saved to .cproject

Hello,
I encounter the following problem:
In a job started from an early startup method (extension point="org.eclipse.ui.startup") I create some make targets . They do show up fine in the Make Targets view, and they perform as expected, so everything seems to work fine. But after exiting Eclipse and reopening, they are lost. They are not written to the .cproject file.
Is there anything I have to call to make these make targets persistent?

I just do it like this:
...
private final String TARGET_BUILD_ID = "org.eclipse.cdt.build.MakeTargetBuilder";
   private IMakeTargetManager targetManager;
...
       targetManager = MakeCorePlugin.getDefault().getTargetManager();
  ...
       for (String tgName : systems) {
IMakeTarget target = targetManager.createTarget(container.getProject(), tgName, TARGET_BUILD_ID);
           target.setContainer(container);
           if (!targetManager.targetExists(target)) {
               target.setUseDefaultBuildCmd(false);
target.setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, MAKE_WRAPPER); target.setBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, SUBCOMMAND + " " + sys );
               target.setBuildAttribute(IMakeTarget.BUILD_TARGET, "all");
               try {
                   targetManager.addTarget(container, target);
                   anyAdded = true;
               } catch (CoreException e) {
                   System.err.println(e.getMessage());
               }
           }
       }
       if (anyAdded) {
           // CDT does not save automatically???
           container.getProject().touch(null);
       }


As you see, I tried to force the writing by calling getProject().touch(), but that did not help either.
Any idea what is missing here?
Thanks,
 Achim



Back to the top