本文整理匯總了Java中org.openide.loaders.DataObject.isTemplate方法的典型用法代碼示例。如果您正苦於以下問題:Java DataObject.isTemplate方法的具體用法?Java DataObject.isTemplate怎麽用?Java DataObject.isTemplate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.openide.loaders.DataObject
的用法示例。
在下文中一共展示了DataObject.isTemplate方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createNodes
import org.openide.loaders.DataObject; //導入方法依賴的package包/類
@Override
protected Node[] createNodes(Node key) {
Node [] orig = super.createNodes (key);
Node [] filtered = new Node [orig.length];
for (int i = 0; i < orig.length; i++) {
FileObject fo = orig[i].getLookup ().lookup(FileObject.class);
boolean isTemplate;
if (fo != null) {
isTemplate = isTemplate(fo);
} else {
DataObject dobj = getDOFromNode (orig [i]);
isTemplate = dobj.isTemplate();
}
if (isTemplate) {
filtered [i] = new TemplateNode (orig [i], Children.LEAF);
} else {
filtered [i] = new TemplateNode (orig [i]);
}
}
return filtered;
}
示例2: createNodes
import org.openide.loaders.DataObject; //導入方法依賴的package包/類
@Override
protected Node[] createNodes(DataObject dobj) {
if (dobj.isTemplate()) {
Node templateNode = new FilterNode(dobj.getNodeDelegate(), Children.LEAF);
if( null == filterText || templateNode.getDisplayName().toLowerCase().contains( filterText.toLowerCase() ) )
return new Node[] { templateNode };
}
return new Node[0];
}
示例3: isTemplate
import org.openide.loaders.DataObject; //導入方法依賴的package包/類
private static boolean isTemplate (DataObject dobj) {
if (dobj.isTemplate())
return true;
if (dobj instanceof DataShadow) {
return ((DataShadow)dobj).getOriginal().isTemplate();
}
return false;
}
示例4: acceptTemplate
import org.openide.loaders.DataObject; //導入方法依賴的package包/類
private boolean acceptTemplate(DataObject d) {
if (d.isTemplate() || d instanceof DataFolder) {
Object o = d.getPrimaryFile().getAttribute("simple"); // NOI18N
return o == null || Boolean.TRUE.equals(o);
} else {
return false;
}
}
示例5: JavaNode
import org.openide.loaders.DataObject; //導入方法依賴的package包/類
/** Create a node for the Java data object using the default children.
* @param jdo the data object to represent
*/
public JavaNode (final DataObject jdo, boolean isJavaSource) {
super (jdo, Children.LEAF);
this.isJavaSource = isJavaSource;
this.isCompiled = new AtomicReference<>();
this.isExecutable = new AtomicReference<>();
this.computedIcon = new AtomicReference<>();
this.computedIconListener = new AtomicReference<>();
this.setIconBaseWithExtension(isJavaSource ? JAVA_ICON_BASE : CLASS_ICON_BASE);
Logger.getLogger("TIMER").log(Level.FINE, "JavaNode", new Object[] {jdo.getPrimaryFile(), this});
if (!jdo.isTemplate()) {
WORKER.post(IconTask.create(this));
if (isJavaSource) {
WORKER.post(new BuildStatusTask(this));
WORKER.post(new ExecutableTask(this));
jdo.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (DataObject.PROP_PRIMARY_FILE.equals(evt.getPropertyName())) {
Logger.getLogger("TIMER").log(Level.FINE, "JavaNode", new Object[]{jdo.getPrimaryFile(), this});
WORKER.post(new Runnable() {
public void run() {
computedIconListener.set(null);
synchronized (JavaNode.this) {
status = null;
executableListener = null;
WORKER.post(new BuildStatusTask(JavaNode.this));
WORKER.post(new ExecutableTask(JavaNode.this));
}
}
});
}
}
});
}
}
}
示例6: create
import org.openide.loaders.DataObject; //導入方法依賴的package包/類
@Override
public FileObject create(FileObject template, FileObject folder, String name) throws IOException {
DataObject templateDobj = DataObject.find(template);
if (templateDobj == null || !templateDobj.isTemplate()) {
return FileUtil.createData(folder, name);
}
DataFolder target = DataFolder.findFolder(folder);
String simpleName = FileObjects.stripExtension(name);
DataObject newDobj = templateDobj.createFromTemplate(target, simpleName);
return newDobj.getPrimaryFile();
}
示例7: enable
import org.openide.loaders.DataObject; //導入方法依賴的package包/類
protected boolean enable (Node[] activatedNodes) {
if (activatedNodes.length != 1) return false;
DataObject obj = activatedNodes[0].getCookie(DataObject.class);
return obj != null && obj.isTemplate ();
}