@Override
 protected void setPreferenceStore(IPreferenceStore store) {
   if (store != null) {
     PreferenceConstants.initializeDefaultValues(store);
   }
   super.setPreferenceStore(store);
 }
  @Override
  protected void doSetInput(IEditorInput input) throws CoreException {

    super.doSetInput(input);

    ExpressionContentAssistProcessor caproc =
        (ExpressionContentAssistProcessor)
            this.getSourceViewerConfiguration()
                .getContentAssistant(this.getSourceViewer())
                .getContentAssistProcessor(IDocument.DEFAULT_CONTENT_TYPE);

    EObject eObj = (EObject) input.getAdapter(EObject.class);

    if (eObj != null) {
      caproc.setModelObject(eObj);
    }

    String expressionContext = (String) input.getAdapter(Integer.class);
    if (expressionContext != null) {
      caproc.setExpressionContext(expressionContext);
      //
      if (this.fVariablePickerAction != null) {
        this.fVariablePickerAction.setEnabled(
            expressionContext.indexOf(IEditorConstants.ET_JOIN) < 0);
      }
    }
  }
  @Override
  protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {

    support.setCharacterPairMatcher(this.fBracketMatcher);
    support.setMatchingCharacterPainterPreferenceKeys(
        PreferenceConstants.EDITOR_MATCHING_BRACKETS,
        PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR);

    super.configureSourceViewerDecorationSupport(support);
  }
  /** @see org.eclipse.ui.texteditor.AbstractTextEditor#dispose() */
  @Override
  public void dispose() {
    this.fColorManager.dispose();
    this.fBracketMatcher.dispose();

    ISourceViewer sourceViewer = getSourceViewer();
    if (sourceViewer instanceof ITextViewerExtension) {
      ((ITextViewerExtension) sourceViewer).removeVerifyKeyListener(this.fBracketInserter);
    }

    super.dispose();
  }
  /** @see AbstractTextEditor#handlePreferenceStoreChanged(PropertyChangeEvent) */
  @Override
  protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {

    String p = event.getProperty();

    if (PreferenceConstants.EDITOR_CLOSE_BRACKETS.equals(p)) {
      this.fBracketInserter.setCloseBracketsEnabled(getPreferenceStore().getBoolean(p));
      return;
    }

    if (PreferenceConstants.EDITOR_CLOSE_STRINGS.equals(p)) {
      this.fBracketInserter.setCloseStringsEnabled(getPreferenceStore().getBoolean(p));
      return;
    }

    super.handlePreferenceStoreChanged(event);
  }
  /** @see AbstractTextEditor#createPartControl(Composite) */
  @Override
  public void createPartControl(Composite parent) {

    super.createPartControl(parent);

    IPreferenceStore preferenceStore = getPreferenceStore();
    boolean closeBrackets = preferenceStore.getBoolean(PreferenceConstants.EDITOR_CLOSE_BRACKETS);
    boolean closeStrings = preferenceStore.getBoolean(PreferenceConstants.EDITOR_CLOSE_STRINGS);

    this.fBracketInserter.setCloseBracketsEnabled(closeBrackets);
    this.fBracketInserter.setCloseStringsEnabled(closeStrings);

    ISourceViewer sourceViewer = getSourceViewer();

    if (sourceViewer instanceof ITextViewerExtension) {
      ((ITextViewerExtension) sourceViewer).prependVerifyKeyListener(this.fBracketInserter);
    }
  }
  /**
   * @see
   *     org.eclipse.ui.texteditor.AbstractTextEditor#editorContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager)
   * @since 3.1
   */
  @Override
  protected void editorContextMenuAboutToShow(IMenuManager menu) {

    super.editorContextMenuAboutToShow(menu);

    IAction variablePicker = getAction(IXPathEditorActionConstants.VARIABLE_PICKER);
    menu.add(new Separator());
    menu.add(variablePicker);

    //		menu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new
    // Separator(ITextEditorActionConstants.GROUP_SETTINGS));
    //		menu.appendToGroup(ITextEditorActionConstants.GROUP_SETTINGS, preferencesAction);
    //
    //		menu.appendToGroup(ITextEditorActionConstants.GROUP_SAVE, new
    // Separator(ITextEditorActionConstants.GROUP_OPEN));
    //		MenuManager showInSubMenu= new MenuManager(getShowInMenuLabel());
    //
    //	showInSubMenu.add(ContributionItemFactory.VIEWS_SHOW_IN.create(getEditorSite().getWorkbenchWindow()));
    //		menu.appendToGroup(ITextEditorActionConstants.GROUP_OPEN, showInSubMenu);
  }
  @Override
  protected void createActions() {
    super.createActions();

    ResourceBundle bundle = ResourceBundle.getBundle("bpelexpression"); // $NON-NLS-1$
    Action action = new ContentAssistAction(bundle, "ContentAssistProposal.", this); // $NON-NLS-1$
    String id = ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS;
    action.setActionDefinitionId(id);
    setAction("ContentAssistProposal", action); // $NON-NLS-1$
    markAsStateDependentAction("ContentAssistProposal", true); // $NON-NLS-1$

    this.fVariablePickerAction =
        new VariablePickerAction(
            XPathEditorMessages.getBundleForConstructedKeys(),
            "Editor.VariablePicker.",
            this); //$NON-NLS-1$
    // action.setHelpContextId(IAbstractTextEditorHelpContextIds.GOTO_LINE_ACTION);
    this.fVariablePickerAction.setActionDefinitionId(
        IXPathEditorActionDefinitionIds.VARIABLE_PICKER);
    setAction(IXPathEditorActionConstants.VARIABLE_PICKER, this.fVariablePickerAction);
  }