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


Java MimePath.EMPTY属性代码示例

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


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

示例1: testWrapping

public void testWrapping() throws Exception {
        MimePath mimePath = MimePath.EMPTY;
        MockMimeLookup.setInstances(mimePath, new TestingUndoableEditWrapper(), new TestingUndoableEditWrapper2());
        CESEnv env = new CESEnv();
        Document doc = env.support.openDocument();
//        doc.addUndoableEditListener(new UndoableEditListener() {
//            @Override
//            public void undoableEditHappened(UndoableEditEvent e) {
//                UndoableEdit edit = e.getEdit();
//            }
//        });
        doc.insertString(0, "Test", null);
        Class wrapEditClass = TestingUndoableEditWrapper.WrapCompoundEdit.class;
        assertNotNull(NbDocument.getEditToBeUndoneOfType(env.support, wrapEditClass));
        Class wrapEditClass2 = TestingUndoableEditWrapper2.WrapCompoundEdit2.class;
        assertNotNull(NbDocument.getEditToBeUndoneOfType(env.support, wrapEditClass2));
        
        // A trick to get whole edit
        UndoableEdit wholeEdit = NbDocument.getEditToBeUndoneOfType(env.support, UndoableEdit.class);
        assertTrue(wholeEdit instanceof List);
        @SuppressWarnings("unchecked")
        List<? extends UndoableEdit> listEdit = (List<? extends UndoableEdit>) wholeEdit;
        assertEquals(3, listEdit.size());
        assertEquals(wrapEditClass, listEdit.get(1).getClass());
        assertEquals(wrapEditClass2, listEdit.get(2).getClass());
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:UndoableEditWrapperTest.java

示例2: TextSearchHighlighting

/** Creates a new instance of TextSearchHighlighting */
public TextSearchHighlighting(JTextComponent component) {
    // Determine the mime type
    String mimeType = getMimeType(component);
    this.mimePath = mimeType == null ? MimePath.EMPTY : MimePath.parse(mimeType);
    
    this.component = component;
    this.document = component.getDocument();
    
    // Let the internal listener update first...
    this.document.addDocumentListener(WeakListeners.document(this, this.document));

    // ...and the bag second
    this.bag = new OffsetsBag(document);
    this.bag.addHighlightsChangeListener(this);
    
    EditorFindSupport.getInstance().addPropertyChangeListener(
        WeakListeners.propertyChange(this, EditorFindSupport.getInstance())
    );
    
    fillInTheBag();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:TextSearchHighlighting.java

示例3: CaretBasedBlockHighlighting

/** Creates a new instance of CaretSelectionLayer */
protected CaretBasedBlockHighlighting(JTextComponent component, String coloringName, boolean extendsEOL, boolean extendsEmptyLine) {
    // Determine the mime type
    String mimeType = BlockHighlighting.getMimeType(component);
    this.mimePath = mimeType == null ? MimePath.EMPTY : MimePath.parse(mimeType);

    this.coloringName = coloringName;
    this.extendsEOL = extendsEOL;
    this.extendsEmptyLine = extendsEmptyLine;
    
    // Hook up the component
    this.component = component;
    
    selectionsBag = new PositionsBag(component.getDocument(), false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:CaretBasedBlockHighlighting.java

示例4: BracesMatchHighlighting

public BracesMatchHighlighting(JTextComponent component, Document document) {
    this.document = document;

    String mimeType = getMimeType(component);
    MimePath mimePath = mimeType == null ? MimePath.EMPTY : MimePath.parse(mimeType);

    // Load the colorings
    FontColorSettings fcs = MimeLookup.getLookup(mimePath).lookup(FontColorSettings.class);
    AttributeSet match = fcs.getFontColors(BRACES_MATCH_COLORING);
    AttributeSet mismatch = fcs.getFontColors(BRACES_MISMATCH_COLORING);
    AttributeSet matchMultichar = fcs.getFontColors(BRACES_MATCH_MULTICHAR_COLORING);
    AttributeSet mismatchMultichar = fcs.getFontColors(BRACES_MISMATCH_MULTICHAR_COLORING);
    this.bracesMatchColoring = match != null ? match : SimpleAttributeSet.EMPTY;
    this.bracesMismatchColoring = mismatch != null ? mismatch : SimpleAttributeSet.EMPTY;
    this.bracesMatchMulticharColoring = matchMultichar != null ? matchMultichar : SimpleAttributeSet.EMPTY;
    this.bracesMismatchMulticharColoring = mismatchMultichar != null ? mismatchMultichar : SimpleAttributeSet.EMPTY;
    
    // Create and hook up the highlights bag
    this.bag = new OffsetsBag(document, true);
    this.bag.addHighlightsChangeListener(this);
    
    // Hook up the component
    this.component = component;
    this.component.addPropertyChangeListener(WeakListeners.propertyChange(this, this.component));

    // Hook up the caret
    this.caret = component.getCaret();
    if (this.caret != null) {
        this.caretListener = WeakListeners.change(this, this.caret);
        this.caret.addChangeListener(caretListener);
    }

    // Refresh the layer
    refresh();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:BracesMatchHighlighting.java

示例5: mimeTypes2mimePath

/**
 * Converts an array of mime types to a <code>MimePath</code> instance.
 */
public static MimePath mimeTypes2mimePath(String[] mimeTypes) {
    MimePath mimePath = MimePath.EMPTY;
    
    for (int i = 0; i < mimeTypes.length; i++) {
        mimePath = MimePath.get(mimePath, mimeTypes[i]);
    }
    
    return mimePath;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:Utils.java

示例6: setMenu

protected @Override void setMenu(){
    super.setMenu();
    JTextComponent c = getComponent();
    MimePath mimePath = c == null ? MimePath.EMPTY : MimePath.parse(DocumentUtilities.getMimeType(c));
    Preferences prefs = MimeLookup.getLookup(mimePath).lookup(Preferences.class);
    boolean visible = prefs.getBoolean(SimpleValueNames.TOOLBAR_VISIBLE_PROP, EditorPreferencesDefaults.defaultToolbarVisible);
    SHOW_TOOLBAR_MENU.setState(visible);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:MainMenuAction.java

示例7: getDisplayName

public String getDisplayName() {
    String languageName = EditorSettings.getDefault().getLanguageName(mimeType.getPath()).toLowerCase();
    if (mimeType == MimePath.EMPTY) {
        return NbBundle.getMessage(MacrosModel.class, "MacroAction_DisplayName_1", getName(), languageName); //NOI18N
    } else {
        return NbBundle.getMessage(MacrosModel.class, "MacroAction_DisplayName_2", getName(), languageName); //NOI18N
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:MacrosModel.java

示例8: DummyMimeLookupInitializer

/** Creates a new instance of DummyMimeDataProvider */
    public DummyMimeLookupInitializer() {
//        System.out.println("Creating DummyMimeLookupInitializer");
        this.mimePath = MimePath.EMPTY;
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:DummyMimeLookupInitializer.java

示例9: getPopupMenu

public @Override JPopupMenu getPopupMenu(){
    JPopupMenu pm = super.getPopupMenu();
    pm.removeAll();
    boolean enable = false;
    BaseKit bKit = getKit();
    if (bKit==null) bKit = BaseKit.getKit(NbEditorKit.class);
    if (bKit!=null){
        Action action = bKit.getActionByName(NbEditorKit.generateFoldPopupAction);
        if (action instanceof BaseAction) {
            JTextComponent component = NbCodeFoldingAction.getComponent();
            MimePath mimePath = component == null ? MimePath.EMPTY : MimePath.parse(DocumentUtilities.getMimeType(component));
            Preferences prefs = MimeLookup.getLookup(mimePath).lookup(Preferences.class);
            boolean foldingAvailable = prefs.getBoolean(SimpleValueNames.CODE_FOLDING_ENABLE, EditorPreferencesDefaults.defaultCodeFoldingEnable);
            
            if (foldingAvailable){
                ActionMap contextActionmap = org.openide.util.Utilities.actionsGlobalContext().lookup(ActionMap.class);
                if (contextActionmap!=null){
                    foldingAvailable = contextActionmap.get(BaseKit.collapseFoldAction) != null &&
                        component != null;

                    if (!foldingAvailable){
                        bKit = BaseKit.getKit(NbEditorKit.class);
                        if (bKit!=null){
                            Action defaultAction = bKit.getActionByName(NbEditorKit.generateFoldPopupAction);
                            if (defaultAction instanceof BaseAction) action = defaultAction;
                        }
                    }
                }
            }

            JMenu menu = (JMenu)((BaseAction)action).getPopupMenuItem(foldingAvailable ? component : null);
            if (menu!=null){
                Component comps[] = menu.getMenuComponents();
                for (int i=0; i<comps.length; i++){
                    pm.add(comps[i]);
                    if (comps[i].isEnabled() && !(comps[i] instanceof JSeparator)) {
                        enable = true;
                    }
                }
            }
        }
    }
    setEnabled(enable);
    pm.pack();
    return pm;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:46,代码来源:NbCodeFoldingAction.java

示例10: IndentationPanelController

public IndentationPanelController(Preferences prefs) {
    this(MimePath.EMPTY, null, prefs, null, null);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:3,代码来源:IndentationPanelController.java


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