Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 53657 - [Forms] FormEditor addPage(IEditorPart, IEditorInput) AssertionFailed
Summary: [Forms] FormEditor addPage(IEditorPart, IEditorInput) AssertionFailed
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: User Assistance (show other bugs)
Version: 3.0   Edit
Hardware: PC All
: P4 normal with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Dejan Glozic CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-03 14:32 EST by thomas CLA
Modified: 2006-11-15 11:21 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description thomas CLA 2004-03-03 14:32:27 EST
Hy,

the FormEditor crash's when i make an addPage(IEditorPart, IEditorInput) and 
IEditorPart is an FormPage.

This can be Tested with the FormsExamples if you change
addPage(new FreeFormPage(this)); 
to 
addPage(new FreeFormPage(this), getEditorInput()); 

The Problem seems to be an Missing selection check in 
MultiPageEditorPart.class:414.

Regards Thomas

StackTrace:
org.eclipse.jface.util.Assert$AssertionFailedException: null argument;
        at org.eclipse.jface.util.Assert.isNotNull(Assert.java:139)
        at org.eclipse.jface.util.Assert.isNotNull(Assert.java:116)
        at 
org.eclipse.jface.viewers.SelectionChangedEvent.<init>SelectionChangedEvent.jav
a:39)
        at 
org.eclipse.ui.part.MultiPageEditorPart.pageChangeMultiPageEditorPart.java:442)
        at 
org.eclipse.ui.forms.editor.FormEditor.pageChangeFormEditor.java:156)
        at 
org.eclipse.ui.forms.editor.FormEditor.setActivePageFormEditor.java:240)
        at 
org.eclipse.ui.part.MultiPageEditorPart.createPartControlMultiPageEditorPart.ja
va:188)
        at org.eclipse.ui.internal.PartPane$1.run(PartPane.java:118)
        at 
org.eclipse.core.internal.runtime.InternalPlatform.runInternalPlatform.java:638
)
        at org.eclipse.core.runtime.Platform.run(Platform.java:497)
        at rg.eclipse.ui.internal.PartPane.createChildControlPartPane.java:114)
        at org.eclipse.ui.internal.PartPane.createControl(PartPane.java:230)
Comment 1 Frank Ostermann CLA 2004-03-10 05:33:55 EST
We have the same problem as describted and hoped that will be fixed in the next
integration build.

regards
frank
Comment 2 Dejan Glozic CLA 2004-03-10 07:42:43 EST
Note however that FormPage by itself was not designed to be a standalone 
editor - rather a page in the multi-page editor that is added by 'addPage
(IFormPage)'. The method you are using is reserved for classes that can be 
standalone editors by themselves (for example, TextEditor). Can you explain why 
you need to call this particular method on the IFormPage class?
Comment 3 thomas CLA 2004-03-10 07:52:31 EST
Because we will create an editor like the plugin.xml editor and with 'addPage
(IFormPage)' we must implement all the editor propertyChange handling 
(isDirty,..) twice.
If we can use 'addPage(IFormPage, IEditorInput)' we can write a normal 
IFormPage an the isDirty Handling is made by the MultiPageEditorPart.
Comment 4 Dejan Glozic CLA 2004-03-10 07:56:57 EST
I am afraid I still don't understand the use case. The two methods are there 
for a reason:

addPage(IFormPage) is there to get individual form pages as in plugin.xml multi-
page editor (PDE team is currently redesigning the very editor and we are using 
addPage(IFormPage) for all pages except source). 

addPage(IEditorPart, IEditorInput) is there for complete standalone editors 
that need to be added as pages. We use this method to add TextEditor for source 
pages.

I still don't understand why adding IFormPage using the second method? 
Comment 5 thomas CLA 2004-03-10 08:33:14 EST
hy dejan,
when i make addPage(IEditorPart, IEditorInput) the MultiPageEditorPart ads an 
propertyChange Listener to ervery part. 
When a property is changed in a part the MultiPageEditorPart notifys the 
workbench for events e.g. isDirty.
I will use these logic for my own editors an don't understand the reason to 
make addPage(IEditorPart) and implement these by self.
i will use a formpage as an editorpart with all advantages and not implement 
the isDirty notification logic in all formpages.
if this is not the logic what is the solution for these problem?

regards thomas
Comment 6 Dejan Glozic CLA 2004-03-10 09:37:27 EST
OK, that's a different story.

PDE is now redesigning editors based on Eclipse Forms (you can find the code 
in CVS HEAD under 'org.eclipse.pde.ui' project in 'srcForms' source folder). 
You can see there that we fire property changes on the multi-page editor 
itself, not on the page.

The concept was always that form pages are not editors by themselves and they 
simply reach up to the multi-page editor to notify that they are dirty. If you 
check the new PDE implementation, you will see that forms mark themselves as 
dirty, turn around and mark the page dirty, which turns around and marks the 
editor dirty. No need for property editors. 

The method 'addPage(IEditorPart, IEditorInput)' is reserved for cases where 
you take an entire editor written by somebody else and add it as-is. Here it 
is important that the editor 'feels' normal inside the multi-page editor i.e. 
all the expected context is there. Form pages, on the other hand, know that 
they are in the multi-page editor and can always delegate notification to the 
editor itself.
Comment 7 Dejan Glozic CLA 2005-05-02 18:24:09 EDT
This defect is fairly old - do you still have a problem with a more recent 
code?
Comment 8 Dejan Glozic CLA 2006-11-15 11:21:22 EST
Closing due to the defect's age.