本文整理汇总了Java中org.eclipse.swt.internal.Callback类的典型用法代码示例。如果您正苦于以下问题:Java Callback类的具体用法?Java Callback怎么用?Java Callback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Callback类属于org.eclipse.swt.internal包,在下文中一共展示了Callback类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: init
import org.eclipse.swt.internal.Callback; //导入依赖的package包/类
public void init() {
Callback openDocCallback = new Callback(this, "openDocProc", 3);
int openDocProc = openDocCallback.getAddress();
if (openDocProc == 0) {
openDocCallback.dispose();
return;
}
if (OS.AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,openDocProc, 0, false) != OS.noErr) {
return;
}
if (OS.AEInstallEventHandler(kURLEventClass, kURLEventClass,openDocProc, 0, false) != OS.noErr) {
return;
}
int appTarget = OS.GetApplicationEventTarget();
Callback appleEventCallback = new Callback(this, "appleEventProc", 3);
int appleEventProc = appleEventCallback.getAddress();
int[] mask3 = new int[] { OS.kEventClassAppleEvent, OS.kEventAppleEvent, kURLEventClass, };
OS.InstallEventHandler(appTarget, appleEventProc,mask3.length / 2, mask3, 0, null);
}
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:20,代码来源:OpenDocListener.java
示例2: getCallbackAddress
import org.eclipse.swt.internal.Callback; //导入依赖的package包/类
private static ILongPtr getCallbackAddress(Callback callback)
{
ILongPtr address = WinAPI.ZERO_LONGPTR;
if (callback != null)
{
try
{
Class<? extends Callback> clasz = callback.getClass();
Method m = clasz.getMethod("getAddress");
address = WinAPI.INSTANCE.createLongPtr(((Number) m.invoke(callback)));
}
catch (Exception e)
{
e.printStackTrace();
}
}
return address;
}
开发者ID:henrikor2,项目名称:eclipsensis,代码行数:19,代码来源:ControlSubclasser.java
示例3: init
import org.eclipse.swt.internal.Callback; //导入依赖的package包/类
public void init() throws Throwable{
long cls = TGCocoa.objc_lookUpClass ("SWTApplicationDelegate");
if( cls != 0 ){
Callback callback = TGCocoa.newCallback( this , "callbackProc64" , "callbackProc32", 4 );
long callbackProc = TGCocoa.getCallbackAddress( callback );
if( callbackProc != 0 ){
TGCocoa.class_addMethod(cls, sel_application_openFile_, callbackProc , "B:@@");
}
}
}
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:12,代码来源:OpenDocListener.java
示例4: ClipboardProxy
import org.eclipse.swt.internal.Callback; //导入依赖的package包/类
ClipboardProxy(Display display) {
this.display = display;
getFunc = new Callback(this, "getFunc", 4); //$NON-NLS-1$
if (getFunc.getAddress() == 0)
SWT.error(SWT.ERROR_NO_MORE_CALLBACKS);
clearFunc = new Callback(this, "clearFunc", 2); //$NON-NLS-1$
if (clearFunc.getAddress() == 0)
SWT.error(SWT.ERROR_NO_MORE_CALLBACKS);
}
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:10,代码来源:ClipboardProxy.java
示例5: newCallback
import org.eclipse.swt.internal.Callback; //导入依赖的package包/类
static private Callback newCallback(Object object, String method,
int argCount) {
Callback callback = new Callback(object, method, argCount);
if (callback.getAddress() == 0)
SWT.error(SWT.ERROR_NO_MORE_CALLBACKS);
return callback;
}
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:8,代码来源:AccessibleFactory.java
示例6: newCallback
import org.eclipse.swt.internal.Callback; //导入依赖的package包/类
public static final Callback newCallback(Object object, String method64, String method32, int argCount) throws Throwable {
return new Callback( object, ( C.PTR_SIZEOF == 8 ? method64 : method32 ) , argCount );
}
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:4,代码来源:TGCocoa.java
示例7: getCallbackAddress
import org.eclipse.swt.internal.Callback; //导入依赖的package包/类
public static final long getCallbackAddress( Callback callback ) throws Throwable {
return longValue(invokeMethod(Callback.class, callback , "getAddress", new Object[] {}));
}
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:4,代码来源:TGCocoa.java
示例8: init
import org.eclipse.swt.internal.Callback; //导入依赖的package包/类
public void init( Shell shell ) throws Throwable{
Callback callback = TGCocoa.newCallback( this , "callbackProc64", "callbackProc32", 3 );
long callbackProc = TGCocoa.getCallbackAddress( callback );
if( callbackProc != 0 ){
String classname = ("MacToolbarDelegate");
if( TGCocoa.objc_lookUpClass ( classname ) == 0 ) {
long cls = TGCocoa.objc_allocateClassPair( classname , 0 ) ;
TGCocoa.class_addIvar(cls, SWT_OBJECT, C.PTR_SIZEOF , (byte)(C.PTR_SIZEOF == 4 ? 2 : 3), new byte[]{'*','\0'} );
TGCocoa.class_addMethod(cls, sel_toolbarButtonClicked_, callbackProc , "@:@");
TGCocoa.objc_registerClassPair(cls);
}
this.delegate = TGCocoa.newMacToolbarDelegate();
this.delegate.alloc().init();
this.delegateRef = TGCocoa.NewGlobalRef( MacToolbar.this );
TGCocoa.object_setInstanceVariable( MacToolbarDelegate.class.getField("id").get( delegate ) , SWT_OBJECT , this.delegateRef );
NSToolbar dummyBar = new NSToolbar();
dummyBar.alloc();
dummyBar.initWithIdentifier(NSString.stringWith("SWTToolbar")); //$NON-NLS-1$
dummyBar.setVisible(false);
NSWindow nsWindow = shell.view.window();
nsWindow.setToolbar(dummyBar);
dummyBar.release();
nsWindow.setShowsToolbarButton(true);
NSButton toolbarButton = TGCocoa.getStandardWindowButton(nsWindow, NSWindowToolbarButton);
if (toolbarButton != null) {
toolbarButton.setTarget( delegate );
TGCocoa.setControlAction( toolbarButton , sel_toolbarButtonClicked_ );
}
}
}
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:37,代码来源:MacToolbar.java
示例9: initialize
import org.eclipse.swt.internal.Callback; //导入依赖的package包/类
private void initialize(final CallbackObject callbackObject) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, ClassNotFoundException {
final Class<?> osCls = Class.forName("org.eclipse.swt.internal.cocoa.OS");
// Register names in Objective-C.
if (sel_toolbarButtonClicked_ == 0) {
sel_preferencesMenuItemSelected_ = registerName(osCls, "preferencesMenuItemSelected:");
sel_aboutMenuItemSelected_ = registerName(osCls, "aboutMenuItemSelected:");
}
// Create an SWT Callback object that will invoke the actionProc method of our internal callbackObject.
proc3Args = new Callback(callbackObject, "actionProc", 3);
final long proc3 = proc3Args.getAddress();
if (proc3 == 0) {
SWT.error(SWT.ERROR_NO_MORE_CALLBACKS);
}
final Object object = invoke(osCls, "objc_lookUpClass", new Object[] { "SWTApplicationDelegate" });
final long cls = convertToLong(object);
// Add the action callbacks for Preferences and About menu items.
invoke(osCls, "class_addMethod", new Object[] { wrapPointer(cls), wrapPointer(sel_preferencesMenuItemSelected_), wrapPointer(proc3), "@:@" });
invoke(osCls, "class_addMethod", new Object[] { wrapPointer(cls), wrapPointer(sel_aboutMenuItemSelected_), wrapPointer(proc3), "@:@" });
final Class<?> nsapplicationCls = Class.forName("org.eclipse.swt.internal.cocoa.NSApplication");
final Class<?> nsmenuCls = Class.forName("org.eclipse.swt.internal.cocoa.NSMenu");
// Get the Mac OS X Application menu.
final Object sharedApplication = invoke(nsapplicationCls, "sharedApplication");
final Object mainMenu = invoke(sharedApplication, "mainMenu");
final Object mainMenuItem = invoke(nsmenuCls, mainMenu, ITEM_AT_INDEX, new Number[] { wrapPointer(0) });
final Object appMenu = invoke(mainMenuItem, "submenu");
final Object aboutMenuItem = invoke(nsmenuCls, appMenu, ITEM_AT_INDEX, new Number[] { wrapPointer(kAboutMenuItem) });
final Object prefMenuItem = invoke(nsmenuCls, appMenu, ITEM_AT_INDEX, new Number[] { wrapPointer(kPreferencesMenuItem) });
final Class<?> nsmenuitemCls = Class.forName("org.eclipse.swt.internal.cocoa.NSMenuItem");
if (callbackObject.aboutEnabled) {
invoke(nsmenuitemCls, aboutMenuItem, "setAction", new Number[] { wrapPointer(sel_aboutMenuItemSelected_) });
}
invoke(nsmenuitemCls, aboutMenuItem, "setEnabled", new Boolean[] { callbackObject.aboutEnabled });
if (callbackObject.preferencesEnabled) {
invoke(nsmenuitemCls, prefMenuItem, "setAction", new Number[] { wrapPointer(sel_preferencesMenuItemSelected_) });
}
invoke(nsmenuitemCls, prefMenuItem, "setEnabled", new Boolean[] { callbackObject.preferencesEnabled });
}
开发者ID:Albertus82,项目名称:JFaceUtils,代码行数:48,代码来源:CocoaUIEnhancer.java
注:本文中的org.eclipse.swt.internal.Callback类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论