1 19 20 package org.netbeans.modules.xml.wsdl.ui.view.treeeditor; 21 22 import java.awt.Dialog ; 23 import java.awt.datatransfer.Transferable ; 24 import java.beans.PropertyChangeEvent ; 25 import java.beans.PropertyChangeListener ; 26 import java.io.IOException ; 27 import java.lang.ref.Reference ; 28 import java.lang.ref.WeakReference ; 29 import java.util.Collections ; 30 import java.util.Iterator ; 31 import java.util.LinkedList ; 32 import java.util.List ; 33 import java.util.Map ; 34 import java.util.Set ; 35 import java.util.Map.Entry; 36 import java.util.logging.Level ; 37 import java.util.logging.Logger ; 38 import javax.swing.Action ; 39 import javax.xml.namespace.QName ; 40 import org.netbeans.modules.refactoring.api.ui.RefactoringActionsFactory; 41 import org.netbeans.modules.xml.refactoring.ui.ReferenceableProvider; 42 import org.netbeans.modules.xml.wsdl.model.Definitions; 43 import org.netbeans.modules.xml.wsdl.model.WSDLComponent; 44 import org.netbeans.modules.xml.wsdl.model.WSDLModel; 45 import org.netbeans.modules.xml.wsdl.ui.actions.ActionHelper; 46 import org.netbeans.modules.xml.wsdl.ui.commands.CommonAttributePropertyAdapter; 47 import org.netbeans.modules.xml.wsdl.ui.commands.OtherAttributePropertyAdapter; 48 import org.netbeans.modules.xml.wsdl.ui.commands.XMLAttributePropertyAdapter; 49 import org.netbeans.modules.xml.wsdl.ui.cookies.RemoveWSDLElementCookie; 50 import org.netbeans.modules.xml.wsdl.ui.cookies.SaveCookieDelegate; 51 import org.netbeans.modules.xml.wsdl.ui.cookies.WSDLAttributeCookie; 52 import org.netbeans.modules.xml.wsdl.ui.cookies.WSDLElementCookie; 53 import org.netbeans.modules.xml.wsdl.ui.netbeans.module.UIUtilities; 54 import org.netbeans.modules.xml.wsdl.ui.netbeans.module.Utility; 55 import org.netbeans.modules.xml.wsdl.ui.view.DesignGotoType; 56 import org.netbeans.modules.xml.wsdl.ui.view.StructureGotoType; 57 import org.netbeans.modules.xml.wsdl.ui.view.property.BaseAttributeProperty; 58 import org.netbeans.modules.xml.wsdl.ui.view.treeeditor.newtype.DocumentationNewType; 59 import org.netbeans.modules.xml.wsdl.ui.view.treeeditor.newtype.NewTypesFactory; 60 import org.netbeans.modules.xml.xam.Component; 61 import org.netbeans.modules.xml.xam.ComponentEvent; 62 import org.netbeans.modules.xml.xam.ComponentListener; 63 import org.netbeans.modules.xml.xam.Model; 64 import org.netbeans.modules.xml.xam.Named; 65 import org.netbeans.modules.xml.xam.Referenceable; 66 import org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent; 67 import org.netbeans.modules.xml.xam.dom.Attribute; 68 import org.netbeans.modules.xml.xam.ui.ComponentPasteType; 69 import org.netbeans.modules.xml.xam.ui.XAMUtils; 70 import org.netbeans.modules.xml.xam.ui.actions.GoToAction; 71 import org.netbeans.modules.xml.xam.ui.actions.GotoType; 72 import org.netbeans.modules.xml.xam.ui.actions.SourceGotoType; 73 import org.netbeans.modules.xml.xam.ui.actions.SuperGotoType; 74 import org.netbeans.modules.xml.xam.ui.cookies.CountChildrenCookie; 75 import org.netbeans.modules.xml.xam.ui.cookies.GotoCookie; 76 import org.netbeans.modules.xml.xam.ui.customizer.Customizer; 77 import org.netbeans.modules.xml.xam.ui.customizer.CustomizerProvider; 78 import org.netbeans.modules.xml.xam.ui.highlight.Highlight; 79 import org.netbeans.modules.xml.xam.ui.highlight.HighlightManager; 80 import org.netbeans.modules.xml.xam.ui.highlight.Highlighted; 81 import org.openide.DialogDescriptor; 82 import org.openide.DialogDisplayer; 83 import org.openide.ErrorManager; 84 import org.openide.actions.CopyAction; 85 import org.openide.actions.CutAction; 86 import org.openide.actions.DeleteAction; 87 import org.openide.actions.NewAction; 88 import org.openide.actions.PasteAction; 89 import org.openide.actions.PropertiesAction; 90 import org.openide.actions.ReorderAction; 91 import org.openide.loaders.DataObject; 92 import org.openide.nodes.AbstractNode; 93 import org.openide.nodes.Children; 94 import org.openide.nodes.Node; 95 import org.openide.nodes.Sheet; 96 import org.openide.util.HelpCtx; 97 import org.openide.util.NbBundle; 98 import org.openide.util.WeakListeners; 99 import org.openide.util.actions.SystemAction; 100 import org.openide.util.datatransfer.NewType; 101 import org.openide.util.datatransfer.PasteType; 102 import org.openide.util.lookup.AbstractLookup; 103 import org.openide.util.lookup.InstanceContent; 104 105 110 public abstract class WSDLElementNode extends AbstractNode 111 implements ComponentListener, ReferenceableProvider, Highlighted, 112 CountChildrenCookie, PropertyChangeListener , GotoCookie { 113 114 protected static final Logger mLogger = Logger.getLogger(WSDLElementNode.class.getName()); 115 116 private WSDLComponent mElement; 117 118 private Reference <Customizer> customizerReference; 119 private NewTypesFactory mNewTypesFactory; 120 121 public static final String WSDL_NAMESPACE = "http://schemas.xmlsoap.org/wsdl/"; private InstanceContent mLookupContents; 123 protected Sheet mSheet; 124 private PropertyChangeListener weakModelListener; 125 private ComponentListener weakComponentListener; 126 127 private Set <Component> referenceSet; 128 129 private List <Highlight> highlights; 130 131 132 private WSDLModel wsdlmodel; 133 134 private static final SystemAction[] ACTIONS = new SystemAction[] { 135 SystemAction.get(CutAction.class), 136 SystemAction.get(CopyAction.class), 137 SystemAction.get(PasteAction.class), 138 null, 139 SystemAction.get(NewAction.class), 140 SystemAction.get(DeleteAction.class), 141 SystemAction.get(ReorderAction.class), 142 null, 143 SystemAction.get(GoToAction.class), 144 (SystemAction)RefactoringActionsFactory.whereUsedAction(), 146 null, 147 (SystemAction)RefactoringActionsFactory.editorSubmenuAction(), 148 null, 149 SystemAction.get(PropertiesAction.class), 150 }; 151 152 private static final GotoType[] GOTO_TYPES = new GotoType[] { 153 new SourceGotoType(), 154 new StructureGotoType(), 155 new DesignGotoType(), 156 new SuperGotoType(), 157 }; 158 159 public WSDLElementNode(Children children, WSDLComponent element, NewTypesFactory newTypesFactory) { 160 this(children, element); 161 this.mNewTypesFactory = newTypesFactory; 162 } 163 164 public WSDLElementNode(Children children, WSDLComponent element) { 165 this(children, element, new InstanceContent()); 166 } 167 168 175 private WSDLElementNode(Children children, WSDLComponent element, 176 InstanceContent contents) { 177 super(children, new AbstractLookup(contents)); 178 mElement = element; 179 mLookupContents = contents; 180 181 contents.add(this); 186 contents.add(new WSDLElementCookie(mElement)); 187 DataObject dobj = ActionHelper.getDataObject(element.getModel()); 190 if (dobj != null) { 191 contents.add(dobj); 192 } 193 contents.add(new SaveCookieDelegate(dobj)); 194 contents.add(new RemoveWSDLElementCookie(mElement)); 195 contents.add(element); 196 197 wsdlmodel = element.getModel(); 198 199 weakModelListener = WeakListeners.propertyChange(this, wsdlmodel); 200 wsdlmodel.addPropertyChangeListener(weakModelListener); 201 weakComponentListener = (ComponentListener) WeakListeners.create( 202 ComponentListener.class, this, wsdlmodel); 203 wsdlmodel.addComponentListener(weakComponentListener); 204 addNodeListener(new WSDLNodeListener(this)); 205 mSheet = new Sheet(); 206 updateDisplayName(); 208 209 referenceSet = Collections.singleton((Component) element); 210 highlights = new LinkedList <Highlight>(); 211 HighlightManager.getDefault().addHighlighted(this); 212 } 213 214 public NewTypesFactory getNewTypesFactory() { 215 if (mNewTypesFactory != null) 216 return mNewTypesFactory; 217 218 219 mNewTypesFactory = new NewTypesFactory() { 220 221 public NewType[] getNewTypes(WSDLComponent component) { 222 if (component.getDocumentation() == null) { 223 return new NewType[] {new DocumentationNewType(getWSDLComponent())}; 224 } 225 return new NewType[] {}; 226 } 227 228 }; 229 return mNewTypesFactory; 230 } 231 232 @Override 233 public Action [] getActions(boolean context) { 234 return ACTIONS; 235 } 236 237 @Override 238 public void destroy() throws IOException { 239 if (wsdlmodel != null) { 241 wsdlmodel.removePropertyChangeListener(weakModelListener); 243 wsdlmodel.removeComponentListener(weakComponentListener); 244 wsdlmodel = null; 246 } 247 248 WSDLModel model = getWSDLComponent() != null ? getWSDLComponent().getModel() : null; 249 if (model != null) { 250 WSDLComponent parent = getWSDLComponent().getParent(); 252 WSDLComponent nextSelection = parent; 254 if (parent == null) { 255 return; 256 } 257 258 if (parent.getChildren() != null) { 259 int size = parent.getChildren().size(); 260 if (size > 0) { 261 int currentPos = parent.getChildren().indexOf(getWSDLComponent()); 262 if (currentPos + 1 < size) { 263 nextSelection = parent.getChildren().get(currentPos + 1); 264 } else if (currentPos - 1 >= 0) { 265 nextSelection = parent.getChildren().get(currentPos - 1); 266 } 267 } 268 if (parent instanceof Definitions) { 269 if (!getWSDLComponent().getClass().isAssignableFrom(nextSelection.getClass())) { 272 nextSelection = parent; 273 } 274 } 275 } 276 277 try { 278 model.startTransaction(); 279 model.removeChildComponent(getWSDLComponent()); 280 } finally { 281 model.endTransaction(); 282 } 283 ActionHelper.selectNode(nextSelection); 284 } 285 super.destroy(); 286 } 287 288 @Override 289 public boolean canCopy() { 290 return true; 291 } 292 293 @Override 294 public boolean canCut() { 295 return isEditable(); 296 } 297 298 @Override 299 protected void createPasteTypes(Transferable transferable, List list) { 300 if (mElement != null && mElement.getModel() != null && isEditable()) { 302 PasteType type = ComponentPasteType.getPasteType( 303 mElement, transferable, null); 304 if (type != null) { 305 list.add(type); 306 } 307 } 308 } 309 310 @Override 311 public PasteType getDropType(Transferable transferable, int action, int index) { 312 if (mElement != null && mElement.getModel() != null && isEditable()) { 314 PasteType type = ComponentPasteType.getDropType( 315 mElement, transferable, null, action, index); 316 if (type != null) { 317 return type; 318 } 319 } 320 return null; 321 } 322 323 @Override 324 public boolean canDestroy() { 325 WSDLModel model = mElement.getModel(); 326 if (model != null && isSameAsMyWSDLElement(model.getDefinitions()) && !isEditable()) { 327 return false; 328 } 329 return isEditable(); 330 } 331 332 public WSDLComponent getWSDLComponent() { 333 return this.mElement; 334 } 335 336 @Override 337 public final NewType[] getNewTypes() 338 { 339 if (isEditable()) { 340 return getNewTypesFactory().getNewTypes(getWSDLComponent()); 341 } 342 return new NewType[] {}; 343 } 344 345 public GotoType[] getGotoTypes() { 346 return GOTO_TYPES; 347 } 348 349 356 protected CustomizerProvider getCustomizerProvider() { 357 return null; 358 } 359 360 @Override 361 public java.awt.Component getCustomizer() { 362 if (!hasCustomizer() || !isEditable()) { 363 return null; 364 } 365 Customizer customizer = customizerReference == null ? null : 366 customizerReference.get(); 367 if (customizer == null) { 368 CustomizerProvider cp = getCustomizerProvider(); 369 if (cp == null) { 370 return null; 371 } 372 customizer = cp.getCustomizer(); 373 if (customizer == null || customizer.getComponent() == null) { 374 return null; 375 } 376 customizerReference = new WeakReference <Customizer>(customizer); 377 } else { 378 customizer.reset(); 379 } 380 DialogDescriptor descriptor = UIUtilities.getCustomizerDialog( 381 customizer, getTypeDisplayName(), isEditable()); 382 Dialog dlg = DialogDisplayer.getDefault().createDialog(descriptor); 383 dlg.getAccessibleContext().setAccessibleDescription(dlg.getTitle()); 384 return dlg; 385 } 386 387 393 public boolean isSameAsMyWSDLElement(Component node) { 394 if(node != null && node.equals(this.getWSDLComponent())) { 395 return true; 396 } 397 398 return false; 399 } 400 401 public void childrenAdded(ComponentEvent evt) { 402 } 403 404 public void childrenDeleted(ComponentEvent evt) { 405 } 406 407 public void valueChanged(ComponentEvent evt) { 408 if (!isSameAsMyWSDLElement((Component) evt.getSource())) { 409 return; 410 } 411 updateDisplayName(); 412 refreshSheet(); 413 firePropertySetsChange(new Node.PropertySet[] {}, getPropertySets()); 415 } 416 417 public void propertyChange(PropertyChangeEvent event) { 418 if (isValid() && event.getSource() == mElement) { 419 try { 420 updateDisplayName(); 421 String propName = event.getPropertyName(); 422 Sheet.Set propertySet = getSheet().get(Sheet.PROPERTIES); 423 if (propertySet != null) { 424 if (propertySet.get(propName) != null) { 425 firePropertyChange(propName, event.getOldValue(), 426 event.getNewValue()); 427 } else { 428 ErrorManager.getDefault().log(ErrorManager.INFORMATIONAL, 429 propName + " property is not defined in " + 430 getTypeDisplayName()); 431 } 432 } 433 } catch (IllegalStateException ise) { 434 ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ise); 436 } catch (NullPointerException npe) { 437 ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, npe); 439 } 440 } 441 } 442 443 449 protected boolean isValid() { 450 return mElement.getModel() != null; 451 } 452 453 459 protected void updateDisplayName() { 460 if (isValid()) { 462 if (mElement instanceof Named) { 464 String name = ((Named) mElement).getName(); 465 super.setName(name == null ? "" : name); 467 if (name == null || name.length() == 0) { 468 name = mElement.getPeer().getLocalName(); 469 } 470 setDisplayName(name); 471 } 472 } 473 } 474 475 @Override 476 protected final Sheet createSheet() { 477 refreshSheet(); 478 return mSheet; 479 } 480 481 protected InstanceContent getLookupContents() { 482 return mLookupContents; 483 } 484 485 private final void refreshSheet() { 486 if (getWSDLComponent() != null && !getWSDLComponent().isInDocumentModel()) return; 487 refreshAttributesSheetSet(); 488 refreshOtherAttributesSheetSet(); 489 Cookie cookie = getCookie(WSDLAttributeCookie.class); 490 if (hasOtherAttributesProperties()) { 491 mLookupContents.add(new WSDLAttributeCookie("attribute", getWSDLComponent())); } else if (cookie != null) { 493 mLookupContents.remove(cookie); 494 } 495 } 496 497 private final boolean hasOtherAttributesProperties() { 498 Map <QName ,String > attributesMap = getWSDLComponent().getAttributeMap(); 499 if(attributesMap != null) { 500 Iterator <Map.Entry <QName , String >> it = attributesMap.entrySet().iterator(); 501 while(it.hasNext()) { 502 Entry<QName , String > entry = it.next(); 503 QName attrQName = entry.getKey(); 504 String ns = attrQName.getNamespaceURI(); 505 if(ns != null && !ns.trim().equals("") && !ns.equals(WSDL_NAMESPACE)) { 509 return true; 510 } 511 } 512 } 513 return false; 514 } 515 516 517 518 protected void refreshAttributesSheetSet() { 519 Sheet.Set ss = createPropertiesSheetSet(); 520 521 try { 522 AbstractDocumentComponent adc = (AbstractDocumentComponent) getWSDLComponent(); 523 QName elementQName = adc.getQName(); 524 String namespace = elementQName.getNamespaceURI(); 525 Map <QName , String > attrMap = getWSDLComponent().getAttributeMap(); 530 for (QName attrQName : attrMap.keySet()) { 531 String ns = attrQName.getNamespaceURI(); 532 533 Node.Property attrValueProperty = createAttributeProperty(attrQName); 534 if(attrValueProperty != null) { 535 if(ns == null || ns.trim().equals("") || ns.equals(namespace)) { 539 ss.put(attrValueProperty); 540 } 541 } 542 } 543 544 List <Node.Property> properties = createAlwaysPresentAttributeProperty(); 545 if(properties != null) { 546 Iterator <Node.Property> itP = properties.iterator(); 547 while(itP.hasNext()) { 548 Node.Property property = itP.next(); 549 if(ss.get(property.getName()) == null) { 551 ss.put(property); 552 } 553 } 554 } 555 556 } catch(Exception ex) { 557 mLogger.log(Level.SEVERE, "failed to create property sheet for "+ getWSDLComponent(), ex); 558 } 559 560 } 561 562 protected org.openide.nodes.Sheet.Set createOtherPropertiesSheetSet() { 563 String otherAttributeSetName = NbBundle.getMessage(DefinitionsNode.class, "PROP_SHEET_CATEGORY_Other_Attributes"); 564 mSheet.remove(otherAttributeSetName); 565 Sheet.Set otherAttributesSheetSet = new Sheet.Set(); 566 otherAttributesSheetSet.setName(otherAttributeSetName); 567 otherAttributesSheetSet.setDisplayName(otherAttributeSetName); 568 mSheet.put(otherAttributesSheetSet); 569 return otherAttributesSheetSet; 570 } 571 572 protected Sheet.Set createPropertiesSheetSet() { 573 mSheet.remove(Sheet.PROPERTIES); 574 Sheet.Set ss = Sheet.createPropertiesSet(); 575 mSheet.put(ss); 576 return ss; 577 } 578 579 584 protected List <Node.Property> createAlwaysPresentAttributeProperty() throws Exception { 585 return Collections.emptyList(); 586 } 587 588 protected Node.Property createAttributeProperty(QName attrQName) { 589 Node.Property attrValueProperty = null; 590 591 try { 592 WSDLComponent component = getWSDLComponent(); 593 AbstractDocumentComponent adc = (AbstractDocumentComponent) component; 594 QName elementQName = adc.getQName(); 595 String namespace = elementQName.getNamespaceURI(); 596 String ns = attrQName.getNamespaceURI(); 597 if(ns == null || ns.trim().equals("") || ns.equals(namespace)) { 601 XMLAttributePropertyAdapter propertyAdapter = 602 new XMLAttributePropertyAdapter(attrQName.getLocalPart(), component); 603 attrValueProperty = getAttributeNodeProperty(attrQName.getLocalPart(), propertyAdapter); 604 605 } else { 606 OtherAttributePropertyAdapter propertyAdapter = 607 new OtherAttributePropertyAdapter(attrQName, component); 608 attrValueProperty = getOtherAttributeNodeProperty(attrQName, propertyAdapter); 610 611 } 612 } catch(Exception ex) { 613 ErrorManager.getDefault().notify(ex); 615 } 616 617 return attrValueProperty; 618 } 619 620 protected Node.Property getAttributeNodeProperty(String attrName, 621 XMLAttributePropertyAdapter propertyAdapter) throws NoSuchMethodException { 622 Node.Property attrValueProperty = new BaseAttributeProperty(propertyAdapter, String .class, 623 CommonAttributePropertyAdapter.VALUE); 624 attrValueProperty.setName(attrName); 625 626 627 String desc = getAttributeShortDescription(attrName); 628 if(desc != null && !desc.trim().equals("")) { 629 attrValueProperty.setShortDescription(desc); 630 } else { 631 attrValueProperty.setShortDescription(attrName); 632 } 633 634 return attrValueProperty; 635 } 636 637 protected Node.Property getOtherAttributeNodeProperty(QName attrQName, 638 OtherAttributePropertyAdapter propertyAdapter) throws NoSuchMethodException { 639 Node.Property attrValueProperty = new BaseAttributeProperty(propertyAdapter, String .class, CommonAttributePropertyAdapter.VALUE); 640 attrValueProperty.setName(Utility.fromQNameToString(attrQName)); 641 String desc = getAttributeShortDescription(attrQName); 642 if(desc != null && !(desc.trim().length() == 0)) { 643 attrValueProperty.setShortDescription(desc); 644 } else { 645 attrValueProperty.setShortDescription(attrQName.toString()); 646 } 647 648 return attrValueProperty; 649 } 650 651 652 protected String getAttributeShortDescription(QName attrQName) { 653 return attrQName.toString(); 654 } 655 656 protected String getAttributeShortDescription(String attrName) { 657 return attrName; 658 } 659 660 protected void refreshOtherAttributesSheetSet() { 661 Sheet.Set otherAttributesSheetSet = createOtherPropertiesSheetSet(); 662 addOtherAttributesProperties(otherAttributesSheetSet); 663 } 664 665 666 public static class QNameAttribute implements Attribute { 667 private QName qName; 668 QNameAttribute(QName q) { 669 this.qName = q; 670 } 671 public String getName() { 672 return Utility.fromQNameToString(qName); 673 } 674 public Class getType() { return String .class; } 675 public Class getMemberType() { return String .class; } 676 } 677 678 private void addOtherAttributesProperties(Sheet.Set ss) { 679 Map <QName ,String > attributesMap = getWSDLComponent().getAttributeMap(); 680 if(attributesMap != null) { 681 Iterator <Map.Entry <QName , String >> it = attributesMap.entrySet().iterator(); 682 while(it.hasNext()) { 683 Entry<QName , String > entry = it.next(); 684 QName attrQName = entry.getKey(); 685 String ns = attrQName.getNamespaceURI(); 686 if(ns != null && !ns.trim().equals("") && !ns.equals(WSDL_NAMESPACE)) { 690 OtherAttributePropertyAdapter propertyAdapter = new OtherAttributePropertyAdapter(attrQName, 692 getWSDLComponent()); 693 Node.Property attrValueProperty; 695 try { 696 attrValueProperty = getOtherAttributeNodeProperty(attrQName, propertyAdapter); 697 ss.put(attrValueProperty); 698 } catch (NoSuchMethodException e) { 699 ErrorManager.getDefault().notify(e); 700 } 701 } 702 } 703 } 704 } 705 706 712 713 protected boolean isEditable() { 714 Model model = mElement.getModel(); 715 return model != null && XAMUtils.isWritable(model); 716 } 717 718 724 public Referenceable getReferenceable() { 725 return (mElement instanceof Referenceable)?Referenceable.class.cast(mElement):null; 726 } 727 728 public Set <Component> getComponents() { 729 return referenceSet; 730 } 731 732 public int getChildCount() { 733 return getWSDLComponent().getChildren().size(); 734 } 735 736 public void highlightAdded(Highlight hl) { 737 highlights.add(hl); 738 fireDisplayNameChange("TempName", getDisplayName()); 739 } 740 741 public void highlightRemoved(Highlight hl) { 742 highlights.remove(hl); 743 fireDisplayNameChange("TempName", getDisplayName()); 744 } 745 746 754 protected String applyHighlights(String name) { 755 int count = highlights.size(); 756 if (count > 0) { 757 Highlight hl = highlights.get(count - 1); 759 String type = hl.getType(); 760 String code = null; 761 if (type.equals(Highlight.SEARCH_RESULT)) { 762 code = "e68b2c"; 763 } else if (type.equals(Highlight.SEARCH_RESULT_PARENT)) { 764 code = "ffc73c"; 765 } else if (type.equals(Highlight.FIND_USAGES_RESULT_PARENT)) { 766 code = "B5E682"; }else if (type.equals(Highlight.FIND_USAGES_RESULT)) { 768 code = "8be62c"; } 770 name = "<strong><font color=\"#" + code + "\">" + name + 771 "</font></strong>"; 772 } 773 return name; 774 } 775 776 @Override 777 public String getDisplayName() { 778 String instanceName = getDefaultDisplayName(); 779 if (getTypeDisplayName() == null) { 780 return instanceName; 781 } 782 return instanceName.length()==0 ? instanceName : 783 instanceName + " " + "[" + getTypeDisplayName() + "]"; } 785 786 public String getDefaultDisplayName() { 787 String instanceName = super.getDisplayName(); 788 return instanceName == null || instanceName.length() == 0 789 ? "" : instanceName; 790 } 791 792 @Override 793 public String getHtmlDisplayName() { 794 String name = getDefaultDisplayName(); 795 if(name!=null) 797 name = name.replace("<", "<").replace(">", ">"); 798 return applyHighlights(name); 799 } 800 801 @Override 802 public HelpCtx getHelpCtx() { 803 return new HelpCtx("org.netbeans.modules.xml.wsdlui.about"); 806 } 807 808 809 813 public abstract String getTypeDisplayName(); 814 815 816 } 817 | Popular Tags |