Skip to content

Commit c998068

Browse files
author
Cedric Betom
committed
devonfw#1509 further processing of the testAdaptMonolithicTemplatesAndGenerate
1 parent 801773d commit c998068

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/common/utils/EclipseCobiGenUtils.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellIsActive;
44
import static org.eclipse.swtbot.swt.finder.waits.Conditions.widgetIsEnabled;
55

6+
import org.eclipse.core.resources.IWorkspace;
67
import org.eclipse.core.resources.IncrementalProjectBuilder;
78
import org.eclipse.core.resources.ResourcesPlugin;
89
import org.eclipse.core.runtime.CoreException;
@@ -359,7 +360,8 @@ private static void captureAdvancedHealthCheck(SWTWorkbenchBot bot) {
359360
*/
360361
public static void runAndCaptureUpdateTemplates(SWTWorkbenchBot bot) throws Exception {
361362

362-
ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
363+
IWorkspace workspace = ResourcesPlugin.getWorkspace();
364+
workspace.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
363365
bot.waitUntil(new AllJobsAreFinished(), DEFAULT_TIMEOUT); // build might take some time
364366

365367
SWTBotView view = bot.viewById(JavaUI.ID_PACKAGES);

cobigen-eclipse/cobigen-eclipse/src/com/devonfw/cobigen/eclipse/common/tools/ResourcesPluginUtil.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public static String getJarPath(boolean isSource) {
212212
*
213213
* @return the templateDirectory
214214
*/
215-
private static File getTemplatesDirectory() {
215+
public static File getTemplatesDirectory() {
216216

217217
return CobiGenPaths.getTemplatesFolderPath().toFile();
218218
}
@@ -239,6 +239,7 @@ public static void processJar(String fileName) throws MalformedURLException, IOE
239239

240240
String pathForCobigenTemplates = "";
241241
IPath ws = ResourcesPluginUtil.getWorkspaceLocation();
242+
Path templateDirectory = ResourcesPluginUtil.getTemplatesDirectory().toPath();
242243

243244
try {
244245
pathForCobigenTemplates = ws.toPortableString()
@@ -264,8 +265,8 @@ public static void processJar(String fileName) throws MalformedURLException, IOE
264265
}
265266

266267
try {
267-
TemplateAdapter templateAdapter = new TemplateAdapterImpl(cobigenFolderPath);
268-
templateAdapter.adaptMonolithicTemplates(cobigenFolderPath.resolve(ConfigurationConstants.COBIGEN_TEMPLATES),
268+
TemplateAdapter templateAdapter = new TemplateAdapterImpl(templateDirectory);
269+
templateAdapter.adaptMonolithicTemplates(templateDirectory.resolve(ConfigurationConstants.COBIGEN_TEMPLATES),
269270
false);
270271
} catch (Exception e) {
271272
LOG.error("An exception occurred while processing Jar files to create CobiGen_Templates folder", e);

cobigen-eclipse/cobigen-eclipse/src/com/devonfw/cobigen/eclipse/workbenchcontrol/handler/AdaptTemplatesHandler.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
108108
}
109109
ResourcesPluginUtil.processJar(fileName);
110110

111-
importProjectIntoWorkspace(ResourceConstants.CONFIG_PROJECT_NAME, null);
111+
importProjectIntoWorkspace(ResourceConstants.CONFIG_PROJECT_NAME,
112+
ResourcesPluginUtil.getTemplatesDirectory().toPath());
112113
dialog = new MessageDialog(Display.getDefault().getActiveShell(), "Information", null,
113114
"CobiGen_Templates folder is imported sucessfully", MessageDialog.INFORMATION, new String[] { "Ok" },
114115
1);

0 commit comments

Comments
 (0)