English 中文(简体)
Can t 获得SWT在MacOS X的显示器
原标题:Can t get SWT Display on Mac OS X
  • 时间:2009-10-14 15:38:50
  •  标签:

I m 经营MacOS XSnow Leopard和wan,从奥SGi bundle的演员那里获取显示器。

下面是我的启动者启动方法:

@Override
public void start(BundleContext context) throws Exception {
    ExecutorService service = Executors.newSingleThreadExecutor();
    service.execute(new Runnable() {

        @Override
        public void run() {
            Display display = Display.getDefault();
            Shell shell = new Shell(display);
            Text helloText = new Text(shell, SWT.CENTER);
            helloText.setText("Hello SWT!");
            helloText.pack();
            shell.pack();
            shell.open();
            while (!shell.isDisposed()) {
                if (!display.readAndDispatch())
                    display.sleep();
            }
            display.dispose();
        }
    });
}

视窗环境中使用该代码的工作成绩良好,但在MacOS X上部署,我取得了以下成果:

2009-10-14 17:17:54.050 java[2010:10003] *** __NSAutoreleaseNoPool(): Object 0x101620d20 of class NSCFString autoreleased with no pool in place - just leaking
2009-10-14 17:17:54.081 java[2010:10003] *** __NSAutoreleaseNoPool(): Object 0x100119240 of class NSCFNumber autoreleased with no pool in place - just leaking
2009-10-14 17:17:54.084 java[2010:10003] *** __NSAutoreleaseNoPool(): Object 0x1001024b0 of class NSCFString autoreleased with no pool in place - just leaking
2009-10-14 17:17:54.086 java[2010:10003] *** __NSAutoreleaseNoPool(): Object 0x7fff701d7f70 of class NSCFString autoreleased with no pool in place - just leaking
2009-10-14 17:17:54.087 java[2010:10003] *** __NSAutoreleaseNoPool(): Object 0x100113330 of class NSCFString autoreleased with no pool in place - just leaking
2009-10-14 17:17:54.092 java[2010:10003] *** __NSAutoreleaseNoPool(): Object 0x101624540 of class NSCFData autoreleased with no pool in place - just leaking
.
.
.

我先用了——XstartOnFirstThread RV论点而没有uck。 位于64美科拉的伊米,但我也审判了32美科拉。

在尝试碳时,我有以下错误:

Invalid memory access of location 00000020 eip=9012337c

在冲入显示器类别时,我可以看到,显示器阵列只含有无效参考资料。

最佳回答

我可以证实,我们成功地在麦克斯温斯堪德(Carbon )上操作了SWT。 X 在其自己的活动中,充斥着诱发的dle,这无疑是可能的! 正在使用——XstartOnFirstThread 启动证书。

www.un.org/chinese/ga/president

看来,尽管我们管理碳SWT的方式有效,但也许不是ko:我们正在把这一活动推向另一个read子,而不是你所认为的主线。 在Cocoa SWT下,这只字不提工作了,而且可能是干.。

在创建显示台之前,我可以把read子与以下 ha子固定下来(从Cocoa SWT装置构造者那里吸收):

  NSAutoreleasePool pool = (NSAutoreleasePool) new NSAutoreleasePool().alloc().init();
  NSThread nsthread = NSThread.currentThread();
  NSMutableDictionary dictionary = nsthread.threadDictionary();
  NSString key = NSString.stringWith("SWT_NSAutoreleasePool");
  id obj = dictionary.objectForKey(key);
  if (obj == null) {
          NSNumber nsnumber = NSNumber.numberWithInteger(pool.id);
          dictionary.setObject(nsnumber, key);
  } else {
          pool.release();
  }

然而,会堂紧随缝(即显示器具/显示器/跳板(舞蹈)。 我怀疑,由于不是主线,它只是看不出“国际倡议”事件。

我不敢肯定,是否有办法解决这一问题。 就我而言,我们控制了发射OSGi的主要轨道,这样我就抱着在SWT事件爆发后能够在那里运行的ook的想法。

问题回答

I had the problem that as soon as "display.sleep()" was called the Window freezed the application. If somebody else hace the same problem, the solution that worked for me was to add: -XstartOnFirstThread to the VM at the moment of the execution.

我正试图使阿丽卡备用软件在我的Mac上发挥作用,并知道它的工作:

我的制度是:MacOsXnow Leopard10.6.2。

Bye, Daniel W.

我有同样的问题,并通过添加<代码>-d32和-XstartOnFirstThread加以解决。

这部法典看着很奇怪......这是否是一种迷幻的花样? 你试图做些什么? 我猜测,你正试图用用户界面创建一种RCP假胜。 如果是的话,请回答:Don t是这样。 你的奥西特尼行动家不负责创建SWT展场。

• 在贵方乐施中扩大申请范围,以明确创建SWT 。 它将研究这样的情况:

   <extension
         id="application"
         point="org.eclipse.core.runtime.applications">
      <application>
         <run
               class="com.yourcompany.foo.Application">
         </run>
      </application>
   </extension>

然后,设立申请组(请你要求它做什么),以研究类似情况:

public class Application implements IApplication {

    /* (non-Javadoc)
     * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
     */
    public Object start(IApplicationContext context) {
        Display display = PlatformUI.createDisplay();
        try {
            int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
            if (returnCode == PlatformUI.RETURN_RESTART) {
                return IApplication.EXIT_RESTART;
            }
            return IApplication.EXIT_OK;
        } finally {
            display.dispose();
        }
    }

    /* (non-Javadoc)
     * @see org.eclipse.equinox.app.IApplication#stop()
     */
    public void stop() {
        final IWorkbench workbench = PlatformUI.getWorkbench();
        if (workbench == null)
            return;
        final Display display = workbench.getDisplay();
        display.syncExec(new Runnable() {
            public void run() {
                if (!display.isDisposed())
                    workbench.close();
            }
        });
    }
}

显然,确保你在万物和花时间上都能获得SWT的原始资料(org.eclipse.ui)。

我希望能够提供帮助。





相关问题