Skip to content

Commit

Permalink
Shading of package name should happen in FormatterProviderImpl
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Nov 26, 2014
1 parent e0c9e47 commit 030bfe7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,7 @@ private static Properties readConfig(File prefs) throws IOException
try
{
Properties config = parseConfig(stream);
Properties modified = new Properties();
String shadePackage = JavaCore.class.getPackage().getName().replaceAll("org\\.eclipse.*$", "");
for (Entry<Object, Object> property : config.entrySet())
{
modified.put(shadePackage + property.getKey(), property.getValue());
}

return modified;
return applyShadedPackageName(config);
}
catch (IOException e)
{
Expand All @@ -165,6 +158,18 @@ private static Properties readConfig(File prefs) throws IOException
return null;
}

public static Properties applyShadedPackageName(Properties config)
{
Properties modified = new Properties();
String shadePackage = JavaCore.class.getPackage().getName().replaceAll("org\\.eclipse.*$", "");
for (Entry<Object, Object> property : config.entrySet())
{
modified.put(shadePackage + property.getKey(), property.getValue());
}

return modified;
}

private static Properties readConfigInternal(String filename)
{
InputStream stream = new BufferedInputStream(org.jboss.forge.roaster.model.util.Formatter.class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public String format(String source)
@Override
public String format(Properties properties, String source)
{
return Formatter.format(properties, source);
Properties shadedProperties = Formatter.applyShadedPackageName(properties);
return Formatter.format(shadedProperties, source);
}
}

0 comments on commit 030bfe7

Please sign in to comment.