[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform] Re: key binding in editor does not work in eclipse 3.4

Daniel Megert wrote:
> Nick Tan wrote:
>> Hi, all:
>>
>> I recently migrate to eclipse 3.4. from 3.3, every thing works fine
>> except that
>> key binding in my xml editor does not work any more, like "ALT + SHIFT
>> + R" for renaming in file,
>> "ALT + ?" for content assist, "CTRL + O" for quick outline etc...
>> Whatever, it works fine in eclipse 3.3!
>> Did I miss anything?
> What is "my xml editor"? Anything in .log (e.g. key binding conflicts)?
> 
> Dani
>> Thanks in advance & Best Regards!
>> Nick


Thanks for reply!
I implement my own xml editor, and retarget actions content assist, rename
in file etc. by overriding
org.eclipse.ui.editors.text.TextEditor.createActions() and extend
org.eclipse.ui.editors.text.TextEditorActionContributor

PS: no errors in .log and no key binding conflicts at all.

code snippets:
//
// com.bluebamboo.bluetools.xmleditor.editor.XmlEditor#createActions()
//
  /**
   * @see org.eclipse.ui.texteditor.AbstractTextEditor#createActions()
   */
  protected void createActions() {
    super.createActions();
    ResourceBundle bundle = getEditorResourceBundle();
    IAction action = new ContentAssistAction(bundle,
        "ContentAssistProposal.", this);
    action

.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
    setAction("ContentAssistProposal", action);

    action = new TextOperationAction(bundle,
        "ContentFormat.", this, ISourceViewer.FORMAT); //$NON-NLS-1$
    action.setActionDefinitionId(IJavaEditorActionDefinitionIds.FORMAT);
    setAction("ContentFormat", action); //$NON-NLS-1$

    action = new OpenDeclarationAction(this);
    setAction("OpenDeclaration", action); //$NON-NLS-1$

    action = new RenameInFileAction(this);
    action

.setActionDefinitionId("com.bluebamboo.bluetools.xmleditor.renameInFile");
//$NON-NLS-1$
    setAction("renameInFile", action); //$NON-NLS-1$

    // Create the quick outline action
    createQuickOutlineAction(bundle);
  }

//
// com.bluebamboo.bluetools.xmleditor.editor.XmlEditorActionContributor
//
  /**
   * @see
IEditorActionBarContributor#setActiveEditor(org.eclipse.ui.IEditorPart)
   */
  public void setActiveEditor(IEditorPart part) {
    super.setActiveEditor(part);
    ITextEditor editor = null;
    if (part instanceof ITextEditor) {
      editor = (ITextEditor) part;
    }
    fContentAssistProposal.setAction(getAction(editor,
        "ContentAssistProposal")); //$NON-NLS-1$
    fContentFormat.setAction(getAction(editor, "ContentFormat"));
//$NON-NLS-1$

    if (fToggleMarkOccurrencesAction != null) {
      fToggleMarkOccurrencesAction.setEditor(editor);
    }

    if (editor instanceof XmlEditor) {
      XmlEditor xmlEditor = (XmlEditor) editor;
      fOpenDeclarationAction = new OpenDeclarationAction(xmlEditor);
      contributeToMenu(getActionBars().getMenuManager());
      fOpenDeclarationAction.setEditor(xmlEditor);
    }
  }