This commit is contained in:
Roman Shevchenko
2011-10-14 13:42:58 +02:00
parent 445b003647
commit 5bf73ebcbc
4 changed files with 10 additions and 20 deletions
@@ -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<T> extends KeyedExtensionCollector<T, Language> {
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<T> extends KeyedExtensionCollector<T, Language> {
return key.getID();
}
@Nullable
public T forLanguage(@NotNull Language l) {
T cached = l.getUserData(IN_LANGUAGE_CACHE);
if (cached != null) return cached;
@@ -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<RefactoringSupportProvider> myCondition = new Condition<RefactoringSupportProvider>() {
@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;
@@ -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);
}
@@ -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);
}