本文整理匯總了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;
}
示例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();
}
} };
}
示例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();
}
}
}
示例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();
}
示例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]);
}
示例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 };
}
示例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 ();
}
}
}
示例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 ();
}
示例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 };
}
示例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;
}
示例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 );
}
}
示例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];
}
}
示例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];
}
}
示例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) };
}
}
示例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();
}
}