The best way to find out is to look at the github plugin code (see the long list below):
- This is basically a plugin.
- No main.m No MainMenu.xib
- The first class is loaded by setting the NSPrincipalClass to info.plist
- in your init: you register for AppKit notifications
- See code examples
- some check the mainBundle application id to make sure it is Xcode
- The Xcode Editor Window Class is DVTSourceTextView
- Its subclass is DVTSourceTextView: NSTextView: NSText
- so you can register to listen to your notifications for NSTextView or NSText
- e.g. NSTextViewWillChangeNotifyingTextViewNotification
Since it is not an official standard, I noticed that each sample is loaded differently.
XCODE PLUGIN SAMPLES
compiled either by github / web search for
'DVTSourceTextView'
This is the class name of the Xcode editor window.
or
Info-list button
'XC4Compatible' https://github.com/omz/ColorSense-for-Xcode https://github.com/ciaran/xcode-bracket-matcher - uses a ruby parser run as pipe! https://github.com/joshaber/WTFXcode https://github.com/0xced/NoLastUpgradeCheck http://code.google.com/p/google-toolbox-for-mac/downloads/list see GTMXcode4Plugin https://github.com/DeepIT/XcodeColors https://github.com/0xced/CLITool-InfoPlist https://github.com/sap-production/xcode-ide-maven-integration https://github.com/ciaran/xcode-bracket-matcher
GET IN NSTextView, which is a console
https://github.com/sap-production/xcode-ide-maven-integration
- (NSTextView *)findConsoleAndActivate { Class consoleTextViewClass = objc_getClass("IDEConsoleTextView"); NSTextView *console = (NSTextView *)[self findView:consoleTextViewClass inView:NSApplication.sharedApplication.mainWindow.contentView]; if (console) { NSWindow *window = NSApplication.sharedApplication.keyWindow; if ([window isKindOfClass:objc_getClass("IDEWorkspaceWindow")]) { if ([window.windowController isKindOfClass:NSClassFromString(@"IDEWorkspaceWindowController")]) { id editorArea = [window.windowController valueForKey:@"editorArea"]; [editorArea performSelector:@selector(activateConsole:) withObject:self]; } } } return console; }
brian.clear Nov 01 '12 at 16:09 2012-11-01 16:09
source share