/* * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intellij.codeInsight.editorActions; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.project.Project; import com.intellij.psi.PsiFile; import org.jetbrains.annotations.NotNull; /** * Handler, extending IDE behaviour on typing in editor. * * @author yole */ public abstract class TypedHandlerDelegate { public static final ExtensionPointName<TypedHandlerDelegate> EP_NAME = ExtensionPointName.create("com.intellij.typedHandler"); /** * If the specified character triggers auto-popup, schedules the auto-popup appearance. This method is called even * in overwrite mode, when the rest of typed handler delegate methods are not called. It is invoked only for the primary caret. */ public Result checkAutoPopup(char charTyped, final Project project, final Editor editor, final PsiFile file) { return Result.CONTINUE; } /** * Called before selected text is deleted. * This method is supposed to be overridden by handlers having custom behaviour with respect to selection. */ public Result beforeSelectionRemoved(char c, final Project project, final Editor editor, final PsiFile file) { return Result.CONTINUE; } /** * Called before the specified character typed by the user is inserted in the editor. */ public Result beforeCharTyped(char c, final Project project, final Editor editor, final PsiFile file, final FileType fileType) { return Result.CONTINUE; } /** * Called after the specified character typed by the user has been inserted in the editor. */ public Result charTyped(char c, final Project project, final @NotNull Editor editor, @NotNull final PsiFile file) { return Result.CONTINUE; } public enum Result { STOP, CONTINUE, DEFAULT } }