Skip to content

Commit

Permalink
devonfw#1509 further processing of the testAdaptMonolithicTemplatesA…
Browse files Browse the repository at this point in the history
…ndGenerate
  • Loading branch information
Cedric Betom committed Feb 14, 2023
1 parent 801773d commit c998068
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellIsActive;
import static org.eclipse.swtbot.swt.finder.waits.Conditions.widgetIsEnabled;

import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
Expand Down Expand Up @@ -359,7 +360,8 @@ private static void captureAdvancedHealthCheck(SWTWorkbenchBot bot) {
*/
public static void runAndCaptureUpdateTemplates(SWTWorkbenchBot bot) throws Exception {

ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
IWorkspace workspace = ResourcesPlugin.getWorkspace();
workspace.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
bot.waitUntil(new AllJobsAreFinished(), DEFAULT_TIMEOUT); // build might take some time

SWTBotView view = bot.viewById(JavaUI.ID_PACKAGES);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public static String getJarPath(boolean isSource) {
*
* @return the templateDirectory
*/
private static File getTemplatesDirectory() {
public static File getTemplatesDirectory() {

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

String pathForCobigenTemplates = "";
IPath ws = ResourcesPluginUtil.getWorkspaceLocation();
Path templateDirectory = ResourcesPluginUtil.getTemplatesDirectory().toPath();

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

try {
TemplateAdapter templateAdapter = new TemplateAdapterImpl(cobigenFolderPath);
templateAdapter.adaptMonolithicTemplates(cobigenFolderPath.resolve(ConfigurationConstants.COBIGEN_TEMPLATES),
TemplateAdapter templateAdapter = new TemplateAdapterImpl(templateDirectory);
templateAdapter.adaptMonolithicTemplates(templateDirectory.resolve(ConfigurationConstants.COBIGEN_TEMPLATES),
false);
} catch (Exception e) {
LOG.error("An exception occurred while processing Jar files to create CobiGen_Templates folder", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
}
ResourcesPluginUtil.processJar(fileName);

importProjectIntoWorkspace(ResourceConstants.CONFIG_PROJECT_NAME, null);
importProjectIntoWorkspace(ResourceConstants.CONFIG_PROJECT_NAME,
ResourcesPluginUtil.getTemplatesDirectory().toPath());
dialog = new MessageDialog(Display.getDefault().getActiveShell(), "Information", null,
"CobiGen_Templates folder is imported sucessfully", MessageDialog.INFORMATION, new String[] { "Ok" },
1);
Expand Down

0 comments on commit c998068

Please sign in to comment.