コード例 #1
0
  protected void addPages() {
    editorPage =
        new RegistryInfoEditorPage(
            this,
            "org.wso2.developerstudio.eclipse.artifact.registry.handler.editor.design",
            "Design");
    sourceEditor = new StructuredTextEditor();
    sourceEditor.setEditorPart(this);
    try {
      editorPage.initContent();
      formEditorIndex = addPage(editorPage);
      sourceEditorIndex = addPage(sourceEditor, getEditorInput());
      setPageText(sourceEditorIndex, "Source");

      getDocument()
          .addDocumentListener(
              new IDocumentListener() {

                public void documentAboutToBeChanged(final DocumentEvent event) {
                  // nothing to do
                }

                public void documentChanged(final DocumentEvent event) {
                  sourceDirty = true;
                  updateDirtyState();
                }
              });
    } catch (Exception e) {
      log.error(e);
    }
  }
コード例 #2
0
 private void updateDesignFromSource() {
   try {
     editorPage.refreshContent();
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
コード例 #3
0
 private void updateSourceFromDesign() {
   try {
     String source = editorPage.getSource();
     getDocument().set(source);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
コード例 #4
0
 public void doSave(IProgressMonitor monitor) {
   if ((getCurrentPage() == formEditorIndex) && (dirty)) {
     updateSourceFromDesign();
   } else if ((getCurrentPage() == sourceEditorIndex) && (sourceDirty)) {
     updateDesignFromSource();
   }
   sourceDirty = false;
   dirty = false;
   try {
     editorPage.save();
     updateDirtyState();
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
コード例 #5
0
 public void updateDirtyState() {
   dirty = editorPage.isDirty();
   firePropertyChange(PROP_DIRTY);
   editorDirtyStateChanged();
 }