RCP開發中錯誤:java.lang.RuntimeException: WARNING: Prevented recursive attempt to activate part。。

來源:互聯網
上載者:User

在做RCP的eclipse外掛程式開發時,啟動管理軟體介面時,總是報如下錯誤 :

 

!ENTRY org.eclipse.ui.workbench 4 0 2012-05-25 18:44:21.306
!MESSAGE WARNING: Prevented recursive attempt to activate part org.gluster.storage.management.console.views.ClusterSummaryView while still in the middle of activating part org.gluster.storage.management.console.views.NavigationView
!STACK 0
java.lang.RuntimeException: WARNING: Prevented recursive attempt to activate part org.gluster.storage.management.console.views.ClusterSummaryView while still in the middle of activating part org.gluster.storage.management.console.views.NavigationView
 at org.eclipse.ui.internal.WorkbenchPage.setActivePart(WorkbenchPage.java:3586)
 at org.eclipse.ui.internal.WorkbenchPage.internalActivate(WorkbenchPage.java:691)
 at org.eclipse.ui.internal.WorkbenchPage.activate(WorkbenchPage.java:663)
 at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:1170)
 at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:1147)
 at org.eclipse.ui.internal.WorkbenchPage$20.run(WorkbenchPage.java:3921)
 at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
 at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3918)
 at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3894)
 at org.gluster.storage.management.console.views.GlusterViewsManager.showViewsForCluster(GlusterViewsManager.java:82)
 at org.gluster.storage.management.console.views.GlusterViewsManager.updateViews(GlusterViewsManager.java:53)
 at org.gluster.storage.management.console.views.NavigationView.selectionChanged(NavigationView.java:142)
 at org.eclipse.ui.internal.AbstractSelectionService.fireSelection(AbstractSelectionService.java:156)
 at org.eclipse.ui.internal.AbstractSelectionService.setActivePart(AbstractSelectionService.java:282)
 at org.eclipse.ui.internal.WorkbenchPagePartList.fireActivePartChanged(WorkbenchPagePartList.java:60)
 at org.eclipse.ui.internal.PartList.setActivePart(PartList.java:136)
 at org.eclipse.ui.internal.WorkbenchPage.setActivePart(WorkbenchPage.java:3636)
 at org.eclipse.ui.internal.WorkbenchPage.internalActivate(WorkbenchPage.java:691)
 at org.eclipse.ui.internal.WorkbenchPage.activate(WorkbenchPage.java:663)
 at org.eclipse.ui.internal.WorkbenchPage.makeActive(WorkbenchPage.java:1324)
 at org.eclipse.ui.internal.WorkbenchPage.updateActivePart(WorkbenchPage.java:1304)
 at org.eclipse.ui.internal.WorkbenchPage.updateVisibility(WorkbenchPage.java:3779)
 at org.eclipse.ui.internal.WorkbenchPage.onActivate(WorkbenchPage.java:2715)
 at org.eclipse.ui.internal.WorkbenchWindow$27.run(WorkbenchWindow.java:3023)
 at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
 at org.eclipse.ui.internal.WorkbenchWindow.setActivePage(WorkbenchWindow.java:3004)
 at org.eclipse.ui.internal.WorkbenchWindow.busyOpenPage(WorkbenchWindow.java:799)
 at org.eclipse.ui.internal.Workbench$23.runWithException(Workbench.java:1224)
 at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
 at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
 at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
 at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3563)
 at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3212)
 at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
 at org.eclipse.ui.internal.Workbench$33.runWithException(Workbench.java:1595)
 at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
 at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
 at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
 at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3563)
 at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3212)
 at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
 at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
 at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
 at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
 at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
 at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
 at org.gluster.storage.management.console.Application.start(Application.java:100)
 at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
 at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
 at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
 at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
 at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
 at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
 at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
 at org.eclipse.equinox.launcher.Main.main(Main.java:1386)

 

之前一直不知道錯誤原因,在網上查了一下,解決辦法有幾個 ,

 

1.

New focus event is run while other focus event was executing and therefore not finished yet.

You have to override setFocus() or find a good place and put this inside your code:
Display.getDefault().asyncExec(new Runnable() {
            @Override
            public void run() {
                while (Display.getDefault().readAndDispatch()) {
                    //wait for events to finish before continue
                }
                // your code for focus here
                // e.g. table.forceFocus()
            }
        });

So Display will wait until current focus event is finish, and then will execute new focus event.

 

 

2.

I just found that one of my colleagues add a PartListener to the part service. When an activated part was adaptable to the IContentOutlinePage, the listener activates the ContentOutline view, so it get
also the focus. This was the reason of the exception.

 

 

 

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.