コード例 #1
0
 @Override
 protected void setPreferenceStore(IPreferenceStore store) {
   if (store != null) {
     PreferenceConstants.initializeDefaultValues(store);
   }
   super.setPreferenceStore(store);
 }
コード例 #2
0
  @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);
      }
    }
  }
コード例 #3
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);
  }
コード例 #4
0
  /** @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();
  }
コード例 #5
0
  /** @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);
  }
コード例 #6
0
  /** @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);
    }
  }
コード例 #7
0
  /**
   * @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);
  }
コード例 #8
0
  @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);
  }