Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 336605 - [Core] Core shall provide a getVisibleEditors() method
Summary: [Core] Core shall provide a getVisibleEditors() method
Status: RESOLVED FIXED
Alias: None
Product: Papyrus
Classification: Modeling
Component: Core (show other bugs)
Version: 0.8.0   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Cedric Dumoulin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 336701
Blocks:
  Show dependency tree
 
Reported: 2011-02-08 06:49 EST by Cedric Dumoulin CLA
Modified: 2013-07-05 12:29 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Cedric Dumoulin CLA 2011-02-08 06:49:22 EST
The core shall provide a getVisibleEditors() method returning a list of actually visible editors.
An editor is visible if its diagram area is visible.
There could be several visible editors, but only one of them is active at a time. 
In Papyrus, there could only have one active editor at a time (accesible with getActiveEditor() ).
Comment 1 Cedric Dumoulin CLA 2011-02-08 11:31:34 EST
methods are added to org.eclipse.papyrus.sasheditor.editor.ISashWindowsContainer:

- List<IEditorPart> getVisibleIEditorParts();
- public List<IPage> getVisiblePages();

You can get the ISashWindowsContainer and access them by one of the following method (see doc) :
- org.eclipse.papyrus.core.utils.ServiceUtils.getISashWindowsContainer(serviceRegistry).
- org.eclipse.papyrus.diagram.common.util.ServiceUtilsForGMF.getISashWindowsContainer(domain)
- org.eclipse.papyrus.core.utils.ServiceUtilsForActionHandlers.getISashWindowsContainer() // check doc !!!
Comment 2 Patrick Tessier CLA 2011-02-08 12:42:07 EST
It seems that the service registry has not been initialized for the value ISashWindowsContainer


see log:
org.eclipse.papyrus.core.services.ServiceNotFoundException: No service registered under 'interface org.eclipse.papyrus.sasheditor.editor.ISashWindowsContainer'
	at org.eclipse.papyrus.core.services.ServicesRegistry.getService(ServicesRegistry.java:334)
	at org.eclipse.papyrus.core.utils.AbstractServiceUtils.getISashWindowsContainer(AbstractServiceUtils.java:105)
	at org.eclipse.papyrus.modelexplorer.LinkHelper.activateEditor(LinkHelper.java:69)
	at org.eclipse.ui.internal.navigator.actions.LinkEditorAction$2.run(LinkEditorAction.java:78)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.navigator.actions.LinkEditorAction$1.runInUIThread(LinkEditorAction.java:76)
	at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:95)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4059)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3678)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	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:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	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)
Comment 3 Patrick Tessier CLA 2011-02-09 08:07:37 EST
there was a bug in SashWindowsContainer at 


public boolean accept(TabFolderPart part) {
			
			IPage page = part.getVisiblePagePart();
			if( part != null && part instanceof IEditorPage ) { <--- here this is page not part
				IEditorPage editorPage = (IEditorPage) page;
					visiblePages.add(editorPage.getIEditorPart());
					
			}
			// continue searching
			return true;
		}
	Done in the revision 3966
Comment 4 Camille Letavernier CLA 2013-07-05 12:29:29 EDT
I close this task