diff --git a/platform/core-api/src/com/intellij/lang/LanguageExtension.java b/platform/core-api/src/com/intellij/lang/LanguageExtension.java index 9b36627f81aa..ed416fbdda77 100644 --- a/platform/core-api/src/com/intellij/lang/LanguageExtension.java +++ b/platform/core-api/src/com/intellij/lang/LanguageExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2011 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. @@ -23,6 +23,7 @@ import com.intellij.openapi.util.Key; import com.intellij.openapi.util.KeyedExtensionCollector; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; @@ -34,7 +35,7 @@ public class LanguageExtension extends KeyedExtensionCollector { this(epName, null); } - public LanguageExtension(@NonNls final String epName, T defaultImplementation) { + public LanguageExtension(@NonNls final String epName, @Nullable final T defaultImplementation) { super(epName); myDefaultImplementation = defaultImplementation; } @@ -43,6 +44,7 @@ public class LanguageExtension extends KeyedExtensionCollector { return key.getID(); } + @Nullable public T forLanguage(@NotNull Language l) { T cached = l.getUserData(IN_LANGUAGE_CACHE); if (cached != null) return cached; diff --git a/platform/lang-impl/src/com/intellij/refactoring/actions/BasePlatformRefactoringAction.java b/platform/lang-impl/src/com/intellij/refactoring/actions/BasePlatformRefactoringAction.java index 155b060d13ff..03ab0086a782 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/actions/BasePlatformRefactoringAction.java +++ b/platform/lang-impl/src/com/intellij/refactoring/actions/BasePlatformRefactoringAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * Copyright 2000-2011 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. @@ -20,6 +20,7 @@ import com.intellij.lang.LanguageRefactoringSupport; import com.intellij.lang.refactoring.RefactoringSupportProvider; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.LangDataKeys; +import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.extensions.ExtensionPointListener; import com.intellij.openapi.extensions.PluginDescriptor; @@ -38,7 +39,6 @@ import java.util.List; * @author yole */ public abstract class BasePlatformRefactoringAction extends BaseRefactoringAction { - private Boolean myHidden = null; private final Condition myCondition = new Condition() { @Override @@ -61,9 +61,8 @@ public abstract class BasePlatformRefactoringAction extends BaseRefactoringActio @Override protected final RefactoringActionHandler getHandler(DataContext dataContext) { - PsiElement element = null; - Editor editor = LangDataKeys.EDITOR.getData(dataContext); + Editor editor = PlatformDataKeys.EDITOR.getData(dataContext); PsiFile file = LangDataKeys.PSI_FILE.getData(dataContext); if (editor != null && file != null) { element = getElementAtCaret(editor, file); @@ -96,6 +95,7 @@ public abstract class BasePlatformRefactoringAction extends BaseRefactoringActio } } } + return null; } @@ -114,7 +114,6 @@ public abstract class BasePlatformRefactoringAction extends BaseRefactoringActio return null; } - @Override protected boolean isAvailableOnElementInEditorAndFile(PsiElement element, Editor editor, PsiFile file, DataContext context) { return getHandler(context) != null; diff --git a/platform/lang-impl/src/com/intellij/refactoring/actions/PullUpAction.java b/platform/lang-impl/src/com/intellij/refactoring/actions/PullUpAction.java index 4a3c7809ab1c..cb38986c000e 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/actions/PullUpAction.java +++ b/platform/lang-impl/src/com/intellij/refactoring/actions/PullUpAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2011 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. @@ -16,16 +16,11 @@ package com.intellij.refactoring.actions; -import com.intellij.lang.Language; -import com.intellij.lang.LanguageRefactoringSupport; import com.intellij.lang.refactoring.RefactoringSupportProvider; -import com.intellij.psi.PsiElement; import com.intellij.refactoring.RefactoringActionHandler; -import com.intellij.refactoring.lang.ElementsHandler; import org.jetbrains.annotations.NotNull; public class PullUpAction extends BasePlatformRefactoringAction { - public PullUpAction() { setInjectedContext(true); } diff --git a/platform/lang-impl/src/com/intellij/refactoring/actions/PushDownAction.java b/platform/lang-impl/src/com/intellij/refactoring/actions/PushDownAction.java index a92cc8644164..115897520481 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/actions/PushDownAction.java +++ b/platform/lang-impl/src/com/intellij/refactoring/actions/PushDownAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2011 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. @@ -16,17 +16,11 @@ package com.intellij.refactoring.actions; -import com.intellij.lang.Language; -import com.intellij.lang.LanguageRefactoringSupport; import com.intellij.lang.refactoring.RefactoringSupportProvider; -import com.intellij.psi.PsiElement; import com.intellij.refactoring.RefactoringActionHandler; -import com.intellij.refactoring.lang.ElementsHandler; import org.jetbrains.annotations.NotNull; - public class PushDownAction extends BasePlatformRefactoringAction { - public PushDownAction() { setInjectedContext(true); }