當前位置: 首頁>>代碼示例>>Java>>正文


Java DataObject.getNodeDelegate方法代碼示例

本文整理匯總了Java中org.openide.loaders.DataObject.getNodeDelegate方法的典型用法代碼示例。如果您正苦於以下問題:Java DataObject.getNodeDelegate方法的具體用法?Java DataObject.getNodeDelegate怎麽用?Java DataObject.getNodeDelegate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.openide.loaders.DataObject的用法示例。


在下文中一共展示了DataObject.getNodeDelegate方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getPopupPresenter

import org.openide.loaders.DataObject; //導入方法依賴的package包/類
@Override
public JMenuItem getPopupPresenter() {
    Lookup l = Utilities.actionsGlobalContext();
    Collection<? extends MatchingObject> matchingObjects
            = l.lookupAll(MatchingObject.class);
    LinkedHashSet<Action> commonActions = new LinkedHashSet<Action>();
    boolean first = true;
    for (MatchingObject mo : matchingObjects) {
        DataObject dob = mo.getDataObject();
        if (dob != null) {
            Node nodeDelegate = dob.getNodeDelegate();
            Collection<Action> dobActions = Arrays.asList(
                    nodeDelegate.getActions(false));
            if (first) {
                commonActions.addAll(dobActions);
                first = false;
            } else {
                commonActions.retainAll(dobActions);
            }
        }
    }
    return actionsToMenu(commonActions, l);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:24,代碼來源:MoreAction.java

示例2: createNode

import org.openide.loaders.DataObject; //導入方法依賴的package包/類
@Override
public Node createNode() {
    // TODO there can be more manifests
    AndroidManifestSource ams = p.getLookup().lookup(AndroidManifestSource.class);
    FileObject manifestFO = ams != null ? ams.get() : null;
    if (manifestFO != null) {
        try {
            DataObject dobj = DataObject.find(manifestFO);
            return new AndroidResourceNode(dobj.getNodeDelegate(), p, AndroidConstants.ANDROID_MANIFEST_XML);
        } catch (DataObjectNotFoundException ex) {
            Exceptions.printStackTrace(ex);
        }
    }
    return null;

}
 
開發者ID:NBANDROIDTEAM,項目名稱:NBANDROID-V2,代碼行數:17,代碼來源:AndroidGradleNodes.java

示例3: testRenameAction

import org.openide.loaders.DataObject; //導入方法依賴的package包/類
public void testRenameAction() throws InterruptedException, InvocationTargetException, IOException {
    DataObject testdo = DataObject.find(f);
    final Node node = testdo.getNodeDelegate();
    
    InstanceContent ic = new InstanceContent();
    Lookup lookup = new AbstractLookup(ic);
    ic.add(node);
    final Action rename = RefactoringActionsFactory.renameAction().createContextAwareInstance(lookup);
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            if (rename.isEnabled()) {
                rename.actionPerformed(RefactoringActionsFactory.DEFAULT_EVENT);
                if (!((RenameRefactoring) DD.rui.getRefactoring()).getRefactoringSource().lookup(FileObject.class).equals(f))
                    fail("Rename dialog was opened with wrong data");
            } else {
                fail("Action is not enabled.");
            }
        }
    });
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:ActionInvocationTest.java

示例4: ShortcutAction

import org.openide.loaders.DataObject; //導入方法依賴的package包/類
/** Create a new presenter.
 * @param obj XML file describing it
 */
public ShortcutAction(DataObject obj, String helpID, boolean showmaster) {
    this.obj = obj;
    this.helpID = helpID;
    this.showmaster = showmaster;
    putValue("noIconInMenu", true); // NOI18N
    Installer.log.log(Level.FINE, "new ShortcutAction: {0} {1} showmaster={2}", new Object[] {obj, helpID, showmaster});
    updateText();
    updateIcon();
    updateEnabled();
    if (obj.isValid()) {
        Node n = obj.getNodeDelegate();
        n.addNodeListener(org.openide.nodes.NodeOp.weakNodeListener (this, n));
    }
    Help h = findHelp();
    if (h != null) {
        h.addChangeListener(WeakListeners.change(this, h));
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:HelpCtxProcessor.java

示例5: updateDataObject

import org.openide.loaders.DataObject; //導入方法依賴的package包/類
/**
 * Update data object. Can be called when a module is enabled and new data
 * loader produces new data object.
 */
public void updateDataObject(DataObject updatedDataObject) {
    FileObject updatedPF = updatedDataObject.getPrimaryFile();
    if (dataObject == null
            || dataObject.getPrimaryFile().equals(updatedPF)) {
        if (updatedPF.isValid()) {
            this.invalidityStatus = null;
            if (fileListener == null) {
                this.fileListener = new FileListener();
                updatedPF.addFileChangeListener(fileListener);
            } else if (updatedPF != dataObject.getPrimaryFile()) {
                dataObject.getPrimaryFile().removeFileChangeListener(
                        fileListener);
                updatedPF.addFileChangeListener(fileListener);
            }
            this.dataObject = updatedDataObject;
            this.nodeDelegate = updatedDataObject.getNodeDelegate();
            this.valid = true;
            for (TextDetail td : textDetails) {
                td.updateDataObject(updatedDataObject);
            }
        }
    } else {
        throw new IllegalArgumentException(
                "Expected data object for the same file");          //NOI18N
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:31,代碼來源:MatchingObject.java

示例6: testCreateNodeForInvalidDataObject

import org.openide.loaders.DataObject; //導入方法依賴的package包/類
/**
 * Test for bug 217984.
 */
public void testCreateNodeForInvalidDataObject() throws IOException {
    ResultModel rm = SearchTestUtils.createResultModelWithOneMatch();
    MatchingObject mo = rm.getMatchingObjects().get(0);
    DataObject dob = mo.getDataObject();
    FileObject fob = mo.getFileObject();
    Node original = dob.getNodeDelegate();
    fob.delete();
    // No exception should be thrown from the constructor.
    Node n = new MatchingObjectNode(original, Children.LEAF, mo, false);
    assertEquals("test.txt", n.getDisplayName());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:MatchingObjectNodeTest.java

示例7: close

import org.openide.loaders.DataObject; //導入方法依賴的package包/類
@Override
protected boolean close(boolean ask) {
    boolean closed = super.close(ask);
    DataObject dobj = getDataObject();
    if(closed && dobj.isValid()) {
        //set the original property sets
        HtmlDataNode nodeDelegate = (HtmlDataNode)dobj.getNodeDelegate();
        nodeDelegate.setPropertySets(null);
    }
    return closed;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:HtmlEditorSupport.java

示例8: prepareTemplates

import org.openide.loaders.DataObject; //導入方法依賴的package包/類
public static List<TemplateItem> prepareTemplates(@NullAllowed Project project, @NonNull Lookup lookup) {
    // check the action context for recommmended/privileged templates..
    PrivilegedTemplates privs = lookup.lookup(PrivilegedTemplates.class);
    final List<TemplateItem> items = new ArrayList<TemplateItem>();
    for (DataObject template : OpenProjectList.getDefault().getTemplatesLRU(project, privs)) {
        Node delegate = template.getNodeDelegate();
        items.add(new TemplateItem(template, delegate.getDisplayName(), ImageUtilities.image2Icon(delegate.getIcon(BeanInfo.ICON_COLOR_16x16))));
    }
    return items;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:OpenProjectList.java

示例9: 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];
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:ProjectTemplatePanel.java

示例10: getDisplayName

import org.openide.loaders.DataObject; //導入方法依賴的package包/類
@Override
public String getDisplayName() {

    String retValue = null;
    DataFolder folder = (DataFolder)getCookie( DataFolder.class );
    if( null != folder ) {
        FileObject fob = folder.getPrimaryFile();
        Object catName = fob.getAttribute( CAT_NAME );
        if (catName instanceof String)
            retValue = catName.toString();
    } 
    if( null == retValue ) {
        retValue = super.getDisplayName();
    }
    // XXX poor impl; should not depend on org.openide.loaders.Bundle#FMT_shadowName:
    if( null != retValue && retValue.indexOf("\u2192") > 0 ) {
        DataShadow shadow = (DataShadow)getCookie( DataShadow.class );
        if( null != shadow ) {
            DataObject dobj = shadow.getOriginal();
            if( null != dobj ) {
                Node origNode = dobj.getNodeDelegate();
                if( null != origNode && null != origNode.getDisplayName() ) {
                    retValue = origNode.getDisplayName();
                }
            }
        }
    }
    return retValue;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:30,代碼來源:CategoryNode.java

示例11: getCategoryNode

import org.openide.loaders.DataObject; //導入方法依賴的package包/類
protected Node getCategoryNode( String catName ) throws DataObjectNotFoundException {
    FileObject fo = getCategoryFile( catName );
    DataObject dobj = DataObject.find( fo );
    if( null == dobj ) {
        fail( "Category data object '" + catName + "' not found." );
    }
    return dobj.getNodeDelegate();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:AbstractPaletteTestHid.java

示例12: getItemNode

import org.openide.loaders.DataObject; //導入方法依賴的package包/類
protected Node getItemNode( String catName, String itemName ) throws DataObjectNotFoundException {
    FileObject fo = getItemFile( catName, itemName );
    DataObject dobj = DataObject.find( fo );
    if( null == dobj ) {
        fail( "Item data object '" + itemName + "' not found." );
    }
    return dobj.getNodeDelegate();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:AbstractPaletteTestHid.java

示例13: getIcon

import org.openide.loaders.DataObject; //導入方法依賴的package包/類
@Override
public Icon getIcon() {
    try {
        DataObject d = DataObject.find(file);
        Node n = d.getNodeDelegate();
        return ImageUtilities.image2Icon(n.getIcon(BeanInfo.ICON_COLOR_16x16));
    } catch (DataObjectNotFoundException ex) {
        LOG.log(Level.FINE, null, ex);
        return null;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:RunAnalysisPanel.java

示例14: testDisplayName

import org.openide.loaders.DataObject; //導入方法依賴的package包/類
public void testDisplayName() throws Exception {
    String res = "Settings/org-netbeans-modules-settings-convertors-testDisplayName.settings";
    FileObject fo = FileUtil.getConfigFile(res);
    assertNotNull(res, fo);
    assertNull("name", fo.getAttribute("name"));
    
    DataObject dobj = DataObject.find (fo);
    Node n = dobj.getNodeDelegate();
    assertNotNull(n);
    assertEquals("I18N", n.getDisplayName());
    
    // property sets have to be initialized otherwise the change name would be
    // propagated to the node after some delay (~2s)
    Object garbage = n.getPropertySets();
    
    InstanceCookie ic = (InstanceCookie) dobj.getCookie(InstanceCookie.class);
    assertNotNull (dobj + " does not contain instance cookie", ic);
    
    FooSetting foo = (FooSetting) ic.instanceCreate();
    String newName = "newName";
    foo.setName(newName);
    assertEquals(n.toString(), newName, n.getDisplayName());
    
    newName = "newNameViaNode";
    n.setName(newName);
    assertEquals(n.toString(), newName, n.getDisplayName());
    assertEquals(n.toString(), newName, foo.getName());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:29,代碼來源:SerialDataNodeTest.java

示例15: refreshPlatforms

import org.openide.loaders.DataObject; //導入方法依賴的package包/類
private void refreshPlatforms() {
    platformsList.clear();
    FileObject storage = FileUtil.getConfigFile(STORAGE);
    if (storage != null) {
        java.util.Map<String, PlatformCategoriesDescriptor> categories = new HashMap<String, PlatformCategoriesDescriptor>();
        for (FileObject child : storage.getChildren()) {
            try {
                final DataObject dobj = DataObject.find(child);
                Node node = dobj.getNodeDelegate();
                AndroidSdk platform = node.getLookup().lookup(AndroidSdk.class);
                if (platform != null) {
                    platformsList.add(platform);
                    final String platformType = "Android";
                    final String platformTypeDisplayName = "Android";
                    PlatformCategoriesDescriptor platforms = categories.get(platformType);
                    if (platforms == null) {
                        platforms = new PlatformCategoriesDescriptor(platformTypeDisplayName);
                        categories.put(platformType, platforms);
                    }
                    platforms.add(node);
                } else {
                    LOG.log(Level.WARNING, "Platform node for : {0} has no platform in its lookup.", node.getDisplayName());   //NOI18N
                }
            } catch (DataObjectNotFoundException e) {
                Exceptions.printStackTrace(e);
            }
        }
        List<PlatformCategoriesDescriptor> keys = new ArrayList<SdksCustomizer.PlatformCategoriesDescriptor>(categories.values());
        Collections.sort(keys);
        setKeys(keys);
    }
}
 
開發者ID:NBANDROIDTEAM,項目名稱:NBANDROID-V2,代碼行數:33,代碼來源:SdksCustomizer.java


注:本文中的org.openide.loaders.DataObject.getNodeDelegate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。