Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 336148 - ServerEditorSection Extension Point Doesn't Correctly Support Redo
Summary: ServerEditorSection Extension Point Doesn't Correctly Support Redo
Status: NEW
Alias: None
Product: WTP ServerTools
Classification: WebTools
Component: wst.server (show other bugs)
Version: unspecified   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: wst.server CLA
QA Contact: Angel Vera CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-02 15:37 EST by Daniel Johnson CLA
Modified: 2011-02-02 15:37 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 Daniel Johnson CLA 2011-02-02 15:37:02 EST
I have created an extension for <extension point="org.eclipse.wst.server.ui.editorPageSections"> that subclasses org.eclipse.wst.server.ui.editor.ServerEditorSection

I have added a checkbox button on the form:

@Override
public void createSection(Composite parent) {
    super.createSection(parent);    
    FormToolkit toolkit = getFormToolkit(parent.getDisplay());
    Composite comp = toolkit.createComposite(parent);
    Button button = toolkit.createButton(comp, "My Button", SWT.CHECK);
    button..addSelectionListener(selectionListener);
}

And my selection listener looks like this:

private SelectionListener selectionListener = new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            if (!(e.widget instanceof Button)) {
                return;
            }
            final Button button = (Button)e.widget;
            execute(new AbstractOperation(XMPServerUIPlugin.PLUGIN_ID) {
                
                @Override
                public boolean canRedo() {
                    return true;
                }

                @Override
                public boolean canUndo() {
                    return true;
                }
                
                @Override
                public IStatus undo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
                    button.setSelection(!button.getSelection());
                    return Status.OK_STATUS;
                }

                @Override
                public IStatus redo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
                    button.setSelection(!button.getSelection());
                    return Status.OK_STATUS;
                }
                
                @Override
                public IStatus execute(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
                    return Status.OK_STATUS;
                }
            });
            
        }
};

Everything works as excepted for execute() and undo(), but when doing a redo in the editor neither the canRedo() or redo() functions of the AbstractOperation are called, though the editor correctly shows as no longer being dirty. Support for redo should be added/fixed.