Line 16
Link Here
|
16 |
import java.awt.datatransfer.Transferable; |
16 |
import java.awt.Component; |
17 |
-- |
17 |
import java.awt.datatransfer.*; |
Line 31
Link Here
|
31 |
import org.openide.util.datatransfer.ExTransferable; |
32 |
import org.openide.util.datatransfer.*; |
32 |
-- |
|
|
Line 184
Link Here
|
|
|
185 |
/** Constructs a new data shadow which will lazily dereference |
186 |
* its original DataObject only if information (generally cookies |
187 |
* or description) are asked for that cannot be found on the primary |
188 |
* file.<P> |
189 |
* Used to avoid creation of the original if the display name and |
190 |
* icon are available on the original node. Note that this constructor |
191 |
* should not be used for shadows where the original DataObject might |
192 |
* change out from under them, because it will only start listening |
193 |
* to the original DataObject if something causes it to call |
194 |
* DataObject.find() and dereference the original. It is primarily |
195 |
* useful for shadows where the common case is that they will remain |
196 |
* untouched and creating the real DataObject to represent the |
197 |
* underlying file would cause additional classloading. See |
198 |
* issue 28683. |
199 |
*/ |
200 |
public DataShadow (FileObject fo, DataLoader loader) throws DataObjectExistsException { |
201 |
super (fo, loader); |
202 |
} |
203 |
|
Line 188
Link Here
|
188 |
if (original == null) |
208 |
if ((original == null) && (!canInstantiateLazily (getPrimaryFile()))) |
189 |
-- |
|
|
Line 213
Link Here
|
|
|
233 |
|
234 |
|
Line 314
Link Here
|
|
|
336 |
|
337 |
/** Returns the primary file of the DataObject this |
338 |
* shadow links to. If this DataShadow was instantiated |
339 |
* without the DataShadow it points to instantiated (i.e., |
340 |
* in an XML layer with the <code>SystemFileSystem.icon</code> |
341 |
* and <code>SystemFileSystem.localizingBundle</code> attributes |
342 |
* present), calling this method will not force instantiation |
343 |
* of the DataObject this shadow links to. |
344 |
*/ |
345 |
public final FileObject getOriginalPrimaryFile() { |
346 |
try { |
347 |
return validate (getPrimaryFile()); |
348 |
} catch (java.io.IOException ioe) { |
349 |
ErrorManager.getDefault().notify (ErrorManager.INFORMATIONAL, ioe); |
350 |
return getOriginal().getPrimaryFile(); |
351 |
} |
352 |
} |
Line 323
Link Here
|
|
|
362 |
FileObject fo = validate (fileObject); |
363 |
return DataObject.find (fo); |
364 |
} |
365 |
|
366 |
/** Can the shadow be instantiated lazily? This could be done for |
367 |
* all shadows, but as this is a micro-optimization, it will hurt |
368 |
* in the case that a lazy node would be created and immediately |
369 |
* asked for some cookie that would force the node's replacement. */ |
370 |
private static final boolean isLazy(FileObject fo) { |
371 |
return (fo.getAttribute("SystemFileSystem.icon") != null && //NOI18N |
372 |
fo.getAttribute ("SystemFileSystem.localizingBundle") != null) && |
373 |
Boolean.TRUE.equals (fo.getAttribute("isLazy")); //NOI18N |
374 |
} |
375 |
|
376 |
/** Checks for icon and display name properties that will allow the |
377 |
* Shadow to be instantiated without first creating the DataObject. */ |
378 |
static final boolean canInstantiateLazily (FileObject fo) { |
379 |
//See if it specifies an icon and display name |
380 |
boolean result = isLazy (fo); |
381 |
//If no, see if the file pointed to does |
382 |
try { |
383 |
if (!result) result = isLazy(validate(fo)); |
384 |
} catch (java.io.IOException ioe) { |
385 |
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ioe); |
386 |
} |
387 |
return result; |
388 |
} |
389 |
|
390 |
/** Returns the primary file pointed to by the passed shadow file |
391 |
* without instantiating a DataObject. */ |
392 |
static FileObject validate (FileObject fileObject) throws java.io.IOException { |
Line 325
Link Here
|
325 |
return DataObject.find (fo); |
395 |
return fo; |
326 |
-- |
|
|
Line 328
Link Here
|
|
|
398 |
|
Line 424
Link Here
|
|
|
495 |
if (original == null) { |
496 |
resolveOriginal(); |
497 |
} |
Line 427
Link Here
|
|
|
501 |
/** For the case of lazy initialization, find the |
502 |
* DataObject. |
503 |
*/ |
504 |
private void resolveOriginal () { |
505 |
try { |
506 |
FileObject fo = this.getPrimaryFile(); |
507 |
init (deserialize (fo)); |
508 |
} catch (java.io.IOException ioe) { |
509 |
ErrorManager.getDefault().notify(ErrorManager.ERROR, ioe); |
510 |
} |
511 |
} |
512 |
|
Line 434
Link Here
|
|
|
520 |
/**Overrides DataObject.isTemplateImpl() to check if the primary |
521 |
* file the shadow points to has its template attribute set. |
522 |
* This avoids DataObject creation if this shadow is was |
523 |
* created from an XML layer and instantiates its backing |
524 |
* DataObject lazily. */ |
525 |
protected boolean isTemplateImpl() { |
526 |
if (original == null) { |
527 |
try { |
528 |
FileObject DOPrimary = validate(getPrimaryFile()); |
529 |
if (DOPrimary != null) { |
530 |
Object o = (Boolean) DOPrimary.getAttribute(PROP_TEMPLATE); |
531 |
return (o != null) && Boolean.TRUE.equals (o); |
532 |
} |
533 |
} catch (java.io.IOException ioe) { |
534 |
ErrorManager.getDefault().notify (ErrorManager.INFORMATIONAL, ioe); |
535 |
} |
536 |
} |
537 |
return getOriginal().isTemplate(); |
538 |
} |
539 |
|
Line 437
Link Here
|
437 |
return new ShadowNode (this); |
543 |
Node realNode; |
438 |
-- |
544 |
if ((original == null) && canInstantiateLazily (getPrimaryFile())) { |
|
|
545 |
realNode = new ProxyShadowNode(new ProxyDOChildren()); |
546 |
} else { |
547 |
realNode = new ShadowNode(this); |
548 |
} |
549 |
MutableFilterNode result = new MutableFilterNode (realNode); |
550 |
return result; |
Line 483
Link Here
|
483 |
return original.handleCreateShadow (f); |
596 |
return getOriginal().handleCreateShadow (f); |
484 |
-- |
|
|
Line 491
Link Here
|
491 |
return original.getCookie (this, c); |
604 |
return getOriginal().getCookie (this, c); |
492 |
-- |
|
|
Line 504
Link Here
|
504 |
if (checkOriginal(original) != null) |
617 |
if (checkOriginal(getOriginal()) != null) |
505 |
-- |
|
|
Line 517
Link Here
|
517 |
FileObject pf = original.getPrimaryFile (); |
630 |
FileObject pf = getOriginal().getPrimaryFile (); |
518 |
-- |
|
|
Line 567
Link Here
|
567 |
final FileObject primary = shadow.original.getPrimaryFile (); |
680 |
final FileObject primary = shadow.getOriginal().getPrimaryFile (); |
568 |
-- |
|
|
Line 599
Link Here
|
|
|
712 |
|
Line 600
Link Here
|
|
|
714 |
/** Utility method for getting the declared resource bundle for the |
715 |
* shadow and looking the display name up in it. Looks for the attribute |
716 |
* <code>SystemFileSystem.localizingBundle</code> first on the |
717 |
* shadow's file, then on the original file it represents, then |
718 |
* tries to find a key for whatever file it got the bundle attribute |
719 |
* from. |
720 |
*/ |
721 |
private static final String displayNameForShadow (DataShadow ds) { |
722 |
FileObject fo = ds.getPrimaryFile(); |
723 |
String bundlename = (String) fo.getAttribute ("SystemFileSystem.localizingBundle"); //NOI18N |
724 |
if (bundlename == null) { |
725 |
fo = ds.getOriginalPrimaryFile(); |
726 |
bundlename = (String) fo.getAttribute("SystemFileSystem.localizingBundle"); //NOI18N |
727 |
} |
728 |
if (bundlename != null) { |
729 |
ResourceBundle rb = NbBundle.getBundle(bundlename); |
730 |
if (rb != null) { |
731 |
try { |
732 |
return rb.getString (fo.toString()); |
733 |
} catch (MissingResourceException mre) { |
734 |
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, mre); |
735 |
} |
736 |
} |
737 |
} |
738 |
return null; |
739 |
} |
740 |
|
741 |
/** Utility method for fetching an attribute from the shadow's source file |
742 |
* or if not present there, on the file pointed to by it, while not |
743 |
* forcing DataObject instantiation. If checkParent is true, will |
744 |
* also check for the attribute on the containing folder for the |
745 |
* shadow (useful, e.g., for specifying HelpCtx for a group of templates)*/ |
746 |
private static final Object attributeForShadow (DataShadow ds, String attr, boolean checkParent) { |
747 |
FileObject fo = ds.getPrimaryFile(); |
748 |
Object result = fo.getAttribute (attr); |
749 |
if (result == null) { |
750 |
fo = ds.getOriginalPrimaryFile(); |
751 |
result = fo.getAttribute (attr); |
752 |
} |
753 |
if ((result == null) && checkParent) { |
754 |
fo = ds.getPrimaryFile().getParent(); |
755 |
result = fo.getAttribute (attr); |
756 |
if (result == null) { |
757 |
fo = ds.getOriginalPrimaryFile(); |
758 |
result = fo.getAttribute (attr); |
759 |
} |
760 |
} |
761 |
return result; |
762 |
} |
763 |
|
764 |
|
765 |
|
766 |
/**Attempt to get the icon from the file's attributes without |
767 |
* recourse to the underlying DataObject. */ |
768 |
private static final Image getDeclaredIcon (DataShadow ds, int type) { |
769 |
//XXX sfs not annotating icon; need to investigate further |
770 |
//Try to get the icon from file attributes. |
771 |
try { |
772 |
// if (!getOriginalPrimaryFile().getFileSystem().equals ( |
773 |
// Repository.getDefault().getDefaultFileSystem())) return null; |
774 |
|
775 |
Object iconRes = attributeForShadow (ds, "SystemFileSystem.icon",false); //NOI18N |
776 |
if (iconRes instanceof java.net.URL) { |
777 |
Image i = java.awt.Toolkit.getDefaultToolkit ().getImage ((java.net.URL) iconRes); |
778 |
ds.getPrimaryFile().getFileSystem().getStatus().annotateIcon (i, type, ds.files()); |
779 |
return i; |
780 |
} |
781 |
} catch (FileStateInvalidException fsie) { |
782 |
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, fsie); |
783 |
} |
784 |
return null; |
785 |
} |
786 |
|
787 |
/** Create a new data object from template. |
788 |
* In DataShadow, this delegates to |
789 |
* <code>getOriginal().createFromTemplate()</code> |
790 |
* |
791 |
* @param df data folder to create object in |
792 |
* @param name name to give to the new object (or <CODE>null</CODE> |
793 |
* if the name should be chosen according to the template) |
794 |
* @return the new data object |
795 |
* @exception IOException if an error occured |
796 |
* |
797 |
*/ |
798 |
protected DataObject handleCreateFromTemplate(DataFolder df, String name) throws IOException { |
799 |
DataObject retValue; |
800 |
retValue = getOriginal().createFromTemplate(df, name); |
801 |
return retValue; |
802 |
} |
803 |
|
804 |
|
805 |
|
806 |
/** A trivial class to make FilterNode.changeOriginal public |
807 |
* for use by ProxyShadowNode. The base DataShadow root |
808 |
* node is a MutableFilterNode that delegates either |
809 |
* to a ProxyShadowNode or a ShadowNode, depending on |
810 |
* whether the DataObject has been instantiated. */ |
811 |
private static class MutableFilterNode extends FilterNode { |
812 |
public MutableFilterNode (Node n) { |
813 |
super (n); |
814 |
} |
815 |
|
816 |
public void setOriginal (Node n) { |
817 |
changeOriginal (n, true); |
818 |
} |
819 |
} |
820 |
|
821 |
/**A node that stands in for ShadowNode and tries to proxy |
822 |
* display name and icon to the filesystem. When asked for |
823 |
* data it can't provide (since it does not represent the |
824 |
* node delegate for the underlying DataObject, which ideally |
825 |
* is not yet instantiated), it will force instantiation of |
826 |
* the DataObject (causing it to be replaced by a bona-fide |
827 |
* ShadowNode) and return the result of the same call to its |
828 |
* replacement. */ |
829 |
private class ProxyShadowNode extends AbstractNode { |
830 |
//This is an inner class of MutableFilterNode in order |
831 |
//to have access to MutableFilterNode.changeOriginal(). |
832 |
public ProxyShadowNode (ProxyDOChildren children) { |
833 |
super (children); //XXX |
834 |
} |
835 |
|
836 |
private boolean dying=false; |
837 |
private ShadowNode replacement=null; |
838 |
/* The method below should *probably* be synchronized, |
839 |
* as it could conceivably be entered before |
840 |
* dying is set to true. This causes a deadlock |
841 |
* in the options dialog, when FormEditorSettings |
842 |
* is selected. TODO: See if the ShadowNode for |
843 |
* a single shadow is ever created twice. -TDB |
844 |
*/ |
845 |
/** Create a ShadowNode to replace this instance and |
846 |
* call changeOriginal on the MutableFilterNode that |
847 |
* was proxying this instance. */ |
848 |
private Node die() { |
849 |
if (dying) return replacement; |
850 |
//Get the filter node that proxies this node |
851 |
MutableFilterNode mfn = (MutableFilterNode)DataShadow.this.getNodeDelegate(); |
852 |
//Create a new ShadowNode to represent the DataObject |
853 |
dying=true; |
854 |
replacement = new ShadowNode (DataShadow.this); |
855 |
//Node, replace thyself |
856 |
mfn.setOriginal(replacement); |
857 |
return replacement; |
858 |
} |
859 |
|
860 |
public Node.Cookie getCookie (Class clazz) { |
861 |
if (clazz == DataShadow.class) { |
862 |
return DataShadow.this; |
863 |
} |
864 |
if (clazz == DataObject.class) { |
865 |
Thread.dumpStack(); |
866 |
return getOriginal(); |
867 |
} |
868 |
|
869 |
Node n = die(); |
870 |
return n.getCookie(clazz); |
871 |
} |
872 |
|
873 |
|
874 |
public String getDisplayName() { |
875 |
//if original is null, see if the FS will supply the filename |
876 |
//from attributes and we can avoid instantiating the DataObject |
877 |
try { |
878 |
String name = displayNameForShadow (DataShadow.this); |
879 |
name = getOriginalPrimaryFile().getFileSystem().getStatus().annotateName(name, files()); |
880 |
if (name.length() > 0) return name; |
881 |
} catch (FileStateInvalidException fsie) { |
882 |
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, fsie); |
883 |
} |
884 |
return getOriginal().getNodeDelegate().getDisplayName(); |
885 |
} |
886 |
|
887 |
public Image getOpenedIcon(int type) { |
888 |
Image i = baseIcon (type); |
889 |
if (i != null) { |
890 |
return i; |
891 |
} else { |
892 |
Node n = die(); |
893 |
return n.getIcon(type); |
894 |
} |
895 |
} |
896 |
|
897 |
public Image getIcon(int type) { |
898 |
Image i = baseIcon (type); |
899 |
if (i != null) { |
900 |
return i; |
901 |
} else { |
902 |
Node n = die(); |
903 |
return n.getIcon (type); |
904 |
} |
905 |
} |
906 |
|
907 |
Image icon; |
908 |
boolean noDeclaredIcon = false; |
909 |
private final Image baseIcon(int type) { |
910 |
if ((icon == null) && !noDeclaredIcon) { |
911 |
icon = getDeclaredIcon (DataShadow.this, type); |
912 |
noDeclaredIcon = icon == null; |
913 |
} |
914 |
return icon; |
915 |
/* |
916 |
//code below should theoretically work but doesn't. |
917 |
Image result = super.getIcon(type); |
918 |
try { |
919 |
FileObject fo = getOriginalPrimaryFile(); |
920 |
fo.getFileSystem().getStatus().annotateIcon(result, type, files()); |
921 |
} catch (FileStateInvalidException fsie) { |
922 |
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, fsie); |
923 |
} |
924 |
return result; |
925 |
*/ |
926 |
} |
927 |
|
928 |
/* Renames the shadow data object. |
929 |
* @param name new name for the object |
930 |
* @exception IllegalArgumentException if the rename failed */ |
931 |
public void setName (String name) { |
932 |
//Modified from ShadowNode - TDB |
933 |
try { |
934 |
if (!name.equals (DataShadow.this.getName ())) { |
935 |
rename (name); |
936 |
// (String strFile, String strFS, FileSystem origSystem) |
937 |
FileObject orig = getOriginalPrimaryFile(); |
938 |
String result [] = read (orig); |
939 |
FileObject fo = checkOriginal (result [IDX_PATH], result [IDX_FS], orig.getFileSystem()); |
940 |
if (fo.isRoot()) { |
941 |
orig.setAttribute (ShadowNode.ATTR_USEOWNNAME, Boolean.TRUE); |
942 |
} |
943 |
fireDisplayNameChange (null, null); |
944 |
fireNameChange (null, null); |
945 |
} |
946 |
} catch (IOException ex) { |
947 |
throw new IllegalArgumentException (ex.getMessage ()); |
948 |
} |
949 |
} |
950 |
|
951 |
MessageFormat descriptionFormat = null; |
952 |
/* Creates description based on the original one. */ |
953 |
public String getShortDescription () { |
954 |
//Note this will instantiate the DO. This node can |
955 |
//remain, however, unless asked for something it can't give. |
956 |
//Cannot use die() pattern here - changeOriginal() in FilterNode |
957 |
//will create an endless loop because it also calls this |
958 |
//method in order to fire changes. |
959 |
//Lacking a spec for specifying short description for a |
960 |
//node in fs layers, this means the DO will be created |
961 |
//when a temnplate node is asked for a tooltip. |
962 |
//IMO, this is not such a bad thing, as this means |
963 |
//that the classloading will be done when the user is |
964 |
//browsing the nodes, rather than waiting for a wizard |
965 |
//step, etc. |
966 |
return getOriginal().getNodeDelegate().getShortDescription(); |
967 |
} |
968 |
|
969 |
|
970 |
public org.openide.util.actions.SystemAction[] getActions () { |
971 |
Node n = die(); |
972 |
return n.getActions(); |
973 |
} |
974 |
|
975 |
public org.openide.util.actions.SystemAction[] getContextActions () { |
976 |
Node n = die(); |
977 |
return n.getContextActions(); |
978 |
} |
979 |
|
980 |
public String getName () { |
981 |
return DataShadow.this.getName(); |
982 |
} |
983 |
|
984 |
/** Returns a help context. Will look for it first on the |
985 |
* file pointed to by the shadow, in the attribute |
986 |
* <code>helpID</code>. If that fails, it will look for |
987 |
* the same attribute on the parent folder of the <i>shadow</i> |
988 |
* (e.g. <code>Templates/</code>). If that also fails, it |
989 |
* falls back to instantiating the DataObject and retrieving |
990 |
* the value from its node delegate. */ |
991 |
public HelpCtx getHelpCtx() { |
992 |
//Find helpID as an attribute of the primary file or original's primary file, |
993 |
//or parent folder of either, shadow first |
994 |
Object id= attributeForShadow (DataShadow.this, "SystemFileSystem.helpID", true); //NOI18N |
995 |
|
996 |
if (id instanceof String) { |
997 |
return new HelpCtx ((String) id); |
998 |
} else if (id instanceof java.net.URL) { |
999 |
return new HelpCtx ((java.net.URL) id); |
1000 |
} |
1001 |
//if the check failed, instantiate the DataObject and return it |
1002 |
Node n = die(); |
1003 |
return n.getHelpCtx(); |
1004 |
} |
1005 |
|
1006 |
public org.openide.util.actions.SystemAction getDefaultAction() { |
1007 |
Node n = die(); |
1008 |
return n.getDefaultAction(); |
1009 |
} |
1010 |
|
1011 |
public Component getCustomizer () { |
1012 |
Node n = die(); |
1013 |
return n.getCustomizer(); |
1014 |
} |
1015 |
|
1016 |
public Node.Handle getHandle() { |
1017 |
//XXX probably could return a real handle for this node, which |
1018 |
//will avoid creating the DO on deserialization. |
1019 |
Node n = die(); |
1020 |
return n.getHandle(); |
1021 |
} |
1022 |
|
1023 |
public NewType[] getNewTypes() { |
1024 |
Node n = die(); |
1025 |
return n.getNewTypes(); |
1026 |
} |
1027 |
|
1028 |
public PasteType getDropType (Transferable t, int action, int index) { |
1029 |
Node n = die(); |
1030 |
return n.getDropType (t, action, index); |
1031 |
} |
1032 |
|
1033 |
public PasteType[] getPasteType (Transferable t) { |
1034 |
Node n = die(); |
1035 |
return n.getPasteTypes(t); |
1036 |
} |
1037 |
|
1038 |
public Node.PropertySet[] getPropertySets() { |
1039 |
return getOriginal().getNodeDelegate().getPropertySets(); |
1040 |
} |
1041 |
|
1042 |
public boolean hasCustomizer() { |
1043 |
Node n = die(); |
1044 |
return n.hasCustomizer(); |
1045 |
} |
1046 |
|
1047 |
public void setShortDescription (String s) { |
1048 |
Node n = die(); |
1049 |
n.setShortDescription (s); |
1050 |
} |
1051 |
|
1052 |
public void setDisplayName(String s) { |
1053 |
Node n = die(); |
1054 |
n.setShortDescription (s); |
1055 |
} |
1056 |
|
1057 |
/* @return obj.isDeleteAllowed () */ |
1058 |
public boolean canDestroy () { |
1059 |
return DataShadow.this.isDeleteAllowed (); |
1060 |
} |
1061 |
|
1062 |
/* Destroyes the node |
1063 |
*/ |
1064 |
public void destroy () throws IOException { |
1065 |
synchronized (DataShadow.this.nodes) { |
1066 |
DataShadow.this.nodes.remove (this); |
1067 |
} |
1068 |
DataShadow.this.delete (); |
1069 |
// super.destroy (); |
1070 |
} |
1071 |
|
1072 |
/** @return true if shadow can be renamed |
1073 |
*/ |
1074 |
public final boolean canRename () { |
1075 |
return DataShadow.this.isRenameAllowed (); |
1076 |
} |
1077 |
|
1078 |
/* Returns true if this object allows copying. |
1079 |
* @returns true if so |
1080 |
*/ |
1081 |
public final boolean canCopy () { |
1082 |
return DataShadow.this.isCopyAllowed (); |
1083 |
} |
1084 |
|
1085 |
/* Returns true if this object allows cutting. |
1086 |
* @returns true if so |
1087 |
*/ |
1088 |
public final boolean canCut () { |
1089 |
return DataShadow.this.isMoveAllowed (); |
1090 |
} |
1091 |
|
1092 |
public Node cloneNode() { |
1093 |
return new ProxyShadowNode(new ProxyDOChildren()); |
1094 |
} |
1095 |
} |
1096 |
|
1097 |
/**A children object that avoids forcing the original DO to be |
1098 |
*instantiated until addNotify() is called. */ |
1099 |
private class ProxyDOChildren extends Children.Keys { |
1100 |
|
1101 |
public ProxyDOChildren() { |
1102 |
} |
1103 |
|
1104 |
public void addNotify() { |
1105 |
//avoid creating the DataObject if the primary file specifies |
1106 |
//that there are no children |
1107 |
Boolean isLeaf = (Boolean) attributeForShadow (DataShadow.this, "isLeaf",false); |
1108 |
if ((isLeaf != null) && Boolean.FALSE.equals (isLeaf)) |
1109 |
setKeys (getOriginal().getNodeDelegate().getChildren().getNodes()); |
1110 |
else |
1111 |
setKeys (Collections.EMPTY_SET); |
1112 |
} |
1113 |
|
1114 |
public Node[] createNodes (Object key) { |
1115 |
Node n = (Node) key; |
1116 |
return new Node[] {new FilterNode (n)}; |
1117 |
} |
1118 |
|
1119 |
public void removeNotify() { |
1120 |
setKeys (Collections.EMPTY_SET); |
1121 |
} |
1122 |
} |
1123 |
|
1124 |
|
Line 651
Link Here
|
651 |
if (obj.original.getPrimaryFile ().isRoot ()) { |
1176 |
if (obj.getOriginal().getPrimaryFile ().isRoot ()) { |
652 |
-- |
|
|
Lines 688-691
Link Here
|
688 |
if (format == null) { |
1213 |
// String n = displayNameForShadow(obj); |
689 |
format = new MessageFormat (NbBundle.getBundle (DataShadow.class).getString ("FMT_shadowName")); |
1214 |
String n = ""; |
690 |
} |
|
|
691 |
String n = format.format (createArguments ()); |
692 |
-- |
Line 693
Link Here
|
|
|
1216 |
if (n!=null && n.length() != 0) { |
1217 |
obj.getPrimaryFile().getFileSystem().getStatus().annotateName(n, obj.files()); |
1218 |
//if a display name is explicitly declared, do not use link format |
1219 |
return n; |
1220 |
} |
1221 |
if (format == null) { |
1222 |
format = new MessageFormat (NbBundle.getBundle (DataShadow.class).getString ("FMT_shadowName")); |
1223 |
} |
1224 |
n = format.format (createArguments ()); |
Line 704
Link Here
|
704 |
if (obj.original.isValid()) { |
1236 |
if (obj.getOriginal().isValid()) { |
705 |
-- |
|
|
Line 785
Link Here
|
785 |
return null; |
1317 |
return getDeclaredIcon (obj, type); |
786 |
-- |
|
|
Line 831
Link Here
|
|
|
1363 |
if (cl == DataShadow.class) return obj; |