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


Java NewType類代碼示例

本文整理匯總了Java中org.openide.util.datatransfer.NewType的典型用法代碼示例。如果您正苦於以下問題:Java NewType類的具體用法?Java NewType怎麽用?Java NewType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: getNewTypes

import org.openide.util.datatransfer.NewType; //導入依賴的package包/類
/** Support for new types that can be created in this node.
 * @return array of new type operations that are allowed
 */
@Override
public NewType[] getNewTypes() {
    if (isReadOnly())
        return RADComponent.NO_NEW_TYPES;

    Class[] classes = supportedMenus.get(Integer.valueOf(getMenuItemType()));

    if (classes == null)
        return RADComponent.NO_NEW_TYPES;

    NewType[] types = new NewType[classes.length];
    for (int i = 0; i < types.length; i++)
        types[i] = new NewMenuType(classes[i]);

    return types;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:RADMenuComponent.java

示例2: getNewTypes

import org.openide.util.datatransfer.NewType; //導入依賴的package包/類
public NewType[] getNewTypes() {
    return new NewType[] { new NewType() {
        public String getName() {
            return bundle.getString("LBL_NewProp");
        }
        public HelpCtx getHelpCtx() {
            return new HelpCtx("org.myorg.systemproperties");
        }
        public void create() throws IOException {
            String title = bundle.getString("LBL_NewProp_dialog");
            String msg = bundle.getString("MSG_NewProp_dialog_key");
            NotifyDescriptor.InputLine desc = new NotifyDescriptor.InputLine(msg, title);
            DialogDisplayer.getDefault().notify(desc);
            String key = desc.getInputText();
            if ("".equals(key)) return;
            msg = bundle.getString("MSG_NewProp_dialog_value");
            desc = new NotifyDescriptor.InputLine(msg, title);
            DialogDisplayer.getDefault().notify(desc);
            String value = desc.getInputText();
            System.setProperty(key, value);
            PropertiesNotifier.changed();
        }
    } };
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:AllPropsNode.java

示例3: performAction

import org.openide.util.datatransfer.NewType; //導入依賴的package包/類
/** Performs action on given type
 */
private static void performAction(Node[] activatedNodes, NewType type) {
    PasteAction.NodeSelector sel = null;

    try {
        ExplorerManager em = PasteAction.findExplorerManager();

        if (em != null) {
            sel = new PasteAction.NodeSelector(em, activatedNodes);
        }

        type.create();
    } catch (java.io.IOException e) {
        Exceptions.printStackTrace(e);
    } finally {
        if (sel != null) {
            sel.select();
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:NewAction.java

示例4: newTypes

import org.openide.util.datatransfer.NewType; //導入依賴的package包/類
private NewType[] newTypes() {
    if (lookup != null) {
        java.util.Collection c = lookup.lookupResult(Node.class).allItems();

        if (c.size() == 1) {
            java.util.Iterator it = c.iterator();

            while (it.hasNext()) {
                Lookup.Item item = (Lookup.Item) it.next();
                Node n = (Node) item.getInstance();

                if (n != null) {
                    if (n == prevNode && prevTypes != null) {
                        return prevTypes;
                    }
                    prevNode = n;
                    prevTypes = n.getNewTypes();
                    return prevTypes;
                }
            }
        }
    }

    return getNewTypes();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:26,代碼來源:NewAction.java

示例5: performActionAt

import org.openide.util.datatransfer.NewType; //導入依賴的package包/類
public void performActionAt(int index) {
    NewType[] nt = newTypes();

    // bugfix #41587, AIOBE if array is empty
    if (nt.length <= index) {
        return;
    }

    Node[] arr;

    if (lookup != null) {
        arr = (Node[]) lookup.lookupAll(Node.class).toArray(new Node[0]);
    } else {
        arr = WindowManager.getDefault().getRegistry().getCurrentNodes();
    }

    performAction(arr, nt[index]);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:NewAction.java

示例6: getNewTypes

import org.openide.util.datatransfer.NewType; //導入依賴的package包/類
public NewType[] getNewTypes() {
    NewType nt = new NewType() {
        public void create() {
            if (array != null) {
                Object []newArray = (Object[])Array.newInstance(getConvertedType(), array.length+1);
                System.arraycopy(array, 0, newArray, 0, array.length);
                // throw away the old array!
                array = newArray;
                array[array.length-1] = defaultValue();
            } else {
                // throw away the old array!
                array = (Object[])Array.newInstance(getConvertedType(), 1);
                array[0] = defaultValue();
            }
            IndexedPropertyEditor.this.firePropertyChange();
            DisplayIndexedNode din = new DisplayIndexedNode(array.length-1);
            getChildren().add(new Node[] { din });
            Index i = (Index)getCookie(Index.class);
            i.addChangeListener(WeakListener.change(din, i));
        }
    };
    return new NewType[] { nt };
}
 
開發者ID:CharlesSkelton,項目名稱:studio,代碼行數:24,代碼來源:IndexedPropertyEditor.java

示例7: performAction

import org.openide.util.datatransfer.NewType; //導入依賴的package包/類
/** Performs action on given type
 */
private static void performAction (Node[] activatedNodes, NewType type) {
    PasteAction.NodeSelector sel = null;
    try {
        ExplorerManager em = PasteAction.findExplorerManager();
        if (em != null) {
            sel = new PasteAction.NodeSelector (em, activatedNodes);
        }
        type.create();
    } catch (java.io.IOException e) {
        DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(e.getMessage(), NotifyDescriptor.ERROR_MESSAGE));
    } finally {
        if (sel != null) {
            sel.select ();
        }
    }
}
 
開發者ID:CharlesSkelton,項目名稱:studio,代碼行數:19,代碼來源:NewAction.java

示例8: newTypes

import org.openide.util.datatransfer.NewType; //導入依賴的package包/類
private NewType[] newTypes () {
    if (lookup != null) {
        java.util.Collection c = lookup.lookup (
            new Lookup.Template (Node.class)
        ).allItems ();
        if (c.size () == 1) {
            java.util.Iterator it = c.iterator();
            while (it.hasNext()) {
                Lookup.Item item = (Lookup.Item)it.next ();
                Node n = (Node)item.getInstance();
                if (n != null) {
                    return n.getNewTypes();
                }
            }
        }
    }
    return getNewTypes ();
}
 
開發者ID:CharlesSkelton,項目名稱:studio,代碼行數:19,代碼來源:NewAction.java

示例9: getNewTypes

import org.openide.util.datatransfer.NewType; //導入依賴的package包/類
public NewType[] getNewTypes() {
    NewType nt = new NewType() {
            public void create() {
                if (array != null) {
                    Object[] newArray = (Object[]) Array.newInstance(getConvertedType(), array.length + 1);
                    System.arraycopy(array, 0, newArray, 0, array.length);

                    // throw away the old array!
                    array = newArray;
                    array[array.length - 1] = defaultValue();
                } else {
                    // throw away the old array!
                    array = (Object[]) Array.newInstance(getConvertedType(), 1);
                    array[0] = defaultValue();
                }

                IndexedPropertyEditor.this.firePropertyChange();

                DisplayIndexedNode din = new DisplayIndexedNode(array.length - 1);
                getChildren().add(new Node[] { din });

                Index i = getCookie(Index.class);
                i.addChangeListener(org.openide.util.WeakListeners.change(din, i));
            }
        };

    return new NewType[] { nt };
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:29,代碼來源:IndexedPropertyEditor.java

示例10: getNewTypes

import org.openide.util.datatransfer.NewType; //導入依賴的package包/類
@Override
public NewType[] getNewTypes() {
    NewType[] res = super.getNewTypes();
    if( null == res || res.length == 0 ) {
        DataFolder paletteFolder = (DataFolder)getCookie( DataFolder.class );
        if( null != paletteFolder )
            res = new NewType[] { new NewCategory() };
    }
    return res;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:RootNode.java

示例11: actionPerformed

import org.openide.util.datatransfer.NewType; //導入依賴的package包/類
public void actionPerformed(ActionEvent event) {
    NewType[] newTypes = paletteNode.getNewTypes();
    try {
        if( null != newTypes && newTypes.length > 0 ) {
            newTypes[0].create();
        }
    } catch( IOException ioE ) {
        ERR.log( Level.INFO, ioE.getLocalizedMessage(), ioE );
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:Utils.java

示例12: getNewTypes

import org.openide.util.datatransfer.NewType; //導入依賴的package包/類
public NewType[] getNewTypes(Phadhail ph, Lookup e) {
    if (ph.hasChildren()) {
        return new NewType[] {
            new PhadhailNewType(ph, false),
            new PhadhailNewType(ph, true),
        };
    } else {
        return new NewType[0];
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:PhadhailLook.java

示例13: getNewTypes

import org.openide.util.datatransfer.NewType; //導入依賴的package包/類
public NewType[] getNewTypes() {
    if (ph.hasChildren()) {
        return new NewType[] {
            new PhadhailNewType(ph, false),
            new PhadhailNewType(ph, true),
        };
    } else {
        return new NewType[0];
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:PhadhailNode.java

示例14: getNewTypes

import org.openide.util.datatransfer.NewType; //導入依賴的package包/類
/** Gets new types that can be created in this node.
 * @return array with <code>NewLocaleType</code> */
@Override
public NewType[] getNewTypes() {
    PropertiesDataObject propDO = (PropertiesDataObject) getDataObject();
    if (propDO.isMultiLocale()) {
    return new NewType[] {new NewLocaleType()};
    } else {
        PropertiesFileEntry pfEntry = (PropertiesFileEntry) propDO.getPrimaryEntry();
        return new NewType[] { new NewLocaleType(),
                               new PropertiesLocaleNode.NewPropertyType(pfEntry) };
}
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:PropertiesDataNode.java

示例15: getNewTypes

import org.openide.util.datatransfer.NewType; //導入依賴的package包/類
/** Getter for array of activated new types.
*/
private static NewType[] getNewTypes(Node[] activatedNodes) {
    if ((activatedNodes == null) || (activatedNodes.length != 1)) {
        return new NewType[0];
    } else {
        return activatedNodes[0].getNewTypes();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:NewAction.java


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