当前位置: 首页>>代码示例>>Java>>正文


Java CookieSet.add方法代码示例

本文整理汇总了Java中org.openide.nodes.CookieSet.add方法的典型用法代码示例。如果您正苦于以下问题:Java CookieSet.add方法的具体用法?Java CookieSet.add怎么用?Java CookieSet.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openide.nodes.CookieSet的用法示例。


在下文中一共展示了CookieSet.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: LayerDataObject

import org.openide.nodes.CookieSet; //导入方法依赖的package包/类
public LayerDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
    super(pf, loader);
    final CookieSet cookies = getCookieSet();
    final Lookup baseLookup = cookies.getLookup();
    lkp = new ProxyLookup(baseLookup) {
        final AtomicBoolean checked = new AtomicBoolean();
        protected @Override void beforeLookup(Template<?> template) {
            if (template.getType() == LayerHandle.class && checked.compareAndSet(false, true)) {
                FileObject xml = getPrimaryFile();
                Project p = FileOwnerQuery.getOwner(xml);
                if (p != null) {
                    setLookups(baseLookup, Lookups.singleton(new LayerHandle(p, xml)));
                }
            }
        }
    };
    registerEditor("text/x-netbeans-layer+xml", true);
    cookies.add(new ValidateXMLSupport(DataObjectAdapters.inputSource(this)));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:LayerDataObject.java

示例2: HtmlDataObject

import org.openide.nodes.CookieSet; //导入方法依赖的package包/类
/** New instance.
 * @param pf primary file object for this data object
 * @param loader the data loader creating it
 * @exception DataObjectExistsException if there was already a data object for it
 */
public HtmlDataObject(FileObject pf, UniFileLoader loader) throws DataObjectExistsException {
    super(pf, loader);
    CookieSet set = getCookieSet();
    set.add(HtmlEditorSupport.class, this);
    set.add(ViewSupport.class, this);
    set.assign(SaveAsCapable.class, new SaveAsCapable() {
        public void saveAs( FileObject folder, String fileName ) throws IOException {
            HtmlEditorSupport es = getCookie( HtmlEditorSupport.class );
            try {
                es.updateEncoding();
                es.saveAs( folder, fileName );
            } catch (UserCancelException e) {
                //ignore, just not save anything
            }
        }
    });

    set.assign(FileEncodingQueryImplementation.class, new FileEncodingQueryImpl());
            
    //add check/validate xml cookies
    InputSource in = DataObjectAdapters.inputSource(this);
    set.add(new ValidateXMLSupport(in));
    set.add(new CheckXMLSupport(in));
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:HtmlDataObject.java

示例3: JShellDataObject

import org.openide.nodes.CookieSet; //导入方法依赖的package包/类
public JShellDataObject(FileObject fo, MultiFileLoader loader) throws DataObjectExistsException {
    super(fo, loader);
    CookieSet cks = getCookieSet();
    cks.add(new Class[] {
            OpenCookie.class,
            EditorCookie.Observable.class,
            CloseCookie.class,
            LineCookie.class,
            SimpleES.class,
        }, new CookieSet.Factory() {
        private CloneableEditorSupport supp;
        public <T extends Node.Cookie> T createCookie(Class<T> klass) {
            if (supp != null) {
                return klass.cast(supp);
            }
            return klass.cast(
                    /*
                    supp = DataEditorSupport.create(JShellDataObject.this, 
                            getPrimaryEntry(), getCookieSet(), 
                            () -> createPane())
                    );*/
                    supp = new SimpleES(JShellDataObject.this, getPrimaryEntry())
            );
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:JShellDataObject.java

示例4: PropertiesLocaleNode

import org.openide.nodes.CookieSet; //导入方法依赖的package包/类
/** Creates a new PropertiesLocaleNode for the given locale-specific file */
public PropertiesLocaleNode (PropertiesFileEntry fe) {
    super(fe, fe.getChildren());
    setDisplayName(Util.getLocaleLabel(fe));

    setIconBaseWithExtension(LOCALE_ICON_BASE);        
    setShortDescription(messageToolTip());

    // the node uses lookup based on CookieSet from PropertiesFileEntry
    CookieSet cookieSet = fe.getCookieSet();
    cookieSet.add(PropertiesOpen.class, this);
    cookieSet.add(fe);
    cookieSet.add(fe.getDataObject());
    cookieSet.add(this);

    fsStatusListener = new FSListener();
    try {
        FileSystem fs = fe.getFile().getFileSystem();
        fs.addFileStatusListener(FileUtil.weakFileStatusListener(fsStatusListener, fs));
    } catch (FileStateInvalidException ex) {
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:PropertiesLocaleNode.java

示例5: EntityDataObject

import org.openide.nodes.CookieSet; //导入方法依赖的package包/类
public EntityDataObject (final FileObject obj, final UniFileLoader loader) throws DataObjectExistsException {
        super (obj, loader);

        CookieSet set = getCookieSet();
        set.add (cookieManager = new DataObjectCookieManager (this, set));
        
        final TextEditorSupport.TextEditorSupportFactory editorFactory =
            new TextEditorSupport.TextEditorSupportFactory (this, MIME_TYPE);
        editorFactory.registerCookies (set);

//         CookieSet.Factory treeEditorFactory = new TreeEditorCookieImpl.CookieFactoryImpl (this);
//         set.add (TreeEditorCookie.class, treeEditorFactory);

        // add check cookie
        InputSource in = DataObjectAdapters.inputSource(this);
        set.add(new CheckXMLSupport(in, CheckXMLSupport.CHECK_ENTITY_MODE));
        
//         new CookieManager (this, set, EntityCookieFactoryCreator.class);
        //enable "Save As"
        set.assign( SaveAsCapable.class, new SaveAsCapable() {
            public void saveAs(FileObject folder, String fileName) throws IOException {
                editorFactory.createEditor().saveAs( folder, fileName );
            }
        });
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:EntityDataObject.java

示例6: HibernateCfgDataObject

import org.openide.nodes.CookieSet; //导入方法依赖的package包/类
public HibernateCfgDataObject(FileObject pf, HibernateCfgDataLoader loader) throws DataObjectExistsException, IOException {
    super(pf, loader);
    
    // Make sure to reset the MIME type here. See bug 127051
    getEditorSupport().setMIMEType(HibernateCfgDataLoader.REQUIRED_MIME);

    // Synchronize between the vew and XML file
    modelSynchronizer = new ModelSynchronizer(this);

    CookieSet cookies = getCookieSet();
    //cookies.add((Node.Cookie) DataEditorSupport.create(this, getPrimaryEntry(), cookies));
    org.xml.sax.InputSource in = DataObjectAdapters.inputSource(this);
    CheckXMLCookie checkCookie = new CheckXMLSupport(in);
    cookies.add(checkCookie);
    ValidateXMLCookie validateCookie = new ValidateXMLSupport(in);
    cookies.add(validateCookie);
    parseDocument();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:HibernateCfgDataObject.java

示例7: GlslGeometryShaderDataObject

import org.openide.nodes.CookieSet; //导入方法依赖的package包/类
public GlslGeometryShaderDataObject(FileObject pf, GlslGeometryShaderDataLoader loader) throws DataObjectExistsException, IOException {

        super(pf, loader);

        CookieSet cookies = getCookieSet();
        observer = new GlslShaderFileObserver(this);

        final CloneableEditorSupport support = DataEditorSupport.create(this, getPrimaryEntry(), cookies);
        support.addPropertyChangeListener(new PropertyChangeListener() {

            public void propertyChange(PropertyChangeEvent event) {
                if ("document".equals(event.getPropertyName())) {
                    if (event.getNewValue() != null) {
                        support.getDocument().addDocumentListener(observer);
                        observer.runCompileTask();
                    } else if (event.getOldValue() != null) {
                        // cylab: I think this is never called.
                        // But I don't know if unregistering the observer makes any difference...
                        ((Document) event.getOldValue()).removeDocumentListener(observer);
                    }
                }
            }
        });
        cookies.add((Node.Cookie) support);
    }
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:26,代码来源:GlslGeometryShaderDataObject.java

示例8: AntProjectDataObject

import org.openide.nodes.CookieSet; //导入方法依赖的package包/类
public AntProjectDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
    super(pf, loader);
    CookieSet cookies = getCookieSet();
    cookies.add (new AntProjectDataEditor (this));
    FileObject prim = getPrimaryFile ();
    AntProjectCookie proj = new AntProjectSupport (prim);
    cookies.add (proj);
    if (proj.getFile () != null) {
        cookies.add (new AntActionInstance (proj));
    }
    cookies.add(new CheckXMLSupport(DataObjectAdapters.inputSource(this)));
    addPropertyChangeListener (this);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:AntProjectDataObject.java

示例9: JnlpDataObject

import org.openide.nodes.CookieSet; //导入方法依赖的package包/类
public JnlpDataObject(FileObject pf, JnlpDataLoader loader) throws DataObjectExistsException, IOException {
    super(pf, loader);
    registerEditor(JnlpDataLoader.REQUIRED_MIME, true);
    CookieSet cookies = getCookieSet();
    InputSource in = DataObjectAdapters.inputSource(this);
    CheckXMLSupport checkCookieImpl = new CheckXMLSupport(in);
    ValidateXMLSupport validateCookieImpl = new ValidateXMLSupport(in);
    cookies.add(checkCookieImpl);
    cookies.add(validateCookieImpl);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:JnlpDataObject.java

示例10: HibernateMappingDataObject

import org.openide.nodes.CookieSet; //导入方法依赖的package包/类
public HibernateMappingDataObject(FileObject pf, HibernateMappingDataLoader loader) throws DataObjectExistsException, IOException {
    super(pf, loader);

    CookieSet cookies = getCookieSet();
    org.xml.sax.InputSource in = DataObjectAdapters.inputSource(this);
    CheckXMLCookie checkCookie = new CheckXMLSupport(in);
    cookies.add(checkCookie);
    ValidateXMLCookie validateCookie = new ValidateXMLSupport(in);
    cookies.add(validateCookie);
    registerEditor(HibernateMappingDataLoader.REQUIRED_MIME, true);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:HibernateMappingDataObject.java

示例11: AntProjectDataObject

import org.openide.nodes.CookieSet; //导入方法依赖的package包/类
public AntProjectDataObject(
            FileObject pf, MultiFileLoader loader
        ) throws DataObjectExistsException, IOException {
            super(pf, loader);
            CookieSet cookies = getCookieSet();
            cookies.add (new AntProjectDataEditor (this));
            FileObject prim = getPrimaryFile ();
            AntProjectCookie proj = new AntProjectSupport (prim);
            cookies.add (proj);
            if (proj.getFile () != null) {
                cookies.add (new AntActionInstance (proj));
            }
//            cookies.add(new CheckXMLSupport(DataObjectAdapters.inputSource(this)));
            addPropertyChangeListener (this);
        }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:AntProjectDataObjectProblemTest.java

示例12: SQLDataObject

import org.openide.nodes.CookieSet; //导入方法依赖的package包/类
public SQLDataObject(FileObject primaryFile, MultiFileLoader loader) throws DataObjectExistsException {
    super(primaryFile, loader);
    CookieSet cookies = getCookieSet();
    final SQLEditorSupport sqlEditorSupport = new SQLEditorSupport(this);
    cookies.add(sqlEditorSupport);
    cookies.assign( SaveAsCapable.class, new SaveAsCapable() {
        @Override
        public void saveAs(FileObject folder, String fileName) throws IOException {
            sqlEditorSupport.saveAs( folder, fileName );
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:SQLDataObject.java

示例13: TestNGSuiteDataObject

import org.openide.nodes.CookieSet; //导入方法依赖的package包/类
public TestNGSuiteDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
    super(pf, loader);
    CookieSet cookies = getCookieSet();
    cookies.add(new CheckXMLSupport(DataObjectAdapters.inputSource(this)));
    cookies.add(new ValidateXMLSupport(DataObjectAdapters.inputSource(this)));
    registerEditor(MIME_TYPE, true);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:TestNGSuiteDataObject.java

示例14: JMEMaterialDataObject

import org.openide.nodes.CookieSet; //导入方法依赖的package包/类
public JMEMaterialDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
    super(pf, loader);
    CookieSet cookies = getCookieSet();
    if (getLookup().lookup(ProjectAssetManager.class) != null) {
        cookies.add((Node.Cookie) new MaterialOpenSupport(getPrimaryEntry()));
    }
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:8,代码来源:JMEMaterialDataObject.java

示例15: addSaveCookie

import org.openide.nodes.CookieSet; //导入方法依赖的package包/类
@Override
public void addSaveCookie(SaveCookie saveDiagram) {

    setModified(true);
    Node.Cookie saveCookie = getCookie(SaveCookie.class);
    if (saveCookie == null) {
        CookieSet cookies = getCookieSet();
        cookies.add(saveDiagram);
    }
}
 
开发者ID:jeddict,项目名称:NBModeler,代码行数:11,代码来源:ModelerFileDataObject.java


注:本文中的org.openide.nodes.CookieSet.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。