Package org.eclipse.jface.text.contentassist

Examples of org.eclipse.jface.text.contentassist.ContentAssistant


    protected SourceViewer createViewer(Composite parent) {
      SourceViewer viewer= new SourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
      SourceViewerConfiguration configuration= new SourceViewerConfiguration() {
        public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {

          ContentAssistant assistant= new ContentAssistant();
          assistant.enableAutoActivation(true);
          assistant.enableAutoInsert(true);
          assistant.setContentAssistProcessor(fTemplateProcessor, IDocument.DEFAULT_CONTENT_TYPE);
          return assistant;
        }
      };
      viewer.configure(configuration);
      return viewer;
View Full Code Here


    return reconciler;
  }

    // javadoc inherited
    public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
        ContentAssistant assistant = new ContentAssistant();
        XMLCompletionProcessor processor =
            new XMLCompletionProcessor(schema);

        assistant.setContentAssistProcessor(
            processor,
            XMLPartitionScanner.XML_TAG);

        assistant.setContentAssistProcessor(
            processor,
            XMLPartitionScanner.XML_DEFAULT);

        assistant.setContentAssistProcessor(
            processor,
            IDocument.DEFAULT_CONTENT_TYPE);

        assistant.enableAutoActivation(true);
        assistant.setAutoActivationDelay(500); // half a second?
        assistant.setProposalPopupOrientation(
            ContentAssistant.CONTEXT_INFO_BELOW);
        assistant.enableAutoInsert(true);

        return assistant;
    }
View Full Code Here

  /**
   * Creates or Returns the <code>IContentAssistant</code>.
   */
  public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
    if(assistant==null){
      assistant = new ContentAssistant();
      assistant.setInformationControlCreator(new IInformationControlCreator() {
        public IInformationControl createInformationControl(Shell parent) {
          return new DefaultInformationControl(parent);
        }});
      assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
View Full Code Here

  private void updateAssistProperties(PropertyChangeEvent event){
    String key = event.getProperty();
    try {
      // auto activation delay
      if(key.equals(HTMLPlugin.PREF_ASSIST_TIMES)){
        ContentAssistant assistant = (ContentAssistant)getSourceViewerConfiguration().getContentAssistant(null);
        assistant.setAutoActivationDelay(Integer.parseInt((String)event.getNewValue()));
     
      // auto activation trigger
      } else if(key.equals(HTMLPlugin.PREF_ASSIST_CHARS)){
        ContentAssistant assistant = (ContentAssistant)getSourceViewerConfiguration().getContentAssistant(null);
        HTMLAssistProcessor processor = (HTMLAssistProcessor)assistant.getContentAssistProcessor(IDocument.DEFAULT_CONTENT_TYPE);
        processor.setAutoAssistChars(((String)event.getNewValue()).toCharArray());
       
      // completion close tag
      } else if(key.equals(HTMLPlugin.PREF_ASSIST_CLOSE)){
        ContentAssistant assistant = (ContentAssistant)getSourceViewerConfiguration().getContentAssistant(null);
        HTMLAssistProcessor processor = (HTMLAssistProcessor)assistant.getContentAssistProcessor(IDocument.DEFAULT_CONTENT_TYPE);
        processor.setAssistCloseTag(((Boolean)event.getNewValue()).booleanValue());
     
      // enable auto activation or not
      } else if(key.equals(HTMLPlugin.PREF_ASSIST_AUTO)){
        ContentAssistant assistant = (ContentAssistant)getSourceViewerConfiguration().getContentAssistant(null);
        assistant.enableAutoActivation(((Boolean)event.getNewValue()).booleanValue());
      }
    } catch(Exception ex){
      HTMLPlugin.logException(ex);
    }
  }
View Full Code Here

      IDocument.DEFAULT_CONTENT_TYPE,
      CSSPartitionScanner.CSS_COMMENT};
  }
 
  public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
    ContentAssistant assistant = new ContentAssistant();
    assistant.enableAutoInsert(true);
    CSSAssistProcessor processor = new CSSAssistProcessor();
    assistant.setContentAssistProcessor(processor,IDocument.DEFAULT_CONTENT_TYPE);
    assistant.install(sourceViewer);
   
//    IPreferenceStore store = HTMLPlugin.getDefault().getPreferenceStore();
//    assistant.enableAutoActivation(store.getBoolean(HTMLPlugin.PREF_ASSIST_AUTO));
//    assistant.setAutoActivationDelay(store.getInt(HTMLPlugin.PREF_ASSIST_TIMES));
   
View Full Code Here

    }
    return assistProcessor;
  }
 
  public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
    ContentAssistant assistant = new ContentAssistant();
    assistant.enableAutoInsert(true);
    assistant.setContentAssistProcessor(getAssistProcessor(),IDocument.DEFAULT_CONTENT_TYPE);
    assistant.install(sourceViewer);
   
    return assistant;
  }
View Full Code Here

  }

  @Override
  public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
    if (this.contentAssistant == null){
      contentAssistant = new ContentAssistant();
      IContentAssistProcessor cap =
        //new ToolCompletionProcessor(null);
        new ToolTemplateAssistProcessor();
      contentAssistant.setContentAssistProcessor(cap, IDocument.DEFAULT_CONTENT_TYPE);
      contentAssistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));
View Full Code Here

      return preferences.getInt(PreferenceConstants.TAB_WIDTH);
  }
 
  @Override
  public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
    ContentAssistant assistant = new ContentAssistant();
    IContentAssistProcessor proc = new PowershellCompletionProcessor(); // FIXME: Don't we want only one copy here?
    DialogSettings dsettings = new DialogSettings("pscoderContentAssist");
    assistant.setContentAssistProcessor(proc, IDocument.DEFAULT_CONTENT_TYPE);
    assistant.enableAutoActivation(true);
    assistant.setRestoreCompletionProposalSize(dsettings);
   
    return assistant;
  }
View Full Code Here

      if (sourceViewer != null) {
        SourceViewerConfiguration configuration = getSourceViewerConfiguration();
        if (configuration != null) {
          IContentAssistant contentAssistant = configuration.getContentAssistant(sourceViewer);
          if (contentAssistant instanceof ContentAssistant) {
            ContentAssistant assistant = (ContentAssistant) contentAssistant;
            RGB rgb = PreferenceConverter.getColor(getPreferenceStore(), EditorPreferenceNames.CODEASSIST_PROPOSALS_BACKGROUND);
            Color color = EditorUtility.getColor(rgb);
            assistant.setProposalSelectorBackground(color);
          }
        }
      }
    }

    // update content assist preferences
    else if (EditorPreferenceNames.CODEASSIST_PROPOSALS_FOREGROUND.equals(property)) {
      ISourceViewer sourceViewer = getSourceViewer();
      if (sourceViewer != null) {
        SourceViewerConfiguration configuration = getSourceViewerConfiguration();
        if (configuration != null) {
          IContentAssistant contentAssistant = configuration.getContentAssistant(sourceViewer);
          if (contentAssistant instanceof ContentAssistant) {
            ContentAssistant assistant = (ContentAssistant) contentAssistant;
            RGB rgb = PreferenceConverter.getColor(getPreferenceStore(), EditorPreferenceNames.CODEASSIST_PROPOSALS_FOREGROUND);
            Color color = EditorUtility.getColor(rgb);
            assistant.setProposalSelectorForeground(color);
          }
        }
      }
    }

    // update content assist preferences
    else if (EditorPreferenceNames.CODEASSIST_PARAMETERS_BACKGROUND.equals(property)) {
      ISourceViewer sourceViewer = getSourceViewer();
      if (sourceViewer != null) {
        SourceViewerConfiguration configuration = getSourceViewerConfiguration();
        if (configuration != null) {
          IContentAssistant contentAssistant = configuration.getContentAssistant(sourceViewer);
          if (contentAssistant instanceof ContentAssistant) {
            ContentAssistant assistant = (ContentAssistant) contentAssistant;
            RGB rgb = PreferenceConverter.getColor(getPreferenceStore(), EditorPreferenceNames.CODEASSIST_PARAMETERS_BACKGROUND);
            Color color = EditorUtility.getColor(rgb);
            assistant.setContextInformationPopupBackground(color);
            assistant.setContextSelectorBackground(color);
          }
        }
      }
    }

    // update content assist preferences
    else if (EditorPreferenceNames.CODEASSIST_PARAMETERS_FOREGROUND.equals(property)) {
      ISourceViewer sourceViewer = getSourceViewer();
      if (sourceViewer != null) {
        SourceViewerConfiguration configuration = getSourceViewerConfiguration();
        if (configuration != null) {
          IContentAssistant contentAssistant = configuration.getContentAssistant(sourceViewer);
          if (contentAssistant instanceof ContentAssistant) {
            ContentAssistant assistant = (ContentAssistant) contentAssistant;
            RGB rgb = PreferenceConverter.getColor(getPreferenceStore(), EditorPreferenceNames.CODEASSIST_PARAMETERS_FOREGROUND);
            Color color = EditorUtility.getColor(rgb);
            assistant.setContextInformationPopupForeground(color);
            assistant.setContextSelectorForeground(color);
          }
        }
      }
    }
View Full Code Here

      public LineStyleProvider[] getLineStyleProviders(ISourceViewer sourceViewer, String partitionType) {
        return baseConfiguration.getLineStyleProviders(sourceViewer, partitionType);
      }

      public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
        ContentAssistant assistant = new ContentAssistant();
        assistant.enableAutoActivation(true);
        assistant.enableAutoInsert(true);
        assistant.setContentAssistProcessor(getTemplateProcessor(), IDocument.DEFAULT_CONTENT_TYPE);
        return assistant;
      }
    };
    return doCreateViewer(parent, sourceViewerConfiguration);
}
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.contentassist.ContentAssistant

Copyright © 2018 www.massapicom. 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.