本文整理匯總了Java中org.eclipse.core.resources.IFile.getFileExtension方法的典型用法代碼示例。如果您正苦於以下問題:Java IFile.getFileExtension方法的具體用法?Java IFile.getFileExtension怎麽用?Java IFile.getFileExtension使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.core.resources.IFile
的用法示例。
在下文中一共展示了IFile.getFileExtension方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getParser
import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
/**
* We only parse graph model files & build policy files & java files . Skip other files...
* @param file
* @return
*/
private GW4EParser getParser(IFile file) {
String extension = file.getFileExtension();
if (extension == null)
return null;
GW4EParser parser = null;
if (PreferenceManager.isGraphModelFile(file) ) {
parser = new GW4EParserImpl();
} else if ("java".equalsIgnoreCase(extension)) {
parser = new GW4ETestParser();
} else {
String projectName = file.getProject().getName();
if (file.getName().equalsIgnoreCase(PreferenceManager.getBuildPoliciesFileName(projectName))) {
parser = new BuildPolicyFileParserImpl();
}
}
return parser;
}
示例2: isModelFile
import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
public boolean isModelFile ( final IFile candidate, final Set<String> extensions )
{
final String ext = candidate.getFileExtension ();
logger.debug ( "Is model file - file: {}, ext: {}, list: {}", candidate, ext, extensions );
if ( extensions.contains ( ext ) )
{
logger.debug ( "This file is a model file" );
return true;
}
return false;
}
示例3: isGraphModelFile
import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
/**
* Is this file a graphml model file ?
*
* @param resource
* @return
*/
public static boolean isGraphModelFile(IFile resource) {
String extension = resource.getFileExtension();
if (Constant.GRAPHML_FILE.equalsIgnoreCase(extension) && allowedFolder(resource)) {
return true;
}
if (Constant.GRAPH_JSON_FILE.equalsIgnoreCase(extension) && allowedFolder(resource)) {
return true;
}
if (Constant.GRAPH_GW4E_FILE.equalsIgnoreCase(extension) && allowedFolder(resource)) {
return true;
}
return false;
}
示例4: isGW3ModelFile
import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
/**
* Is the passed file a GW3 file ?
*
* @param resource
* @return
*/
public static boolean isGW3ModelFile(IFile resource) {
if (resource == null) return false;
String extension = resource.getFileExtension();
if (Constant.GW3_FILE.equalsIgnoreCase(extension) && allowedFolder(resource)) {
return true;
}
return false;
}
示例5: isJSONModelFile
import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
/**
* @param resource
* @return
*/
public static boolean isJSONModelFile(IFile resource) {
String extension = resource.getFileExtension();
if (Constant.GW3_FILE.equalsIgnoreCase(extension) && allowedFolder(resource)) {
return true;
}
return false;
}
示例6: isWorkBookFile
import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
public static boolean isWorkBookFile(IFile file) throws CoreException {
String extension = file.getFileExtension();
if ("xlsx".equalsIgnoreCase(extension)) {
return true;
}
return false;
}
示例7: isJUnitResultFile
import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
public static boolean isJUnitResultFile(IFile file) throws CoreException {
String filename = file.getName();
String extension = file.getFileExtension();
if (filename.startsWith("TEST-GraphWalker-") && "xml".equalsIgnoreCase(extension)) {
return true;
}
return false;
}
示例8: stripFileExtension
import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
/**
* Return the file name of the passed selection without its extension file,
* if it is a file ...
*
* @param selection
* @return
*/
public static String stripFileExtension(IStructuredSelection selection) {
Object obj = ((IStructuredSelection) selection).getFirstElement();
if (!(obj instanceof IFile))
return "";
IFile file = ((IFile) obj);
String extension = file.getFileExtension();
String name = file.getName();
int pos = name.indexOf("." + extension);
return name.substring(0, pos);
}
示例9: getFileExtension
import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
static public String getFileExtension(String filePath) {
IFile file = getIFile(filePath);
return file.getFileExtension();
}
示例10: test
import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
/**
* Checking the file type by getting the known extensions from the FileExtensionProvider
*
* @param iFile
* file to judge
* @return true if the file is a valid file for organize import
*/
@Override
public boolean test(IFile iFile) {
String fileExtension = iFile.getFileExtension();
return fileExtension != null && n4FileExtensions.get().contains(fileExtension);
}