Guest User

Untitled

a guest
Feb 19th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. From: Allan Odgaard <XXX>
  2. Date: 13. jun 2006 3:07:28 GMT+02:00
  3. To: Håkan Waara <XXX>
  4. Subject: Re: way to change current bundle?
  5.  
  6. On 13/6/2006, at 1:20, Håkan Waara wrote:
  7.  
  8. > I don't remember what the conclusion of this discussion was, but I remember asking you in #textmate about a way for my plugin to change the current bundle.
  9. >
  10. > Is there at least some API which would give me an array of the bundles' names that I then could choose from? Substring matching the language to find the right one would work for me...
  11.  
  12. I assume you mean language (grammar)?
  13.  
  14. This API is not set in stone, but there is a BundleManager singleton class. You can get the class object using:
  15.  
  16. Class cl = [[NSBundle mainBundle] classNamed:@"BundleManager"];
  17.  
  18. Then to get the instance use this class method:
  19.  
  20. + (BundleManager*)sharedInstance;
  21.  
  22. This object has the following method:
  23.  
  24. - (NSArray*)languages;
  25.  
  26. This gives you an array of all languages, the actual objects are bundle items and respond to:
  27.  
  28. - (NSString*)name;
  29. - (NSString*)UUID;
  30.  
  31. This is the display name, but I assume this is what you want to compare against.
  32.  
  33. When you have found the language you want to change to, the OakTextView has the following method:
  34.  
  35. - (void)changeLanguageTo:(id)anUUID andLearn:(BOOL)flag;
  36.  
  37. Here you give the UUID of the language and give NO as flag. The flag tells if it should learn the association, i.e. if files with the current extension should forever be tied to the given language.
Add Comment
Please, Sign In to add comment