public class EditUtilities
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
REMOTEFILE
Name of the "remote files" cache folder
|
| Constructor and Description |
|---|
EditUtilities() |
| Modifier and Type | Method and Description |
|---|---|
static void |
cleanUpEdit(IResource pRes,
FileDescriptor pFile2Delete,
IExecutionContext pContext)
Deletes a local file.
|
static void |
createLocalFile(FileDescriptor pFileDescr,
IElement pElement,
IExecutionContext pContext,
org.eclipse.core.runtime.IProgressMonitor pMon)
Creates a local IFile in the internal TAURUS project and maintains the
internal maps for local edit.
|
static FileDescriptor |
createTempFile(FileDescriptor pFDSource,
java.lang.String pFileName,
IElement pElement,
IExecutionContext pContext,
boolean pReadOnly)
Creates a temporary local file within the TAURUS file system.
|
static void |
doLocalSyntaxCheck(IElement pElement,
FileDescriptor pFd)
Perform the local syntax check to a local IFile in the internal TAURUS
project.
|
static org.eclipse.core.resources.IFolder |
getCacheFolder(FileDescriptor pFD,
IExecutionContext pContext)
Creates and gets the folder where the file corresponding to the given
file descriptor will be cached.
|
static java.lang.String |
getConfiguredCompareSuffix(ToolDescriptor pTd,
IExecutionContext pContext) |
static IElement |
getElementFromContext(IExecutionContext pContext)
Gets the element from the context.
|
static java.lang.String |
getFileName(FileDescriptor pFD)
Gets the filename from the file descriptor's physical name.
|
static java.lang.String |
getFileName(java.lang.String pPhysicalName,
IExecutionContext pContext)
Gets a file name for the given context.
|
static org.eclipse.core.resources.IFile |
getLocalFile(IElement pElement)
Uses the element's ID definition to get the persistent workspace path of
the given element.
|
static org.eclipse.core.resources.IFile |
openFile(FileDescriptor pFD,
IExecutionContext pContext,
boolean pReadOnly,
java.lang.String pSuffix,
int pLine,
org.eclipse.core.runtime.IProgressMonitor pMon)
Opens the given Content in the default editor for the given file
extension.The MF background parsing is turn off.
|
static void |
setReadOnlyFlag(org.eclipse.core.resources.IFile pFile)
Sets the read only flag of the given file and refreshes it in the
workspace.
|
static void |
uploadFile(FileDescriptor pSource,
FileDescriptor pTarget,
IExecutionContext pContext,
EExistingResourceHandling pExistingResourceHandling,
org.eclipse.core.runtime.IProgressMonitor pMon)
Uploads the contents of a File Descriptor.
|
static void |
uploadFile(FileDescriptor pSource,
FileDescriptor pTarget,
IExecutionContext pContext,
org.eclipse.core.runtime.IProgressMonitor pMon)
Uploads the contents of a File Descriptor.
|
static void |
uploadFile(java.util.List<FileDescriptor> pSources,
java.util.List<FileDescriptor> pTargets,
IExecutionContext pContext,
EExistingResourceHandling pExistingResourceHandling,
org.eclipse.core.runtime.IProgressMonitor pMon)
Uploads the contents of File Descriptors.
|
static void |
uploadFile(java.util.List<FileDescriptor> pSources,
java.util.List<FileDescriptor> pTargets,
IExecutionContext pContext,
org.eclipse.core.runtime.IProgressMonitor pMon)
Uploads the contents of File Descriptors.
|
public static final java.lang.String REMOTEFILE
public static void createLocalFile(FileDescriptor pFileDescr, IElement pElement, IExecutionContext pContext, org.eclipse.core.runtime.IProgressMonitor pMon) throws TaurusCoreException, java.io.IOException, TaurusToolException
pFileDescr - file descriptor pointing to the filepElement - element to which the file belongspContext - execution context of the edit actionpMon - a progress monitorTaurusCoreException - if the file could not be createdjava.io.IOException - if reading the file contents failsTaurusToolException - if associating a property group to the file failspublic static void setReadOnlyFlag(org.eclipse.core.resources.IFile pFile)
throws org.eclipse.core.runtime.CoreException
pFile - the fileorg.eclipse.core.runtime.CoreException - if setting the flag or refreshing the file failspublic static FileDescriptor createTempFile(FileDescriptor pFDSource, java.lang.String pFileName, IElement pElement, IExecutionContext pContext, boolean pReadOnly) throws TaurusToolException, TaurusCoreException
pFDSource - a FileDescriptor of the source filepFileName - the new file namepElement - The Element to which the created file belongs to or
null, since this is only needed for a future
local syntax checkpContext - actual execution contextpReadOnly - whether the file should be created read-onlyTaurusCoreException - if the file could not be createdTaurusToolException - if the file could not be createdpublic static void doLocalSyntaxCheck(IElement pElement, FileDescriptor pFd) throws TaurusException
pElement - element to which the file belongspFd - the file descriptor of the local fileTaurusException - if the syntax check failspublic static org.eclipse.core.resources.IFile getLocalFile(IElement pElement) throws TaurusCoreException
pElement - the elementTaurusCoreException - if the application folder could not be created/locatedEIntegratedTools.LOCAL_FILE_CREATOR,
EIntegratedTools.LOCAL_FILE_LOCATORpublic static void uploadFile(FileDescriptor pSource, FileDescriptor pTarget, IExecutionContext pContext, org.eclipse.core.runtime.IProgressMonitor pMon) throws TaurusCoreException
Same as calling
uploadFile(FileDescriptor, FileDescriptor, IExecutionContext, EExistingResourceHandling, IProgressMonitor) with existing resource handling
EExistingResourceHandling.REPLACE.
pSource - the source file, which contents should be uploadedpTarget - the destination filepContext - execution context of the upload actionpMon - progress monitorTaurusCoreException - if an exception occurs while reading the source file or
setting contents of the target filepublic static void uploadFile(FileDescriptor pSource, FileDescriptor pTarget, IExecutionContext pContext, EExistingResourceHandling pExistingResourceHandling, org.eclipse.core.runtime.IProgressMonitor pMon) throws TaurusCoreException
pSource - the source file, which contents should be uploadedpTarget - the destination filepContext - execution context of the upload actionpExistingResourceHandling - what to do if the target file already existspMon - progress monitorTaurusCoreException - if an exception occurs while reading the source file or
setting contents of the target filepublic static void uploadFile(java.util.List<FileDescriptor> pSources, java.util.List<FileDescriptor> pTargets, IExecutionContext pContext, org.eclipse.core.runtime.IProgressMonitor pMon) throws TaurusCoreException
Same as calling
uploadFile(List, List, IExecutionContext, EExistingResourceHandling, IProgressMonitor) with existing resource handling
EExistingResourceHandling.REPLACE.
pSources - the source files, which contents should be uploadedpTargets - the destination filespContext - execution context of the upload actionpMon - progress monitorTaurusCoreException - if an exception occurs while reading the source file or
setting contents of the target filepublic static void uploadFile(java.util.List<FileDescriptor> pSources, java.util.List<FileDescriptor> pTargets, IExecutionContext pContext, EExistingResourceHandling pExistingResourceHandling, org.eclipse.core.runtime.IProgressMonitor pMon) throws TaurusCoreException
pSources - the source files, which contents should be uploadedpTargets - the destination filespContext - execution context of the upload actionpExistingResourceHandling - what to do if the target file already existspMon - progress monitorTaurusCoreException - if an exception occurs while reading the source file or
setting contents of the target filepublic static void cleanUpEdit(IResource pRes, FileDescriptor pFile2Delete, IExecutionContext pContext) throws TaurusCoreException
pRes - the corresponding resourcepFile2Delete - the file that shall be deletedpContext - the execution contextTaurusCoreException - if an exception occurs while deleting the file or removing
its property grouppublic static IElement getElementFromContext(IExecutionContext pContext)
null if the
context resource is not an element or element list entry.pContext - the contextnullpublic static java.lang.String getFileName(java.lang.String pPhysicalName,
IExecutionContext pContext)
pPhysicalName - the physical file namepContext - the execution contextgetElementFromContext(IExecutionContext),
RElementProperty.isElementName()public static java.lang.String getConfiguredCompareSuffix(ToolDescriptor pTd, IExecutionContext pContext) throws TaurusToolException
pTd - the tool descriptorpContext - the contextTaurusToolException - if an exception occurs during finding out parameter value.public static java.lang.String getFileName(FileDescriptor pFD)
pFD - the file descriptorpublic static org.eclipse.core.resources.IFolder getCacheFolder(FileDescriptor pFD, IExecutionContext pContext) throws org.eclipse.core.runtime.CoreException, TaurusCoreException
pFD - the file descriptionpContext - the execution contextEFileTypes.MVSPO_MEMBER,
EFileTypes.MVSSEQ, EFileTypes.USS_FILE and
EFileTypes.LOCAL_FILE the folder where the file
description's file will be cached.. Otherwise return the AWM
internal file cache folder .org.eclipse.core.runtime.CoreException - if errors occurred during the creation of foldersTaurusCoreException - if errors occurred by creation of the AWM internal file cache
folderpublic static org.eclipse.core.resources.IFile openFile(FileDescriptor pFD, IExecutionContext pContext, boolean pReadOnly, java.lang.String pSuffix, int pLine, org.eclipse.core.runtime.IProgressMonitor pMon) throws TaurusCoreException
pContext - the execution contextpFD - the file descriptor for the file to openpSuffix - can be null if the file name contains a file
extension. If no file extension is given, TAURUS will try to
find a suffix.pReadOnly - if true the file is opened in read only moduspLine - the line number that should be selected after the editor is
opened (can be 0)pMon - progress monitornull if no UI is available to open the file.TaurusCoreException - if an Exception of any kind occursCopyright © 2015 Micro Focus GmbH. All rights reserved.