本文整理汇总了Java中org.openide.windows.IOProvider.getDefault方法的典型用法代码示例。如果您正苦于以下问题:Java IOProvider.getDefault方法的具体用法?Java IOProvider.getDefault怎么用?Java IOProvider.getDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.windows.IOProvider
的用法示例。
在下文中一共展示了IOProvider.getDefault方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getIOProvider
import org.openide.windows.IOProvider; //导入方法依赖的package包/类
public static IOProvider getIOProvider() {
IOProvider iop = IOProvider.get("Terminal"); // NOI18N
if (iop == null) {
// System.out.printf("IOProviderActionSupport.getTermIOProvider() couldn't find our provider\n");
iop = IOProvider.getDefault();
}
return iop;
}
示例2: getIOProvider
import org.openide.windows.IOProvider; //导入方法依赖的package包/类
private static IOProvider getIOProvider() {
IOProvider iop = IOProvider.get("Terminal"); // NOI18N
if (iop == null) {
System.out.printf("IOProviderActionSupport.getTermIOProvider() couldn't find our provider\n");
iop = IOProvider.getDefault();
}
return iop;
}
示例3: SimpleRenderVisitor
import org.openide.windows.IOProvider; //导入方法依赖的package包/类
/** Creates a new instance of SimpleRenderVisitor */
public SimpleRenderVisitor() {
IOProvider iop = IOProvider.getDefault();
InputOutput io = iop.getIO( "SimpleRenderVisitor", false );
this.ow = io.getOut();
}
示例4: setUp
import org.openide.windows.IOProvider; //导入方法依赖的package包/类
protected void setUp(boolean select) throws Exception {
System.out.printf("TestSupport.setUp()\n");
if (defaultContainer) {
ioContainer = IOContainer.getDefault();
actualContainer = defaultContainer(ioContainer);
} else {
TerminalContainer tc = TerminalContainer.create(null, "Test");
actualContainer = tc;
ioContainer = tc.ioContainer();
}
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
frame = new JFrame();
frame.getContentPane().setLayout(new BorderLayout());
frame.getContentPane().add(actualContainer, BorderLayout.CENTER);
frame.setBounds(20, 20, 700, 300);
frame.setVisible(true);
}
});
if (defaultProvider) {
ioProvider = IOProvider.getDefault();
assertNotNull ("Could not find IOProvider", ioProvider);
} else {
ioProvider = IOProvider.get("Terminal");
assertNotNull ("Could not find IOProvider", ioProvider);
//this check is really strange as terminal CAN be default, why not?
assertTrue("Got provider which is not TerminalIOProvider", (ioProvider instanceof TerminalIOProvider));
}
dummyAction = new DummyAction();
Action[] actions = new Action[] {dummyAction};
io = ioProvider.getIO("test", actions, ioContainer);
assertNotNull ("Could not get InputOutput", io);
if (select) {
io.select();
sleep(1); // give select time to take effect
}
}
示例5: testTTGGC
import org.openide.windows.IOProvider; //导入方法依赖的package包/类
public void testTTGGC() throws Exception {
IOProvider.getDefault(); // initialize stdio streams to default, else we will get stack overflow later
final List<Reference<Thread>> t = new ArrayList<Reference<Thread>>();
Runnable r = new Runnable() {
public void run() {
System.out.println("Running a task in the execution engine...");
t.add(new WeakReference<Thread>(Thread.currentThread()));
Runnable r1 = new Runnable() {
public void run() {
System.out.println("Ran second thread.");
}
};
Thread nue1 = new Thread(r1);
nue1.start();
try {
nue1.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
t.add(new WeakReference<Thread>(nue1));
Runnable r2 = new Runnable() {
public void run() {
System.out.println("Ran third thread.");
}
};
Thread nue2 = new Thread(r2);
nue2.start();
t.add(new WeakReference<Thread>(nue2));
Runnable r3 = new Runnable() {
public void run() {
fail("Should not have even run.");
}
};
Thread nue3 = new Thread(r3);
t.add(new WeakReference<Thread>(nue3));
System.out.println("done.");
}
};
ExecutorTask task = ExecutionEngine.getDefault().execute("foo", r, null);
assertEquals(0, task.result());
assertFalse(t.toString(), t.contains(null));
r = null;
task = null;
assertGC("Collected secondary task thread too", t.get(1));
assertGC("Collected forked task thread too", t.get(2));
assertGC("Collected unstarted task thread too", t.get(3));
/*
Thread main = t.get(0).get();
if (main != null) {
assertFalse(main.isAlive());
main = null;
}
*/
assertGC("Collected task thread " + t.get(0).get(), t.get(0));
}
示例6: performAction
import org.openide.windows.IOProvider; //导入方法依赖的package包/类
@Override
protected void performAction(Node[] activatedNodes) {
Node node = activatedNodes[0];
DataObject c = (DataObject) node.getCookie(DataObject.class);
// TODO use c
// Extract the prop keys
FileObject foProperty = c.getPrimaryFile();
FindInfoComposite fic = null;
try {
URL propertiesUrl = null;
propertiesUrl = foProperty.getURL();
PropertiesKeyExtractor pke = new PropertiesKeyExtractor(propertiesUrl);
fic = pke.extract();
} catch (FileStateInvalidException ex) {
ex.printStackTrace();
}
if (fic != null) {
// Output tab text visiting render
SimpleRenderVisitor srv = new SimpleRenderVisitor();
// Count #match per FindItem
CounterListener counterListener = new CounterListener();
// search extracted key props in this project
Project project = ProjectHelper.findProject(node);
FileObject projectDirectoryFileObject = project.getProjectDirectory();
for (Enumeration files = projectDirectoryFileObject.getData(true); files.hasMoreElements();) {
FileObject fo = (FileObject) files.nextElement();
final String foMimeType = fo.getMIMEType();
if (foMimeType.startsWith("text")) { // f.getName().endsWith("java")) {
File f = FileUtil.toFile(fo);
System.out.println("f " + f.toString());
SingleFileSearcher sfs = new SingleFileSearcher(f);
sfs.getSearchVisitor().addPropertyChangeListener(counterListener);
SearchInfoComposite sic = sfs.search(fic);
if (sic != null && sic.getSize() > 0) {
sic.accept(srv);
}
sfs.getSearchVisitor().removePropertyChangeListener(counterListener);
}
}
// TODO what to do with counterListener???!!!
IOProvider iop = IOProvider.getDefault();
OutputWriter ow = iop.getIO("FindPropertyKey Counter", false).getOut();
List<ComponentCounter<FindItem>> ccfil = counterListener.getCounterFindItemList();
for (Iterator<ComponentCounter<FindItem>> i = ccfil.iterator(); i.hasNext();) {
ComponentCounter<FindItem> ccfi = i.next();
FindItem fi = ccfi.getComponent();
Integer count = ccfi.getCount();
ow.println(fi.getPattern() + ": " + count);
}
}
}
示例7: createIO
import org.openide.windows.IOProvider; //导入方法依赖的package包/类
private InputOutput createIO() {
IOProvider iop = IOProvider.getDefault();
InputOutput io = iop.getIO( name, newIO );
return io;
}