Copying a folder from any location to Workspace (CDT) [message #1770267] |
Wed, 09 August 2017 09:56  |
Eclipse User |
|
|
|
Hello,
I am new to Eclipse CDT and the project template. Is there a process in the CDT template that would allow me to copy a folder (which has sub-folders), from a location declared in the environment variable (lets say the folder is at c:/temp_1) to my eclipse workspace (I am using Windows Operating system). Please note the Source can be anywhere.
Can you please provide a template XML Snippet.
Thanks
|
|
|
|
|
|
|
Re: Copying a folder from any location to Workspace (CDT) [message #1770607 is a reply to message #1770599] |
Mon, 14 August 2017 19:38   |
Eclipse User |
|
|
|
Hi Jonah,
Based on your feedback and searching the internet, I am trying to run a simple processRunner, to make sure that I have the structure down to trigger the Java code. But I don't seem to be triggering the java code, instead I am getting an error: "unknown process: com.mam.projectProcess.NewProject"
I made the modifications to an already working project with a template.
-----------------------------------------------------------------------
My java code looks like below (I copied it from another eclipse post )
package com.mam.projectProcess;
import org.eclipse.cdt.core.templateengine.process.ProcessRunner;
import org.eclipse.cdt.core.templateengine.TemplateCore;
import org.eclipse.cdt.core.templateengine.process.ProcessArgument;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.cdt.core.templateengine.process.ProcessFailureException;
public class NewProject extends ProcessRunner {
public void process(TemplateCore template , ProcessArgument[] args,
String processId, IProgressMonitor monitor) throws ProcessFailureException
{
System.out.println("saveVariables 111 ");
saveVariables(args[0].getSimpleValue(), args[1].getSimpleValue() );
}
protected void saveVariables(String var1 , String var2 )
{
System.out.println("saveVariables : " + var1 + "::" + var2 );
}
}
------------------------------------------------------------------------
This is what my plugin.xml looks like.
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.cdt.core.templates">
<template
id="com.mam.projectTemplates.template"
location="template/template.xml"
projectType="org.eclipse.cdt.build.core.buildArtefactType.exe">
</template>
</extension>
<extension
point="org.eclipse.cdt.core.templateProcessTypes">
<processType
name= "NewProject"
processRunner="com.mam.projectProcess.NewProject">
<simple name= "projectName"/>
<simple name= "path"/>
<simple name= "uid2"/>
</processType>
</extension>
</plugin>
---------------------------------------------------------------------------
My template is big, so I am just showing you the lines I have added.
<process type="com.mam.projectProcess.NewProject">
<simple name="name" value="$(projectName)"/>
<simple name="targetType" value="$(targetType)"/>
</process>
---------------------------------------------------------------------------
Please let me know if you need more information.
Thanks
Faisal
|
|
|
|
Re: Copying a folder from any location to Workspace (CDT) [message #1770658 is a reply to message #1770613] |
Tue, 15 August 2017 14:57  |
Eclipse User |
|
|
|
Thank you again Jonah. That worked! But I had other bugs in the code that needed fixing, so people beware before using what I posted above.
I can now trigger the template to send me to the newProject Java. I put a breakpoint to see if my code is entering the Java code. (For somereason the system.out.println() did not print in the console). but I do not care about printing right now, however if you have suggestions, I am all ears.
Thanks once again.
Faisal
[Updated on: Tue, 15 August 2017 15:18] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.04306 seconds