Refine search
/*package*/ static void registerItemInDataObject(DataObject obj, NativeFileItem item) { if (obj != null) { NativeFileItemSet set = obj.getLookup().lookup(NativeFileItemSet.class); if (set != null) { set.add(item); if (item instanceof NativeFileItemImpl) { ((NativeFileItemImpl)item).lastDataObject = obj; } } } }
/** * Returns a cloneable editor lookup for specified data object. * The CloneableEditorSupport has to be in data object lookup. * @param dataObject the data object * @return the cloneable editor support */ public static CloneableEditorSupport getCloneableEditorSupport(DataObject dataObject) { CloneableEditorSupport editorSupport = dataObject.getLookup().lookup(CloneableEditorSupport.class); if (editorSupport == null) { throw Debug.illegalArgument("Missing CloneableEditorSupport in DataObject lookup", dataObject); // NOI18N } return editorSupport; }
private void detachFrom(DataObject dao) { if (dao != null) { LOG.log(Level.FINEST, "detaching {0} from {1}", new Object[]{System.identityHashCode(this), dao}); dao.removePropertyChangeListener(this); NativeFileItemSet set = dao.getLookup().lookup(NativeFileItemSet.class); if (set != null) { set.remove(this); } } }
private Document getDocument() { Document document = docRef.get(); if (document != null) { return document; } DataObject dataObject = getDataObject(); EditorCookie ec = dataObject == null ? null : dataObject.getLookup().lookup(EditorCookie.class); if (ec == null) { return null; } Document doc = ec.getDocument(); docRef = new WeakReference<>(doc); return doc; }
private static BaseDocument getDocument(final FileObject fo) throws DataObjectNotFoundException, IOException { BaseDocument doc = null; DataObject dObj = DataObject.find(fo); if (dObj != null) { EditorCookie editor = dObj.getLookup().lookup(EditorCookie.class); if (editor != null) { doc = (BaseDocument) editor.openDocument(); } } return doc; }
public static LineCookie getLineCookie(final FileObject fo) { LineCookie result = null; try { DataObject dataObject = DataObject.find(fo); if (dataObject != null) { result = dataObject.getLookup().lookup(LineCookie.class); } } catch (DataObjectNotFoundException e) { e.printStackTrace(); } return result; }