|
|
Re: Copying a folder from any location to Workspace (CDT) [message #1770453 is a reply to message #1770427] |
Fri, 11 August 2017 16:13 |
Faisal Tariq Messages: 33 Registered: August 2017 |
Member |
|
|
Hello Jonah,
Thank you for your response. I am trying to add a list of microcontrollers to the File menu in eclipse File->NewProject->etc->micro (which I can do using the Template.xml). However, the next step is that once the Micro is selected then the necessary files at a particular location will get copied into the Eclipse Workspace, which I am struggling with.
I don't mind writing Java Code for this. But at this point I am lost as to how to accomplish this. I was hoping that I would be able to write some java code in Activator.java to do a copy folder/files. I was able to see with a simple Plug-in that when the plug-in was used the Activator "start" was accessed. I can see myself putting the file transfer code in there. However, with the template.xml I do not know how to tie these two together. Any suggestions on this.
I would love to join the cdt-dev mailing list and listen in to all that is going on.
Thanks
Faisal
[Updated on: Fri, 11 August 2017 16:17] Report message to a moderator
|
|
|
|
|
Re: Copying a folder from any location to Workspace (CDT) [message #1770607 is a reply to message #1770599] |
Mon, 14 August 2017 23:38 |
Faisal Tariq Messages: 33 Registered: August 2017 |
Member |
|
|
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 18:57 |
Faisal Tariq Messages: 33 Registered: August 2017 |
Member |
|
|
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 19:18] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02317 seconds