Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Command / handler issue - Ctrl+S won't work
Command / handler issue - Ctrl+S won't work [message #335781] Wed, 29 April 2009 14:16 Go to next message
Eclipse UserFriend
Originally posted by: mark_melvin.amis.com

I'm struggling to figure out the root cause of a bug in my multi-page
editor, and after a couple days of debugging - I give up. I need help. ;)
Here is the scenario:

I have a multipage editor (a subclass of FormEditor) that starts out with
a place-holder as one of its pages. This place-holder page has a button
that allows you to generate a file in your project. When you click this
button, the file is generated, and the place-holder page is replaced with
a simple text editor containing the contents of the new file. It all
works fine, but if you edit the file in the newly-shown text editor (the
dirty state is correct) and try to save it with Ctrl+S, nothing happens.
But here are the weird bits about the behaviour I am seeing:

- The File > Save menu item is enabled, but the keybinding does nothing
- Clicking between pages in my multi-page editor and coming back to the
text editor page has no effect and the keybinding still fails to work
- If I click outside the editor (say on the Outline View), then back in
the editor, the keybinding starts to work

Alternatively, even before I change focus to fix the keybinding issue:

- If I click the Save button on the toolbar, it will always save the file
even though the keybinding doesn't work
- If I click File > Save, it will save the file even though the keybinding
doesn't work


I have pulled my hair out trying to fix this, and I finally turned on
tracing to see what the heck was going on with commands. Here is a marked
up version of my trace log (my annotations look like <[ MM: comment ]>):


<[ MM: Starting runtime workbench ]>

BINDINGS >>> Cache miss
BINDINGS >>> There are 1 deletion markers

<[ MM: Clicked the button to generate the file and new text editor appears
]>

HANDLERS >>> Command('org.eclipse.ui.file.save') has changed to
'LegacyHandlerWrapper(ActionHandler(action=org.eclipse.ui.internal.SaveAction@16d7e89))'
as its handler
org.eclipse.ui/listeners/IWorkbenchPartReference Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor, property dirty

<[ MM: Click in the editor and press 'Enter' ]>

KEYS >>> Listener.handleEvent(type = Traverse, stateMask = 0x0, keyCode =
0xd, time = 3430656, character = 0xd)
KEYS >>> WorkbenchKeyboard.press(potentialKeyStrokes = [CR])
KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x0, keyCode =
0xd, time = 3430656, character = 0xd)
KEYS >>> WorkbenchKeyboard.press(potentialKeyStrokes = [CR])
org.eclipse.ui/listeners/IWorkbenchPartReference Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor, property dirty

<[ MM: Pressed 'Ctrl + S', and nothing happens ]>

KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x0, keyCode =
0x40000, time = 3432359, character = 0x0)
KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x40000, keyCode
= 0x73, time = 3432656, character = 0x13)
KEYS >>> WorkbenchKeyboard.press(potentialKeyStrokes = [CTRL+S])
KEYS >>> WorkbenchKeyboard.executeCommand(commandId =
'org.eclipse.ui.file.save', parameters = {})
KEYS >>> not enabled
COMMANDS >>> execute >>> starting: id=org.eclipse.ui.file.save;
event=ExecutionEvent(Command(org.eclipse.ui.file.save,Save,
Save the current contents,
Category(org.eclipse.ui.category.file,File,null,true),
LegacyHandlerWrapper(ActionHandler(action=org.eclipse.ui.internal.SaveAction@16d7e89)),
,,true),{},Event {type=1 StyledText {} time=3432656 data=null x=0 y=0
width=0 height=0
detail=0},org.eclipse.core.expressions.EvaluationContext@17f92da)
COMMANDS >>> execute >>> not enabled: id=org.eclipse.ui.file.save;
exception=org.eclipse.core.commands.NotEnabledException: Trying to execute
the disabled command org.eclipse.ui.file.save

<[ MM: OK, nothing happened - now I click outside the editor on the
Outline View ]>

org.eclipse.ui/listeners/IWorkbenchPage.IPartListener 387,
partDeactivated(Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor)
org.eclipse.ui/listeners/IWorkbenchPage.IPartListener2 387,
partDectivated(Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor)
org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener 627,
partDeactivated(Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor)
HANDLERS >>> Command('org.eclipse.ui.file.save') has changed to
'ActionHandler(org.eclipse.ui.internal.SaveAction@7835ec)' as its handler
HANDLERS >>> 96 command ids changed in 0ms
BINDINGS >>> Cache hit
org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener2 627,
partDectivated(Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor)
org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener 627,
partActivated(Outline - org.eclipse.ui.views.ContentOutline)
org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener2 627,
partActivated(Outline - org.eclipse.ui.views.ContentOutline)
org.eclipse.ui/listeners/IWorkbenchPage.IPartListener 387,
partActivated(Outline - org.eclipse.ui.views.ContentOutline)
org.eclipse.ui/listeners/IWorkbenchPage.IPartListener2 387,
partActivated(Outline - org.eclipse.ui.views.ContentOutline)
org.eclipse.ui/listeners/IWorkbenchPage.IPartListener 387,
partDeactivated(Outline - org.eclipse.ui.views.ContentOutline)
org.eclipse.ui/listeners/IWorkbenchPage.IPartListener2 387,
partDectivated(Outline - org.eclipse.ui.views.ContentOutline)
org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener 627,
partDeactivated(Outline - org.eclipse.ui.views.ContentOutline)

<[ MM: Clicked back in the editor ]>

HANDLERS >>> Command('org.eclipse.ui.file.save') has changed to
'LegacyHandlerWrapper(ActionHandler(action=org.eclipse.ui.internal.SaveAction@16d7e89))'
as its handler
HANDLERS >>> 96 command ids changed in 0ms
BINDINGS >>> Cache hit
org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener2 627,
partDectivated(Outline - org.eclipse.ui.views.ContentOutline)
org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener 627,
partActivated(Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor)
org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener2 627,
partActivated(Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor)
org.eclipse.ui/listeners/IWorkbenchPage.IPartListener 387,
partActivated(Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor)
org.eclipse.ui/listeners/IWorkbenchPage.IPartListener2 387,
partActivated(Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor)

<[ MM: Pressed 'Ctrl + S', and the files saves just fine ]>

KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x0, keyCode =
0x40000, time = 3496406, character = 0x0)
KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x40000, keyCode
= 0x73, time = 3496687, character = 0x13)
KEYS >>> WorkbenchKeyboard.press(potentialKeyStrokes = [CTRL+S])
KEYS >>> WorkbenchKeyboard.executeCommand(commandId =
'org.eclipse.ui.file.save', parameters = {})
COMMANDS >>> execute >>> starting: id=org.eclipse.ui.file.save;
event=ExecutionEvent(Command(org.eclipse.ui.file.save,Save,
Save the current contents,
Category(org.eclipse.ui.category.file,File,null,true),
LegacyHandlerWrapper(ActionHandler(action=org.eclipse.ui.internal.SaveAction@16d7e89)),
,,true),{},Event {type=1 StyledText {} time=3496687 data=null x=0 y=0
width=0 height=0
detail=0},org.eclipse.core.expressions.EvaluationContext@d4ba66)
org.eclipse.ui/listeners/IWorkbenchPartReference Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor, property dirty
org.eclipse.ui/listeners/IWorkbenchPartReference Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor, property dirty
COMMANDS >>> execute >>> success: id=org.eclipse.ui.file.save;
returnValue=null


So, do any command gurus have any pointers as to what the heck I should do
next? This is a minor bug but since I have spent so much time on it I
*really* want to fix it at this point. I am using Eclipse 3.4.1 on
Windows XP. In case you are interested, the code I use to replace the
editor with a text editor when the button is clicked is as follows:

// When the multipage editor is created, I create a text editor in the
// variable 'xmlEditor' but just don't stick it anywhere visible

// Then, in my button clicked handler
// (Note: 'customBuildPageIndex' is the index of the placeholder page)

addPage(customBuildPageIndex + 1, xmlEditor, new
FileEditorInput(destFile));
setPageText(customBuildPageIndex + 1,
IXMLConstants.FILENAME_CUSTOM_BUILD_XML);
// Make the new page the active page
setActivePage(customBuildPageIndex + 1);
// Remove the existing custom build generator page.
removePage(customBuildPageIndex);


Thanks in advance,
Mark.
Re: Command / handler issue - Ctrl+S won't work [message #335794 is a reply to message #335781] Thu, 30 April 2009 00:07 Go to previous messageGo to next message
Ben Vitale is currently offline Ben VitaleFriend
Messages: 247
Registered: July 2009
Senior Member
I guess just basic sanity checks:

When you manipulate the editor widgets, you're firing a property change
event for IEditorPart.PROP_DIRTY?

You're also answering correctly when asked isDirty()?

You could also set some breakpoints at various points SaveAction or its
superclass to see where things are going awry.

Beyond that I don't have any good suggestions.

Regards,
Ben

Mark Melvin wrote:
> I'm struggling to figure out the root cause of a bug in my multi-page
> editor, and after a couple days of debugging - I give up. I need help.
> ;) Here is the scenario:
>
> I have a multipage editor (a subclass of FormEditor) that starts out
> with a place-holder as one of its pages. This place-holder page has a
> button that allows you to generate a file in your project. When you
> click this button, the file is generated, and the place-holder page is
> replaced with a simple text editor containing the contents of the new
> file. It all works fine, but if you edit the file in the newly-shown
> text editor (the dirty state is correct) and try to save it with Ctrl+S,
> nothing happens. But here are the weird bits about the behaviour I am
> seeing:
>
> - The File > Save menu item is enabled, but the keybinding does nothing
> - Clicking between pages in my multi-page editor and coming back to the
> text editor page has no effect and the keybinding still fails to work
> - If I click outside the editor (say on the Outline View), then back in
> the editor, the keybinding starts to work
>
> Alternatively, even before I change focus to fix the keybinding issue:
>
> - If I click the Save button on the toolbar, it will always save the
> file even though the keybinding doesn't work
> - If I click File > Save, it will save the file even though the
> keybinding doesn't work
>
>
> I have pulled my hair out trying to fix this, and I finally turned on
> tracing to see what the heck was going on with commands. Here is a
> marked up version of my trace log (my annotations look like <[ MM:
> comment ]>):
>
>
> <[ MM: Starting runtime workbench ]>
>
> BINDINGS >>> Cache miss
> BINDINGS >>> There are 1 deletion markers
>
> <[ MM: Clicked the button to generate the file and new text editor
> appears ]>
>
> HANDLERS >>> Command('org.eclipse.ui.file.save') has changed to
> 'LegacyHandlerWrapper(ActionHandler(action=org.eclipse.ui.internal.SaveAction@16d7e89))'
> as its handler
> org.eclipse.ui/listeners/IWorkbenchPartReference Build Settings Editor -
> com.signaklara.skt.build.ui.buildPrefsEditor, property dirty
>
> <[ MM: Click in the editor and press 'Enter' ]>
>
> KEYS >>> Listener.handleEvent(type = Traverse, stateMask = 0x0, keyCode
> = 0xd, time = 3430656, character = 0xd)
> KEYS >>> WorkbenchKeyboard.press(potentialKeyStrokes = [CR])
> KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x0, keyCode =
> 0xd, time = 3430656, character = 0xd)
> KEYS >>> WorkbenchKeyboard.press(potentialKeyStrokes = [CR])
> org.eclipse.ui/listeners/IWorkbenchPartReference Build Settings Editor -
> com.signaklara.skt.build.ui.buildPrefsEditor, property dirty
>
> <[ MM: Pressed 'Ctrl + S', and nothing happens ]>
>
> KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x0, keyCode =
> 0x40000, time = 3432359, character = 0x0)
> KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x40000,
> keyCode = 0x73, time = 3432656, character = 0x13)
> KEYS >>> WorkbenchKeyboard.press(potentialKeyStrokes = [CTRL+S])
> KEYS >>> WorkbenchKeyboard.executeCommand(commandId =
> 'org.eclipse.ui.file.save', parameters = {})
> KEYS >>> not enabled
> COMMANDS >>> execute >>> starting: id=org.eclipse.ui.file.save;
> event=ExecutionEvent(Command(org.eclipse.ui.file.save,Save,
> Save the current contents,
> Category(org.eclipse.ui.category.file,File,null,true),
>
> LegacyHandlerWrapper(ActionHandler(action=org.eclipse.ui.internal.SaveAction@16d7e89)),
>
> ,,true),{},Event {type=1 StyledText {} time=3432656 data=null
> x=0 y=0 width=0 height=0
> detail=0},org.eclipse.core.expressions.EvaluationContext@17f92da)
> COMMANDS >>> execute >>> not enabled: id=org.eclipse.ui.file.save;
> exception=org.eclipse.core.commands.NotEnabledException: Trying to
> execute the disabled command org.eclipse.ui.file.save
>
> <[ MM: OK, nothing happened - now I click outside the editor on the
> Outline View ]>
>
> org.eclipse.ui/listeners/IWorkbenchPage.IPartListener 387,
> partDeactivated(Build Settings Editor -
> com.signaklara.skt.build.ui.buildPrefsEditor)
> org.eclipse.ui/listeners/IWorkbenchPage.IPartListener2 387,
> partDectivated(Build Settings Editor -
> com.signaklara.skt.build.ui.buildPrefsEditor)
> org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener 627,
> partDeactivated(Build Settings Editor -
> com.signaklara.skt.build.ui.buildPrefsEditor)
> HANDLERS >>> Command('org.eclipse.ui.file.save') has changed to
> 'ActionHandler(org.eclipse.ui.internal.SaveAction@7835ec)' as its handler
> HANDLERS >>> 96 command ids changed in 0ms
> BINDINGS >>> Cache hit
> org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener2 627,
> partDectivated(Build Settings Editor -
> com.signaklara.skt.build.ui.buildPrefsEditor)
> org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener 627,
> partActivated(Outline - org.eclipse.ui.views.ContentOutline)
> org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener2 627,
> partActivated(Outline - org.eclipse.ui.views.ContentOutline)
> org.eclipse.ui/listeners/IWorkbenchPage.IPartListener 387,
> partActivated(Outline - org.eclipse.ui.views.ContentOutline)
> org.eclipse.ui/listeners/IWorkbenchPage.IPartListener2 387,
> partActivated(Outline - org.eclipse.ui.views.ContentOutline)
> org.eclipse.ui/listeners/IWorkbenchPage.IPartListener 387,
> partDeactivated(Outline - org.eclipse.ui.views.ContentOutline)
> org.eclipse.ui/listeners/IWorkbenchPage.IPartListener2 387,
> partDectivated(Outline - org.eclipse.ui.views.ContentOutline)
> org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener 627,
> partDeactivated(Outline - org.eclipse.ui.views.ContentOutline)
>
> <[ MM: Clicked back in the editor ]>
>
> HANDLERS >>> Command('org.eclipse.ui.file.save') has changed to
> 'LegacyHandlerWrapper(ActionHandler(action=org.eclipse.ui.internal.SaveAction@16d7e89))'
> as its handler
> HANDLERS >>> 96 command ids changed in 0ms
> BINDINGS >>> Cache hit
> org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener2 627,
> partDectivated(Outline - org.eclipse.ui.views.ContentOutline)
> org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener 627,
> partActivated(Build Settings Editor -
> com.signaklara.skt.build.ui.buildPrefsEditor)
> org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener2 627,
> partActivated(Build Settings Editor -
> com.signaklara.skt.build.ui.buildPrefsEditor)
> org.eclipse.ui/listeners/IWorkbenchPage.IPartListener 387,
> partActivated(Build Settings Editor -
> com.signaklara.skt.build.ui.buildPrefsEditor)
> org.eclipse.ui/listeners/IWorkbenchPage.IPartListener2 387,
> partActivated(Build Settings Editor -
> com.signaklara.skt.build.ui.buildPrefsEditor)
>
> <[ MM: Pressed 'Ctrl + S', and the files saves just fine ]>
>
> KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x0, keyCode =
> 0x40000, time = 3496406, character = 0x0)
> KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x40000,
> keyCode = 0x73, time = 3496687, character = 0x13)
> KEYS >>> WorkbenchKeyboard.press(potentialKeyStrokes = [CTRL+S])
> KEYS >>> WorkbenchKeyboard.executeCommand(commandId =
> 'org.eclipse.ui.file.save', parameters = {})
> COMMANDS >>> execute >>> starting: id=org.eclipse.ui.file.save;
> event=ExecutionEvent(Command(org.eclipse.ui.file.save,Save,
> Save the current contents,
> Category(org.eclipse.ui.category.file,File,null,true),
>
> LegacyHandlerWrapper(ActionHandler(action=org.eclipse.ui.internal.SaveAction@16d7e89)),
>
> ,,true),{},Event {type=1 StyledText {} time=3496687 data=null
> x=0 y=0 width=0 height=0
> detail=0},org.eclipse.core.expressions.EvaluationContext@d4ba66)
> org.eclipse.ui/listeners/IWorkbenchPartReference Build Settings Editor -
> com.signaklara.skt.build.ui.buildPrefsEditor, property dirty
> org.eclipse.ui/listeners/IWorkbenchPartReference Build Settings Editor -
> com.signaklara.skt.build.ui.buildPrefsEditor, property dirty
> COMMANDS >>> execute >>> success: id=org.eclipse.ui.file.save;
> returnValue=null
>
>
> So, do any command gurus have any pointers as to what the heck I should
> do next? This is a minor bug but since I have spent so much time on it
> I *really* want to fix it at this point. I am using Eclipse 3.4.1 on
> Windows XP. In case you are interested, the code I use to replace the
> editor with a text editor when the button is clicked is as follows:
>
> // When the multipage editor is created, I create a text editor in the
> // variable 'xmlEditor' but just don't stick it anywhere visible
>
> // Then, in my button clicked handler
> // (Note: 'customBuildPageIndex' is the index of the placeholder page)
>
> addPage(customBuildPageIndex + 1, xmlEditor, new
> FileEditorInput(destFile));
> setPageText(customBuildPageIndex + 1,
> IXMLConstants.FILENAME_CUSTOM_BUILD_XML);
> // Make the new page the active page
> setActivePage(customBuildPageIndex + 1);
> // Remove the existing custom build generator page.
> removePage(customBuildPageIndex);
>
>
> Thanks in advance,
> Mark.
>
Re: Command / handler issue - Ctrl+S won't work [message #335798 is a reply to message #335794] Thu, 30 April 2009 13:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mark_melvin.amis.com

Hey Ben,

Thanks for listening...

Yes, I am firing the appropriate changes, and my editor is in fact
reporting itself as dirty (you can see the "property dirty" event in the
trace right after I press enter in the editor).

I have tried to debug the SaveAction, but it seems that the command
framework just never gets that far as nothing is ever called in the object
when Ctrl+S doesn't work. I guess I should look closer at
EvaluationContext.

Another weird thing is that there seems to be a proliferation of
"SaveAction" instances. I recall seeing a growing list (like 5 or 6
instances) of them in a listener list while debugging. I'm pretty deep in
the internals of Eclipse though, and sort of lost at this point. The
command framework always makes my head spin a little. ;)

Mark.

Ben Vitale wrote:

> I guess just basic sanity checks:

> When you manipulate the editor widgets, you're firing a property change
> event for IEditorPart.PROP_DIRTY?

> You're also answering correctly when asked isDirty()?

> You could also set some breakpoints at various points SaveAction or its
> superclass to see where things are going awry.

> Beyond that I don't have any good suggestions.

> Regards,
> Ben

> Mark Melvin wrote:
>> I'm struggling to figure out the root cause of a bug in my multi-page
>> editor, and after a couple days of debugging - I give up. I need help.
>> ;) Here is the scenario:
>>
>> I have a multipage editor (a subclass of FormEditor) that starts out
>> with a place-holder as one of its pages. This place-holder page has a
>> button that allows you to generate a file in your project. When you
>> click this button, the file is generated, and the place-holder page is
>> replaced with a simple text editor containing the contents of the new
>> file. It all works fine, but if you edit the file in the newly-shown
>> text editor (the dirty state is correct) and try to save it with Ctrl+S,
>> nothing happens. But here are the weird bits about the behaviour I am
>> seeing:
>>
>> - The File > Save menu item is enabled, but the keybinding does nothing
>> - Clicking between pages in my multi-page editor and coming back to the
>> text editor page has no effect and the keybinding still fails to work
>> - If I click outside the editor (say on the Outline View), then back in
>> the editor, the keybinding starts to work
>>
>> Alternatively, even before I change focus to fix the keybinding issue:
>>
>> - If I click the Save button on the toolbar, it will always save the
>> file even though the keybinding doesn't work
>> - If I click File > Save, it will save the file even though the
>> keybinding doesn't work
>>
>>
>> I have pulled my hair out trying to fix this, and I finally turned on
>> tracing to see what the heck was going on with commands. Here is a
>> marked up version of my trace log (my annotations look like <[ MM:
>> comment ]>):
>>
>>
>> <[ MM: Starting runtime workbench ]>
>>
>> BINDINGS >>> Cache miss
>> BINDINGS >>> There are 1 deletion markers
>>
>> <[ MM: Clicked the button to generate the file and new text editor
>> appears ]>
>>
>> HANDLERS >>> Command('org.eclipse.ui.file.save') has changed to
>>
'LegacyHandlerWrapper(ActionHandler(action=org.eclipse.ui.internal.SaveAction@16d7e89))'
>> as its handler
>> org.eclipse.ui/listeners/IWorkbenchPartReference Build Settings Editor -
>> com.signaklara.skt.build.ui.buildPrefsEditor, property dirty
>>
>> <[ MM: Click in the editor and press 'Enter' ]>
>>
>> KEYS >>> Listener.handleEvent(type = Traverse, stateMask = 0x0, keyCode
>> = 0xd, time = 3430656, character = 0xd)
>> KEYS >>> WorkbenchKeyboard.press(potentialKeyStrokes = [CR])
>> KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x0, keyCode =
>> 0xd, time = 3430656, character = 0xd)
>> KEYS >>> WorkbenchKeyboard.press(potentialKeyStrokes = [CR])
>> org.eclipse.ui/listeners/IWorkbenchPartReference Build Settings Editor -
>> com.signaklara.skt.build.ui.buildPrefsEditor, property dirty
>>
>> <[ MM: Pressed 'Ctrl + S', and nothing happens ]>
>>
>> KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x0, keyCode =
>> 0x40000, time = 3432359, character = 0x0)
>> KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x40000,
>> keyCode = 0x73, time = 3432656, character = 0x13)
>> KEYS >>> WorkbenchKeyboard.press(potentialKeyStrokes = [CTRL+S])
>> KEYS >>> WorkbenchKeyboard.executeCommand(commandId =
>> 'org.eclipse.ui.file.save', parameters = {})
>> KEYS >>> not enabled
>> COMMANDS >>> execute >>> starting: id=org.eclipse.ui.file.save;
>> event=ExecutionEvent(Command(org.eclipse.ui.file.save,Save,
>> Save the current contents,
>> Category(org.eclipse.ui.category.file,File,null,true),
>>
>>
LegacyHandlerWrapper(ActionHandler(action=org.eclipse.ui.internal.SaveAction@16d7e89)),
>>
>> ,,true),{},Event {type=1 StyledText {} time=3432656 data=null
>> x=0 y=0 width=0 height=0
>> detail=0},org.eclipse.core.expressions.EvaluationContext@17f92da)
>> COMMANDS >>> execute >>> not enabled: id=org.eclipse.ui.file.save;
>> exception=org.eclipse.core.commands.NotEnabledException: Trying to
>> execute the disabled command org.eclipse.ui.file.save
>>
>> <[ MM: OK, nothing happened - now I click outside the editor on the
>> Outline View ]>
>>
>> org.eclipse.ui/listeners/IWorkbenchPage.IPartListener 387,
>> partDeactivated(Build Settings Editor -
>> com.signaklara.skt.build.ui.buildPrefsEditor)
>> org.eclipse.ui/listeners/IWorkbenchPage.IPartListener2 387,
>> partDectivated(Build Settings Editor -
>> com.signaklara.skt.build.ui.buildPrefsEditor)
>> org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener 627,
>> partDeactivated(Build Settings Editor -
>> com.signaklara.skt.build.ui.buildPrefsEditor)
>> HANDLERS >>> Command('org.eclipse.ui.file.save') has changed to
>> 'ActionHandler(org.eclipse.ui.internal.SaveAction@7835ec)' as its handler
>> HANDLERS >>> 96 command ids changed in 0ms
>> BINDINGS >>> Cache hit
>> org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener2 627,
>> partDectivated(Build Settings Editor -
>> com.signaklara.skt.build.ui.buildPrefsEditor)
>> org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener 627,
>> partActivated(Outline - org.eclipse.ui.views.ContentOutline)
>> org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener2 627,
>> partActivated(Outline - org.eclipse.ui.views.ContentOutline)
>> org.eclipse.ui/listeners/IWorkbenchPage.IPartListener 387,
>> partActivated(Outline - org.eclipse.ui.views.ContentOutline)
>> org.eclipse.ui/listeners/IWorkbenchPage.IPartListener2 387,
>> partActivated(Outline - org.eclipse.ui.views.ContentOutline)
>> org.eclipse.ui/listeners/IWorkbenchPage.IPartListener 387,
>> partDeactivated(Outline - org.eclipse.ui.views.ContentOutline)
>> org.eclipse.ui/listeners/IWorkbenchPage.IPartListener2 387,
>> partDectivated(Outline - org.eclipse.ui.views.ContentOutline)
>> org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener 627,
>> partDeactivated(Outline - org.eclipse.ui.views.ContentOutline)
>>
>> <[ MM: Clicked back in the editor ]>
>>
>> HANDLERS >>> Command('org.eclipse.ui.file.save') has changed to
>>
'LegacyHandlerWrapper(ActionHandler(action=org.eclipse.ui.internal.SaveAction@16d7e89))'
>> as its handler
>> HANDLERS >>> 96 command ids changed in 0ms
>> BINDINGS >>> Cache hit
>> org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener2 627,
>> partDectivated(Outline - org.eclipse.ui.views.ContentOutline)
>> org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener 627,
>> partActivated(Build Settings Editor -
>> com.signaklara.skt.build.ui.buildPrefsEditor)
>> org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener2 627,
>> partActivated(Build Settings Editor -
>> com.signaklara.skt.build.ui.buildPrefsEditor)
>> org.eclipse.ui/listeners/IWorkbenchPage.IPartListener 387,
>> partActivated(Build Settings Editor -
>> com.signaklara.skt.build.ui.buildPrefsEditor)
>> org.eclipse.ui/listeners/IWorkbenchPage.IPartListener2 387,
>> partActivated(Build Settings Editor -
>> com.signaklara.skt.build.ui.buildPrefsEditor)
>>
>> <[ MM: Pressed 'Ctrl + S', and the files saves just fine ]>
>>
>> KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x0, keyCode =
>> 0x40000, time = 3496406, character = 0x0)
>> KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x40000,
>> keyCode = 0x73, time = 3496687, character = 0x13)
>> KEYS >>> WorkbenchKeyboard.press(potentialKeyStrokes = [CTRL+S])
>> KEYS >>> WorkbenchKeyboard.executeCommand(commandId =
>> 'org.eclipse.ui.file.save', parameters = {})
>> COMMANDS >>> execute >>> starting: id=org.eclipse.ui.file.save;
>> event=ExecutionEvent(Command(org.eclipse.ui.file.save,Save,
>> Save the current contents,
>> Category(org.eclipse.ui.category.file,File,null,true),
>>
>>
LegacyHandlerWrapper(ActionHandler(action=org.eclipse.ui.internal.SaveAction@16d7e89)),
>>
>> ,,true),{},Event {type=1 StyledText {} time=3496687 data=null
>> x=0 y=0 width=0 height=0
>> detail=0},org.eclipse.core.expressions.EvaluationContext@d4ba66)
>> org.eclipse.ui/listeners/IWorkbenchPartReference Build Settings Editor -
>> com.signaklara.skt.build.ui.buildPrefsEditor, property dirty
>> org.eclipse.ui/listeners/IWorkbenchPartReference Build Settings Editor -
>> com.signaklara.skt.build.ui.buildPrefsEditor, property dirty
>> COMMANDS >>> execute >>> success: id=org.eclipse.ui.file.save;
>> returnValue=null
>>
>>
>> So, do any command gurus have any pointers as to what the heck I should
>> do next? This is a minor bug but since I have spent so much time on it
>> I *really* want to fix it at this point. I am using Eclipse 3.4.1 on
>> Windows XP. In case you are interested, the code I use to replace the
>> editor with a text editor when the button is clicked is as follows:
>>
>> // When the multipage editor is created, I create a text editor in the
>> // variable 'xmlEditor' but just don't stick it anywhere visible
>>
>> // Then, in my button clicked handler
>> // (Note: 'customBuildPageIndex' is the index of the placeholder page)
>>
>> addPage(customBuildPageIndex + 1, xmlEditor, new
>> FileEditorInput(destFile));
>> setPageText(customBuildPageIndex + 1,
>> IXMLConstants.FILENAME_CUSTOM_BUILD_XML);
>> // Make the new page the active page
>> setActivePage(customBuildPageIndex + 1);
>> // Remove the existing custom build generator page.
>> removePage(customBuildPageIndex);
>>
>>
>> Thanks in advance,
>> Mark.
>>
Re: Command / handler issue - Ctrl+S won't work [message #335845 is a reply to message #335798] Mon, 04 May 2009 21:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mark_melvin.amis.com

No Eclipse Commands experts on this one? Does it look like it may
possibly be a bug (I'll file one if so)? I'm just not sure if it is
something I am missing with my Form Editor.

Thanks,
Mark.

Mark Melvin wrote:

> Hey Ben,

> Thanks for listening...

> Yes, I am firing the appropriate changes, and my editor is in fact
> reporting itself as dirty (you can see the "property dirty" event in the
> trace right after I press enter in the editor).

> I have tried to debug the SaveAction, but it seems that the command
> framework just never gets that far as nothing is ever called in the object
> when Ctrl+S doesn't work. I guess I should look closer at
> EvaluationContext.

> Another weird thing is that there seems to be a proliferation of
> "SaveAction" instances. I recall seeing a growing list (like 5 or 6
> instances) of them in a listener list while debugging. I'm pretty deep in
> the internals of Eclipse though, and sort of lost at this point. The
> command framework always makes my head spin a little. ;)

> Mark.

> Ben Vitale wrote:

>> I guess just basic sanity checks:

>> When you manipulate the editor widgets, you're firing a property change
>> event for IEditorPart.PROP_DIRTY?

>> You're also answering correctly when asked isDirty()?

>> You could also set some breakpoints at various points SaveAction or its
>> superclass to see where things are going awry.

>> Beyond that I don't have any good suggestions.

>> Regards,
>> Ben

>> Mark Melvin wrote:
>>> I'm struggling to figure out the root cause of a bug in my multi-page
>>> editor, and after a couple days of debugging - I give up. I need help.
>>> ;) Here is the scenario:
>>>
>>> I have a multipage editor (a subclass of FormEditor) that starts out
>>> with a place-holder as one of its pages. This place-holder page has a
>>> button that allows you to generate a file in your project. When you
>>> click this button, the file is generated, and the place-holder page is
>>> replaced with a simple text editor containing the contents of the new
>>> file. It all works fine, but if you edit the file in the newly-shown
>>> text editor (the dirty state is correct) and try to save it with Ctrl+S,
>>> nothing happens. But here are the weird bits about the behaviour I am
>>> seeing:
>>>
>>> - The File > Save menu item is enabled, but the keybinding does nothing
>>> - Clicking between pages in my multi-page editor and coming back to the
>>> text editor page has no effect and the keybinding still fails to work
>>> - If I click outside the editor (say on the Outline View), then back in
>>> the editor, the keybinding starts to work
>>>
>>> Alternatively, even before I change focus to fix the keybinding issue:
>>>
>>> - If I click the Save button on the toolbar, it will always save the
>>> file even though the keybinding doesn't work
>>> - If I click File > Save, it will save the file even though the
>>> keybinding doesn't work
>>>
>>>
>>> I have pulled my hair out trying to fix this, and I finally turned on
>>> tracing to see what the heck was going on with commands. Here is a
>>> marked up version of my trace log (my annotations look like <[ MM:
>>> comment ]>):
>>>
>>>
>>> <[ MM: Starting runtime workbench ]>
>>>
>>> BINDINGS >>> Cache miss
>>> BINDINGS >>> There are 1 deletion markers
>>>
>>> <[ MM: Clicked the button to generate the file and new text editor
>>> appears ]>
>>>
>>> HANDLERS >>> Command('org.eclipse.ui.file.save') has changed to
>>>
>
'LegacyHandlerWrapper(ActionHandler(action=org.eclipse.ui.internal.SaveAction@16d7e89))'
>>> as its handler
>>> org.eclipse.ui/listeners/IWorkbenchPartReference Build Settings Editor -
>>> com.signaklara.skt.build.ui.buildPrefsEditor, property dirty
>>>
>>> <[ MM: Click in the editor and press 'Enter' ]>
>>>
>>> KEYS >>> Listener.handleEvent(type = Traverse, stateMask = 0x0, keyCode
>>> = 0xd, time = 3430656, character = 0xd)
>>> KEYS >>> WorkbenchKeyboard.press(potentialKeyStrokes = [CR])
>>> KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x0, keyCode =
>>> 0xd, time = 3430656, character = 0xd)
>>> KEYS >>> WorkbenchKeyboard.press(potentialKeyStrokes = [CR])
>>> org.eclipse.ui/listeners/IWorkbenchPartReference Build Settings Editor -
>>> com.signaklara.skt.build.ui.buildPrefsEditor, property dirty
>>>
>>> <[ MM: Pressed 'Ctrl + S', and nothing happens ]>
>>>
>>> KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x0, keyCode =
>>> 0x40000, time = 3432359, character = 0x0)
>>> KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x40000,
>>> keyCode = 0x73, time = 3432656, character = 0x13)
>>> KEYS >>> WorkbenchKeyboard.press(potentialKeyStrokes = [CTRL+S])
>>> KEYS >>> WorkbenchKeyboard.executeCommand(commandId =
>>> 'org.eclipse.ui.file.save', parameters = {})
>>> KEYS >>> not enabled
>>> COMMANDS >>> execute >>> starting: id=org.eclipse.ui.file.save;
>>> event=ExecutionEvent(Command(org.eclipse.ui.file.save,Save,
>>> Save the current contents,
>>> Category(org.eclipse.ui.category.file,File,null,true),
>>>
>>>
>
LegacyHandlerWrapper(ActionHandler(action=org.eclipse.ui.internal.SaveAction@16d7e89)),
>>>
>>> ,,true),{},Event {type=1 StyledText {} time=3432656 data=null
>>> x=0 y=0 width=0 height=0
>>> detail=0},org.eclipse.core.expressions.EvaluationContext@17f92da)
>>> COMMANDS >>> execute >>> not enabled: id=org.eclipse.ui.file.save;
>>> exception=org.eclipse.core.commands.NotEnabledException: Trying to
>>> execute the disabled command org.eclipse.ui.file.save
>>>
>>> <[ MM: OK, nothing happened - now I click outside the editor on the
>>> Outline View ]>
>>>
>>> org.eclipse.ui/listeners/IWorkbenchPage.IPartListener 387,
>>> partDeactivated(Build Settings Editor -
>>> com.signaklara.skt.build.ui.buildPrefsEditor)
>>> org.eclipse.ui/listeners/IWorkbenchPage.IPartListener2 387,
>>> partDectivated(Build Settings Editor -
>>> com.signaklara.skt.build.ui.buildPrefsEditor)
>>> org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener 627,
>>> partDeactivated(Build Settings Editor -
>>> com.signaklara.skt.build.ui.buildPrefsEditor)
>>> HANDLERS >>> Command('org.eclipse.ui.file.save') has changed to
>>> 'ActionHandler(org.eclipse.ui.internal.SaveAction@7835ec)' as its handler
>>> HANDLERS >>> 96 command ids changed in 0ms
>>> BINDINGS >>> Cache hit
>>> org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener2 627,
>>> partDectivated(Build Settings Editor -
>>> com.signaklara.skt.build.ui.buildPrefsEditor)
>>> org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener 627,
>>> partActivated(Outline - org.eclipse.ui.views.ContentOutline)
>>> org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener2 627,
>>> partActivated(Outline - org.eclipse.ui.views.ContentOutline)
>>> org.eclipse.ui/listeners/IWorkbenchPage.IPartListener 387,
>>> partActivated(Outline - org.eclipse.ui.views.ContentOutline)
>>> org.eclipse.ui/listeners/IWorkbenchPage.IPartListener2 387,
>>> partActivated(Outline - org.eclipse.ui.views.ContentOutline)
>>> org.eclipse.ui/listeners/IWorkbenchPage.IPartListener 387,
>>> partDeactivated(Outline - org.eclipse.ui.views.ContentOutline)
>>> org.eclipse.ui/listeners/IWorkbenchPage.IPartListener2 387,
>>> partDectivated(Outline - org.eclipse.ui.views.ContentOutline)
>>> org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener 627,
>>> partDeactivated(Outline - org.eclipse.ui.views.ContentOutline)
>>>
>>> <[ MM: Clicked back in the editor ]>
>>>
>>> HANDLERS >>> Command('org.eclipse.ui.file.save') has changed to
>>>
>
'LegacyHandlerWrapper(ActionHandler(action=org.eclipse.ui.internal.SaveAction@16d7e89))'
>>> as its handler
>>> HANDLERS >>> 96 command ids changed in 0ms
>>> BINDINGS >>> Cache hit
>>> org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener2 627,
>>> partDectivated(Outline - org.eclipse.ui.views.ContentOutline)
>>> org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener 627,
>>> partActivated(Build Settings Editor -
>>> com.signaklara.skt.build.ui.buildPrefsEditor)
>>> org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener2 627,
>>> partActivated(Build Settings Editor -
>>> com.signaklara.skt.build.ui.buildPrefsEditor)
>>> org.eclipse.ui/listeners/IWorkbenchPage.IPartListener 387,
>>> partActivated(Build Settings Editor -
>>> com.signaklara.skt.build.ui.buildPrefsEditor)
>>> org.eclipse.ui/listeners/IWorkbenchPage.IPartListener2 387,
>>> partActivated(Build Settings Editor -
>>> com.signaklara.skt.build.ui.buildPrefsEditor)
>>>
>>> <[ MM: Pressed 'Ctrl + S', and the files saves just fine ]>
>>>
>>> KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x0, keyCode =
>>> 0x40000, time = 3496406, character = 0x0)
>>> KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x40000,
>>> keyCode = 0x73, time = 3496687, character = 0x13)
>>> KEYS >>> WorkbenchKeyboard.press(potentialKeyStrokes = [CTRL+S])
>>> KEYS >>> WorkbenchKeyboard.executeCommand(commandId =
>>> 'org.eclipse.ui.file.save', parameters = {})
>>> COMMANDS >>> execute >>> starting: id=org.eclipse.ui.file.save;
>>> event=ExecutionEvent(Command(org.eclipse.ui.file.save,Save,
>>> Save the current contents,
>>> Category(org.eclipse.ui.category.file,File,null,true),
>>>
>>>
>
LegacyHandlerWrapper(ActionHandler(action=org.eclipse.ui.internal.SaveAction@16d7e89)),
>>>
>>> ,,true),{},Event {type=1 StyledText {} time=3496687 data=null
>>> x=0 y=0 width=0 height=0
>>> detail=0},org.eclipse.core.expressions.EvaluationContext@d4ba66)
>>> org.eclipse.ui/listeners/IWorkbenchPartReference Build Settings Editor -
>>> com.signaklara.skt.build.ui.buildPrefsEditor, property dirty
>>> org.eclipse.ui/listeners/IWorkbenchPartReference Build Settings Editor -
>>> com.signaklara.skt.build.ui.buildPrefsEditor, property dirty
>>> COMMANDS >>> execute >>> success: id=org.eclipse.ui.file.save;
>>> returnValue=null
>>>
>>>
>>> So, do any command gurus have any pointers as to what the heck I should
>>> do next? This is a minor bug but since I have spent so much time on it
>>> I *really* want to fix it at this point. I am using Eclipse 3.4.1 on
>>> Windows XP. In case you are interested, the code I use to replace the
>>> editor with a text editor when the button is clicked is as follows:
>>>
>>> // When the multipage editor is created, I create a text editor in the
>>> // variable 'xmlEditor' but just don't stick it anywhere visible
>>>
>>> // Then, in my button clicked handler
>>> // (Note: 'customBuildPageIndex' is the index of the placeholder page)
>>>
>>> addPage(customBuildPageIndex + 1, xmlEditor, new
>>> FileEditorInput(destFile));
>>> setPageText(customBuildPageIndex + 1,
>>> IXMLConstants.FILENAME_CUSTOM_BUILD_XML);
>>> // Make the new page the active page
>>> setActivePage(customBuildPageIndex + 1);
>>> // Remove the existing custom build generator page.
>>> removePage(customBuildPageIndex);
>>>
>>>
>>> Thanks in advance,
>>> Mark.
>>>
Re: Command / handler issue - Ctrl+S won't work [message #335850 is a reply to message #335845] Tue, 05 May 2009 11:45 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Mark Melvin wrote:
> No Eclipse Commands experts on this one? Does it look like it may
> possibly be a bug (I'll file one if so)? I'm just not sure if it is
> something I am missing with my Form Editor.

MultiPageEditorPart is always good for a laugh. It doesn't play nicely
with the framework (although there was an inner editor bug recently
fixed in 3.5 M7 that would prevent handlers from working if there were
more than one text editor, for example).

The standard save action contributed by the workbench simply walks the
list of dirty editors and tries to save them. When you generate the new
file and use addPage(*) to add the editor, do you update the
FormEditor's dirty state? If your inner editor is already dirty before
being added, I'm not sure that it will fire the PROP_DIRTY

If you subclassed FormEditor, what does your implementation of doSave(*)
look like?

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Re: Command / handler issue - Ctrl+S won't work [message #335854 is a reply to message #335850] Tue, 05 May 2009 13:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mark_melvin.amis.com

Paul Webster wrote:

> Mark Melvin wrote:
>> No Eclipse Commands experts on this one? Does it look like it may
>> possibly be a bug (I'll file one if so)? I'm just not sure if it is
>> something I am missing with my Form Editor.

> MultiPageEditorPart is always good for a laugh. It doesn't play nicely
> with the framework (although there was an inner editor bug recently
> fixed in 3.5 M7 that would prevent handlers from working if there were
> more than one text editor, for example).

> The standard save action contributed by the workbench simply walks the
> list of dirty editors and tries to save them. When you generate the new
> file and use addPage(*) to add the editor, do you update the
> FormEditor's dirty state? If your inner editor is already dirty before
> being added, I'm not sure that it will fire the PROP_DIRTY

> If you subclassed FormEditor, what does your implementation of doSave(*)
> look like?

Thanks, Paul. It looks like it is firing the PROP_DIRTY property change
(I can see the event in the console), and the editor is shown as dirty
with an asterisk as well. The problem seems to be listener-related.

My doSave(*) looks/works fine; I can post it if you think it will help,
but I don't think it is an issue. The issue is I never actually get
there. If I put a breakpoint in it, it is never reached. Again, here is
the sequence of events:

1) Open my multipage editor
2) Switch to second pane
3) Click the button that creates a new file, and replaces the nested page
with the button on it to one that contains a TextEditor (the file is new,
and not dirty at this point so the editor state is not dirty)
4) Type something into the new editor (the property change is fired in the
console, and the editor is marked as dirty)
5) Press Ctrl+S and nothing happens

Here is the console trace for those exact events:

org.eclipse.ui/listeners/IWorkbenchPartReference Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor, property title
org.eclipse.ui/listeners/IWorkbenchPage.IPartListener 386,
partOpened(Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor)
org.eclipse.ui/listeners/IWorkbenchPage.IPartListener2 386,
partOpened(Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor)
org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener 177,
partOpened(Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor)
org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener2 177,
partOpened(Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor)
org.eclipse.ui/listeners/IWorkbenchPage.IPartListener2 386,
partVisible(Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor)
org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener2 177,
partVisible(Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor)
org.eclipse.ui/listeners/IWorkbenchPage.IPartListener 386,
partBroughtToTop(Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor)
org.eclipse.ui/listeners/IWorkbenchPage.IPartListener2 386,
partBroughtToTop(Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor)
org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener 177,
partBroughtToTop(Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor)
org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener2 177,
partBroughtToTop(Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor)
org.eclipse.ui/listeners/IWorkbenchPage.IPartListener 386,
partDeactivated(Navigator - org.eclipse.ui.views.ResourceNavigator)
org.eclipse.ui/listeners/IWorkbenchPage.IPartListener2 386,
partDectivated(Navigator - org.eclipse.ui.views.ResourceNavigator)
org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener 177,
partDeactivated(Navigator - org.eclipse.ui.views.ResourceNavigator)
HANDLERS >>> 20 command ids changed in 0ms
org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener2 177,
partDectivated(Navigator - org.eclipse.ui.views.ResourceNavigator)
org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener 177,
partActivated(Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor)
org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener2 177,
partActivated(Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor)
org.eclipse.ui/listeners/IWorkbenchPage.IPartListener 386,
partActivated(Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor)
org.eclipse.ui/listeners/IWorkbenchPage.IPartListener2 386,
partActivated(Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor)
BINDINGS >>> Cache hit
HANDLERS >>> Command('org.eclipse.ui.file.save') has changed to
'LegacyHandlerWrapper(ActionHandler(action=org.eclipse.ui.internal.SaveAction@10d1090))'
as its handler
org.eclipse.ui/listeners/IWorkbenchPartReference Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor, property dirty
KEYS >>> Listener.handleEvent(type = Traverse, stateMask = 0x0, keyCode =
0xd, time = 3355437, character = 0xd)
KEYS >>> WorkbenchKeyboard.press(potentialKeyStrokes = [CR])
KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x0, keyCode =
0xd, time = 3355437, character = 0xd)
KEYS >>> WorkbenchKeyboard.press(potentialKeyStrokes = [CR])
org.eclipse.ui/listeners/IWorkbenchPartReference Build Settings Editor -
com.signaklara.skt.build.ui.buildPrefsEditor, property dirty
KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x0, keyCode =
0x40000, time = 3356265, character = 0x0)
KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x40000, keyCode
= 0x73, time = 3356828, character = 0x13)
KEYS >>> WorkbenchKeyboard.press(potentialKeyStrokes = [CTRL+S])
KEYS >>> WorkbenchKeyboard.executeCommand(commandId =
'org.eclipse.ui.file.save', parameters = {})
KEYS >>> not enabled
COMMANDS >>> execute >>> starting: id=org.eclipse.ui.file.save;
event=ExecutionEvent(Command(org.eclipse.ui.file.save,Save,
Save the current contents,
Category(org.eclipse.ui.category.file,File,null,true),
LegacyHandlerWrapper(ActionHandler(action=org.eclipse.ui.internal.SaveAction@10d1090)),
,,true),{},Event {type=1 StyledText {} time=3356828 data=null x=0 y=0
width=0 height=0
detail=0},org.eclipse.core.expressions.EvaluationContext@1d6c962)
COMMANDS >>> execute >>> not enabled: id=org.eclipse.ui.file.save;
exception=org.eclipse.core.commands.NotEnabledException: Trying to execute
the disabled command org.eclipse.ui.file.save

I wonder if it has something to do with the fact that I create the
TextEditor when I create the multipage editor, and just "hook it up" if
the user presses the "generate file" button?

Mark.
Re: Command / handler issue - Ctrl+S won't work [message #335858 is a reply to message #335854] Tue, 05 May 2009 17:36 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Mark Melvin wrote:
>
> I wonder if it has something to do with the fact that I create the
> TextEditor when I create the multipage editor, and just "hook it up" if
> the user presses the "generate file" button?

I don't think that would matter much. I might get a chance to look at
the trace later this week, but the only other thing that comes to mind
is after calling addPage(*) do an editorPart.setFocus() so that the
newly materialized editor knows it has focus (this will probably be a
no-op. but you never know)

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Previous Topic:Change label of UIElement when command handler is disabled
Next Topic:Dynamic Submenus in Dynamic Menus?
Goto Forum:
  


Current Time: Tue Jul 16 14:01:30 GMT 2024

Powered by FUDForum. Page generated in 0.04398 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top