本文整理匯總了Java中org.openide.nodes.Node.Cookie方法的典型用法代碼示例。如果您正苦於以下問題:Java Node.Cookie方法的具體用法?Java Node.Cookie怎麽用?Java Node.Cookie使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.openide.nodes.Node
的用法示例。
在下文中一共展示了Node.Cookie方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: checkLookup
import org.openide.nodes.Node; //導入方法依賴的package包/類
private static void checkLookup(DataObject obj, int expected) throws DataObjectNotFoundException {
Collection<? extends Object> all = obj.getLookup().lookupAll(Object.class);
int cnt = 0;
for (Object object : all) {
assertEquals("Is in lkp", object, obj.getLookup().lookup(object.getClass()));
Class c = object.getClass();
if (object instanceof EditorCookie) {
c = EditorCookie.class;
}
if (object instanceof Node.Cookie) {
assertEquals("Is in cookie: " + c.getSuperclass(), object, obj.getCookie(c));
}
cnt++;
}
assertEquals("There are some items:\n" + all, expected, cnt);
}
示例2: findCloneableEditorSupport
import org.openide.nodes.Node; //導入方法依賴的package包/類
private CloneableEditorSupport findCloneableEditorSupport() {
Node.Cookie obj = dataObject.getCookie(org.openide.cookies.OpenCookie.class);
if (obj instanceof CloneableEditorSupport) {
return (CloneableEditorSupport)obj;
}
obj = dataObject.getCookie(org.openide.cookies.EditorCookie.class);
if (obj instanceof CloneableEditorSupport) {
return (CloneableEditorSupport)obj;
}
return null;
}
示例3: getCookie
import org.openide.nodes.Node; //導入方法依賴的package包/類
@Override
@SuppressWarnings("unchecked")
public Node.Cookie getCookie(Class cls) {
if ( cls == Database.class ) {
return model;
} else {
return super.getCookie(cls);
}
}
示例4: getCookie
import org.openide.nodes.Node; //導入方法依賴的package包/類
@Override
@SuppressWarnings("unchecked")
public Node.Cookie getCookie(Class cls) {
if ( cls == DatabaseServer.class ) {
return server;
} else {
return super.getCookie(cls);
}
}
示例5: openDataObjectByCookie
import org.openide.nodes.Node; //導入方法依賴的package包/類
private boolean openDataObjectByCookie(DataObject dataObject) {
Node.Cookie cookie;
Class cookieClass;
if (((( cookie = dataObject.getCookie(cookieClass = EditorCookie.Observable.class)) != null
|| (cookie = dataObject.getCookie(cookieClass = EditorCookie.class)) != null))
|| (cookie = dataObject.getCookie(cookieClass = OpenCookie.class)) != null
|| (cookie = dataObject.getCookie(cookieClass = EditCookie.class)) != null
|| (cookie = dataObject.getCookie(cookieClass = ViewCookie.class)) != null) {
return openByCookie(cookie, cookieClass);
}
return false;
}
示例6: performAction
import org.openide.nodes.Node; //導入方法依賴的package包/類
/** Performs action. Overrides superclass method. */
protected void performAction (Node[] activatedNodes) {
Node n = activatedNodes[0]; // we supposed that one node is activated
Node.Cookie cake = n.getCookie(PropertiesLocaleNode.class);
PropertiesLocaleNode pln = (PropertiesLocaleNode)cake;
String lang = Util.getLocaleSuffix(pln.getFileEntry());
if (lang.length() > 0)
if (lang.charAt(0) == PropertiesDataLoader.PRB_SEPARATOR_CHAR)
lang = lang.substring(1);
NotifyDescriptor.InputLine dlg = new NotifyDescriptor.InputLine(
NbBundle.getMessage(LangRenameAction.class,
"LBL_RenameLabel"), //NOI18N
NbBundle.getMessage(LangRenameAction.class,
"LBL_RenameTitle")); //NOI18N
dlg.setInputText(lang);
if (NotifyDescriptor.OK_OPTION.equals(DialogDisplayer.getDefault().notify(dlg))) {
try {
pln.setName(Util.assembleName (pln.getFileEntry().getDataObject().getPrimaryFile().getName(), dlg.getInputText()));
}
catch (IllegalArgumentException e) {
// catch & report badly formatted names
NotifyDescriptor.Message msg = new NotifyDescriptor.Message(
MessageFormat.format(
NbBundle.getBundle("org.openide.actions.Bundle").getString("MSG_BadFormat"),
new Object[] {pln.getName()}),
NotifyDescriptor.ERROR_MESSAGE);
DialogDisplayer.getDefault().notify(msg);
}
}
}
示例7: initialize
import org.openide.nodes.Node; //導入方法依賴的package包/類
/** Initializes the object. Used by construction and deserialized. */
private void initialize() {
bundleStructure = null;
Class<? extends Node.Cookie>[] arr = (Class<Node.Cookie>[]) new Class[2];
arr[0] = PropertiesOpen.class;
arr[1] = PropertiesEditorSupport.class;
getCookieSet().add(arr, this);
getCookieSet().assign(PropertiesEncoding.class, getEncoding());
}
示例8: getCookie
import org.openide.nodes.Node; //導入方法依賴的package包/類
@Override
public <T extends Node.Cookie> T getCookie(Class<T> type) {
if ( type == BiFeatureNode.class )
return type.cast(this);
return getCookieSet().getCookie( type );
}
示例9: checkCookieSet
import org.openide.nodes.Node; //導入方法依賴的package包/類
@Override
final void checkCookieSet(Class<?> c) {
if (Node.Cookie.class.isAssignableFrom(c) && !cookieSetFixed) {
Class<? extends Node.Cookie> cookie = c.asSubclass(Node.Cookie.class);
fixCookieSet(cookie, false);
}
}
示例10: openInEditor
import org.openide.nodes.Node; //導入方法依賴的package包/類
private void openInEditor(FileObject fo) {
DataObject dobj;
try {
dobj = DataObject.find(fo);
} catch (DataObjectNotFoundException e) {
Exceptions.printStackTrace(e);
return;
}
if (dobj != null) {
Node.Cookie cookie = dobj.getLookup().lookup(OpenCookie.class);
if (cookie != null) {
((OpenCookie) cookie).open();
}
}
}
示例11: createCookie
import org.openide.nodes.Node; //導入方法依賴的package包/類
public <T extends Node.Cookie> T createCookie(Class<T> klass) {
if (klass.isAssignableFrom(DES.class)) {
return klass.cast(new DES(this, new MyEnv(this)));
} else {
return null;
}
}
示例12: createCookie
import org.openide.nodes.Node; //導入方法依賴的package包/類
/** Implements <code>CookieSet.Factory</code> interface. */
public Node.Cookie createCookie(Class clazz) {
if(clazz.isAssignableFrom(TXTEditorSupport.class))
return getEditorSupport();
else
return null;
}
示例13: createCookie
import org.openide.nodes.Node; //導入方法依賴的package包/類
/** Implements <code>CookieSet.Factory</code> interface method. */
@SuppressWarnings("unchecked")
public <T extends Node.Cookie> T createCookie(Class<T> clazz) {
if(clazz.isAssignableFrom(PropertiesOpen.class)) {
return (T) getOpenSupport();
} else if(clazz.isAssignableFrom(PropertiesEditorSupport.class)) {
return (T) ((PropertiesFileEntry)getPrimaryEntry()).getPropertiesEditor();
} else {
return null;
}
}
示例14: createCookie
import org.openide.nodes.Node; //導入方法依賴的package包/類
/**
*/
public Node.Cookie createCookie (Class clazz) {
if ( clazz.isAssignableFrom (GenerateDTDSupport.class) ) {
return new GenerateDTDSupport (this.dataObject);
}
return null;
}
示例15: getCookie
import org.openide.nodes.Node; //導入方法依賴的package包/類
@Override
public <T extends Node.Cookie> T getCookie(Class<T> clazz) {
if (clazz.isAssignableFrom(OpenCookie.class)) {
return clazz.cast(new OpenCookie () {
public void open() {
}
});
}
return super.getCookie(clazz);
}