本文整理汇总了Java中org.netbeans.api.editor.mimelookup.MimeLookup.getMimeLookup方法的典型用法代码示例。如果您正苦于以下问题:Java MimeLookup.getMimeLookup方法的具体用法?Java MimeLookup.getMimeLookup怎么用?Java MimeLookup.getMimeLookup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.api.editor.mimelookup.MimeLookup
的用法示例。
在下文中一共展示了MimeLookup.getMimeLookup方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testForChangeInLayer
import org.netbeans.api.editor.mimelookup.MimeLookup; //导入方法依赖的package包/类
/**
* Issues of changes in layer
*/
public void testForChangeInLayer() throws IOException{
// issue #63338
// http://www.netbeans.org/issues/show_bug.cgi?id=63338
// Subj: deadlock during showing annotations
// fix: deadlock occured in after inproper firing of lookup changed event.
// event was fired even in cases, the lookup listener should be quiet.
MimeLookup lookup = MimeLookup.getMimeLookup("text/jsp"); //NOI18N
Result result = lookup.lookup(new Template(TestLookupObject.class));
result.allInstances().size(); // remove this line if issue #60010 is fixed
LookupListener listener = new LookupListener(){
public void resultChanged(LookupEvent ev){
resultChangedCount[0]++;
}
};
result.addLookupListener(listener);
//simulate module installation, new file will be added
createFile("Editors/text/jsp/testLookup/org-openide-actions-PasteAction.instance"); //NOI18N
checkResultChange(0);
TestUtilities.deleteFile(getWorkDir(),
"Editors/text/jsp/testLookup/org-netbeans-modules-editor-mimelookup-impl-TestLookupObject.instance");
checkResultChange(1);
result.removeLookupListener(listener);
resultChangedCount[0] = 0;
// end of issue #63338 ------------------------------------------------
}
示例2: testDoubleItems
import org.netbeans.api.editor.mimelookup.MimeLookup; //导入方法依赖的package包/类
/** Issue #72873
* MimeLookup duplicates objects from default mimetype folder
*/
public void testDoubleItems(){
MimeLookup lookup = MimeLookup.getMimeLookup("text/x-java"); //NOI18N
Result result = lookup.lookup(new Template(TestLookupObjectTwo.class));
Collection col = result.allInstances();
assertTrue(col.size() == 1);
lookup = MimeLookup.getMimeLookup(""); //NOI18N
result = lookup.lookup(new Template(TestLookupObjectTwo.class));
col = result.allInstances();
assertTrue(col.size() == 1);
}
示例3: testLookupFolderRecursivity
import org.netbeans.api.editor.mimelookup.MimeLookup; //导入方法依赖的package包/类
/**
* FolderLookup behaves recursively by default. It is not ideal as for MimeLookup,
* that should operate only on the mime-type-folder
* see issue #58991
* Testing if the MimeLookup is not recursive
*/
public void testLookupFolderRecursivity(){
//StringBuffer.instance is declared
// in "Editors/text/xml/text/html/java-lang-StringBuffer.instance"
// it shouldn't be found in text/xml parent folder
MimeLookup lookup = MimeLookup.getMimeLookup("text/xml");
checkLookupObject(lookup, StringBuffer.class, false);
}
示例4: testLazyLookupObjectInstantiation
import org.netbeans.api.editor.mimelookup.MimeLookup; //导入方法依赖的package包/类
/**
* Checking wheather the initialization of MimeLookup for appropriate
* mime type will not instantiate lookup object
*/
public void testLazyLookupObjectInstantiation() throws IOException{
MimeLookup lookup = MimeLookup.getMimeLookup("text/xml"); //NOI18N
// lookup for some object in the mime lookup
checkLookupObject(lookup, StringBuffer.class, false);
// calling
// checkLookupObject(lookup, TestLookupObjectInstantiation.class, false);
// should fail
}
示例5: testHidding
import org.netbeans.api.editor.mimelookup.MimeLookup; //导入方法依赖的package包/类
/**
* Issue #61216: MimeLookup should support layer hidding
*/
public void testHidding(){
MimeLookup lookup = MimeLookup.getMimeLookup("text/xml");
checkLookupObject(lookup, CopyAction.class, true);
checkLookupObject(lookup, ReplaceAction.class, true);
checkLookupObject(lookup, PasteAction.class, false);
lookup = MimeLookup.getMimeLookup("text/x-ant+xml");
checkLookupObject(lookup, CutAction.class, true);
checkLookupObject(lookup, CopyAction.class, false);
checkLookupObject(lookup, PasteAction.class, true);
checkLookupObject(lookup, ReplaceAction.class, false);
}
示例6: test61245
import org.netbeans.api.editor.mimelookup.MimeLookup; //导入方法依赖的package包/类
/**
* Issue #61245: Delegate application/*+xml -> text/xml
*/
public void test61245(){
MimeLookup lookup = MimeLookup.getMimeLookup("application/xml");
checkLookupObject(lookup, FindAction.class, true);
lookup = MimeLookup.getMimeLookup("application/xhtml+xml");
checkLookupObject(lookup, CutAction.class, true);
checkLookupObject(lookup, FindAction.class, false);
checkLookupObject(lookup, ReplaceAction.class, true);
}
示例7: testAntXmlPopup
import org.netbeans.api.editor.mimelookup.MimeLookup; //导入方法依赖的package包/类
public void testAntXmlPopup(){
MimeLookup lookup = MimeLookup.getMimeLookup("text/xml"); //NOI18N
Class layerObjects[] = {CutAction.class, CopyAction.class, PasteAction.class, ReplaceAction.class};
testPopupItems(lookup, layerObjects);
lookup = MimeLookup.getMimeLookup("text/x-ant+xml"); //NOI18N
Class layerObjects2[] = {CutAction.class, CopyAction.class, PasteAction.class, ReplaceAction.class, FindAction.class};
testPopupItems(lookup, layerObjects2);
}
示例8: testBaseLevelPopups
import org.netbeans.api.editor.mimelookup.MimeLookup; //导入方法依赖的package包/类
/** Testing Base level popup items lookup and sorting */
public void testBaseLevelPopups(){
MimeLookup lookup = MimeLookup.getMimeLookup(""); //NOI18N
Class layerObjects[] = {CutAction.class, CopyAction.class, PasteAction.class};
testPopupItems(lookup, layerObjects);
}
示例9: testDynamicChangeInPopupFolders
import org.netbeans.api.editor.mimelookup.MimeLookup; //导入方法依赖的package包/类
/** Testing Base level popup items lookup and sorting */
@RandomlyFails // NB-Core-Build #3718
public void testDynamicChangeInPopupFolders() throws IOException{
final int resultChangedCount[] = new int[1];
resultChangedCount[0] = 0;
MimeLookup lookup = MimeLookup.getMimeLookup("text/x-java").childLookup("text/xml"). //NOI18N
childLookup("text/html"); //NOI18N
Lookup.Result result = lookup.lookup(new Template(PopupActions.class));
result.allInstances(); // remove this line if issue #60010 is fixed
LookupListener listener = new LookupListener(){
public void resultChanged(LookupEvent ev){
resultChangedCount[0]++;
}
};
result.addLookupListener(listener);
PopupActions actions = (PopupActions) lookup.lookup(PopupActions.class);
assertTrue("PopupActions should be found", actions != null);
List popupActions = actions.getPopupActions();
int size = popupActions.size();
assertTrue("Number of PopupActions found:"+size+" and should be:"+fsstruct.length, size == fsstruct.length);
//delete RenameAction
TestUtilities.deleteFile(getWorkDir(),
"Editors/text/html/Popup/org-openide-actions-RenameAction.instance");
checkPopupItemPresence(lookup, RenameAction.class, false);
// check firing the change
assertTrue(("resultChangedCount is:"+resultChangedCount[0]+" instead of 1"),resultChangedCount[0] == 1);
resultChangedCount[0] = 0;
//delete base CutAction
TestUtilities.deleteFile(getWorkDir(),
"Editors/Popup/org-openide-actions-CutAction.instance");
checkPopupItemPresence(lookup, CutAction.class, false);
// check firing the change
assertTrue(("resultChangedCount is:"+resultChangedCount[0]+" instead of 1"),resultChangedCount[0] == 1);
resultChangedCount[0] = 0;
//simulate module installation, new action will be added
TestUtilities.createFile(getWorkDir(),
"Editors/Popup/org-openide-actions-FindAction.instance"); //NOI18N
checkPopupItemPresence(lookup, FindAction.class, true);
// check firing the change
assertTrue(("resultChangedCount is:"+resultChangedCount[0]+" instead of 1"),resultChangedCount[0] == 1);
resultChangedCount[0] = 0;
//simulate module installation, new action will be added
TestUtilities.createFile(getWorkDir(),
"Editors/text/x-java/text/xml/text/html/Popup/org-openide-actions-ReplaceAction.instance"); //NOI18N
checkPopupItemPresence(lookup, ReplaceAction.class, true);
//ReplaceAction was created in the uppermost folder
// let's try it is missing in the lower lookup
lookup = MimeLookup.getMimeLookup("text/x-java").childLookup("text/xml"); //NOI18N
checkPopupItemPresence(lookup, ReplaceAction.class, false);
checkPopupItemPresence(lookup, FindAction.class, true);
// lookup for ReplaceAction in the folder that doesn't exist
lookup = MimeLookup.getMimeLookup("text/html"); //NOI18N
checkPopupItemPresence(lookup, ReplaceAction.class, false);
// create folder with ReplaceAction
TestUtilities.createFile(getWorkDir(),
"Editors/text/html/Popup/org-openide-actions-ReplaceAction.instance"); //NOI18N
checkPopupItemPresence(lookup, ReplaceAction.class, true);
}