@@ -63,41 +63,6 @@ public String getTitle() {
6363  }
6464
6565
66-   /* 
67-   public String getPluralTitle() { 
68-     switch (this) { 
69-     case LIBRARY: 
70-       return "Libraries"; 
71-     case MODE: 
72-       return "Modes"; 
73-     case TOOL: 
74-       return "Tools"; 
75-     case EXAMPLES: 
76-       return "Examples"; 
77-     } 
78-     return null;  // should be unreachable 
79-   } 
80-   */ 
81- 
82- 
83- //  public String getFolderName() { 
84- //    return toString(); 
85- //    /* 
86- //    switch (this) { 
87- //    case LIBRARY: 
88- //      return "libraries"; 
89- //    case TOOL: 
90- //      return "tools"; 
91- //    case MODE: 
92- //      return "modes"; 
93- //    case EXAMPLES: 
94- //      return "examples"; 
95- //    } 
96- //    return null;  // should be unreachable 
97- //    */ 
98- //  } 
99- 
100- 
10166  /** Get the name of the properties file for this type of contribution. */ 
10267  public  String  getPropertiesName () {
10368    return  this  + ".properties" ;
@@ -109,42 +74,11 @@ public File createTempFolder() throws IOException {
10974  }
11075
11176
112-   /* 
113-   // removed for 4.0a6, doesn't appear to be in use 
114-   public File[] listTempFolders() throws IOException { 
115-     File base = getSketchbookFolder(); 
116-     return base.listFiles(new FileFilter() { 
117-       @Override 
118-       public boolean accept(File file) { 
119-         String name = file.getName(); 
120-         return (file.isDirectory() && 
121-                 name.startsWith(toString()) && name.endsWith("tmp")); 
122-       } 
123-     }); 
124-   } 
125-   */ 
126- 
127- 
12877  public  boolean  isTempFolderName (String  name ) {
12978    return  name .startsWith (toString ()) && name .endsWith ("tmp" );
13079  }
13180
13281
133- //  public String getTempPrefix() { 
134- //    return toString(); 
135- //  } 
136- // 
137- // 
138- //  public String getTempSuffix() { 
139- //    return "tmp"; 
140- //  } 
141- 
142- 
143- //    public String getPropertiesName() { 
144- //      return toString() + ".properties"; 
145- //    } 
146- 
147- 
14882  static  public  ContributionType  fromName (String  s ) {
14983    if  (s  != null ) {
15084      if  ("library" .equalsIgnoreCase (s )) {
@@ -239,20 +173,22 @@ LocalContribution load(Base base, File folder) {
239173  }
240174
241175
242-   List <LocalContribution > listContributions (Editor  editor ) {
176+   List <LocalContribution > listContributions (Base   base ,  Editor  editor ) {
243177    List <LocalContribution > contribs  = new  ArrayList <>();
244178    switch  (this ) {
245179    case  LIBRARY :
246-       contribs .addAll (editor .getMode ().contribLibraries );
180+       if  (editor  != null ) {
181+         contribs .addAll (editor .getMode ().contribLibraries );
182+       }
247183      break ;
248184    case  TOOL :
249-       contribs .addAll (editor . getBase () .getToolContribs ());
185+       contribs .addAll (base .getToolContribs ());
250186      break ;
251187    case  MODE :
252-       contribs .addAll (editor . getBase () .getModeContribs ());
188+       contribs .addAll (base .getModeContribs ());
253189      break ;
254190    case  EXAMPLES :
255-       contribs .addAll (editor . getBase () .getExampleContribs ());
191+       contribs .addAll (base .getExampleContribs ());
256192      break ;
257193    }
258194    return  contribs ;
@@ -266,41 +202,11 @@ File getBackupFolder() {
266202
267203  File  createBackupFolder (StatusPanel  status ) {
268204    File  backupFolder  = getBackupFolder ();
269- //    if (backupFolder.isDirectory()) { 
270- //      status.setErrorMessage("First remove the folder named \"old\" from the " + 
271- //                             getFolderName() + " folder in the sketchbook."); 
272- //      return null; 
273- //    } 
274205    if  (!backupFolder .exists () && !backupFolder .mkdirs ()) {
275206      status .setErrorMessage ("Could not create a backup folder in the "  +
276207      		                   "sketchbook "  + this  + " folder." );
277208      return  null ;
278209    }
279210    return  backupFolder ;
280211  }
281- 
282- 
283- //  /** 
284- //   * Create a filter for a specific contribution type. 
285- //   * @param type The type, or null for a generic update checker. 
286- //   */ 
287- //  Contribution.Filter createFilter2() { 
288- //    return new Contribution.Filter() { 
289- //      public boolean matches(Contribution contrib) { 
290- //        return contrib.getType() == ContributionType.this; 
291- //      } 
292- //    }; 
293- //  } 
294- 
295- 
296- //  static Contribution.Filter createUpdateFilter() { 
297- //    return new Contribution.Filter() { 
298- //      public boolean matches(Contribution contrib) { 
299- //        if (contrib instanceof LocalContribution) { 
300- //          return ContributionListing.getInstance().hasUpdates(contrib); 
301- //        } 
302- //        return false; 
303- //      } 
304- //    }; 
305- //  } 
306212}
0 commit comments