Package ro.sync.util.editorvars
Class EditorVariables
- java.lang.Object
-
- ro.sync.util.editorvars.EditorVariablesBase
-
- ro.sync.util.editorvars.EditorVariables
-
- All Implemented Interfaces:
EditorVariablesConstants
@API(type=NOT_EXTENDABLE, src=PRIVATE) public final class EditorVariables extends EditorVariablesBase
Holds constants representing all editor variables defined in Oxygen.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EditorVariables.FrameworkRewritePolicy
Used to determine how framework variables should be expanded/rewritten.static interface
EditorVariables.FunctionResolver
Resolves a function
-
Field Summary
-
Fields inherited from interface ro.sync.util.editorvars.EditorVariablesConstants
ACTIVE_PROFILING_CONDITION_SET, ANCESTOR_FILE_TO_DIFF, ANSWER_PARAM_START, ARCHIVE_FILE_DIRECTORY, ARCHIVE_FILE_DIRECTORY_URL, ARCHIVE_NAME, ARCHIVE_NAME_WITH_EXTENSION, ARCHIVE_PATH, ARCHIVE_PATH_URL, ASK_PARAM_START, ASK_PARAM_VALUE_TEMPLATE, AUTHOR_NAME, BASE_FRAMEWORK_DIRECTORY, BASE_FRAMEWORK_URL, CONFIGURED_DITA_OT_DIR, CONFIGURED_DITA_OT_DIR_URL, CT_CARET_EDITOR_VARIABLE, CT_SELECTION_EDITOR_VARIABLE, CURRENT_FILE, CURRENT_FILE_DIRECTORY, CURRENT_FILE_DIRECTORY_URL, CURRENT_FILE_URL, CURRENT_FILE_URL_OLD, CURRENT_FILENAME, CURRENT_FILENAME_WITH_EXTENSION, DATE_FUNCTION_SAMPLE, DATE_FUNCTION_VARIABLE_PREFIX, DEBUGGER_XML_SOURCE, DEBUGGER_XSL_SOURCE, DETECTED_SCHEMA, DETECTED_SCHEMA_URL, EDITOR_VARIABLES_PREFIX, EDITOR_VARIABLES_SUFIX, ENV_FUNCTION_SAMPLE, ENV_FUNCTION_VARIABLE_PREFIX, ENV_VAR_NAME, FIRST_FILE_TO_DIFF, FO_INPUT_FILE, FOP_AH_TRANSFORMATION_METHOD, FOP_TRANSFORMATION_METHOD, FRAMEWORK_DIR_FUNCTION_TEMPLATE, FRAMEWORK_DIR_FUNCTION_VARIABLE_PREFIX, FRAMEWORK_DIRECTORY, FRAMEWORK_FUNCTION_VARIABLE_PREFIX, FRAMEWORK_URL, FRAMEWORK_URL_FUNCTION_TEMPLATE, FRAMEWORKS_DIRECTORY, FRAMEWORKS_DIRECTORY_URL, FUNCTION_VARIABLE_SUFFIX, ID, MAKE_RELATIVE_FUNCTION_SAMPLE, MAKE_RELATIVE_FUNCTION_VARIABLE_PREFIX, OUTPUT_FILE, OUTPUT_FILE_URL, OXYGEN_HOME_URL, OXYGEN_INSTALL_DIR, PATH_SEPARATOR, PLUGIN_DIR_FUNCTION_TEMPLATE, PLUGIN_DIR_FUNCTION_VARIABLE_PREFIX, PLUGIN_DIR_URL_FUNCTION_VARIABLE_PREFIX, PLUGIN_URL_FUNCTION_TEMPLATE, PROJECT_DIRECTORY, PROJECT_DIRECTORY_URL, PROJECT_NAME, ROOT_MAP_DIR, ROOT_MAP_DIR_URL, ROOT_MAP_FILE, ROOT_MAP_URL, SECOND_FILE_TO_DIFF, SQL, SQL_URL, STATIC_XPATH_FUNCTION_VARIABLE_PREFIX, SYSTEM_FUNCTION_SAMPLE, SYSTEM_FUNCTION_VARIABLE_PREFIX, SYSTEM_VAR_NAME, TIMESTAMP, TRANSFORMATION_SAVED_FILE, TRANSLATE_FUNCTION_VARIABLE_PREFIX, UNIQUE_CARET_MARKER_FOR_AUTHOR, UNIQUE_CARET_MARKER_PI_NAME_FOR_AUTHOR, USER_HOME_DIR, USER_HOME_URL, UUID, XML, XML_CATALOG_FILES_LIST, XML_URL, XPATH_FUNCTION_SAMPLE, XPROC, XPROC_URL, XQUERY, XQUERY_URL, XSL, XSL_URL
-
-
Constructor Summary
Constructors Constructor Description EditorVariables()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addCustomEditorVariablesResolver(EditorVariablesResolver resolver)
Add custom resolver.static boolean
containsEditorVariable(java.lang.String expression)
Checks if the given expression contains editor variables.static boolean
containsInteractiveVariable(java.lang.String expression)
Checks if the given expression contains at least an interactive editor variable ($ask, $answer).static boolean
containsXPathEvalEditorVariable(java.lang.String expression)
Checks if the given expression contains the xpath_eval editor variables.static java.lang.String
expandEditorVariables(java.lang.String expr, java.lang.String currentEditedFileURL)
Expand the editor variables in the output file name.static java.lang.String
expandEditorVariables(java.lang.String expr, java.lang.String currentEditedFileURL, java.util.Map<java.lang.String,ro.sync.util.editorvars.expander.EditorVariableResolver> additionalResolvers, ro.sync.util.editorvars.expander.ErrorListener errorListener)
Expand the editor variables in the output file name.static java.lang.String
expandEditorVariablesAsFilePath(java.lang.String expr, java.lang.String currentEditedFileURL)
Expand the editor variables.static java.net.URL
expandEditorVariablesAsURL(java.lang.String path, java.lang.String baseSystemID)
Expand the editor variables.static java.lang.String
expandFrameworksVariables(java.lang.String expr, java.lang.String frameworkStoreLocation, java.lang.String baseStoreLocation, EditorVariables.FrameworkRewritePolicy rewritePolicy)
Expand FRAMEWORKS_DIRECTORY_URL, FRAMEWORKS_DIRECTORY, FRAMEWORK_DIRECTORY and FRAMEWORK_URL.static java.lang.String
expandFrameworksVariables(java.lang.String expr, java.lang.String frameworkStoreLocation, EditorVariables.FrameworkRewritePolicy rewritePolicy)
Expand FRAMEWORKS_DIRECTORY_URL, FRAMEWORKS_DIRECTORY, FRAMEWORK_DIRECTORY and FRAMEWORK_URL.static java.lang.String
expandFrameworksVariables(java.lang.String expr, EditorVariables.FrameworkRewritePolicy rewritePolicy, java.io.File frameworksDir, java.net.URL frameworksURL, java.io.File frameworkDir, java.net.URL frameworkURL)
Expand FRAMEWORKS_DIRECTORY_URL, FRAMEWORKS_DIRECTORY, FRAMEWORK_DIRECTORY and FRAMEWORK_URL.static java.lang.String
generateUniqueID()
static java.io.File[]
getAdditionalFrameworksDirs()
Get all the additional frameworks directories specified by user.static java.util.List<EditorVariableDescription>
getAllCustomResolvedEditorVariables()
Get a list with all custom resolved editor variables.static java.io.File[]
getAllFrameworksDirs()
Get all the frameworks directories including default framework directory, user preferences directory and additional frameworks directories.static java.io.File
getBaseUserFrameworksDir()
Get the base frameworks directory from the user preferences directory like: Users\***\AppData\Roaming\com.oxygenxml\extensions\v14.0\frameworks Note: This is not the actual directory with frameworks but the directory which contains all frameworks directories.static ro.sync.util.editorvars.CatalogManagerUtilsAccess
getCatalogUtilsAccess()
Get the catalog utils access.static java.net.URL
getCurrentArchiveURL(java.lang.String currentFileSystemID)
Returns theURL
of the current archive.static java.net.URL
getCurrentFrameworksURL()
Get the current frameworks directory.static java.net.URL
getCurrentFrameworksURL(ro.sync.options.NotifyableMap optionsMap)
Get the current frameworks directory.static java.net.URL
getCurrentProjectURL(java.lang.String currentFileSystemID)
Returns theURL
of the current project.static java.net.URL
getDefaultFrameworkURL()
Get the default frameworks directory.static java.lang.String
getDescription(java.lang.String editorVariable)
Returns a description of the editor variable.static java.io.File
getFrameworksDir()
Get theFile
representing the"frameworks"
directory.static java.net.URL
getFrameworksUrl()
Get the"frameworks"
directoryURL
.static java.lang.String
getSystemPathSeparator()
static java.io.File[]
getUserFrameworksDirs()
Get the frameworks directories from the user preferences directory like: Users\***\AppData\Roaming\com.oxygenxml\extensions\v14.0\frameworks\{update_site}.static ro.sync.util.editorvars.XPathEvaluator
getXpathEvaluator()
Gets the XPath evaluator.static boolean
isRelativizedToProject(java.lang.String url)
Checks if URL is relative to projectstatic java.lang.String
makeFileRelative2DITAOTDir(java.lang.String fileOrDir)
Make a file or directory relative to the configured DITA OT directory.static java.lang.String
makeFileRelative2Framework(java.lang.String path, java.lang.String frameworkFilePath)
Make a file or directory relative to the $framework or $frameworks directory.static java.lang.String
makeFileRelative2Frameworks(java.lang.String fileOrDir)
Make a file or directory relative to the"frameworks"
directory.static java.lang.String
makeFileRelative2Project(java.lang.String path, java.lang.String projectFilePath)
Make a file or directory relative to the $pdudirectory.static java.lang.String
makeURLRelative2Framework(java.lang.String url, java.lang.String frameworkFileURL)
Make an URL relative to $framework or that if not possible, to $frameworks (also if possible).static java.lang.String
makeURLRelative2Frameworks(java.lang.String url)
Make an URL relative to the"frameworks"
directory.static java.lang.String
makeURLRelative2Project(java.lang.String url, java.lang.String projectFileURL)
Make an URL relative to $pdu if possible.static boolean
possiblyContainsEditorVariable(java.lang.String expression)
Checks if the given expression potentially contains editor variables.static void
removeCustomEditorVariablesResolver(EditorVariablesResolver resolver)
Remove a custom resolver.static void
resetDefaultFrameworkURL()
Reset the cached value of the default frameworks directory property.static void
resetFrameworksDir()
Reset the computed value for the framework location.static void
setAdditionalFrameorksProvider(ro.sync.exml.options.AdditionalFrameworksProvider additionalFrameorksProvider)
Sets the referenced directory as additional framework directory.static void
setArchiveExtensionsRecognizer(ro.sync.util.ArchiveExtensionsRecognizer archiveExtensionsRecognizer)
Set an archive extensions recognizerstatic void
setArchiveURLProvider(ro.sync.util.ArchiveURLProvider archiveURLProvider)
Set the archive URL provider.static void
setCatalogUtilsAccess(ro.sync.util.editorvars.CatalogManagerUtilsAccess catalogUtilsAccess)
Set the catalogs utils access.static void
setConditionSetNameResolver(ro.sync.util.editorvars.ConditionSetNameResolver conditionSetNameResolver)
Set the provider for the profiling condition set name.static void
setFrameworkLocationResolver(ro.sync.util.editorvars.FrameworkLocationResolver frameworkLocationResolver)
Can locate a framework by using its name.static void
setFrameworksDirForTest(java.io.File fDir)
Set a frameworks dir so it will not be computed from the home url.static void
setFrameworksURLForTest(java.net.URL fURL)
Set a frameworks url so it will not be computed from the home url.static void
setPluginLocationResolver(ro.sync.util.editorvars.PluginLocationResolver resolver)
Set the plugin location resolver.static void
setProjectURLProvider(ro.sync.util.ProjectURLProvider projectURLProvider)
Set the project URL provider.static void
setRootMapResolver(ro.sync.util.editorvars.DITARootMapProvider ditaRootMapProvider)
Obtain the provider that contains information about DITA root map.static void
setUserUploadedFrameworks(java.io.File userFrameworksDir)
Sets directory where the user uploaded frameworks are stored.static void
setXpathEvaluator(ro.sync.util.editorvars.XPathEvaluator staticXpathEvaluator)
Set an XPath evaluator.-
Methods inherited from class ro.sync.util.editorvars.EditorVariablesBase
expandEnvAndSystem, fastEquals, getName, registerEnvAndSystemResolver, replaceFunctions
-
-
-
-
Method Detail
-
getDescription
public static java.lang.String getDescription(java.lang.String editorVariable)
Returns a description of the editor variable.- Parameters:
editorVariable
- The editor variable to get description for.- Returns:
- The description for the editor variable.
-
possiblyContainsEditorVariable
public static boolean possiblyContainsEditorVariable(java.lang.String expression)
Checks if the given expression potentially contains editor variables. The method is very fast but it does not guarantee the expression actually contains editor variables which are understood by the application.- Parameters:
expression
- The expression to check.- Returns:
true
if the expression potentially contains editor variables.
-
containsXPathEvalEditorVariable
public static boolean containsXPathEvalEditorVariable(java.lang.String expression)
Checks if the given expression contains the xpath_eval editor variables.- Parameters:
expression
- The expression to check.- Returns:
true
if the expression contains the xpath_eval editor variable.
-
containsInteractiveVariable
public static boolean containsInteractiveVariable(java.lang.String expression)
Checks if the given expression contains at least an interactive editor variable ($ask, $answer).- Parameters:
expression
- The expression to check.- Returns:
true
if the expression contains at least an interactive editor variable.
-
containsEditorVariable
public static boolean containsEditorVariable(java.lang.String expression)
Checks if the given expression contains editor variables.- Parameters:
expression
- The expression to check.- Returns:
true
if the expression contains one of the available editor variables.
-
expandEditorVariablesAsFilePath
public static java.lang.String expandEditorVariablesAsFilePath(java.lang.String expr, java.lang.String currentEditedFileURL)
Expand the editor variables. The returned value will attempt to be a file path. So even if the editor variables expand to an URL, the file path will be returned. The currently known editor variables are declared in this class.- Parameters:
expr
- The expresion containing editor variables.currentEditedFileURL
- The full path of the current edited file, as an URI.- Returns:
- The expresion with the editor variables expanded, possibly an URI.
-
expandEditorVariablesAsURL
public static java.net.URL expandEditorVariablesAsURL(java.lang.String path, java.lang.String baseSystemID)
Expand the editor variables. The returned value will be an URL, ornull
if it cannot be built.- Parameters:
path
- the path to be resolved, may be relative to thebaseSystemID
baseSystemID
- the system ID of the base file.- Returns:
- the resolved path as URL, or
null
-
expandEditorVariables
public static java.lang.String expandEditorVariables(java.lang.String expr, java.lang.String currentEditedFileURL)
Expand the editor variables in the output file name. The currently known editor variables are declared in this class.- Parameters:
expr
- The expresion containing editor variables.currentEditedFileURL
- The full path of the current edited file, as an URI.- Returns:
- The expresion with the editor variables expanded, possibly an URI.
-
expandEditorVariables
public static java.lang.String expandEditorVariables(java.lang.String expr, java.lang.String currentEditedFileURL, java.util.Map<java.lang.String,ro.sync.util.editorvars.expander.EditorVariableResolver> additionalResolvers, ro.sync.util.editorvars.expander.ErrorListener errorListener) throws ro.sync.util.editorvars.parser.ParseException, ro.sync.util.editorvars.expander.OperationCancelledException
Expand the editor variables in the output file name. The currently known editor variables are declared in this class.- Parameters:
expr
- The expression containing editor variables.currentEditedFileURL
- The full path of the current edited file, as an URI.additionalResolvers
- Some additional variables resolvers.errorListener
- Error listener.- Returns:
- The expression with the editor variables expanded, possibly an URI.
- Throws:
ro.sync.util.editorvars.expander.OperationCancelledException
ro.sync.util.editorvars.parser.ParseException
-
makeURLRelative2Frameworks
public static java.lang.String makeURLRelative2Frameworks(java.lang.String url)
Make an URL relative to the"frameworks"
directory.- Parameters:
url
- The original URL.- Returns:
- The relative URL to the
"frameworks"
if possible, otherwise the original URL.
-
makeFileRelative2DITAOTDir
public static java.lang.String makeFileRelative2DITAOTDir(java.lang.String fileOrDir)
Make a file or directory relative to the configured DITA OT directory.- Parameters:
fileOrDir
- The original file or directory.- Returns:
- The relative path to the configured DITA OT directory or
null
if could not make it relative.
-
makeFileRelative2Frameworks
public static java.lang.String makeFileRelative2Frameworks(java.lang.String fileOrDir)
Make a file or directory relative to the"frameworks"
directory.- Parameters:
fileOrDir
- The original file or directory.- Returns:
- The relative path to the
"frameworks"
if possible, otherwise the original file or directory path.
-
setFrameworksURLForTest
public static void setFrameworksURLForTest(java.net.URL fURL)
Set a frameworks url so it will not be computed from the home url.- Parameters:
fURL
- The url.
-
getFrameworksUrl
public static java.net.URL getFrameworksUrl() throws java.net.MalformedURLException
Get the"frameworks"
directoryURL
.- Returns:
- The
"frameworks"
directoryURL
. - Throws:
java.net.MalformedURLException
- If the oxygen home URL is not set.
-
resetFrameworksDir
public static void resetFrameworksDir()
Reset the computed value for the framework location. The next time it will be requested it will be recomputed.
-
getCurrentFrameworksURL
public static java.net.URL getCurrentFrameworksURL() throws java.net.MalformedURLException
Get the current frameworks directory.- Returns:
- The current frameworks URL. Can be a custom one if it was set in options, or the default one.
- Throws:
java.net.MalformedURLException
- If the oxygen home URL is not set.
-
getCurrentFrameworksURL
public static java.net.URL getCurrentFrameworksURL(ro.sync.options.NotifyableMap optionsMap) throws java.net.MalformedURLException
Get the current frameworks directory.- Parameters:
optionsMap
- The Oxygen options.- Returns:
- The current frameworks URL. Can be a custom one if it was set in options, or the default one.
- Throws:
java.net.MalformedURLException
- If the oxygen home URL is not set.
-
getDefaultFrameworkURL
public static java.net.URL getDefaultFrameworkURL() throws java.net.MalformedURLException
Get the default frameworks directory. It is relative to the oxygen installation directory.- Returns:
- The default frameworks directory.
- Throws:
java.net.MalformedURLException
- If the oxygen home URL is not set.
-
resetDefaultFrameworkURL
public static void resetDefaultFrameworkURL()
Reset the cached value of the default frameworks directory property.
-
setFrameworksDirForTest
public static void setFrameworksDirForTest(java.io.File fDir)
Set a frameworks dir so it will not be computed from the home url. Only from tests.- Parameters:
fDir
-
-
getFrameworksDir
public static java.io.File getFrameworksDir() throws java.net.MalformedURLException
Get theFile
representing the"frameworks"
directory.- Returns:
- The
"frameworks"
directoryFile
. - Throws:
java.net.MalformedURLException
- If the oxygen home URL is not set.
-
getBaseUserFrameworksDir
public static java.io.File getBaseUserFrameworksDir()
Get the base frameworks directory from the user preferences directory like: Users\***\AppData\Roaming\com.oxygenxml\extensions\v14.0\frameworks Note: This is not the actual directory with frameworks but the directory which contains all frameworks directories. A directory for each update site: - extensions\v14.0\frameworks\{update_site_1} - extensions\v14.0\frameworks\{update_site_2}- Returns:
- The user frameworks directory.
-
getUserFrameworksDirs
public static java.io.File[] getUserFrameworksDirs()
Get the frameworks directories from the user preferences directory like: Users\***\AppData\Roaming\com.oxygenxml\extensions\v14.0\frameworks\{update_site}. A new level is inserted ({update_site}) to protect against add-ons conflicts (sort of like a namespace).- Returns:
- The user frameworks directories or null if it doesn't exists.
-
getAllFrameworksDirs
public static java.io.File[] getAllFrameworksDirs()
Get all the frameworks directories including default framework directory, user preferences directory and additional frameworks directories.- Returns:
- All the frameworks directories.
-
getAdditionalFrameworksDirs
public static java.io.File[] getAdditionalFrameworksDirs()
Get all the additional frameworks directories specified by user.- Returns:
- The additional frameworks directories.
-
getCurrentProjectURL
public static java.net.URL getCurrentProjectURL(java.lang.String currentFileSystemID)
Returns theURL
of the current project.- Parameters:
currentFileSystemID
- The current file system ID.- Returns:
- The current project
URL
ornull
if it cannot be determined.
-
getCurrentArchiveURL
public static java.net.URL getCurrentArchiveURL(java.lang.String currentFileSystemID)
Returns theURL
of the current archive.- Parameters:
currentFileSystemID
- The current file system ID.- Returns:
- The current archive
URL
ornull
if it cannot be determined.
-
setProjectURLProvider
public static void setProjectURLProvider(ro.sync.util.ProjectURLProvider projectURLProvider)
Set the project URL provider.- Parameters:
projectURLProvider
- The new project URL provider.
-
setArchiveURLProvider
public static void setArchiveURLProvider(ro.sync.util.ArchiveURLProvider archiveURLProvider)
Set the archive URL provider.- Parameters:
archiveURLProvider
- The new archive URL provider.
-
setFrameworkLocationResolver
public static void setFrameworkLocationResolver(ro.sync.util.editorvars.FrameworkLocationResolver frameworkLocationResolver)
Can locate a framework by using its name.- Parameters:
frameworkLocationResolver
- Can locate a framework by using its name.
-
setPluginLocationResolver
public static void setPluginLocationResolver(ro.sync.util.editorvars.PluginLocationResolver resolver)
Set the plugin location resolver.- Parameters:
resolver
- The plugin location resolver.
-
setRootMapResolver
public static void setRootMapResolver(ro.sync.util.editorvars.DITARootMapProvider ditaRootMapProvider)
Obtain the provider that contains information about DITA root map.- Parameters:
ditaRootMapProvider
- The provider for the DITA root map.
-
setConditionSetNameResolver
public static void setConditionSetNameResolver(ro.sync.util.editorvars.ConditionSetNameResolver conditionSetNameResolver)
Set the provider for the profiling condition set name.- Parameters:
conditionSetNameResolver
- Object which provides the profiling condition set name.
-
setArchiveExtensionsRecognizer
public static void setArchiveExtensionsRecognizer(ro.sync.util.ArchiveExtensionsRecognizer archiveExtensionsRecognizer)
Set an archive extensions recognizer- Parameters:
archiveExtensionsRecognizer
- The archiveExtensionsRecognizer.
-
getSystemPathSeparator
public static java.lang.String getSystemPathSeparator()
- Returns:
- The system path separator. It is dependent on the platform.
-
expandFrameworksVariables
public static java.lang.String expandFrameworksVariables(java.lang.String expr, java.lang.String frameworkStoreLocation, EditorVariables.FrameworkRewritePolicy rewritePolicy)
Expand FRAMEWORKS_DIRECTORY_URL, FRAMEWORKS_DIRECTORY, FRAMEWORK_DIRECTORY and FRAMEWORK_URL. All these variables are resolved relative to framework store location.- Parameters:
expr
- Editor variables expression.frameworkStoreLocation
- The framework store location as an file path.rewritePolicy
- Rewrite FRAMEWORK_DIRECTORY and FRAMEWORK_URL using FRAMEWORKS_DIRECTORY_URL and FRAMEWORKS_DIRECTORY variables.- Returns:
- The given expression with the framework variables expanded.
-
expandFrameworksVariables
public static java.lang.String expandFrameworksVariables(java.lang.String expr, java.lang.String frameworkStoreLocation, java.lang.String baseStoreLocation, EditorVariables.FrameworkRewritePolicy rewritePolicy)
Expand FRAMEWORKS_DIRECTORY_URL, FRAMEWORKS_DIRECTORY, FRAMEWORK_DIRECTORY and FRAMEWORK_URL. All these variables are resolved relative to framework store location.- Parameters:
expr
- Editor variables expression.frameworkStoreLocation
- The framework store location as an file path.baseStoreLocation
- The base store locationrewritePolicy
- Rewrite FRAMEWORK_DIRECTORY and FRAMEWORK_URL using FRAMEWORKS_DIRECTORY_URL and FRAMEWORKS_DIRECTORY variables.- Returns:
- The given expression with the framework variables expanded.
-
expandFrameworksVariables
public static java.lang.String expandFrameworksVariables(java.lang.String expr, EditorVariables.FrameworkRewritePolicy rewritePolicy, java.io.File frameworksDir, java.net.URL frameworksURL, java.io.File frameworkDir, java.net.URL frameworkURL)
Expand FRAMEWORKS_DIRECTORY_URL, FRAMEWORKS_DIRECTORY, FRAMEWORK_DIRECTORY and FRAMEWORK_URL.- Parameters:
expr
- Editor variables expression.rewritePolicy
- Rewrite FRAMEWORK_DIRECTORY and FRAMEWORK_URL using FRAMEWORKS_DIRECTORY_URL and FRAMEWORKS_DIRECTORY variables.frameworksDir
- The directory where all frameworks reside.frameworksURL
- The URL of the directory where all frameworks reside.frameworkDir
- The directory where the specific framework reside.frameworkURL
- The URL of the directory where the specific framework reside.- Returns:
- The given expression with the framework variables expanded.
-
makeURLRelative2Framework
public static java.lang.String makeURLRelative2Framework(java.lang.String url, java.lang.String frameworkFileURL)
Make an URL relative to $framework or that if not possible, to $frameworks (also if possible). OBS: $frameworks is the frameworks directory of the given framework frameworkFileURL.- Parameters:
url
- The URL.frameworkFileURL
- The URL of the ".framework" file.- Returns:
- The relative URL to the $framework or $frameworks if possible, otherwise the original URL.
-
makeURLRelative2Project
public static java.lang.String makeURLRelative2Project(java.lang.String url, java.lang.String projectFileURL)
Make an URL relative to $pdu if possible.- Parameters:
url
- The URL.projectFileURL
- The URL of the ".prj" file.- Returns:
- The relative URL to the $pdu if possible, otherwise the original URL.
-
makeFileRelative2Framework
public static java.lang.String makeFileRelative2Framework(java.lang.String path, java.lang.String frameworkFilePath)
Make a file or directory relative to the $framework or $frameworks directory. The $frameworks directory is the frameworks directory of the given framework file, so it might differ from the default Oxygen frameworks directory.- Parameters:
path
- The original file or directory.frameworkFilePath
- The URL of the ".framework" file.- Returns:
- The relative path to the $framework or $frameworks if possible, otherwise the original file or directory path.
-
makeFileRelative2Project
public static java.lang.String makeFileRelative2Project(java.lang.String path, java.lang.String projectFilePath)
Make a file or directory relative to the $pdudirectory.- Parameters:
path
- The original file or directory.projectFilePath
- The URL of the ".pdu" file.- Returns:
- The relative path to the $pdu if possible, otherwise the original file or directory path.
-
setXpathEvaluator
public static void setXpathEvaluator(ro.sync.util.editorvars.XPathEvaluator staticXpathEvaluator)
Set an XPath evaluator.- Parameters:
staticXpathEvaluator
- The static xpath evaluator interface.
-
getXpathEvaluator
public static ro.sync.util.editorvars.XPathEvaluator getXpathEvaluator()
Gets the XPath evaluator.- Returns:
- The static xpath evaluator interface. Can be
null
if not previously set.
-
addCustomEditorVariablesResolver
public static void addCustomEditorVariablesResolver(EditorVariablesResolver resolver)
Add custom resolver.- Parameters:
resolver
- The custom resolver to add.
-
removeCustomEditorVariablesResolver
public static void removeCustomEditorVariablesResolver(EditorVariablesResolver resolver)
Remove a custom resolver.- Parameters:
resolver
- The resolver to remove.
-
getAllCustomResolvedEditorVariables
public static java.util.List<EditorVariableDescription> getAllCustomResolvedEditorVariables()
Get a list with all custom resolved editor variables.- Returns:
- a list with all custom resolved editor variables.
-
setAdditionalFrameorksProvider
public static void setAdditionalFrameorksProvider(ro.sync.exml.options.AdditionalFrameworksProvider additionalFrameorksProvider)
Sets the referenced directory as additional framework directory.- Parameters:
additionalFrameorksProvider
- The additionalFrameorksProvider to set.
-
setUserUploadedFrameworks
public static void setUserUploadedFrameworks(java.io.File userFrameworksDir)
Sets directory where the user uploaded frameworks are stored.- Parameters:
userFrameworksDir
- The location of frameworks uploaded by the user in WA.
-
setCatalogUtilsAccess
public static void setCatalogUtilsAccess(ro.sync.util.editorvars.CatalogManagerUtilsAccess catalogUtilsAccess)
Set the catalogs utils access.- Parameters:
catalogUtilsAccess
- The catalog Utils Access.
-
getCatalogUtilsAccess
public static ro.sync.util.editorvars.CatalogManagerUtilsAccess getCatalogUtilsAccess()
Get the catalog utils access.- Returns:
- Returns the catalog Utils Access.
-
generateUniqueID
public static java.lang.String generateUniqueID()
- Returns:
- The generated Unique ID
-
isRelativizedToProject
public static boolean isRelativizedToProject(java.lang.String url)
Checks if URL is relative to project- Parameters:
url
- URL to check- Returns:
true
if URL starts with ${pd}
-
-