Skip to content

Commit

Permalink
devonfw#1518 Implemented requested changes
Browse files Browse the repository at this point in the history
Deleted all public static fields in eclipse, to be solved in a new Issue
  • Loading branch information
MansourD committed Sep 27, 2022
1 parent f1ba716 commit d0446f5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,10 @@ private void checkMonolithicConfigurationException() {
} catch (DeprecatedMonolithicConfigurationException e) {
String monolithicConfigurationMessage = "Found monolithic configuration at:";
if (this.templatesProject == null)
LOG.warn(monolithicConfigurationMessage + "{} ", ConfigurationFinder.findTemplatesLocation());
LOG.warn(monolithicConfigurationMessage.concat("{} {}"), ConfigurationFinder.findTemplatesLocation(),
e.getMessage());
else
LOG.warn(monolithicConfigurationMessage + "{} {}", this.templatesProject, e.getMessage());
LOG.warn(monolithicConfigurationMessage.concat("{} {}"), this.templatesProject, e.getMessage());
if (this.upgradeConfiguration) {
startTemplatesUpgrader();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,6 @@ public class ResourcesPluginUtil {
*/
static boolean userWantsToDownloadTemplates = true;

/**
* This variable is used to know if the templates got upgraded or not
*/
public static boolean templatesUpgraded = false;

/**
* This variable is used to know if we have a custom generator project
*/
public static boolean generatorProjExists = false;

/**
* Refreshes the configuration project from the file system.
*/
Expand Down Expand Up @@ -97,9 +87,10 @@ public static void refreshConfigurationProject() {
public static IProject getGeneratorConfigurationProject() throws GeneratorProjectNotExistentException, CoreException {

if (Files.exists(getTemplateSetDirectory().toPath())) {
generatorProjExists = false;
// FIXME Implement a new way to set the generatorProj as the new template-set
return null;
}

File templatesDirectory = getTemplatesDirectory();

generatorProj = ResourcesPlugin.getWorkspace().getRoot().getProject(ResourceConstants.CONFIG_PROJECT_NAME);
Expand Down Expand Up @@ -133,7 +124,6 @@ public static IProject getGeneratorConfigurationProject() throws GeneratorProjec
}
}
if (userWantsToDownloadTemplates) {
generatorProjExists = true;
return generatorProj;
} else {
return null;
Expand Down Expand Up @@ -304,7 +294,9 @@ public static void startTemplatesUpgrader(Path configurationPath) {

TemplateAdapter templateAdapter = new TemplateAdapterImpl(configurationPath);
templateAdapter.upgradeMonolithicTemplates(configurationPath);
templatesUpgraded = true;
// Deactivate generatorProj after the upgrade to use the new template-set
// FIXME set generatorProj instead to the new template set
generatorProj = null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,6 @@ private static CobiGen initializeGenerator(boolean allowMonolithicConfiguration)

initializeCobiGen(generatorProj, allowMonolithicConfiguration);

// we need to check if templates got upgraded then initialize cobigen again. Now with the new template-set
// structure
if (ResourcesPluginUtil.templatesUpgraded)
return initializeCobiGen(null, true);

return initializeCobiGen(generatorProj, true);
} catch (CoreException e) {
throw new GeneratorCreationException("An eclipse internal exception occurred", e);
Expand Down Expand Up @@ -263,15 +258,8 @@ private static CobiGen initializeCobiGen(IProject generatorProj, boolean allowMo
Path templateSetsAdaptedFolderPath = templatesDirectoryPath.resolve(ConfigurationConstants.ADAPTED_FOLDER);
Path templateSetsDownloadedFolderPath = templatesDirectoryPath.resolve(ConfigurationConstants.DOWNLOADED_FOLDER);

if (!ResourcesPluginUtil.generatorProjExists || ResourcesPluginUtil.templatesUpgraded
|| generatorProj.getLocationURI() == null) {
if (generatorProj.isEmpty()) {

/*
* After the upgrade the new template-sets will be used. Only once! Then the old configuration has to be deleted
* or the upgrader will start again. This time the upgrader cannot start again because template-sets already
* exists.
*/
ResourcesPluginUtil.templatesUpgraded = false;
// check adapted and downloaded folder
if (Files.exists(templateSetsAdaptedFolderPath) || Files.exists(templateSetsDownloadedFolderPath)) {
return CobiGenFactory.create(templatesDirectoryPath.toUri(), allowMonolithicConfiguration);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Tests TimestampUtil class on write to the config file and read from the config file correctly
*
*/
public class TimestampUtilTest {
public class PostponeUtilTest {

/**
*
Expand Down

0 comments on commit d0446f5

Please sign in to comment.