2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com
.intellij
.codeInsight
.template
;
19 import com
.intellij
.openapi
.editor
.Editor
;
20 import com
.intellij
.openapi
.project
.Project
;
21 import com
.intellij
.psi
.PsiFile
;
22 import com
.intellij
.util
.PairProcessor
;
23 import org
.jetbrains
.annotations
.NonNls
;
24 import org
.jetbrains
.annotations
.NotNull
;
25 import org
.jetbrains
.annotations
.Nullable
;
29 public abstract class TemplateManager
{
30 public static TemplateManager
getInstance(Project project
) {
31 return project
.getComponent(TemplateManager
.class);
34 public abstract void startTemplate(@NotNull Editor editor
, @NotNull Template template
);
36 public abstract void startTemplate(@NotNull Editor editor
, String selectionString
, @NotNull Template template
);
38 public abstract void startTemplate(@NotNull Editor editor
, @NotNull Template template
, TemplateEditingListener listener
);
40 public abstract void startTemplate(@NotNull final Editor editor
,
41 @NotNull final Template template
,
42 boolean inSeparateCommand
,
43 Map
<String
, String
> predefinedVarValues
,
44 TemplateEditingListener listener
);
46 public abstract void startTemplate(@NotNull Editor editor
,
47 @NotNull Template template
,
48 TemplateEditingListener listener
,
49 final PairProcessor
<String
, String
> callback
);
51 public abstract boolean startTemplate(@NotNull Editor editor
, char shortcutChar
);
53 public abstract TemplateContextType
getContextType(@NotNull PsiFile file
, int offset
);
55 public abstract Template
createTemplate(@NotNull String key
, String group
);
57 public abstract Template
createTemplate(@NotNull String key
, String group
, @NonNls String text
);
60 public abstract Template
getActiveTemplate(@NotNull Editor editor
);