Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 76977 Details for
Bug 201154
Add support in SWT for event-based document opening
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
OS X equinox launcher patch
org.eclipse.equinox.executable.patch (text/plain), 4.42 KB, created by
Mike Schrag
on 2007-08-25 20:21:19 EDT
(
hide
)
Description:
OS X equinox launcher patch
Filename:
MIME Type:
Creator:
Mike Schrag
Created:
2007-08-25 20:21:19 EDT
Size:
4.42 KB
patch
obsolete
>Index: library/carbon/eclipseCarbonCommon.c >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox.executable/library/carbon/eclipseCarbonCommon.c,v >retrieving revision 1.5 >diff -u -r1.5 eclipseCarbonCommon.c >--- library/carbon/eclipseCarbonCommon.c 25 Apr 2007 20:33:57 -0000 1.5 >+++ library/carbon/eclipseCarbonCommon.c 26 Aug 2007 00:18:37 -0000 >@@ -26,6 +26,9 @@ > static CFBundleRef javaVMBundle = NULL; > > void initWindowSystem( int* pArgc, _TCHAR* argv[], int showSplash ); >+static OSStatus appleEventProc(EventHandlerCallRef inCaller, EventRef inEvent, void* inRefcon); >+static pascal OSErr openApplicationAEProc(const AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon); >+static pascal OSErr openDocumentsAEProc(const AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon); > > int initialized = 0; > >@@ -48,11 +51,18 @@ > */ > void initWindowSystem( int* pArgc, char* argv[], int showSplash ) > { >+ EventTypeSpec kEvents[] = { {kEventClassAppleEvent, kEventAppleEvent} }; >+ > char *homeDir = getProgramDir(); > /*debug("install dir: %s\n", homeDir);*/ > if (homeDir != NULL) > chdir(homeDir); >- >+ >+ InstallApplicationEventHandler(NewEventHandlerUPP(appleEventProc), GetEventTypeCount(kEvents), kEvents, 0, NULL); >+ AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, NewAEEventHandlerUPP(openApplicationAEProc), 0, false); >+ AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, NewAEEventHandlerUPP(openDocumentsAEProc), 0, false); >+ > if (showSplash) > init(); > } >@@ -166,4 +176,88 @@ > } > CFRelease(url); > return result; >-} >\ No newline at end of file >+} >+ >+static OSStatus appleEventProc(EventHandlerCallRef inCaller, EventRef inEvent, void* inRefcon) { >+ Boolean release = false; >+ EventRecord eventRecord; >+ OSErr ignoreErrForThisSample; >+ >+ // Events of type kEventAppleEvent must be removed from the queue >+ // before being passed to AEProcessAppleEvent. >+ if (IsEventInQueue(GetMainEventQueue(), inEvent)) { >+ // RemoveEventFromQueue will release the event, which will >+ // destroy it if we don't retain it first. >+ RetainEvent(inEvent); >+ release = true; >+ RemoveEventFromQueue(GetMainEventQueue(), inEvent); >+ } >+ >+ // Convert the event ref to the type AEProcessAppleEvent expects. >+ ConvertEventRefToEventRecord(inEvent, &eventRecord); >+ ignoreErrForThisSample = AEProcessAppleEvent(&eventRecord); >+ >+ if (release) { >+ ReleaseEvent(inEvent); >+ } >+ >+ // This Carbon event has been handled, even if no AppleEvent handlers >+ // were installed for the Apple event. >+ return noErr; >+} >+ >+static pascal OSErr openApplicationAEProc(const AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon) { >+ printf("openApplication\n"); >+ return noErr; >+} >+ >+static pascal OSErr openDocumentsAEProc(const AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon) { >+ printf("openDocuments\n"); >+ AEDescList docList; >+ FSRef fsRef; >+ CFURLRef resolved; >+ Boolean isFolder, wasAliased; >+ CFStringRef string; >+ long index; >+ long count = 0; >+ char *result; >+ OSErr err = AEGetParamDesc(theAppleEvent, keyDirectObject, typeAEList, &docList); >+ require_noerr(err, CantGetDocList); >+ >+ err = AECountItems(&docList, &count); >+ require_noerr(err, CantGetCount); >+ >+ for (index = 1; index <= count; index++) { >+ err = AEGetNthPtr(&docList, index, typeFSRef, NULL, NULL, &fsRef, sizeof(FSRef), NULL); >+ require_noerr(err, CantGetDocDescPtr); >+ >+ if (FSResolveAliasFile(&fsRef, true, &isFolder, &wasAliased) == noErr) { >+ resolved = CFURLCreateFromFSRef(kCFAllocatorDefault, &fsRef); >+ if (resolved != NULL) { >+ string = CFURLCopyFileSystemPath(resolved, kCFURLPOSIXPathStyle); >+ CFIndex length = CFStringGetMaximumSizeForEncoding(CFStringGetLength(string), kCFStringEncodingUTF8); >+ char *s = malloc(length); >+ if (CFStringGetCString(string, s, length, kCFStringEncodingUTF8)) { >+ result = s; >+ printf(">%s\n", result); >+ free(s); >+ } >+ else { >+ free(s); >+ } >+ CFRelease(string); >+ CFRelease(resolved); >+ } >+ } >+ } >+ >+CantGetCount: >+CantGetDocDescPtr: >+ AEDisposeDesc(&docList); >+ >+CantGetDocList: >+ if (err != noErr) { >+ // For handlers that expect a reply, add error information here. >+ } >+ return err; >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 201154
:
76977
|
76978
|
77255
|
83404
|
150098
|
150099
|
150100
|
150134
|
151354
|
151355
|
153400
|
156013