Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Bug(s) in model persistence and setFocus?
Bug(s) in model persistence and setFocus? [message #753848] Sat, 29 October 2011 07:54 Go to previous message
Karl Weber is currently offline Karl Weber
Messages: 63
Registered: September 2010
Member
I observe some strange things with model-persistence and don't know whether it is my fault or whether there are some bugs.

To explain what I mean: I have implemented the method AppHooks.processAdditions, which does nothing but print the model:
	@ProcessAdditions
	public void processAdditions(MApplication appModel) {
		System.out.println("AppHooks: processAdditions; appModel: " + appModel);
		List<MCommand> commands = appModel.getCommands();
		for (MCommand cmd : commands) {
			System.out.println("MCommand: " + cmd);
		}
		printMUIElement(appModel);
	}
	
	private int off = 0;
	
	private void printMUIElement(MUIElement element) {
		// print element
		for(int i = 0; i < off; i++) System.out.print("-");
		System.out.println("MUIElement: " + element);
		// print children
		if (element instanceof MElementContainer) {
			off++;
			List<? extends MUIElement> children = (List<? extends MUIElement>)((MElementContainer)element).getChildren();
			for( MUIElement child : children) {
				printMUIElement(child);
			}			
			off--;
		}
	}

When I start a clean application, I get, for instance:
MUIElement: org.eclipse.e4.ui.model.application.impl.ApplicationImpl@41e701b0 (elementId: de.gps.app.application, tags: null, contributorURI: platform:/plugin/de.gps.app) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (context: WorkbenchContext, variables: null)
-MUIElement: org.eclipse.e4.ui.model.application.ui.basic.impl.TrimmedWindowImpl@569eebe5 (elementId: null, tags: null, contributorURI: platform:/plugin/de.gps.app) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (label: %windowTitle, iconURI: null, tooltip: null, context: null, variables: null, x: 30, y: 30, width: 300, height: 200)
--MUIElement: org.eclipse.e4.ui.model.application.ui.basic.impl.PartSashContainerImpl@226eb6a4 (elementId: null, tags: null, contributorURI: platform:/plugin/de.gps.app) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: , accessibilityPhrase: null) (horizontal: true)
---MUIElement: org.eclipse.e4.ui.model.application.ui.basic.impl.PartStackImpl@3a5c470d (elementId: de.gps.app.partstacks.first, tags: null, contributorURI: platform:/plugin/de.gps.app) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: 30, accessibilityPhrase: null)
---MUIElement: org.eclipse.e4.ui.model.application.ui.basic.impl.PartStackImpl@3cc46a (elementId: de.gps.app.partstacks.second, tags: [de.gps.app.editorArea], contributorURI: platform:/plugin/de.gps.app) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: 70, accessibilityPhrase: null)

The model has two MPartDescriptors, contributed through fragments, the first one can only provide one MPart (LogView), the other can provide multiple MParts (MtkEditor). The latter one is also dirtyable. So, when I open a clean application (see output above), create the LogView and one MtkEditor, close the application and start it again, I get:
MUIElement: org.eclipse.e4.ui.model.application.impl.ApplicationImpl@41e701b0 (elementId: de.gps.app.application, tags: null, contributorURI: platform:/plugin/de.gps.app) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (context: WorkbenchContext, variables: null)
-MUIElement: org.eclipse.e4.ui.model.application.ui.basic.impl.TrimmedWindowImpl@569eebe5 (elementId: null, tags: [topLevel], contributorURI: platform:/plugin/de.gps.app) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (label: %windowTitle, iconURI: null, tooltip: null, context: null, variables: null, x: 30, y: 30, width: 300, height: 200)
--MUIElement: org.eclipse.e4.ui.model.application.ui.basic.impl.PartSashContainerImpl@1298daa5 (elementId: null, tags: null, contributorURI: platform:/plugin/de.gps.app) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: , accessibilityPhrase: null) (horizontal: true)
---MUIElement: org.eclipse.e4.ui.model.application.ui.basic.impl.PartStackImpl@3cc46a (elementId: de.gps.app.partstacks.first, tags: null, contributorURI: platform:/plugin/de.gps.app) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: 30, accessibilityPhrase: null)
---MUIElement: org.eclipse.e4.ui.model.application.ui.basic.impl.PartStackImpl@15830b45 (elementId: de.gps.app.partstacks.second, tags: [de.gps.app.editorArea, active], contributorURI: platform:/plugin/de.gps.app) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: 70, accessibilityPhrase: null)
----MUIElement: org.eclipse.e4.ui.model.application.ui.basic.impl.PartImpl@2276517f (elementId: de.gps.log.db.ui.LogView, tags: null, contributorURI: null) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (contributionURI: platform:/plugin/de.gps.log.db.ui/de.gps.log.db.ui.views.LogView, object: null, context: null, variables: null, label: DBLogView, iconURI: null, tooltip: Tooltip, dirty: false, closeable: true, description: null)
----MUIElement: org.eclipse.e4.ui.model.application.ui.basic.impl.PartImpl@5e07a86 (elementId: de.gps.mtk.ui.mtkEditor, tags: [active], contributorURI: null) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (contributionURI: platform:/plugin/de.gps.mtk.ui/de.gps.mtk.ui.views.MtkLogger, object: null, context: null, variables: null, label: Mtk Editor - 1, iconURI: null, tooltip: Tooltip1, dirty: false, closeable: true, description: null)

Things to note:

  • The are two MParts in the model, as expected
  • One MPart has the tag active

The Editor is active, which is correct.

First Problem: Aktive tags. With two parts (one LogView and one MtkEditor) I can switch the focus between these parts at will, close the application and start it again and only one part has the aktive tag. When I have three parts (one LogView and two MtkEditors), I can get all three parts to have the active tag after restarting the application:
MUIElement: org.eclipse.e4.ui.model.application.impl.ApplicationImpl@253b0fd8 (elementId: de.gps.app.application, tags: null, contributorURI: platform:/plugin/de.gps.app) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (context: WorkbenchContext, variables: null)
-MUIElement: org.eclipse.e4.ui.model.application.ui.basic.impl.TrimmedWindowImpl@4ab69761 (elementId: null, tags: [topLevel], contributorURI: platform:/plugin/de.gps.app) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (label: %windowTitle, iconURI: null, tooltip: null, context: null, variables: null, x: 515, y: 270, width: 868, height: 198)
--MUIElement: org.eclipse.e4.ui.model.application.ui.basic.impl.PartSashContainerImpl@5943bd77 (elementId: null, tags: null, contributorURI: platform:/plugin/de.gps.app) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: , accessibilityPhrase: null) (horizontal: true)
---MUIElement: org.eclipse.e4.ui.model.application.ui.basic.impl.PartStackImpl@70fab733 (elementId: de.gps.app.partstacks.first, tags: null, contributorURI: platform:/plugin/de.gps.app) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: 30, accessibilityPhrase: null)
---MUIElement: org.eclipse.e4.ui.model.application.ui.basic.impl.PartStackImpl@5c11af37 (elementId: de.gps.app.partstacks.second, tags: [de.gps.app.editorArea, active], contributorURI: platform:/plugin/de.gps.app) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: 70, accessibilityPhrase: null)
----MUIElement: org.eclipse.e4.ui.model.application.ui.basic.impl.PartImpl@cc1d919 (elementId: de.gps.log.db.ui.LogView, tags: [active], contributorURI: null) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (contributionURI: platform:/plugin/de.gps.log.db.ui/de.gps.log.db.ui.views.LogView, object: null, context: null, variables: null, label: DBLogView, iconURI: null, tooltip: Tooltip, dirty: false, closeable: true, description: null)
----MUIElement: org.eclipse.e4.ui.model.application.ui.basic.impl.PartImpl@a93feda (elementId: de.gps.mtk.ui.mtkEditor, tags: [active], contributorURI: null) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (contributionURI: platform:/plugin/de.gps.mtk.ui/de.gps.mtk.ui.views.MtkLogger, object: null, context: null, variables: null, label: Mtk Editor - 1, iconURI: null, tooltip: Tooltip1, dirty: false, closeable: true, description: null)
----MUIElement: org.eclipse.e4.ui.model.application.ui.basic.impl.PartImpl@7a409fa2 (elementId: de.gps.mtk.ui.mtkEditor, tags: [active], contributorURI: null) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (contributionURI: platform:/plugin/de.gps.mtk.ui/de.gps.mtk.ui.views.MtkLogger, object: null, context: null, variables: null, label: Mtk Editor - 2, iconURI: null, tooltip: Tooltip2, dirty: false, closeable: true, description: null)

This is reproducible. I would conclude, that the active tag is not properly persisted.

Second Problem: Inconsistent model. I can open a clean application (the model has no part), add the LogView and (maybe) three MtkEditors. Then I delete the editor parts again and close the application. When I start it again, I get
MUIElement: org.eclipse.e4.ui.model.application.impl.ApplicationImpl@59a69d87 (elementId: de.gps.app.application, tags: null, contributorURI: platform:/plugin/de.gps.app) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (context: WorkbenchContext, variables: null)
-MUIElement: org.eclipse.e4.ui.model.application.ui.basic.impl.TrimmedWindowImpl@74e6cbcd (elementId: null, tags: [topLevel], contributorURI: platform:/plugin/de.gps.app) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (label: %windowTitle, iconURI: null, tooltip: null, context: null, variables: null, x: 30, y: 30, width: 1436, height: 198)
--MUIElement: org.eclipse.e4.ui.model.application.ui.basic.impl.PartSashContainerImpl@66129da5 (elementId: null, tags: null, contributorURI: platform:/plugin/de.gps.app) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: , accessibilityPhrase: null) (horizontal: true)
---MUIElement: org.eclipse.e4.ui.model.application.ui.basic.impl.PartStackImpl@226eb6a4 (elementId: de.gps.app.partstacks.first, tags: null, contributorURI: platform:/plugin/de.gps.app) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: 30, accessibilityPhrase: null)
---MUIElement: org.eclipse.e4.ui.model.application.ui.basic.impl.PartStackImpl@1298daa5 (elementId: de.gps.app.partstacks.second, tags: [de.gps.app.editorArea, active], contributorURI: platform:/plugin/de.gps.app) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: 70, accessibilityPhrase: null)
----MUIElement: org.eclipse.e4.ui.model.application.ui.basic.impl.PartImpl@62f8f173 (elementId: de.gps.log.db.ui.LogView, tags: [active], contributorURI: null) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (contributionURI: platform:/plugin/de.gps.log.db.ui/de.gps.log.db.ui.views.LogView, object: null, context: null, variables: null, label: DBLogView, iconURI: null, tooltip: Tooltip, dirty: false, closeable: true, description: null)
----MUIElement: org.eclipse.e4.ui.model.application.ui.basic.impl.PartImpl@45b3e7c8 (elementId: de.gps.mtk.ui.mtkEditor, tags: null, contributorURI: null) (widget: null, renderer: null, toBeRendered: false, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (contributionURI: platform:/plugin/de.gps.mtk.ui/de.gps.mtk.ui.views.MtkLogger, object: null, context: null, variables: null, label: Mtk Editor - 1, iconURI: null, tooltip: Tooltip1, dirty: false, closeable: true, description: null)
----MUIElement: org.eclipse.e4.ui.model.application.ui.basic.impl.PartImpl@26361f38 (elementId: de.gps.mtk.ui.mtkEditor, tags: null, contributorURI: null) (widget: null, renderer: null, toBeRendered: false, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (contributionURI: platform:/plugin/de.gps.mtk.ui/de.gps.mtk.ui.views.MtkLogger, object: null, context: null, variables: null, label: Mtk Editor - 2, iconURI: null, tooltip: Tooltip2, dirty: false, closeable: true, description: null)
----MUIElement: org.eclipse.e4.ui.model.application.ui.basic.impl.PartImpl@2276517f (elementId: de.gps.mtk.ui.mtkEditor, tags: null, contributorURI: null) (widget: null, renderer: null, toBeRendered: false, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (contributionURI: platform:/plugin/de.gps.mtk.ui/de.gps.mtk.ui.views.MtkLogger, object: null, context: null, variables: null, label: Mtk Editor - 3, iconURI: null, tooltip: Tooltip3, dirty: false, closeable: true, description: null)

Strange, I have three editors in the model, but the UI only shows the LogView. These three model elements (editors) must have been persisted although I deleted them before I closed the application.

Third problem (may not be related, since I do not persist the model in between): The number of calls to the setFocus method of the parts:
I open a clean application and add the LogView. setFocus is called once. I add an editor, setFocus is called once. I select the LogView and setFocus is called twice. I again select the editor and setFocus is also called twice.




 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:WebDAV and SFS
Next Topic:minimize/maximize part
Goto Forum:
  


Current Time: Thu May 23 21:51:58 EDT 2013

Powered by FUDForum. Page generated in 0.01787 seconds