Package mmrnmhrm.ui.editor

Source Code of mmrnmhrm.ui.editor.DeeBaseEditor

package mmrnmhrm.ui.editor;

import org.eclipse.dltk.internal.ui.editor.BracketInserter;
import org.eclipse.jface.text.ITextViewerExtension;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.widgets.Composite;

public abstract class DeeBaseEditor extends AbstractLangEditor_DLTK {
 
  protected BracketInserter fBracketInserter = new DeeBracketInserter(this);
 
  @Override
  public void createPartControl(Composite parent) {
    super.createPartControl(parent);
   
    boolean closeBrackets = true;
    boolean closeStrings = true;
    boolean closeAngularBrackets = false;
   
    fBracketInserter.setCloseBracketsEnabled(closeBrackets);
    fBracketInserter.setCloseStringsEnabled(closeStrings);
    fBracketInserter.setCloseAngularBracketsEnabled(closeAngularBrackets);
   
    ISourceViewer sourceViewer = getSourceViewer();
    if (sourceViewer instanceof ITextViewerExtension) {
      ((ITextViewerExtension) sourceViewer).prependVerifyKeyListener(fBracketInserter);
    }
  }
 
  @Override
  public void dispose() {
    ISourceViewer sourceViewer = getSourceViewer();
    if (sourceViewer instanceof ITextViewerExtension) {
      ((ITextViewerExtension) sourceViewer).removeVerifyKeyListener(fBracketInserter);
    }
    super.dispose();
  }
 
  @Override
  protected void doSelectionChanged(SelectionChangedEvent event) {
    // This is the normal path
    super.doSelectionChanged(event);
  }
 
}
TOP

Related Classes of mmrnmhrm.ui.editor.DeeBaseEditor

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.