本文整理匯總了Java中org.openide.loaders.DataObject.getLookup方法的典型用法代碼示例。如果您正苦於以下問題:Java DataObject.getLookup方法的具體用法?Java DataObject.getLookup怎麽用?Java DataObject.getLookup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.openide.loaders.DataObject
的用法示例。
在下文中一共展示了DataObject.getLookup方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: runAction
import org.openide.loaders.DataObject; //導入方法依賴的package包/類
private void runAction(String action) {
Project project = getProject();
if (project != null) {
Lookup lookup = project.getLookup();
if (fileForDocument != null) {
try {
DataObject dobj = DataObject.find(fileForDocument);
lookup = dobj.getLookup();
} catch (DataObjectNotFoundException ex) {
Exceptions.printStackTrace(ex);
}
}
ActionProvider provider = project.getLookup().lookup(ActionProvider.class);
if (provider != null) {
if (provider.isActionEnabled(action, lookup)) {
provider.invokeAction(action, lookup);
}
}
}
}
示例2: testLookup
import org.openide.loaders.DataObject; //導入方法依賴的package包/類
public void testLookup() throws Exception {
clearWorkDir();
File propFile = new File(getWorkDir(), "foo.properties");
propFile.createNewFile();
DataObject propDO = DataObject.find(FileUtil.toFileObject(propFile));
Lookup lookup = propDO.getLookup();
PropertiesEncoding encoding = lookup.lookup(PropertiesEncoding.class);
assertNotNull(encoding);
assertSame(encoding, lookup.lookup(FileEncodingQueryImplementation.class));
}
示例3: SimpleES
import org.openide.loaders.DataObject; //導入方法依賴的package包/類
public SimpleES(DataObject obj, Entry entry, CookieSet set, Callable<Pane> paneFactory) {
super(obj, obj.getLookup(), new Environment(obj, entry));
this.set = set;
this.factory = paneFactory;
}
示例4: DataEditorSupport
import org.openide.loaders.DataObject; //導入方法依賴的package包/類
/** Editor support for given data object. The content of editor is taken
* from the primary file of the data object. The lookup can be anything,
* but it is recommended to use {@link DataObject#getLookup()}.
*
* @param obj object to create editor for
* @param lkp lookup to use. if <code>null</code>, then {@link DataObject#getLookup()} is used.
* @param env environment responsible for loading/storing the strams
* @since 7.28
*/
public DataEditorSupport(DataObject obj, @NullAllowed Lookup lkp, CloneableEditorSupport.Env env) {
super (env, lkp == null ? obj.getLookup() : lkp);
this.obj = obj;
}
示例5: SimpleES
import org.openide.loaders.DataObject; //導入方法依賴的package包/類
/** Constructor.
* @param obj data object to work on
* @param set set to add/remove save cookie from
*/
public SimpleES (DataObject obj, MultiDataObject.Entry entry) {
super(obj, obj.getLookup(), new ESEnv(obj, entry));
}