Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Editor dirty handling
Editor dirty handling [message #910964] Mon, 10 September 2012 18:01 Go to next message
Sir Wayne is currently offline Sir Wayne
Messages: 214
Registered: July 2009
Senior Member
Hello,

why doesn't the DefaultPersistencyBehavior use the "normal" dirty handling from the basic command stack (isSaveNeeded). What is the intention of implement it on its own way?

	public boolean isDirty() {
		BasicCommandStack commandStack = (BasicCommandStack) diagramEditor.getEditingDomain().getCommandStack();
		return savedCommand != commandStack.getUndoCommand();
	}
Re: Editor dirty handling [message #911170 is a reply to message #910964] Tue, 11 September 2012 05:57 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1595
Registered: July 2009
Location: Walldorf, Germany
Senior Member
As far as I remember there was an issue with the command we trigger directly
on save (we update the version of the diagram file on save in case it is not
up to date). By using the default implementation this command would appear
in the undo stack, we our approach we omit that one.

Michael
Re: Editor dirty handling [message #911364 is a reply to message #911170] Tue, 11 September 2012 13:04 Go to previous messageGo to next message
Sir Wayne is currently offline Sir Wayne
Messages: 214
Registered: July 2009
Senior Member
First time all my Features and Commands works well. But after the first saving the dirty handling is buggy.

Steps:
1. Move a Shape
2. Saving
3. Click ContextButtonPad with follow Feature

public class OpenPropertyViewFeature extends AbstractCustomFeature
    {

    public OpenPropertyViewFeature (IFeatureProvider fp)
        {
        super(fp);
        }

    @Override
    public boolean canExecute(ICustomContext context)
        {
        return true;
        }

    @Override
    public void execute(ICustomContext context)
        {
        try
            {
  PlatformUI.getWorkbench().getActiveWorkbenchWindow()
                    .getActivePage().showView("org.eclipse.ui.views.PropertySheet"); 
        catch (PartInitException e)
            {
  
            }
        }


    @Override
    public boolean hasDoneChanges()
        {
        return false;
        }

    @Override
    public boolean canUndo(IContext context)
        {
        return false;
        }




The Editor is dirty, because savedCommand = Move Shape Command and commandStack.getUndoCommand() is null.
So savedCommand != commandStack.getUndoCommand() is true

And the Undo/Redo Handling (e.g Toolbar action) is buggy too.

[Updated on: Tue, 11 September 2012 13:08]

Report message to a moderator

Re: Editor dirty handling [message #911718 is a reply to message #911364] Wed, 12 September 2012 07:16 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1595
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Hm, have you tried with canUndo() returning true?

Anyhow, this appears to be a bug. Would you please file this as a bugzilla?

Thanks,
Michael
Re: Editor dirty handling [message #911725 is a reply to message #911718] Wed, 12 September 2012 07:33 Go to previous message
Sir Wayne is currently offline Sir Wayne
Messages: 214
Registered: July 2009
Senior Member
If i return canUndo() true, i will get a undoable command.
That's not desired.
I will create a Bug =), we have have more problems with the undo/redo handling
Previous Topic:Saving Editor in a AbstractCustomFeature = UI Deadlock
Next Topic:Connection Selection Tolerance, Adjusting Connection Context, Automatic Layout
Goto Forum:
  


Current Time: Tue Sep 23 12:29:08 GMT 2014

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

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