0

ビューとエディターで構成される RCP アプリケーションを開発しています。値を変更し、エディターで一部のパラメーターの値を編集できます。値が変更されたら、エディターをダーティにする必要があり、保存ボタンも有効にしたいと考えています。今まで、保存ボタンを実装していませんでした。保存ボタンを有効にする方法と、エディターで変更が発生したときにエディターをダーティにする方法を教えてください。

前もって感謝します。どんな助けでも大歓迎です。

よろしく、ギリッシュ

4

1 に答える 1

1

これがフォームエディタロジックの概要です。お役に立てば幸いです。

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;
    }
}
于 2012-07-18T13:19:01.697 に答える