assetLocation = assetContainer.assetLocation(".");
}
String targetPath = null;
File assetLocationParentDir = assetLocation.dir().getParentFile();
BRJS root = assetContainer.root();
try {
if(assetContainer instanceof Aspect) {
Aspect aspect = (Aspect) assetContainer;
if (assetLocation instanceof ThemedAssetLocation && assetLocationParentDir.getName().equals("themes")) {
ThemedAssetLocation theme = (ThemedAssetLocation) assetLocation;
String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), theme.dir(), imageFile);
targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.ASPECT_THEME_REQUEST, ((Aspect) assetContainer).getName(), theme.dir().getName(), resourcePath);
} else {
String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), assetContainer.dir(), imageFile);
targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.ASPECT_RESOURCE_REQUEST, aspect.getName(), resourcePath);
}
}
else if(assetContainer instanceof Bladeset) {
Bladeset bladeset = (Bladeset) assetContainer;
if (assetLocation instanceof ThemedAssetLocation && assetLocationParentDir.getName().equals("themes")) {
ThemedAssetLocation theme = (ThemedAssetLocation) assetLocation;
String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), theme.dir(), imageFile);
targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.BLADESET_THEME_REQUEST, bladeset.getName(), theme.dir().getName(), resourcePath);
} else {
String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), bladeset.dir(), imageFile);
targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.BLADESET_RESOURCE_REQUEST, bladeset.getName(), resourcePath);
}
}
else if(assetContainer instanceof Blade) {
Blade blade = (Blade) assetContainer;
Bladeset bladeset = blade.parent();
if (assetLocation instanceof ThemedAssetLocation && assetLocationParentDir.getName().equals("themes")) {
ThemedAssetLocation theme = (ThemedAssetLocation) assetLocation;
String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), theme.dir(), imageFile);
targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.BLADE_THEME_REQUEST, bladeset.getName(), blade.getName(), theme.dir().getName(), resourcePath);
} else {
String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), blade.dir(), imageFile);
targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.BLADE_RESOURCE_REQUEST, bladeset.getName(), blade.getName(), resourcePath);
}
}
else if(assetContainer instanceof Workbench) {
Workbench workbench = (Workbench) assetContainer;
Blade blade = workbench.parent();
Bladeset bladeset = blade.parent();
if (assetLocation instanceof ThemedAssetLocation && assetLocationParentDir.getName().equals("themes")) {
String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), assetLocation.file("resources"), imageFile);
targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.WORKBENCH_RESOURCE_REQUEST, bladeset.getName(), blade.getName(), resourcePath);
} else {
String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), workbench.dir(), imageFile);
targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.WORKBENCH_RESOURCE_REQUEST, bladeset.getName(), blade.getName(), resourcePath);
}
}
else if(assetContainer instanceof JsLib) {
JsLib jsLib = (JsLib) assetContainer;
String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), jsLib.dir(), imageFile);
targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.LIB_REQUEST, jsLib.getName(), resourcePath);
}
else {
throw new ContentFileProcessingException(imageFile, "File does not exist in a known scope");