Girish Chandran C
Girish Chandran C

Reputation: 111

Save option in RCP Product

Iam developing a RCP application which consists of views and editors. I can change the values and edit the values of some parameters in editor. When a value has been changed, i need to make the editor dirty as well as would also like to enable the save button. Till now, i have not implemented my save button. Could anyone guide me how to make the save button enabled as well as how can i make an editor dirty when some modifications happen in editor.

Thanks in advance. Any help will be greatly appreciated.

Regards, Girish

Upvotes: 0

Views: 439

Answers (1)

Kelibiano
Kelibiano

Reputation: 81

Here is an overview of the Form editor logic, hop it will help you.

public class TestEditor extends FormEditor {

    @Override
    protected void addPages() {
        // this method is called when the editor is being created
        // to add the necessary pages
        // page classes should be like following
        // class TestEditorPage extends FormPage
        try {
            TestEditorPage pageTest = new TestEditorPage(this);
            addPage(pageTest);
        } catch (PartInitException e) {
        }
    }

    @Override
    public void doSave(IProgressMonitor monitor) {
        // this method will be called on save action
        // (or Ctrl + s shortcut)
    }

    @Override
    public void doSaveAs() {
        // this method will be called on save-as 
        //call (or Ctrl + Shift + s shortcut)
    }


    @Override
    public boolean isSaveAsAllowed() {
       // put here the call to the logic that 
       // check if the save is allowed
       return true;
    }


    @Override
    public boolean isDirty() {
        // Here the call for the logic that 
        // defines if the editor is dirty or not
        return true;
    }
}

Upvotes: 1

Related Questions