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 30488 Details for
Bug 104744
[Mac] Investigate open document/applescript support
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch against org.eclipse.ui.carbon
UI.Carbon-Applescript.txt (text/plain), 6.02 KB, created by
Kim Horne
on 2005-11-23 11:19:07 EST
(
hide
)
Description:
Patch against org.eclipse.ui.carbon
Filename:
MIME Type:
Creator:
Kim Horne
Created:
2005-11-23 11:19:07 EST
Size:
6.02 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.carbon >Index: src/org/eclipse/ui/carbon/CarbonUIEnhancer.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.carbon/src/org/eclipse/ui/carbon/CarbonUIEnhancer.java,v >retrieving revision 1.11 >diff -u -r1.11 CarbonUIEnhancer.java >--- src/org/eclipse/ui/carbon/CarbonUIEnhancer.java 21 Jul 2005 23:02:54 -0000 1.11 >+++ src/org/eclipse/ui/carbon/CarbonUIEnhancer.java 23 Nov 2005 16:04:03 -0000 >@@ -19,6 +19,7 @@ > import org.eclipse.jface.action.ActionContributionItem; > import org.eclipse.jface.action.IAction; > import org.eclipse.swt.internal.Callback; >+import org.eclipse.swt.internal.carbon.EventRecord; > import org.eclipse.swt.internal.carbon.HICommand; > import org.eclipse.swt.internal.carbon.OS; > import org.eclipse.swt.widgets.Display; >@@ -85,6 +86,7 @@ > public void run() { > hookApplicationMenu(display); > hookToolbarButtonCallback(); >+ hookApplescriptCallback(); > hookWorkbenchListener(); > // modify all shells opened on startup > IWorkbenchWindow[] windows = PlatformUI.getWorkbench() >@@ -96,7 +98,57 @@ > }); > } > >- /** >+ protected void hookApplescriptCallback() { >+ Object target = new Object() { >+ public int applescriptProc(int nextHandler, int inEvent, >+ int userData) { >+ boolean doRelease = false; >+ int err = OS.noErr; >+ EventRecord eventRecord = new EventRecord(); >+ >+ if (doRelease = OS.IsEventInQueue(OS.GetMainEventQueue(), >+ inEvent)) { >+ >+ OS.RetainEvent(inEvent); >+ OS.RemoveEventFromQueue(OS.GetMainEventQueue(), inEvent); >+ } >+ >+ OS.ConvertEventRefToEventRecord(inEvent, eventRecord); >+ err = OS.AEProcessAppleEvent(eventRecord); >+ if (doRelease) >+ OS.ReleaseEvent(inEvent); >+ return err; >+ } >+ >+ }; >+ final Callback commandCallback = new Callback(target, >+ "applescriptProc", 3); //$NON-NLS-1$ >+ int commandProc = commandCallback.getAddress(); >+ if (commandProc == 0) { >+ commandCallback.dispose(); >+ return; // give up >+ } >+ >+ int[] mask = new int[] { OS.kEventClassAppleEvent, OS.kEventAppleEvent }; >+ OS.InstallEventHandler(OS.GetApplicationEventTarget(), commandProc, >+ mask.length / 2, mask, 0, null); >+ >+ Object openAppleScriptHandler = new Object() { >+ public int handle(int inEvent, int outEvent, int ref) { >+ System.out.println("Handled."); //$NON-NLS-1$ >+ return OS.noErr; >+ } >+ }; >+ final Callback appleScriptCallback = new Callback(openAppleScriptHandler, "handle", 3); //$NON-NLS-1$ >+ int openAppleScriptProc = appleScriptCallback.getAddress(); >+ if (openAppleScriptProc == 0) { >+ appleScriptCallback.dispose(); >+ return; // give up >+ } >+ OS.AEInstallEventHandler(AppleScriptConstants.kCoreEventClass, AppleScriptConstants.kAEOpenApplication, openAppleScriptProc, 0, false); >+ } >+ >+ /** > * Hooks a listener that tweaks newly opened workbench window shells with > * the proper OS flags. > * >Index: src/org/eclipse/ui/carbon/AppleScriptHelper.java >=================================================================== >RCS file: src/org/eclipse/ui/carbon/AppleScriptHelper.java >diff -N src/org/eclipse/ui/carbon/AppleScriptHelper.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/carbon/AppleScriptHelper.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,35 @@ >+/******************************************************************************* >+ * Copyright (c) 2005 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.ui.carbon; >+ >+ >+/** >+ * @since 3.2 >+ * >+ */ >+public final class AppleScriptHelper { >+ >+ /** >+ * Generate the integer event id based on a 4 character event string. >+ * >+ * @param eventId >+ * the 4 character event string >+ * @return the integer event id >+ */ >+ public static int generateEventId(String eventId) { >+// if (eventId.length() != 4) >+// throw new IllegalArgumentException(); >+ >+ return (eventId.charAt(0) << 24) + (eventId.charAt(1) << 16) >+ + (eventId.charAt(2) << 8) + eventId.charAt(3); >+ } >+} >Index: src/org/eclipse/ui/carbon/AppleScriptConstants.java >=================================================================== >RCS file: src/org/eclipse/ui/carbon/AppleScriptConstants.java >diff -N src/org/eclipse/ui/carbon/AppleScriptConstants.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/carbon/AppleScriptConstants.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,36 @@ >+/******************************************************************************* >+ * Copyright (c) 2005 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.carbon; >+ >+/** >+ * >+ * @since 3.2 >+ */ >+public interface AppleScriptConstants { >+ >+ public final static int kCoreEventClass = AppleScriptHelper >+ .generateEventId("aevt"); //$NON-NLS-1$ >+ >+ public final static int kAEOpenApplication = AppleScriptHelper >+ .generateEventId("oapp"); //$NON-NLS-1$ >+ >+ public final static int kAEReopenApplication = AppleScriptHelper >+ .generateEventId("rapp"); //$NON-NLS-1$ >+ >+ public final static int kAEOpenDocuments = AppleScriptHelper >+ .generateEventId("odoc"); //$NON-NLS-1$ >+ >+ public final static int kAEPrintDocuments = AppleScriptHelper >+ .generateEventId("pdoc"); //$NON-NLS-1$ >+ >+ public final static int kAEOpenContents = AppleScriptHelper >+ .generateEventId("ocon"); //$NON-NLS-1$ >+}
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 104744
:
30487
| 30488