blob: 825e94bbecf49586be82e2894fc7b0cbd9613bd8 [file] [log] [blame]
/*
* 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;
/**
* @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.
*/
public Result checkAutoPopup(char charTyped, 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.
*
* @return true if the typing has been processed (in this case, no further delegates are called and the character is not inserted),
* false otherwise.
*/
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
}
}