mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
+36
-9
@@ -46,6 +46,7 @@ import com.intellij.openapi.projectRoots.JavaSdkType;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.*;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
@@ -89,6 +90,9 @@ public class BackendCompilerWrapper {
|
||||
private static final FileObject myStopThreadToken = new FileObject(new File(""), new byte[0]);
|
||||
public final Map<String, Set<CompiledClass>> myFileNameToSourceMap= new THashMap<String, Set<CompiledClass>>();
|
||||
private final Set<VirtualFile> myProcessedPackageInfos = new HashSet<VirtualFile>();
|
||||
private final CompileStatistics myStatistics;
|
||||
private volatile String myModuleName = null;
|
||||
|
||||
|
||||
public BackendCompilerWrapper(Chunk<Module> chunk, @NotNull final Project project,
|
||||
@NotNull List<VirtualFile> filesToCompile,
|
||||
@@ -101,6 +105,12 @@ public class BackendCompilerWrapper {
|
||||
myFilesToCompile = filesToCompile;
|
||||
mySink = sink;
|
||||
myProjectFileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
|
||||
CompileStatistics stat = compileContext.getUserData(CompileStatistics.KEY);
|
||||
if (stat == null) {
|
||||
stat = new CompileStatistics();
|
||||
compileContext.putUserData(CompileStatistics.KEY, stat);
|
||||
}
|
||||
myStatistics = stat;
|
||||
}
|
||||
|
||||
public void compile() throws CompilerException, CacheCorruptedException {
|
||||
@@ -155,7 +165,6 @@ public class BackendCompilerWrapper {
|
||||
}
|
||||
|
||||
private void compileModules(final Map<Module, List<VirtualFile>> moduleToFilesMap) throws CompilerException {
|
||||
myProcessedFilesCount = 0;
|
||||
try {
|
||||
compileChunk(new ModuleChunk(myCompileContext, myChunk, moduleToFilesMap));
|
||||
}
|
||||
@@ -765,12 +774,8 @@ public class BackendCompilerWrapper {
|
||||
return out;
|
||||
}
|
||||
|
||||
private volatile int myProcessedFilesCount = 0;
|
||||
private volatile int myClassesCount = 0;
|
||||
private volatile String myModuleName = null;
|
||||
|
||||
private void sourceFileProcessed() {
|
||||
myProcessedFilesCount++;
|
||||
myStatistics.incFilesCount();
|
||||
updateStatistics();
|
||||
}
|
||||
|
||||
@@ -778,10 +783,10 @@ public class BackendCompilerWrapper {
|
||||
final String msg;
|
||||
String moduleName = myModuleName;
|
||||
if (moduleName != null) {
|
||||
msg = CompilerBundle.message("statistics.files.classes.module", myProcessedFilesCount, myClassesCount, moduleName);
|
||||
msg = CompilerBundle.message("statistics.files.classes.module", myStatistics.getFilesCount(), myStatistics.getClassesCount(), moduleName);
|
||||
}
|
||||
else {
|
||||
msg = CompilerBundle.message("statistics.files.classes", myProcessedFilesCount, myClassesCount);
|
||||
msg = CompilerBundle.message("statistics.files.classes", myStatistics.getFilesCount(), myStatistics.getClassesCount());
|
||||
}
|
||||
myCompileContext.getProgressIndicator().setText2(msg);
|
||||
//myCompileContext.getProgressIndicator().setFraction(1.0* myProcessedFilesCount /myTotalFilesToCompile);
|
||||
@@ -888,7 +893,7 @@ public class BackendCompilerWrapper {
|
||||
LOG.info(e);
|
||||
}
|
||||
finally {
|
||||
myClassesCount++;
|
||||
myStatistics.incClassesCount();
|
||||
updateStatistics();
|
||||
}
|
||||
}
|
||||
@@ -923,4 +928,26 @@ public class BackendCompilerWrapper {
|
||||
}
|
||||
return isJDK16;
|
||||
}
|
||||
|
||||
private static final class CompileStatistics {
|
||||
private static final Key<CompileStatistics> KEY = Key.create("_Compile_Statistics_");
|
||||
private int myClassesCount;
|
||||
private int myFilesCount;
|
||||
|
||||
public int getClassesCount() {
|
||||
return myClassesCount;
|
||||
}
|
||||
|
||||
public int incClassesCount() {
|
||||
return ++myClassesCount;
|
||||
}
|
||||
|
||||
public int getFilesCount() {
|
||||
return myFilesCount;
|
||||
}
|
||||
|
||||
public int incFilesCount() {
|
||||
return ++myFilesCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
*/
|
||||
package com.intellij.lang.java;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionProcess;
|
||||
import com.intellij.codeInsight.completion.CompletionService;
|
||||
import com.intellij.lang.WordCompletionElementFilter;
|
||||
import com.intellij.psi.JavaDocTokenType;
|
||||
import com.intellij.psi.JavaTokenType;
|
||||
@@ -30,6 +32,11 @@ public class JavaWordCompletionFilter implements WordCompletionElementFilter {
|
||||
JavaDocTokenType.DOC_COMMENT_DATA, JavaTokenType.STRING_LITERAL);
|
||||
|
||||
public boolean isWordCompletionEnabledIn(final IElementType element) {
|
||||
final CompletionProcess process = CompletionService.getCompletionService().getCurrentCompletion();
|
||||
if (process != null && process.isAutopopupCompletion()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ENABLED_TOKENS.contains(element);
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ import com.intellij.util.io.StringRef;
|
||||
import java.io.IOException;
|
||||
|
||||
public class JavaFileElementType extends IStubFileElementType<PsiJavaFileStub> {
|
||||
public static final int STUB_VERSION = JavaParserDefinition.USE_NEW_PARSER ? 4 : 3;
|
||||
public static final int STUB_VERSION = JavaParserDefinition.USE_NEW_PARSER ? 5 : 4;
|
||||
|
||||
public JavaFileElementType() {
|
||||
super("java.FILE", StdLanguages.JAVA);
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.intellij.lang.java.parser;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.lang.PsiBuilder;
|
||||
import com.intellij.lang.StdLanguages;
|
||||
import com.intellij.lang.java.JavaParserDefinition;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
@@ -121,9 +120,7 @@ public abstract class JavaParsingTestCase extends ParsingTestCase {
|
||||
@Override
|
||||
protected void doTest(final boolean checkResult) {
|
||||
doTestDefaultParser(checkResult);
|
||||
if (JavaParserDefinition.USE_NEW_PARSER) {
|
||||
doTestNewParser();
|
||||
}
|
||||
doTestNewParser();
|
||||
}
|
||||
|
||||
protected void doTestDefaultParser(final boolean checkResult) {
|
||||
|
||||
@@ -223,6 +223,9 @@ public class ClassloaderUtil {
|
||||
final File libFolder = new File(aFolderPath + File.separator + "lib");
|
||||
addLibraries(classPath, libFolder, selfRootUrl);
|
||||
|
||||
final File extLib = new File(new File(libFolder, "ext"), "lib");
|
||||
addLibraries(classPath, extLib, selfRootUrl);
|
||||
|
||||
final File antLib = new File(new File(libFolder, "ant"), "lib");
|
||||
addLibraries(classPath, antLib, selfRootUrl);
|
||||
}
|
||||
|
||||
@@ -19,10 +19,17 @@
|
||||
*/
|
||||
package com.intellij.lang;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionProcess;
|
||||
import com.intellij.codeInsight.completion.CompletionService;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
|
||||
public class DefaultWordCompletionFilter implements WordCompletionElementFilter {
|
||||
public boolean isWordCompletionEnabledIn(final IElementType element) {
|
||||
final CompletionProcess process = CompletionService.getCompletionService().getCurrentCompletion();
|
||||
if (process != null && process.isAutopopupCompletion()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final ParserDefinition parserDefinition = LanguageParserDefinitions.INSTANCE.forLanguage(element.getLanguage());
|
||||
return parserDefinition != null && parserDefinition.getCommentTokens().contains(element);
|
||||
}
|
||||
|
||||
@@ -33,14 +33,16 @@ public class ProjectLocatorImpl extends ProjectLocator {
|
||||
@Nullable
|
||||
public Project guessProjectForFile(final VirtualFile file) {
|
||||
ProjectManager projectManager = ProjectManager.getInstance();
|
||||
if (projectManager == null || file == null) return null;
|
||||
if (projectManager == null) return null;
|
||||
final Project[] projects = projectManager.getOpenProjects();
|
||||
if (projects.length == 0) return null;
|
||||
if (projects.length == 1 && !projects[0].isDisposed()) return projects[0];
|
||||
|
||||
for (Project project : projects) {
|
||||
if (project.isInitialized() && !project.isDisposed() && ProjectRootManager.getInstance(project).getFileIndex().isInContent(file)) {
|
||||
return project;
|
||||
if (file != null) {
|
||||
for (Project project : projects) {
|
||||
if (project.isInitialized() && !project.isDisposed() && ProjectRootManager.getInstance(project).getFileIndex().isInContent(file)) {
|
||||
return project;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
@@ -60,6 +60,10 @@ public class CompletionAutoPopupHandler extends TypedHandlerDelegate {
|
||||
finishAutopopupCompletion();
|
||||
return Result.CONTINUE;
|
||||
}
|
||||
} else {
|
||||
if (LookupManager.getActiveLookup(editor) != null) {
|
||||
return Result.CONTINUE;
|
||||
}
|
||||
}
|
||||
|
||||
myEditor = editor;
|
||||
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.template.macro;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightBundle;
|
||||
import com.intellij.codeInsight.template.Expression;
|
||||
import com.intellij.codeInsight.template.ExpressionContext;
|
||||
import com.intellij.codeInsight.template.Result;
|
||||
import com.intellij.codeInsight.template.TextResult;
|
||||
import com.intellij.psi.codeStyle.NameUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class CapitalizeAndUnderscoreMacro extends MacroBase {
|
||||
public CapitalizeAndUnderscoreMacro() {
|
||||
super("capitalizeAndUnderscore", CodeInsightBundle.message("macro.capitalizeAndUnderscore.string"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Result calculateResult(@NotNull Expression[] params, ExpressionContext context, boolean quick) {
|
||||
String text = getTextResult(params, context, true);
|
||||
if (text != null && text.length() > 0) {
|
||||
final String[] words = NameUtil.nameToWords(text);
|
||||
boolean insertUnderscore = false;
|
||||
final StringBuffer buf = new StringBuffer();
|
||||
for (String word : words) {
|
||||
if (insertUnderscore) {
|
||||
buf.append("_");
|
||||
} else {
|
||||
insertUnderscore = true;
|
||||
}
|
||||
buf.append(word.toUpperCase());
|
||||
}
|
||||
return new TextResult(buf.toString());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+18
-36
@@ -17,47 +17,29 @@
|
||||
package com.intellij.codeInsight.template.macro;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightBundle;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.template.*;
|
||||
import com.intellij.codeInsight.template.Expression;
|
||||
import com.intellij.codeInsight.template.ExpressionContext;
|
||||
import com.intellij.codeInsight.template.Result;
|
||||
import com.intellij.codeInsight.template.TextResult;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class CapitalizeMacro implements Macro {
|
||||
|
||||
public String getName() {
|
||||
return "capitalize";
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class CapitalizeMacro extends MacroBase {
|
||||
public CapitalizeMacro() {
|
||||
super("capitalize", CodeInsightBundle.message("macro.capitalize.string"));
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return CodeInsightBundle.message("macro.capitalize.string");
|
||||
}
|
||||
|
||||
public String getDefaultValue() {
|
||||
return "A";
|
||||
}
|
||||
|
||||
public Result calculateResult(@NotNull Expression[] params, ExpressionContext context) {
|
||||
if (params.length != 1) return null;
|
||||
Result result = params[0].calculateResult(context);
|
||||
return execute(result);
|
||||
}
|
||||
|
||||
public Result calculateQuickResult(@NotNull Expression[] params, ExpressionContext context) {
|
||||
if (params.length != 1) return null;
|
||||
Result result = params[0].calculateQuickResult(context);
|
||||
return execute(result);
|
||||
}
|
||||
|
||||
private Result execute(Result result) {
|
||||
if (result == null) return null;
|
||||
String text = result.toString();
|
||||
if (text == null) return null;
|
||||
if (text.length() > 0) {
|
||||
text = text.substring(0, 1).toUpperCase() + text.substring(1, text.length());
|
||||
@Override
|
||||
protected Result calculateResult(@NotNull Expression[] params, ExpressionContext context, boolean quick) {
|
||||
String text = getTextResult(params, context);
|
||||
if (text != null) {
|
||||
if (text.length() > 0) {
|
||||
text = text.substring(0, 1).toUpperCase() + text.substring(1, text.length());
|
||||
}
|
||||
return new TextResult(text);
|
||||
}
|
||||
return new TextResult(text);
|
||||
}
|
||||
|
||||
public LookupElement[] calculateLookupItems(@NotNull Expression[] params, final ExpressionContext context) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+15
-34
@@ -17,46 +17,27 @@
|
||||
package com.intellij.codeInsight.template.macro;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightBundle;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.template.*;
|
||||
import com.intellij.codeInsight.template.Expression;
|
||||
import com.intellij.codeInsight.template.ExpressionContext;
|
||||
import com.intellij.codeInsight.template.Result;
|
||||
import com.intellij.codeInsight.template.TextResult;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class DecapitalizeMacro implements Macro {
|
||||
|
||||
public String getName() {
|
||||
return "decapitalize";
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class DecapitalizeMacro extends MacroBase {
|
||||
public DecapitalizeMacro() {
|
||||
super("decapitalize", CodeInsightBundle.message("macro.decapitalize.string"));
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return CodeInsightBundle.message("macro.decapitalize.string");
|
||||
}
|
||||
|
||||
public String getDefaultValue() {
|
||||
return "a";
|
||||
}
|
||||
|
||||
public Result calculateResult(@NotNull Expression[] params, ExpressionContext context) {
|
||||
if (params.length != 1) return null;
|
||||
Result result = params[0].calculateResult(context);
|
||||
return execute(result);
|
||||
}
|
||||
|
||||
public Result calculateQuickResult(@NotNull Expression[] params, ExpressionContext context) {
|
||||
if (params.length != 1) return null;
|
||||
Result result = params[0].calculateQuickResult(context);
|
||||
return execute(result);
|
||||
}
|
||||
|
||||
private Result execute(Result result) {
|
||||
if (result == null) return null;
|
||||
String text = result.toString();
|
||||
if (text.length() > 0) {
|
||||
@Override
|
||||
protected Result calculateResult(@NotNull Expression[] params, ExpressionContext context, boolean quick) {
|
||||
String text = getTextResult(params, context);
|
||||
if (text != null && text.length() > 0) {
|
||||
text = text.substring(0, 1).toLowerCase() + text.substring(1, text.length());
|
||||
return new TextResult(text);
|
||||
}
|
||||
return new TextResult(text);
|
||||
}
|
||||
|
||||
public LookupElement[] calculateLookupItems(@NotNull Expression[] params, final ExpressionContext context) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+15
-40
@@ -17,53 +17,28 @@
|
||||
package com.intellij.codeInsight.template.macro;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightBundle;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.template.*;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import com.intellij.codeInsight.template.Expression;
|
||||
import com.intellij.codeInsight.template.ExpressionContext;
|
||||
import com.intellij.codeInsight.template.Result;
|
||||
import com.intellij.codeInsight.template.TextResult;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class FirstWordMacro implements Macro {
|
||||
@NonNls
|
||||
public String getName() {
|
||||
return "firstWord";
|
||||
public class FirstWordMacro extends MacroBase {
|
||||
public FirstWordMacro() {
|
||||
super("firstWord", CodeInsightBundle.message("macro.firstWord.string"));
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return CodeInsightBundle.message("macro.firstWord.string");
|
||||
}
|
||||
|
||||
@NonNls
|
||||
public String getDefaultValue() {
|
||||
return "a";
|
||||
}
|
||||
|
||||
public Result calculateResult(@NotNull Expression[] params, ExpressionContext context) {
|
||||
if (params.length != 1) return null;
|
||||
Result result = params[0].calculateResult(context);
|
||||
return execute(result);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Result execute(final Result result) {
|
||||
if (result == null) {
|
||||
return null;
|
||||
@Override
|
||||
protected Result calculateResult(@NotNull Expression[] params, ExpressionContext context, boolean quick) {
|
||||
final String text = getTextResult(params, context);
|
||||
if (text != null) {
|
||||
final int index = text.indexOf(' ');
|
||||
return index >= 0 ? new TextResult(text.substring(0, index)) : new TextResult(text);
|
||||
}
|
||||
final String resultString = result.toString();
|
||||
final int index = resultString.indexOf(' ');
|
||||
return index >= 0 ? new TextResult(resultString.substring(0, index)) : result;
|
||||
}
|
||||
|
||||
public Result calculateQuickResult(@NotNull Expression[] params, ExpressionContext context) {
|
||||
if (params.length != 1) return null;
|
||||
Result result = params[0].calculateResult(context);
|
||||
return execute(result);
|
||||
}
|
||||
|
||||
public LookupElement[] calculateLookupItems(@NotNull Expression[] params, ExpressionContext context) {
|
||||
return LookupElement.EMPTY_ARRAY;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.template.macro;
|
||||
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.template.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public abstract class MacroBase implements Macro {
|
||||
private final String myName;
|
||||
private final String myDescription;
|
||||
|
||||
public MacroBase(String name, String description) {
|
||||
myName = name;
|
||||
myDescription = description;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected abstract Result calculateResult(@NotNull Expression[] params, ExpressionContext context, boolean quick);
|
||||
|
||||
@Override
|
||||
public Result calculateResult(@NotNull Expression[] params, ExpressionContext context) {
|
||||
return calculateResult(params, context, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result calculateQuickResult(@NotNull Expression[] params, ExpressionContext context) {
|
||||
return calculateResult(params, context, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return myName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return myDescription;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultValue() {
|
||||
return "a";
|
||||
}
|
||||
|
||||
public LookupElement[] calculateLookupItems(@NotNull Expression[] params, final ExpressionContext context) {
|
||||
return LookupElement.EMPTY_ARRAY;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getTextResult(@NotNull Expression[] params, final ExpressionContext context) {
|
||||
return getTextResult(params, context, false);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getTextResult(@NotNull Expression[] params, final ExpressionContext context, boolean useSelection) {
|
||||
if (params.length == 1) {
|
||||
Result result = params[0].calculateResult(context);
|
||||
if (result == null && useSelection) {
|
||||
final String property = context.getProperty(ExpressionContext.SELECTION);
|
||||
if (property != null) {
|
||||
result = new TextResult(property);
|
||||
}
|
||||
}
|
||||
return result == null ? null : result.toString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.template.macro;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightBundle;
|
||||
import com.intellij.codeInsight.template.Expression;
|
||||
import com.intellij.codeInsight.template.ExpressionContext;
|
||||
import com.intellij.codeInsight.template.Result;
|
||||
import com.intellij.codeInsight.template.TextResult;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class ReplaceUnderscoresToCamelCaseMacro extends MacroBase {
|
||||
public ReplaceUnderscoresToCamelCaseMacro() {
|
||||
super("underscoresToCamelCase", CodeInsightBundle.message("macro.undescoresToCamelCase.string"));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected Result calculateResult(@NotNull Expression[] params, ExpressionContext context, boolean quick) {
|
||||
final String text = getTextResult(params, context, true);
|
||||
if (text != null) {
|
||||
final StringBuffer buf = new StringBuffer();
|
||||
final List<String> strings = StringUtil.split(text, "_");
|
||||
buf.append(strings.get(0).toLowerCase());
|
||||
for (int i = 1; i < strings.size(); i++) {
|
||||
buf.append(StringUtil.capitalize(strings.get(i).toLowerCase()));
|
||||
}
|
||||
return new TextResult(buf.toString());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+14
-37
@@ -17,50 +17,27 @@
|
||||
package com.intellij.codeInsight.template.macro;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightBundle;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.template.*;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import com.intellij.codeInsight.template.Expression;
|
||||
import com.intellij.codeInsight.template.ExpressionContext;
|
||||
import com.intellij.codeInsight.template.Result;
|
||||
import com.intellij.codeInsight.template.TextResult;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Roman.Chernyatchik
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class ReplaceUnderscoresWithSpacesMacro implements Macro {
|
||||
@NonNls
|
||||
public String getName() {
|
||||
return "underscoresToSpaces";
|
||||
public class ReplaceUnderscoresWithSpacesMacro extends MacroBase {
|
||||
public ReplaceUnderscoresWithSpacesMacro() {
|
||||
super("undescoresToSpaces", CodeInsightBundle.message("macro.undescoresToSpaces.string"));
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return CodeInsightBundle.message("macro.undescoresToSpaces.string");
|
||||
}
|
||||
|
||||
@NonNls
|
||||
public String getDefaultValue() {
|
||||
return "a";
|
||||
}
|
||||
|
||||
public Result calculateResult(@NotNull Expression[] params, ExpressionContext context) {
|
||||
if (params.length != 1) {
|
||||
return null;
|
||||
@Override
|
||||
protected Result calculateResult(@NotNull Expression[] params, ExpressionContext context, boolean quick) {
|
||||
final String text = getTextResult(params, context);
|
||||
if (text != null) {
|
||||
return new TextResult(text.replace('_', ' '));
|
||||
}
|
||||
Result param_result = params[0].calculateResult(context);
|
||||
if (param_result == null) {
|
||||
return null;
|
||||
}
|
||||
return execute(param_result);
|
||||
}
|
||||
|
||||
public Result calculateQuickResult(@NotNull Expression[] params, ExpressionContext context) {
|
||||
return calculateResult(params, context);
|
||||
}
|
||||
|
||||
public LookupElement[] calculateLookupItems(@NotNull Expression[] params, ExpressionContext context) {
|
||||
return LookupElement.EMPTY_ARRAY;
|
||||
}
|
||||
|
||||
private Result execute(final Result param_result) {
|
||||
final String param_string_value = param_result.toString();
|
||||
return new TextResult(param_string_value.replace('_', ' '));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -924,7 +924,6 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder {
|
||||
}
|
||||
else if (item instanceof DoneMarker) {
|
||||
curNode = nodes.pop();
|
||||
item.next = i < myProduction.size() - 1 ? myProduction.get(i + 1) : null;
|
||||
}
|
||||
else if (item instanceof ErrorItem) {
|
||||
int curToken = item.myLexemeIndex;
|
||||
@@ -987,79 +986,43 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder {
|
||||
CompositeElement curNode = rootNode;
|
||||
|
||||
int lexIndex = rootMarker.myLexemeIndex;
|
||||
int lastErrorIndex = -1;
|
||||
for (int i = myProduction.indexOf(rootMarker) + 1; i <= myProduction.indexOf(rootMarker.myDoneMarker); i++) {
|
||||
final ProductionMarker item = myProduction.get(i);
|
||||
|
||||
lexIndex = insertLeaves(lexIndex, item.myLexemeIndex, curNode);
|
||||
|
||||
if (item instanceof StartMarker) {
|
||||
final StartMarker marker = (StartMarker)item;
|
||||
if (!marker.myDoneMarker.myCollapse) {
|
||||
markers.push(curMarker);
|
||||
curMarker = marker;
|
||||
|
||||
final CompositeElement childNode = createComposite(curMarker);
|
||||
curNode.rawAddChildren(childNode);
|
||||
nodes.push(curNode);
|
||||
curNode = childNode;
|
||||
}
|
||||
else {
|
||||
lexIndex = collapseLeaves(curNode, marker);
|
||||
//noinspection AssignmentToForLoopParameter
|
||||
i = myProduction.indexOf(marker.myDoneMarker);
|
||||
}
|
||||
}
|
||||
else if (item instanceof DoneMarker) {
|
||||
curMarker = markers.pop();
|
||||
curNode = nodes.pop();
|
||||
}
|
||||
else if (item instanceof ErrorItem) {
|
||||
int curToken = item.myLexemeIndex;
|
||||
if (curToken == lastErrorIndex) continue;
|
||||
lastErrorIndex = curToken;
|
||||
|
||||
final PsiErrorElementImpl errorElement = new PsiErrorElementImpl();
|
||||
errorElement.setErrorDescription(((ErrorItem)item).myMessage);
|
||||
curNode.rawAddChildren(errorElement);
|
||||
}
|
||||
}
|
||||
/*
|
||||
ProductionMarker item = rootMarker.firstChild != null ? rootMarker.firstChild : rootMarker.myDoneMarker;
|
||||
while (item != null) {
|
||||
while (true) {
|
||||
lexIndex = insertLeaves(lexIndex, item.myLexemeIndex, curNode);
|
||||
|
||||
if (item == rootMarker.myDoneMarker) break;
|
||||
|
||||
if (item instanceof StartMarker) {
|
||||
final StartMarker marker = (StartMarker)item;
|
||||
if (!marker.myDoneMarker.myCollapse) {
|
||||
markers.push(curMarker);
|
||||
curMarker = marker;
|
||||
|
||||
final CompositeElement childNode = createComposite(curMarker);
|
||||
final CompositeElement childNode = createComposite(marker);
|
||||
curNode.rawAddChildren(childNode);
|
||||
nodes.push(curNode);
|
||||
curNode = childNode;
|
||||
|
||||
item = marker.firstChild != null ? marker.firstChild : marker.myDoneMarker;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
lexIndex = collapseLeaves(curNode, marker);
|
||||
item = marker.myDoneMarker.next;
|
||||
}
|
||||
}
|
||||
else if (item instanceof ErrorItem) {
|
||||
final PsiErrorElementImpl errorElement = new PsiErrorElementImpl();
|
||||
errorElement.setErrorDescription(((ErrorItem)item).myMessage);
|
||||
curNode.rawAddChildren(errorElement);
|
||||
item = item.next != null ? item.next : curMarker.myDoneMarker;
|
||||
}
|
||||
else if (item instanceof DoneMarker) {
|
||||
curMarker = markers.pop();
|
||||
curNode = nodes.pop();
|
||||
item = item.next;
|
||||
item = ((DoneMarker)item).myStart;
|
||||
}
|
||||
|
||||
item = item.next != null ? item.next : curMarker.myDoneMarker;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private int insertLeaves(int curToken, int lastIdx, final CompositeElement curNode) {
|
||||
|
||||
+8
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.intellij.psi.impl.source.resolve.reference.impl.providers;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionProcess;
|
||||
import com.intellij.codeInsight.completion.CompletionService;
|
||||
import com.intellij.codeInsight.daemon.EmptyResolveMessageProvider;
|
||||
import com.intellij.codeInsight.daemon.QuickFixProvider;
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
|
||||
@@ -201,6 +203,12 @@ public class FileReference implements FileReferenceOwner, PsiPolyVariantReferenc
|
||||
|
||||
@NotNull
|
||||
public Object[] getVariants() {
|
||||
final CompletionProcess process = CompletionService.getCompletionService().getCurrentCompletion();
|
||||
if (process != null && process.isAutopopupCompletion() && isSoft()) {
|
||||
return ArrayUtil.EMPTY_OBJECT_ARRAY;
|
||||
}
|
||||
|
||||
|
||||
final String s = getText();
|
||||
if (s != null && s.equals("/")) {
|
||||
return ArrayUtil.EMPTY_OBJECT_ARRAY;
|
||||
|
||||
+1
-1
@@ -219,7 +219,7 @@ public class VariableInplaceRenamer {
|
||||
|
||||
//move to old offset
|
||||
final LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(myEditor);
|
||||
final boolean lookupShown = lookup != null && lookup.getLookupStart() < offset;
|
||||
final boolean lookupShown = lookup != null && lookup.getLookupStart() <= offset;
|
||||
if (lookupShown) {
|
||||
lookup.setAdditionalPrefix(myEditor.getDocument().getCharsSequence().subSequence(lookup.getLookupStart(), offset).toString());
|
||||
lookup.setFocused(false);
|
||||
|
||||
@@ -535,34 +535,37 @@ public class FileBasedIndex implements ApplicationComponent {
|
||||
if (!myShutdownPerformed.compareAndSet(false, true)) {
|
||||
return; // already shut down
|
||||
}
|
||||
if (myFlushingFuture != null) {
|
||||
myFlushingFuture.cancel(false);
|
||||
myFlushingFuture = null;
|
||||
}
|
||||
|
||||
myFileDocumentManager.saveAllDocuments();
|
||||
|
||||
LOG.info("START INDEX SHUTDOWN");
|
||||
try {
|
||||
myChangedFilesCollector.forceUpdate(null, null, true);
|
||||
|
||||
for (ID<?, ?> indexId : myIndices.keySet()) {
|
||||
final UpdatableIndex<?, ?, FileContent> index = getIndex(indexId);
|
||||
assert index != null;
|
||||
checkRebuild(indexId, true); // if the index was scheduled for rebuild, only clean it
|
||||
//LOG.info("DISPOSING " + indexId);
|
||||
index.dispose();
|
||||
if (myFlushingFuture != null) {
|
||||
myFlushingFuture.cancel(false);
|
||||
myFlushingFuture = null;
|
||||
}
|
||||
|
||||
myVfManager.removeVirtualFileListener(myChangedFilesCollector);
|
||||
myFileDocumentManager.saveAllDocuments();
|
||||
}
|
||||
finally {
|
||||
LOG.info("START INDEX SHUTDOWN");
|
||||
try {
|
||||
myChangedFilesCollector.forceUpdate(null, null, true);
|
||||
|
||||
//FileUtil.delete(getMarkerFile());
|
||||
for (ID<?, ?> indexId : myIndices.keySet()) {
|
||||
final UpdatableIndex<?, ?, FileContent> index = getIndex(indexId);
|
||||
assert index != null;
|
||||
checkRebuild(indexId, true); // if the index was scheduled for rebuild, only clean it
|
||||
//LOG.info("DISPOSING " + indexId);
|
||||
index.dispose();
|
||||
}
|
||||
|
||||
myVfManager.removeVirtualFileListener(myChangedFilesCollector);
|
||||
|
||||
//FileUtil.delete(getMarkerFile());
|
||||
}
|
||||
catch (Throwable e) {
|
||||
LOG.info("Problems during index shutdown", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
LOG.info("END INDEX SHUTDOWN");
|
||||
}
|
||||
catch (Throwable e) {
|
||||
LOG.info("Problems during index shutdown", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
LOG.info("END INDEX SHUTDOWN");
|
||||
}
|
||||
|
||||
private void flushAllIndices() {
|
||||
|
||||
@@ -628,30 +628,7 @@ public class Messages {
|
||||
panel.add(container, BorderLayout.WEST);
|
||||
}
|
||||
if (myMessage != null) {
|
||||
JLabel label = new JLabel();
|
||||
final JTextPane messageComponent = new JTextPane();
|
||||
messageComponent.setFont(label.getFont());
|
||||
if (BasicHTML.isHTMLString(myMessage)) {
|
||||
final HTMLEditorKit editorKit = new HTMLEditorKit();
|
||||
editorKit.getStyleSheet().addRule(UIUtil.displayPropertiesToCSS(label.getFont(), label.getForeground()));
|
||||
messageComponent.setEditorKit(editorKit);
|
||||
messageComponent.setContentType("text/html");
|
||||
messageComponent.addHyperlinkListener(new BrowserHyperlinkListener());
|
||||
}
|
||||
messageComponent.setText(myMessage);
|
||||
messageComponent.setEditable(false);
|
||||
if (messageComponent.getCaret() != null) {
|
||||
messageComponent.setCaretPosition(0);
|
||||
}
|
||||
|
||||
if (UIUtil.isUnderNimbusLookAndFeel()) {
|
||||
messageComponent.setOpaque(false);
|
||||
messageComponent.setBackground(new Color(0, 0, 0, 0));
|
||||
} else {
|
||||
messageComponent.setBackground(UIUtil.getOptionPaneBackground());
|
||||
}
|
||||
|
||||
messageComponent.setForeground(label.getForeground());
|
||||
final JTextPane messageComponent = createMessageComponent(myMessage);
|
||||
|
||||
final Dimension screenSize = messageComponent.getToolkit().getScreenSize();
|
||||
final Dimension textSize = messageComponent.getPreferredSize();
|
||||
@@ -682,6 +659,34 @@ public class Messages {
|
||||
return panel;
|
||||
}
|
||||
|
||||
protected static JTextPane createMessageComponent(final String message) {
|
||||
JLabel label = new JLabel();
|
||||
final JTextPane messageComponent = new JTextPane();
|
||||
messageComponent.setFont(label.getFont());
|
||||
if (BasicHTML.isHTMLString(message)) {
|
||||
final HTMLEditorKit editorKit = new HTMLEditorKit();
|
||||
editorKit.getStyleSheet().addRule(UIUtil.displayPropertiesToCSS(label.getFont(), label.getForeground()));
|
||||
messageComponent.setEditorKit(editorKit);
|
||||
messageComponent.setContentType("text/html");
|
||||
messageComponent.addHyperlinkListener(new BrowserHyperlinkListener());
|
||||
}
|
||||
messageComponent.setText(message);
|
||||
messageComponent.setEditable(false);
|
||||
if (messageComponent.getCaret() != null) {
|
||||
messageComponent.setCaretPosition(0);
|
||||
}
|
||||
|
||||
if (UIUtil.isUnderNimbusLookAndFeel()) {
|
||||
messageComponent.setOpaque(false);
|
||||
messageComponent.setBackground(new Color(0, 0, 0, 0));
|
||||
} else {
|
||||
messageComponent.setBackground(UIUtil.getOptionPaneBackground());
|
||||
}
|
||||
|
||||
messageComponent.setForeground(label.getForeground());
|
||||
return messageComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doHelpAction() {
|
||||
// do nothing
|
||||
@@ -833,10 +838,17 @@ public class Messages {
|
||||
|
||||
JPanel messagePanel = new JPanel(new BorderLayout());
|
||||
if (myMessage != null) {
|
||||
JLabel textLabel = new JLabel(myMessage);
|
||||
textLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
|
||||
textLabel.setUI(new MultiLineLabelUI());
|
||||
messagePanel.add(textLabel, BorderLayout.NORTH);
|
||||
JComponent textComponent;
|
||||
if (BasicHTML.isHTMLString(myMessage)) {
|
||||
textComponent = createMessageComponent(myMessage);
|
||||
}
|
||||
else {
|
||||
JLabel textLabel = new JLabel(myMessage);
|
||||
textLabel.setUI(new MultiLineLabelUI());
|
||||
textComponent = textLabel;
|
||||
}
|
||||
textComponent.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
|
||||
messagePanel.add(textComponent, BorderLayout.NORTH);
|
||||
}
|
||||
|
||||
myField = createTextFieldComponent();
|
||||
|
||||
+12
-9
@@ -709,19 +709,22 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
|
||||
}
|
||||
|
||||
private void scheduleReloadApplicationAndProject() {
|
||||
IdeEventQueue.getInstance().addIdleListener(new Runnable() {
|
||||
@Override
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
IdeEventQueue.getInstance().removeIdleListener(this);
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
IdeEventQueue.getInstance().addIdleListener(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!tryToReloadApplication()) return;
|
||||
askToReloadProjectIfConfigFilesChangedExternally();
|
||||
IdeEventQueue.getInstance().removeIdleListener(this);
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
if (!tryToReloadApplication()) return;
|
||||
askToReloadProjectIfConfigFilesChangedExternally();
|
||||
}
|
||||
}, ModalityState.NON_MODAL);
|
||||
}
|
||||
|
||||
}, ModalityState.NON_MODAL);
|
||||
}, 2000);
|
||||
}
|
||||
}, 2000);
|
||||
}, ModalityState.NON_MODAL);
|
||||
}
|
||||
|
||||
public void setCurrentTestProject(@Nullable final Project project) {
|
||||
|
||||
@@ -310,6 +310,8 @@ macro.current.package=currentPackage()
|
||||
macro.decapitalize.string=decapitalize(String)
|
||||
macro.firstWord.string=firstWord(String)
|
||||
macro.undescoresToSpaces.string=underscoresToSpaces(String)
|
||||
macro.undescoresToCamelCase.string=underscoresToCamelCase(String)
|
||||
macro.capitalizeAndUnderscore.string=capitalizeAndUnderscore(String)
|
||||
macro.descendant.classes.enum=descendantClassesEnum(String)
|
||||
macro.enum=enum(...)
|
||||
macro.expected.type=expectedType()
|
||||
|
||||
@@ -316,6 +316,8 @@
|
||||
<liveTemplateMacro implementation="com.intellij.codeInsight.template.macro.FirstWordMacro"/>
|
||||
<liveTemplateMacro implementation="com.intellij.codeInsight.template.macro.ReplaceUnderscoresWithSpacesMacro"/>
|
||||
<liveTemplateMacro implementation="com.intellij.codeInsight.template.macro.LineNumberMacro"/>
|
||||
<liveTemplateMacro implementation="com.intellij.codeInsight.template.macro.ReplaceUnderscoresToCamelCaseMacro"/>
|
||||
<liveTemplateMacro implementation="com.intellij.codeInsight.template.macro.CapitalizeAndUnderscoreMacro"/>
|
||||
|
||||
<liveTemplateMacro implementation="com.intellij.codeInsight.template.macro.CompleteMacro"/>
|
||||
<liveTemplateMacro implementation="com.intellij.codeInsight.template.macro.CompleteSmartMacro"/>
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.intellij.openapi.util;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class ShutDownTracker implements Runnable {
|
||||
@@ -25,7 +26,7 @@ public class ShutDownTracker implements Runnable {
|
||||
private static ShutDownTracker ourInstance;
|
||||
private final List<Thread> myThreads = new ArrayList<Thread>();
|
||||
private final List<Thread> myShutdownThreads = new ArrayList<Thread>();
|
||||
private final List<Runnable> myShutdownTasks = new ArrayList<Runnable>();
|
||||
private final LinkedList<Runnable> myShutdownTasks = new LinkedList<Runnable>();
|
||||
private volatile boolean myIsShutdownHookRunning = false;
|
||||
|
||||
private ShutDownTracker() {
|
||||
@@ -46,6 +47,18 @@ public class ShutDownTracker implements Runnable {
|
||||
|
||||
public void run() {
|
||||
myIsShutdownHookRunning = true;
|
||||
|
||||
while (!myShutdownTasks.isEmpty()) {
|
||||
// task can change myShutdownTasks
|
||||
final Runnable task = myShutdownTasks.removeLast();
|
||||
try {
|
||||
task.run();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
Thread[] threads = getStopperThreads();
|
||||
while (threads.length > 0) {
|
||||
Thread thread = threads[0];
|
||||
@@ -65,17 +78,6 @@ public class ShutDownTracker implements Runnable {
|
||||
threads = getStopperThreads();
|
||||
}
|
||||
|
||||
while (!myShutdownTasks.isEmpty()) {
|
||||
// task can change myShutdownTasks
|
||||
final Runnable task = myShutdownTasks.remove(myShutdownTasks.size()-1);
|
||||
try {
|
||||
task.run();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
for (int idx = myShutdownThreads.size() - 1; idx >= 0; idx--) {
|
||||
final Thread thread = myShutdownThreads.remove(idx);
|
||||
thread.start();
|
||||
@@ -111,7 +113,7 @@ public class ShutDownTracker implements Runnable {
|
||||
}
|
||||
|
||||
public void registerShutdownTask(Runnable task) {
|
||||
myShutdownTasks.add(task);
|
||||
myShutdownTasks.addLast(task);
|
||||
}
|
||||
|
||||
public void unregisterShutdownTask(Runnable task) {
|
||||
|
||||
+18
-5
@@ -16,6 +16,7 @@
|
||||
package com.intellij.xdebugger.impl.breakpoints;
|
||||
|
||||
import com.intellij.ide.startup.StartupManagerEx;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.Result;
|
||||
import com.intellij.openapi.application.WriteAction;
|
||||
@@ -26,11 +27,13 @@ import com.intellij.openapi.editor.event.*;
|
||||
import com.intellij.openapi.editor.markup.MarkupEditorFilterFactory;
|
||||
import com.intellij.openapi.editor.markup.RangeHighlighter;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.fileEditor.FileEditor;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.fileEditor.TextEditor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.startup.StartupManager;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.util.containers.BidirectionalMap;
|
||||
import com.intellij.util.ui.update.MergingUpdateQueue;
|
||||
@@ -185,10 +188,11 @@ public class XLineBreakpointManager {
|
||||
public void mouseClicked(final EditorMouseEvent e) {
|
||||
final Editor editor = e.getEditor();
|
||||
final MouseEvent mouseEvent = e.getMouseEvent();
|
||||
if (mouseEvent.isPopupTrigger() ||
|
||||
mouseEvent.getButton() != MouseEvent.BUTTON1 ||
|
||||
MarkupEditorFilterFactory.createIsDiffFilter().avaliableIn(editor) ||
|
||||
e.getArea() != EditorMouseEventArea.LINE_MARKERS_AREA) {
|
||||
if (mouseEvent.isPopupTrigger()
|
||||
|| mouseEvent.getButton() != MouseEvent.BUTTON1
|
||||
|| MarkupEditorFilterFactory.createIsDiffFilter().avaliableIn(editor)
|
||||
|| e.getArea() != EditorMouseEventArea.LINE_MARKERS_AREA
|
||||
||!isFromMyProject(editor)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -211,6 +215,15 @@ public class XLineBreakpointManager {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isFromMyProject(Editor editor) {
|
||||
for (FileEditor fileEditor : FileEditorManager.getInstance(myProject).getAllEditors()) {
|
||||
if (fileEditor instanceof TextEditor && ((TextEditor)fileEditor).getEditor().equals(editor)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private class MyDependentBreakpointListener implements XDependentBreakpointListener {
|
||||
public void dependencySet(final XBreakpoint<?> slave, final XBreakpoint<?> master) {
|
||||
queueBreakpointUpdate(slave);
|
||||
|
||||
+7
@@ -19,12 +19,19 @@
|
||||
*/
|
||||
package com.intellij.lang.properties;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionProcess;
|
||||
import com.intellij.codeInsight.completion.CompletionService;
|
||||
import com.intellij.lang.DefaultWordCompletionFilter;
|
||||
import com.intellij.lang.properties.parsing.PropertiesElementTypes;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
|
||||
public class PropertiesWordCompletionFilter extends DefaultWordCompletionFilter {
|
||||
public boolean isWordCompletionEnabledIn(final IElementType element) {
|
||||
final CompletionProcess process = CompletionService.getCompletionService().getCurrentCompletion();
|
||||
if (process != null && process.isAutopopupCompletion()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return super.isWordCompletionEnabledIn(element) || element == PropertiesElementTypes.PROPERTY;
|
||||
}
|
||||
}
|
||||
+7
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.intellij.lang.properties.references;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionProcess;
|
||||
import com.intellij.codeInsight.completion.CompletionService;
|
||||
import com.intellij.codeInsight.daemon.EmptyResolveMessageProvider;
|
||||
import com.intellij.lang.properties.psi.PropertiesFile;
|
||||
import com.intellij.lang.properties.psi.Property;
|
||||
@@ -180,6 +182,11 @@ public abstract class PropertyReferenceBase implements PsiPolyVariantReference,
|
||||
|
||||
@NotNull
|
||||
public Object[] getVariants() {
|
||||
final CompletionProcess process = CompletionService.getCompletionService().getCurrentCompletion();
|
||||
if (process != null && process.isAutopopupCompletion() && isSoft()) {
|
||||
return ArrayUtil.EMPTY_OBJECT_ARRAY;
|
||||
}
|
||||
|
||||
final Set<Object> variants = new THashSet<Object>(new TObjectHashingStrategy<Object>() {
|
||||
public int computeHashCode(final Object object) {
|
||||
if (object instanceof Property) {
|
||||
|
||||
@@ -16,8 +16,7 @@ import com.intellij.util.xml.DomElement;
|
||||
import com.intellij.util.xml.DomElementVisitor;
|
||||
import com.intellij.util.xml.EvaluatedXmlName;
|
||||
import com.intellij.util.xml.GenericAttributeValue;
|
||||
import com.intellij.util.xml.events.ElementChangedEvent;
|
||||
import com.intellij.util.xml.events.ElementDefinedEvent;
|
||||
import com.intellij.util.xml.events.DomEvent;
|
||||
import com.intellij.xml.util.XmlStringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -77,7 +76,8 @@ public class AttributeChildInvocationHandler extends DomInvocationHandler<Attrib
|
||||
attribute = ensureTagExists().setAttribute(getXmlElementName(), getXmlApiCompatibleNamespace(getParentHandler()), "");
|
||||
setXmlElement(attribute);
|
||||
getManager().cacheHandler(DomManagerImpl.DOM_ATTRIBUTE_HANDLER_KEY, attribute, this);
|
||||
manager.fireEvent(new ElementDefinedEvent(getProxy()));
|
||||
final DomElement element = getProxy();
|
||||
manager.fireEvent(new DomEvent(element, true));
|
||||
return attribute;
|
||||
}
|
||||
catch (IncorrectOperationException e) {
|
||||
@@ -165,7 +165,8 @@ public class AttributeChildInvocationHandler extends DomInvocationHandler<Attrib
|
||||
}
|
||||
});
|
||||
final DomElement proxy = getProxy();
|
||||
getManager().fireEvent(oldValue != null ? new ElementChangedEvent(proxy) : new ElementDefinedEvent(proxy));
|
||||
final DomElement element = proxy;
|
||||
getManager().fireEvent(oldValue != null ? new DomEvent(proxy, false) : new DomEvent(element, true));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.intellij.openapi.util.Factory;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.psi.xml.XmlElement;
|
||||
import com.intellij.util.xml.DomElement;
|
||||
import com.intellij.util.xml.events.ElementChangedEvent;
|
||||
import com.intellij.util.xml.events.DomEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -47,7 +47,7 @@ public class CollectionElementInvocationHandler extends DomInvocationHandler<Abs
|
||||
|
||||
getManager().cacheHandler(getCacheKey(), tag, null);
|
||||
deleteTag(tag);
|
||||
getManager().fireEvent(new ElementChangedEvent(parent));
|
||||
getManager().fireEvent(new DomEvent(parent, false));
|
||||
}
|
||||
|
||||
public DomElement createPathStableCopy() {
|
||||
|
||||
@@ -27,9 +27,7 @@ import com.intellij.util.*;
|
||||
import com.intellij.util.containers.ConcurrentFactoryMap;
|
||||
import com.intellij.util.containers.FactoryMap;
|
||||
import com.intellij.util.xml.*;
|
||||
import com.intellij.util.xml.events.ElementChangedEvent;
|
||||
import com.intellij.util.xml.events.ElementDefinedEvent;
|
||||
import com.intellij.util.xml.events.ElementUndefinedEvent;
|
||||
import com.intellij.util.xml.events.DomEvent;
|
||||
import com.intellij.util.xml.reflect.*;
|
||||
import net.sf.cglib.proxy.AdvancedProxy;
|
||||
import net.sf.cglib.proxy.InvocationHandler;
|
||||
@@ -171,7 +169,7 @@ public abstract class DomInvocationHandler<T extends AbstractDomChildDescription
|
||||
setTagValue(tag, value);
|
||||
}
|
||||
});
|
||||
myManager.fireEvent(new ElementChangedEvent(getProxy()));
|
||||
myManager.fireEvent(new DomEvent(getProxy(), false));
|
||||
}
|
||||
|
||||
public void copyFrom(final DomElement other) {
|
||||
@@ -221,7 +219,7 @@ public abstract class DomInvocationHandler<T extends AbstractDomChildDescription
|
||||
});
|
||||
|
||||
if (!myManager.getSemService().isInsideAtomicChange()) {
|
||||
myManager.fireEvent(new ElementChangedEvent(myProxy));
|
||||
myManager.fireEvent(new DomEvent(myProxy, false));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,7 +274,8 @@ public abstract class DomInvocationHandler<T extends AbstractDomChildDescription
|
||||
tag = setEmptyXmlTag();
|
||||
setXmlElement(tag);
|
||||
|
||||
myManager.fireEvent(new ElementDefinedEvent(getProxy()));
|
||||
final DomElement element = getProxy();
|
||||
myManager.fireEvent(new DomEvent(element, true));
|
||||
addRequiredChildren();
|
||||
myManager.cacheHandler(getCacheKey(), tag, this);
|
||||
return getXmlTag();
|
||||
@@ -365,7 +364,7 @@ public abstract class DomInvocationHandler<T extends AbstractDomChildDescription
|
||||
}
|
||||
|
||||
protected final void fireUndefinedEvent() {
|
||||
myManager.fireEvent(new ElementUndefinedEvent(getProxy()));
|
||||
myManager.fireEvent(new DomEvent(getProxy(), false));
|
||||
}
|
||||
|
||||
protected abstract XmlTag setEmptyXmlTag();
|
||||
@@ -666,7 +665,7 @@ public abstract class DomInvocationHandler<T extends AbstractDomChildDescription
|
||||
final EvaluatedXmlName name = createEvaluatedXmlName(description.getXmlName());
|
||||
final XmlTag tag = addEmptyTag(name, index);
|
||||
final CollectionElementInvocationHandler handler = new CollectionElementInvocationHandler(type, tag, description, this);
|
||||
myManager.fireEvent(new ElementChangedEvent(getProxy()));
|
||||
myManager.fireEvent(new DomEvent(getProxy(), false));
|
||||
getManager().getTypeChooserManager().getTypeChooser(description.getType()).distinguishTag(tag, type);
|
||||
handler.addRequiredChildren();
|
||||
return handler.getProxy();
|
||||
|
||||
@@ -37,9 +37,6 @@ import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.xml.*;
|
||||
import com.intellij.util.xml.events.DomEvent;
|
||||
import com.intellij.util.xml.events.ElementChangedEvent;
|
||||
import com.intellij.util.xml.events.ElementDefinedEvent;
|
||||
import com.intellij.util.xml.events.ElementUndefinedEvent;
|
||||
import com.intellij.util.xml.reflect.AbstractDomChildrenDescription;
|
||||
import com.intellij.util.xml.reflect.DomGenericInfo;
|
||||
import net.sf.cglib.proxy.AdvancedProxy;
|
||||
@@ -212,16 +209,9 @@ public final class DomManagerImpl extends DomManager {
|
||||
return list.length > 0;
|
||||
}
|
||||
|
||||
final DomEvent[] recomputeFileElement(final XmlFile file) {
|
||||
static DomEvent[] recomputeFileElement(final XmlFile file) {
|
||||
final DomFileElementImpl oldElement = getCachedFileElement(file);
|
||||
final DomFileElementImpl<DomElement> newElement = getFileElement(file);
|
||||
if (newElement == null) {
|
||||
return oldElement == null ? DomEvent.EMPTY_ARRAY : new DomEvent[]{new ElementUndefinedEvent(oldElement)};
|
||||
}
|
||||
|
||||
if (oldElement == null) return new DomEvent[]{new ElementDefinedEvent(newElement)};
|
||||
if (oldElement.equals(newElement)) return new DomEvent[]{new ElementChangedEvent(newElement)};
|
||||
return new DomEvent[]{new ElementUndefinedEvent(oldElement), new ElementDefinedEvent(newElement)};
|
||||
return oldElement == null ? DomEvent.EMPTY_ARRAY : new DomEvent[]{new DomEvent(oldElement, false)};
|
||||
}
|
||||
|
||||
private void processDirectoryChange(final VirtualFile directory) {
|
||||
|
||||
@@ -13,7 +13,6 @@ import com.intellij.psi.xml.XmlElement;
|
||||
import com.intellij.psi.xml.XmlFile;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.util.xml.events.DomEvent;
|
||||
import com.intellij.util.xml.events.ElementChangedEvent;
|
||||
import com.intellij.util.xml.DomElement;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
@@ -40,7 +39,7 @@ public class ExternalChangeProcessor implements XmlChangeVisitor {
|
||||
public void processChanges() {
|
||||
if (myDocumentChanged) return;
|
||||
for (DomInvocationHandler handler : myChangeSets.values()) {
|
||||
myDomManager.fireEvent(new ElementChangedEvent(handler.getProxy()));
|
||||
myDomManager.fireEvent(new DomEvent(handler.getProxy(), false));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +104,7 @@ public class ExternalChangeProcessor implements XmlChangeVisitor {
|
||||
LOG.assertTrue(rootTag.isValid());
|
||||
rootHandler.setXmlElement(rootTag);
|
||||
}
|
||||
myDomManager.fireEvent(new ElementChangedEvent(oldElement.getRootElement()));
|
||||
myDomManager.fireEvent(new DomEvent(oldElement.getRootElement(), false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,6 @@ import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.HashSet;
|
||||
import com.intellij.util.xml.*;
|
||||
import com.intellij.util.xml.events.DomEvent;
|
||||
import com.intellij.util.xml.events.ElementDefinedEvent;
|
||||
import com.intellij.util.xml.events.ElementUndefinedEvent;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -97,7 +95,7 @@ class FileDescriptionCachedValueProvider<T extends DomElement> implements SemEle
|
||||
final List<DomEvent> events = fireEvents ? new SmartList<DomEvent>() : Collections.<DomEvent>emptyList();
|
||||
if (oldValue != null) {
|
||||
if (fireEvents) {
|
||||
events.add(new ElementUndefinedEvent(oldValue));
|
||||
events.add(new DomEvent(oldValue, false));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +114,8 @@ class FileDescriptionCachedValueProvider<T extends DomElement> implements SemEle
|
||||
}
|
||||
|
||||
if (fireEvents) {
|
||||
events.add(new ElementDefinedEvent(myLastResult));
|
||||
final DomElement element = myLastResult;
|
||||
events.add(new DomEvent(element, true));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,19 +20,12 @@ import com.intellij.util.xml.events.*;
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public abstract class DomChangeAdapter extends DomEventAdapter {
|
||||
public abstract class DomChangeAdapter implements DomEventListener {
|
||||
|
||||
protected abstract void elementChanged(DomElement element);
|
||||
|
||||
public void elementChanged(ElementChangedEvent event) {
|
||||
elementChanged(event.getElement());
|
||||
}
|
||||
|
||||
public void elementDefined(ElementDefinedEvent event) {
|
||||
elementChanged(event.getElement());
|
||||
}
|
||||
|
||||
public void elementUndefined(ElementUndefinedEvent event) {
|
||||
@Override
|
||||
public void eventOccured(DomEvent event) {
|
||||
elementChanged(event.getElement());
|
||||
}
|
||||
|
||||
|
||||
@@ -15,36 +15,9 @@
|
||||
*/
|
||||
package com.intellij.util.xml;
|
||||
|
||||
import com.intellij.util.xml.events.*;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public abstract class DomEventAdapter implements DomEventVisitor, DomEventListener {
|
||||
|
||||
public void elementDefined(ElementDefinedEvent event) {
|
||||
}
|
||||
|
||||
public void elementUndefined(ElementUndefinedEvent event) {
|
||||
}
|
||||
|
||||
public void elementChanged(ElementChangedEvent event) {
|
||||
}
|
||||
|
||||
public void eventOccured(DomEvent event) {
|
||||
event.accept(this);
|
||||
}
|
||||
|
||||
public final void visitElementDefined(final ElementDefinedEvent event) {
|
||||
elementDefined(event);
|
||||
}
|
||||
|
||||
public final void visitElementUndefined(final ElementUndefinedEvent event) {
|
||||
elementUndefined(event);
|
||||
}
|
||||
|
||||
public final void visitElementChangedEvent(final ElementChangedEvent event) {
|
||||
elementChanged(event);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public abstract class DomEventAdapter implements DomEventListener {
|
||||
}
|
||||
|
||||
@@ -22,10 +22,8 @@ import com.intellij.util.xml.events.*;
|
||||
*/
|
||||
public interface DomEventVisitor {
|
||||
|
||||
void visitElementDefined(final ElementDefinedEvent event);
|
||||
void visitElementDefined(final DomEvent event);
|
||||
|
||||
void visitElementUndefined(final ElementUndefinedEvent event);
|
||||
|
||||
void visitElementChangedEvent(final ElementChangedEvent event);
|
||||
void visitElementChangedEvent(final DomEvent event);
|
||||
|
||||
}
|
||||
|
||||
@@ -15,13 +15,34 @@
|
||||
*/
|
||||
package com.intellij.util.xml.events;
|
||||
|
||||
import com.intellij.util.xml.DomElement;
|
||||
import com.intellij.util.xml.DomEventVisitor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public interface DomEvent {
|
||||
DomEvent[] EMPTY_ARRAY = new DomEvent[0];
|
||||
public class DomEvent {
|
||||
public static final DomEvent[] EMPTY_ARRAY = new DomEvent[0];
|
||||
|
||||
private final DomElement myElement;
|
||||
private final boolean myDefined;
|
||||
|
||||
public DomEvent(@NotNull final DomElement element, boolean defined) {
|
||||
myDefined = defined;
|
||||
myElement = element;
|
||||
}
|
||||
|
||||
public final DomElement getElement() {
|
||||
return myElement;
|
||||
}
|
||||
|
||||
public boolean isDefined() {
|
||||
return myDefined;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return (myDefined ? "Defined " : "Changed ") + myElement;
|
||||
}
|
||||
|
||||
void accept(DomEventVisitor visitor);
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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.util.xml.events;
|
||||
|
||||
import com.intellij.util.xml.DomElement;
|
||||
import com.intellij.util.xml.DomEventVisitor;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public class ElementChangedEvent implements DomEvent {
|
||||
private final DomElement myElement;
|
||||
|
||||
public ElementChangedEvent(final DomElement element) {
|
||||
assert element != null;
|
||||
myElement = element;
|
||||
}
|
||||
|
||||
public final DomElement getElement() {
|
||||
return myElement;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Changed " + myElement;
|
||||
}
|
||||
|
||||
public void accept(DomEventVisitor visitor) {
|
||||
visitor.visitElementChangedEvent(this);
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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.util.xml.events;
|
||||
|
||||
import com.intellij.util.xml.events.ElementChangedEvent;
|
||||
import com.intellij.util.xml.DomElement;
|
||||
import com.intellij.util.xml.DomEventVisitor;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public class ElementDefinedEvent extends ElementChangedEvent {
|
||||
public ElementDefinedEvent(final DomElement element) {
|
||||
super(element);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Defined " + getElement();
|
||||
}
|
||||
|
||||
public void accept(DomEventVisitor visitor) {
|
||||
visitor.visitElementDefined(this);
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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.util.xml.events;
|
||||
|
||||
import com.intellij.util.xml.events.ElementChangedEvent;
|
||||
import com.intellij.util.xml.DomElement;
|
||||
import com.intellij.util.xml.DomEventVisitor;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public class ElementUndefinedEvent extends ElementChangedEvent {
|
||||
|
||||
public ElementUndefinedEvent(final DomElement element) {
|
||||
super(element);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Undefined " + getElement();
|
||||
}
|
||||
|
||||
public void accept(DomEventVisitor visitor) {
|
||||
visitor.visitElementUndefined(this);
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,7 @@ public class DomFileEditor<T extends BasicDomElementComponent> extends Perspecti
|
||||
new MnemonicHelper().register(getComponent());
|
||||
myComponent = myComponentFactory.create();
|
||||
DomUIFactory.getDomUIFactory().setupErrorOutdatingUserActivityWatcher(this, getDomElement());
|
||||
DomManager.getDomManager(getProject()).addDomEventListener(new DomEventAdapter() {
|
||||
DomManager.getDomManager(getProject()).addDomEventListener(new DomEventListener() {
|
||||
public void eventOccured(DomEvent event) {
|
||||
checkIsValid();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user