|
What this is
Other links
The source code/*
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License
* Version 1.0 (the "License"). You may not use this file except in
* compliance with the License. A copy of the License is available at
* http://www.sun.com/
*
* The Original Code is NetBeans. The Initial Developer of the Original
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
* Microsystems, Inc. All Rights Reserved.
*/
package org.netbeans.modules.java.ui.nodes.elements;
import org.openide.nodes.Children;
import org.openide.nodes.Sheet;
import org.openide.nodes.Node;
import org.openide.util.HelpCtx;
import org.openide.util.datatransfer.NewType;
import org.openide.src.ElementProperties;
import org.netbeans.jmi.javamodel.JavaEnum;
import java.util.Map;
import java.util.HashMap;
/**
* Node representing an enumeration
* @see org.netbeans.jmi.javamodel.JavaEnum
*/
public final class EnumNode extends ElementNode {
private static final Map mapAttributeName;
static {
mapAttributeName = new HashMap();
mapAttributeName.put(PROP_MODIFIERS, PROP_MODIFIERS);
mapAttributeName.put(ElementProperties.PROP_NAME, ElementProperties.PROP_NAME);
mapAttributeName.put("interfaceNames", PROP_INTERFACES); // NOI18N
}
public EnumNode(JavaEnum element, Children children, boolean writeable) {
super(element, children, writeable, SourceOptions.PROP_ENUM_FORMAT);
setElementFormat0(getElementFormatProperty());
}
protected String resolveIconBase() {
return IconStrings.ENUM;
}
protected ElementFormat getElementFormatProperty() {
return getSourceOptions().getEnumElementFormat();
}
protected ElementFormat getHintElementFormat() {
return getSourceOptions().getEnumElementLongFormat();
}
protected Map getAttributeNameMap() {
return mapAttributeName;
}
public NewType[] getNewTypes() {
if (writeable) {
return SourceEditSupport.createEnumNewTypes(getEnum());
} else {
return super.getNewTypes();
}
}
protected Sheet createSheet() {
Sheet s = Sheet.createDefault();
Sheet.Set ps = s.get(Sheet.PROPERTIES);
ps.put(createModifiersProperty(writeable));
ps.put(createNameProperty(getEnum()));
ps.put(createInterfacesProperty(writeable));
return s;
}
/** Create a node property for the implemented interfaces of this class.
* (Or, extended interfaces if this is itself an interface.)
* @param canW if
|
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.