org.eclipse.jface.text.reconciler.IReconciler Java Examples

The following examples show how to use org.eclipse.jface.text.reconciler.IReconciler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EditorConfigSourceViewerConfiguration.java    From editorconfig-eclipse with Apache License 2.0 6 votes vote down vote up
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
	if (!EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED))
		return null;

	IReconcilingStrategy strategy = new SpellingReconcileStrategy(sourceViewer, EditorsUI.getSpellingService()) {
		@Override
		protected IContentType getContentType() {
			return EditorConfigTextTools.EDITORCONFIG_CONTENT_TYPE;
		}
	};

	MonoReconciler reconciler = new MonoReconciler(strategy, false);
	reconciler.setDelay(500);
	return reconciler;
}
 
Example #2
Source File: PropertiesFileSourceViewerConfiguration.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
	if (!EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED))
		return null;

	IReconcilingStrategy strategy= new SpellingReconcileStrategy(sourceViewer, EditorsUI.getSpellingService()) {
		@Override
		protected IContentType getContentType() {
			return PROPERTIES_CONTENT_TYPE;
		}
	};

	MonoReconciler reconciler= new MonoReconciler(strategy, false);
	reconciler.setDelay(500);
	return reconciler;
}
 
Example #3
Source File: TexSourceViewerConfiguration.java    From texlipse with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getReconciler(org.eclipse.jface.text.source.ISourceViewer)
 */
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
    if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED))
        return null;
    if (!TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(TexlipseProperties.ECLIPSE_BUILDIN_SPELLCHECKER))
        return null;
    //Set TeXlipse spelling Engine as default
    PreferenceStore store = new PreferenceStore();
    store.setValue(SpellingService.PREFERENCE_SPELLING_ENGINE, 
            "org.eclipse.texlipse.LaTeXSpellEngine");
    store.setValue(SpellingService.PREFERENCE_SPELLING_ENABLED, 
    true);
    SpellingService spellingService = new SpellingService(store);
    if (spellingService.getActiveSpellingEngineDescriptor(store) == null)
        return null;
    IReconcilingStrategy strategy= new TeXSpellingReconcileStrategy(sourceViewer, spellingService);
    
    MonoReconciler reconciler= new MonoReconciler(strategy, true);
    reconciler.setDelay(500);
    reconciler.setProgressMonitor(new NullProgressMonitor());
    return reconciler;
}
 
Example #4
Source File: PyEditConfigurationWithoutEditor.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
    if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) {
        return null;
    }

    SpellingService spellingService = EditorsUI.getSpellingService();
    if (spellingService.getActiveSpellingEngineDescriptor(fPreferenceStore) == null) {
        return null;
    }

    //Overridden (just) to return a PyReconciler!
    IReconcilingStrategy strategy = new PyReconciler(sourceViewer, spellingService);

    MonoReconciler reconciler = new MonoReconciler(strategy, false);
    reconciler.setIsIncrementalReconciler(false);
    reconciler.setProgressMonitor(new NullProgressMonitor());
    reconciler.setDelay(500);
    return reconciler;
}
 
Example #5
Source File: UiBinderStructuredRegionProcessor.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
public static void setAsReconciler(
    StructuredTextViewerConfiguration configuration) throws Exception {
  try {
    IReconciler reconciler = createReconciler();

    // Reflectively set the spelling service to our own
    Field reconcilerField = StructuredTextViewerConfiguration.class.getDeclaredField("fReconciler");
    reconcilerField.setAccessible(true);
    reconcilerField.set(configuration, reconciler);
  } catch (Throwable t) {
    throw new Exception(t);
  }
}
 
Example #6
Source File: JavaEditor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void internalDoSetInput(IEditorInput input) throws CoreException {
	ISourceViewer sourceViewer= getSourceViewer();
	JavaSourceViewer javaSourceViewer= null;
	if (sourceViewer instanceof JavaSourceViewer)
		javaSourceViewer= (JavaSourceViewer)sourceViewer;

	IPreferenceStore store= getPreferenceStore();
	if (javaSourceViewer != null && isFoldingEnabled() &&(store == null || !store.getBoolean(PreferenceConstants.EDITOR_SHOW_SEGMENTS)))
		javaSourceViewer.prepareDelayedProjection();

	super.doSetInput(input);

	if (javaSourceViewer != null && javaSourceViewer.getReconciler() == null) {
		IReconciler reconciler= getSourceViewerConfiguration().getReconciler(javaSourceViewer);
		if (reconciler != null) {
			reconciler.install(javaSourceViewer);
			javaSourceViewer.setReconciler(reconciler);
		}
	}

	if (fEncodingSupport != null)
		fEncodingSupport.reset();

	setOutlinePageInput(fOutlinePage, input);

	if (isShowingOverrideIndicators())
		installOverrideIndicator(false);
}
 
Example #7
Source File: JavaSourceViewerConfiguration.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {

	final ITextEditor editor= getEditor();
	if (editor != null && editor.isEditable()) {

		JavaCompositeReconcilingStrategy strategy= new JavaCompositeReconcilingStrategy(sourceViewer, editor, getConfiguredDocumentPartitioning(sourceViewer));
		JavaReconciler reconciler= new JavaReconciler(editor, strategy, false);
		reconciler.setIsAllowedToModifyDocument(false);
		reconciler.setDelay(500);

		return reconciler;
	}
	return null;
}
 
Example #8
Source File: CommonSourceViewerConfiguration.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer)
{
	if (fTextEditor != null && fTextEditor.isEditable())
	{
		IReconcilingStrategy reconcilingStrategy = new CommonReconcilingStrategy(fTextEditor);
		if (EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED))
		{
			SpellingService spellingService = EditorsUI.getSpellingService();
			Collection<String> spellingContentTypes = getSpellingContentTypes(sourceViewer);
			if (spellingService.getActiveSpellingEngineDescriptor(fPreferenceStore) != null
					&& !spellingContentTypes.isEmpty())
			{
				reconcilingStrategy = new CompositeReconcilingStrategy(reconcilingStrategy,
						new MultiRegionSpellingReconcileStrategy(sourceViewer, spellingService,
								getConfiguredDocumentPartitioning(sourceViewer), spellingContentTypes));
			}
		}
		CommonReconciler reconciler = new CommonReconciler(reconcilingStrategy);
		reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
		reconciler.setIsIncrementalReconciler(false);
		reconciler.setIsAllowedToModifyDocument(false);
		reconciler.setProgressMonitor(new NullProgressMonitor());
		reconciler.setDelay(500);
		return fReconciler = reconciler;
	}
	return null;
}
 
Example #9
Source File: CommitCommentArea.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public IReconciler getReconciler(ISourceViewer sourceViewer) {
	MonoReconciler reconciler = new MonoReconciler(strategy, false);
	reconciler.setIsIncrementalReconciler(false);
	reconciler.setProgressMonitor(new NullProgressMonitor());
	reconciler.setDelay(200);
	return reconciler;
}
 
Example #10
Source File: ScriptSourceViewerConfiguration.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public IReconciler getReconciler( ISourceViewer sourceViewer )
{
	// Creates an instance of MonoReconciler with the specified strategy,
	// and is not incremental.
	return new MonoReconciler( new ScriptReconcilingStrategy( sourceViewer ),
			false );
}
 
Example #11
Source File: JsonSourceViewerConfiguration.java    From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
    JsonReconcilingStrategy strategy = new JsonReconcilingStrategy();
    strategy.setEditor(editor);
    MonoReconciler reconciler = new MonoReconciler(strategy, false);
    return reconciler;
}
 
Example #12
Source File: GWTSourceViewerConfiguration.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
  JavaReconciler reconciler = (JavaReconciler) super.getReconciler(sourceViewer);
  if (reconciler != null) {
    try {
      JavaCompositeReconcilingStrategy strategy = (JavaCompositeReconcilingStrategy) reconciler.getReconcilingStrategy(IDocument.DEFAULT_CONTENT_TYPE);
      IReconcilingStrategy[] strategies = strategy.getReconcilingStrategies();
      IReconcilingStrategy[] newStrategies = new IReconcilingStrategy[strategies.length];
      for (int i = 0; i < strategies.length; i++) {
        if (strategies[i] instanceof JavaSpellingReconcileStrategy) {
          // Replace the default Java reconcile strategy with our own, which
          // will suppress spell checking within JSNI blocks
          newStrategies[i] = new GWTJavaSpellingReconcileStrategy(
              sourceViewer, getEditor());
        } else {
          newStrategies[i] = strategies[i];
        }
      }
      strategy.setReconcilingStrategies(newStrategies);
    } catch (Exception e) {
      // We're being defensive to ensure that we always return a reconciler
      GWTPluginLog.logError(e);
    }
    return reconciler;
  }

  return null;
}
 
Example #13
Source File: UiBinderStructuredRegionProcessor.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates and initializes the UI Binder-specific reconciler.
 */
private static IReconciler createReconciler() {
  // Initialization mirrors StructuredTextViewerConfiguration.getReconciler.
  // Difference: We do not have an ISourceViewer, but the
  // ISourceViewer.getConfiguredDocumentPartitioning for structured text
  // always returns the DEFAULT_STRUCTURED_PARTITIONING (the method is final
  // and it is just a simple return of this value.)
  UiBinderStructuredRegionProcessor reconciler = new UiBinderStructuredRegionProcessor();
  reconciler.setDocumentPartitioning(IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING);
  return reconciler;
}
 
Example #14
Source File: JavaScriptLightWeightEditor.java    From typescript.java with MIT License 5 votes vote down vote up
private void internalDoSetInput(IEditorInput input) throws CoreException {
	ISourceViewer sourceViewer = getSourceViewer();
	TypeScriptSourceViewer TypeScriptSourceViewer = null;
	if (sourceViewer instanceof TypeScriptSourceViewer)
		TypeScriptSourceViewer = (TypeScriptSourceViewer) sourceViewer;

	IPreferenceStore store = getPreferenceStore();
	// if (TypeScriptSourceViewer != null && isFoldingEnabled() &&(store ==
	// null || !store.getBoolean(PreferenceConstants.EDITOR_SHOW_SEGMENTS)))
	// TypeScriptSourceViewer.prepareDelayedProjection();

	super.doSetInput(input);

	if (TypeScriptSourceViewer != null && TypeScriptSourceViewer.getReconciler() == null) {
		IReconciler reconciler = getSourceViewerConfiguration().getReconciler(TypeScriptSourceViewer);
		if (reconciler != null) {
			reconciler.install(TypeScriptSourceViewer);
			TypeScriptSourceViewer.setReconciler(reconciler);
		}
	}

	// if (fEncodingSupport != null)
	// fEncodingSupport.reset();

	// setOutlinePageInput(fOutlinePage, input);
	//
	// if (isShowingOverrideIndicators())
	// installOverrideIndicator(false);
}
 
Example #15
Source File: TLASourceViewerConfiguration.java    From tlaplus with MIT License 5 votes vote down vote up
/**
    * 
    */
   @Override
public IReconciler getReconciler(final ISourceViewer sourceViewer) {
       final TLAReconcilingStrategy strategy = new TLAReconcilingStrategy();
       strategy.setEditor(editor);
       if (sourceViewer instanceof ProjectionViewer) {
       	strategy.setProjectionViewer((ProjectionViewer)sourceViewer);
       }
       return new MonoReconciler(strategy, false);
   }
 
Example #16
Source File: ModulaSourceViewerConfiguration.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
/**
     * {@inheritDoc}
     */
    @Override
    public IReconciler getReconciler(ISourceViewer sourceViewer) {
        final ITextEditor editor = getEditor();
        if (editor != null) {
            ModulaCompositeReconcilingStrategy strategy = new ModulaCompositeReconcilingStrategy(sourceViewer, textEditor);
            ModulaReconciler reconciler = new ModulaReconciler(textEditor, strategy);
            reconciler.setIsAllowedToModifyDocument(false);
            reconciler.setDelay(500);
//            return super.getReconciler(sourceViewer);
            return reconciler;
        }
        return null;
    }
 
Example #17
Source File: XtextSourceViewerConfiguration.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
	IReconciler reconciler = reconcilerProvider.get();
	if (reconciler instanceof XtextReconciler && editor instanceof XtextEditor) 
		((XtextReconciler) reconciler).setEditor((XtextEditor) editor);
	return reconciler;
}
 
Example #18
Source File: XtextSourceViewer.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Supported adapter types are {@link IReconciler} and {@link IXtextDocument}.
 * 
 * @since 2.3
 */
@Override
public <T> T getAdapter(Class<T> adapter) {
	if (IReconciler.class.isAssignableFrom(adapter) && adapter.isInstance(fReconciler)) {
		return adapter.cast(fReconciler);
	}
	if (IXtextDocument.class.equals(adapter)) {
		return adapter.cast(getXtextDocument());
	}
	return Platform.getAdapterManager().getAdapter(this, adapter);
}
 
Example #19
Source File: XtextEditor.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @since 2.7
 */
@Override
public void forceReconcile() {
	IReconciler reconciler = Adapters.adapt(getInternalSourceViewer(), IReconciler.class);
	if (reconciler instanceof XtextReconciler)
		((XtextReconciler)reconciler).forceReconcile();
}
 
Example #20
Source File: SpellingQuickfixTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected ICompletionProposal[] computeQuickAssistProposals(int offset) {
	XtextSourceViewer sourceViewer = getSourceViewer();
	XtextReconciler reconciler = (XtextReconciler) sourceViewer.getAdapter(IReconciler.class);
	IReconcilingStrategyExtension reconcilingStrategyExtension = (IReconcilingStrategyExtension) reconciler.getReconcilingStrategy("");
	reconcilingStrategyExtension.initialReconcile();
	QuickAssistAssistant quickAssistAssistant = (QuickAssistAssistant) sourceViewer.getQuickAssistAssistant();
	IQuickAssistProcessor quickAssistProcessor = quickAssistAssistant.getQuickAssistProcessor();
	ICompletionProposal[] quickAssistProposals = quickAssistProcessor
			.computeQuickAssistProposals(new TextInvocationContext(sourceViewer, offset, -1));
	return quickAssistProposals;
}
 
Example #21
Source File: ConditionModelUiModule.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public Class<? extends IReconciler> bindIReconciler() {
	return NoSpellingReconciler.class;
}
 
Example #22
Source File: AbstractLangSourceViewerConfiguration.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
	return null; // not used, disable the textual spellchecker too
}
 
Example #23
Source File: GamlUiModule.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Class<? extends IReconciler> bindIReconciler() {
	return GamlReconciler.class;
}
 
Example #24
Source File: DefaultUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IReconciler> bindIReconciler() {
	return XtextReconciler.class;
}
 
Example #25
Source File: JavaSourceViewer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Returns the reconciler.
 *
 * @return the reconciler or <code>null</code> if not set
 * @since 3.0
 */
IReconciler getReconciler() {
	return fReconciler;
}
 
Example #26
Source File: JavaSourceViewer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Sets the given reconciler.
 *
 * @param reconciler the reconciler
 * @since 3.0
 */
void setReconciler(IReconciler reconciler) {
	fReconciler= reconciler;
}
 
Example #27
Source File: TypeScriptSourceViewer.java    From typescript.java with MIT License 2 votes vote down vote up
/**
 * Returns the reconciler.
 *
 * @return the reconciler or <code>null</code> if not set
 * 
 */
IReconciler getReconciler() {
	return fReconciler;
}
 
Example #28
Source File: TypeScriptSourceViewer.java    From typescript.java with MIT License 2 votes vote down vote up
/**
 * Sets the given reconciler.
 *
 * @param reconciler
 *            the reconciler
 * 
 */
void setReconciler(IReconciler reconciler) {
	fReconciler = reconciler;
}