当前位置: 首页>>代码示例>>Java>>正文


Java MimePath.validate方法代码示例

本文整理汇总了Java中org.netbeans.api.editor.mimelookup.MimePath.validate方法的典型用法代码示例。如果您正苦于以下问题:Java MimePath.validate方法的具体用法?Java MimePath.validate怎么用?Java MimePath.validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.netbeans.api.editor.mimelookup.MimePath的用法示例。


在下文中一共展示了MimePath.validate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createInstance

import org.netbeans.api.editor.mimelookup.MimePath; //导入方法依赖的package包/类
public static PathRecognizer createInstance(Map fileAttributes) {
    
    // path ids
    Set<String> sourcePathIds = readIdsAttribute(fileAttributes, "sourcePathIds"); //NOI18N
    Set<String> libraryPathIds = readIdsAttribute(fileAttributes, "libraryPathIds"); //NOI18N
    Set<String> binaryLibraryPathIds = readIdsAttribute(fileAttributes, "binaryLibraryPathIds"); //NOI18N

    // mime types
    Set<String> mimeTypes = new HashSet<String>();
    Object mts = fileAttributes.get("mimeTypes"); //NOI18N
    if (mts instanceof String) {
        String [] arr = ((String) mts).split(","); //NOI18N
        for(String mt : arr) {
            mt = mt.trim();
            if (mt.length() > 0 && MimePath.validate(mt)) {
                mimeTypes.add(mt);
            } else {
                LOG.log(Level.WARNING, "Invalid mimetype {0}, ignoring.", mt); //NOI18N
            }
        }
    }

    return new DefaultPathRecognizer(sourcePathIds, libraryPathIds, binaryLibraryPathIds, Collections.unmodifiableSet(mimeTypes));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:DefaultPathRecognizer.java

示例2: CustomizerSelector

import org.netbeans.api.editor.mimelookup.MimePath; //导入方法依赖的package包/类
public CustomizerSelector(PreferencesFactory pf, boolean acceptOldControllers, String allowedMimeTypes) {
    this.pf = pf;
    this.acceptOldControllers = acceptOldControllers;

    if (allowedMimeTypes != null) {
        this.allowedMimeTypes = new HashSet<String>();
        for(String mimeType : allowedMimeTypes.split(",")) { //NOI18N
            mimeType = mimeType.trim();
            if (MimePath.validate(mimeType)) {
                this.allowedMimeTypes.add(mimeType);
            } else {
                LOG.warning("Ignoring invalid mimetype '" + mimeType + "'"); //NOI18N
            }
        }
    } else {
        this.allowedMimeTypes = null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:CustomizerSelector.java

示例3: createActionsLookupResult

import org.netbeans.api.editor.mimelookup.MimePath; //导入方法依赖的package包/类
public static Lookup.Result<Action> createActionsLookupResult(String mimeType) {
    if (!MimePath.validate(mimeType)) {
        throw new IllegalArgumentException("Ïnvalid mimeType=\"" + mimeType + "\"");
    }
    Lookup lookup = Lookups.forPath(getPath(mimeType, "Actions"));
    return lookup.lookupResult(Action.class);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:EditorActionUtilities.java

示例4: getAccelerator

import org.netbeans.api.editor.mimelookup.MimePath; //导入方法依赖的package包/类
/**
 * Get single-key accelerator for a given declared action.
 * Only a single-key accelerators are supported.
 */
public static KeyStroke getAccelerator(FileObject fo) {
    if (fo == null) {
        throw new IllegalArgumentException("Must be called with non-null fileObject"); // NOI18N
    }
    boolean fineLoggable = LOG.isLoggable(Level.FINE);
    String path = fo.getParent().getPath();
    String actionName = (String) fo.getAttribute(Action.NAME);
    KeyStroke ks = null;
    if (path.startsWith("Editors/")) {
        path = path.substring(7); // Leave ending '/' to support "Editors/Actions"
        if (path.endsWith("/Actions")) {
            path = path.substring(0, path.length() - 8);
            if (path.startsWith("/")) {
                path = path.substring(1);
            }
            String mimeType = path;
            if (!MimePath.validate(mimeType)) {
                LOG.info("Invalid mime-type='" + mimeType + "' of action's fileObject=" + fo); // NOI18N
            }
            ks = getAccelerator(mimeType, actionName);
        } else if (fineLoggable) {
            LOG.fine("No \"/Actions\" at end of mime-type='" + path +
                "' of action's fileObject=" + fo); // NOI18N
        }
    } else if (fineLoggable) {
        LOG.fine("No \"Editors/\" at begining of mime-type='" + path + // NOI18N
                "' of action's fileObject=" + fo); // NOI18N
    }

    if (LOG.isLoggable(Level.FINER)) {
        LOG.finer("Accelerator for action \"" + actionName + "\" is " + ks);
    }
    return ks;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:39,代码来源:EditorActionUtilities.java

示例5: isValidType

import org.netbeans.api.editor.mimelookup.MimePath; //导入方法依赖的package包/类
private static boolean isValidType(FileObject typeFile) {
    if (!typeFile.isFolder()) {
        return false;
    }

    String typeName = typeFile.getNameExt();
    return MimePath.validate(typeName, null);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:LanguageRegistry.java

示例6: isValidSubtype

import org.netbeans.api.editor.mimelookup.MimePath; //导入方法依赖的package包/类
private static boolean isValidSubtype(FileObject subtypeFile) {
    if (!subtypeFile.isFolder()) {
        return false;
    }

    String typeName = subtypeFile.getNameExt();
    return MimePath.validate(null, typeName) && !typeName.equals("base"); //NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:LanguageRegistry.java

示例7: isValidSubtype

import org.netbeans.api.editor.mimelookup.MimePath; //导入方法依赖的package包/类
private static boolean isValidSubtype(FileObject subtypeFile) {
    if (!subtypeFile.isFolder()) {
        return false;
    }

    String typeName = subtypeFile.getNameExt();
    return MimePath.validate(null, typeName);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:KitsTrackerImpl.java

示例8: findKit

import org.netbeans.api.editor.mimelookup.MimePath; //导入方法依赖的package包/类
private EditorKit findKit(String mimeType) {
    if (!MimePath.validate(mimeType)) // #146276 - exclude invalid mime paths
        return null;
    Lookup lookup = MimeLookup.getLookup(MimePath.parse(mimeType));
    EditorKit kit = (EditorKit) lookup.lookup(EditorKit.class);
    return kit == null ? null : (EditorKit) kit.clone();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:EditorModule.java

示例9: detectMimeType

import org.netbeans.api.editor.mimelookup.MimePath; //导入方法依赖的package包/类
private static String detectMimeType(FileObject f) {
    String mimeType = f.getParent().getPath().substring("Editors/".length()); //NOI18N
    return MimePath.validate(mimeType) && mimeType.length() > 0 ? mimeType : null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:CslEditorKit.java


注:本文中的org.netbeans.api.editor.mimelookup.MimePath.validate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。