mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
@@ -84,15 +84,13 @@ public class Extensions {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T[] getExtensions(@NotNull ExtensionPointName<T> extensionPointName) {
|
||||
return (T[])getExtensions(extensionPointName.getName(), null);
|
||||
return getExtensions(extensionPointName, null);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T> T[] getExtensions(@NotNull ExtensionPointName<T> extensionPointName, AreaInstance areaInstance) {
|
||||
// keep it until 1.7 JDK
|
||||
return Extensions.getExtensions(extensionPointName.getName(), areaInstance);
|
||||
public static <T> T[] getExtensions(@NotNull ExtensionPointName<T> extensionPointName, @Nullable AreaInstance areaInstance) {
|
||||
return getExtensions(extensionPointName.getName(), areaInstance);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -78,6 +78,7 @@ public class ExtractIncludeAction extends BasePlatformRefactoringAction {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected RefactoringActionHandler getRefactoringHandler(@NotNull RefactoringSupportProvider provider, PsiElement element) {
|
||||
return getHandler(element);
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.intellij.openapi.roots.impl.libraries.LibraryTableBase;
|
||||
import com.intellij.openapi.roots.impl.libraries.ProjectLibraryTable;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.project.ProjectKt;
|
||||
import com.intellij.util.JdomKt;
|
||||
import org.jdom.Element;
|
||||
import org.jdom.JDOMException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -35,9 +36,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import static com.intellij.util.JdomKt.loadElement;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
@@ -60,7 +58,7 @@ public class CoreProjectLoader {
|
||||
if (modulesXml == null)
|
||||
throw new FileNotFoundException("Missing 'modules.xml' in " + dotIdea.getPath());
|
||||
|
||||
TreeMap<String, Element> storageData = loadStorageFile(project, modulesXml);
|
||||
Map<String, Element> storageData = loadStorageFile(project, modulesXml);
|
||||
final Element moduleManagerState = storageData.get("ProjectModuleManager");
|
||||
if (moduleManagerState == null) {
|
||||
throw new JDOMException("cannot find ProjectModuleManager state in modules.xml");
|
||||
@@ -90,7 +88,7 @@ public class CoreProjectLoader {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static TreeMap<String, Element> loadStorageFile(@NotNull ComponentManager componentManager, @NotNull VirtualFile modulesXml) throws JDOMException, IOException {
|
||||
return FileStorageCoreUtil.load(loadElement(modulesXml.getInputStream()), PathMacroManager.getInstance(componentManager), false);
|
||||
static Map<String, Element> loadStorageFile(@NotNull ComponentManager componentManager, @NotNull VirtualFile modulesXml) throws JDOMException, IOException {
|
||||
return FileStorageCoreUtil.load(JdomKt.loadElement(modulesXml.getInputStream()), PathMacroManager.getInstance(componentManager), false);
|
||||
}
|
||||
}
|
||||
|
||||
+10
-13
@@ -151,6 +151,7 @@ import static org.junit.Assert.*;
|
||||
/**
|
||||
* @author Dmitry Avdeev
|
||||
*/
|
||||
@TestOnly
|
||||
public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsightTestFixture {
|
||||
private static final Function<IntentionAction, String> INTENTION_NAME_FUN = intentionAction -> '"' + intentionAction.getText() + '"';
|
||||
|
||||
@@ -745,14 +746,9 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
@Override
|
||||
public void renameElementAtCaretUsingHandler(@NotNull final String newName) {
|
||||
final DataContext editorContext = ((EditorEx)myEditor).getDataContext();
|
||||
final DataContext context = new DataContext() {
|
||||
@Override
|
||||
public Object getData(final String dataId) {
|
||||
return PsiElementRenameHandler.DEFAULT_NAME.getName().equals(dataId)
|
||||
? newName
|
||||
: editorContext.getData(dataId);
|
||||
}
|
||||
};
|
||||
final DataContext context = dataId -> PsiElementRenameHandler.DEFAULT_NAME.getName().equals(dataId)
|
||||
? newName
|
||||
: editorContext.getData(dataId);
|
||||
final RenameHandler renameHandler = RenameHandlerRegistry.getInstance().getRenameHandler(context);
|
||||
assertNotNull("No handler for this context", renameHandler);
|
||||
|
||||
@@ -788,7 +784,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
@Override
|
||||
public void type(final char c) {
|
||||
assertInitialized();
|
||||
ApplicationManager.getApplication().invokeAndWait((Runnable)() -> {
|
||||
ApplicationManager.getApplication().invokeAndWait(() -> {
|
||||
final EditorActionManager actionManager = EditorActionManager.getInstance();
|
||||
if (c == '\b') {
|
||||
performEditorAction(IdeActions.ACTION_EDITOR_BACKSPACE);
|
||||
@@ -1139,7 +1135,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
public void checkResult(@NotNull String text, boolean stripTrailingSpaces) {
|
||||
new WriteCommandAction(getProject()) {
|
||||
@Override
|
||||
protected void run(@NotNull Result result) throws Throwable {
|
||||
protected void run(@NotNull Result result) {
|
||||
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
|
||||
EditorUtil.fillVirtualSpaceUntilCaret(myEditor);
|
||||
checkResult("TEXT", stripTrailingSpaces, SelectionAndCaretMarkupLoader.fromText(text), getHostFile().getText());
|
||||
@@ -1151,7 +1147,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
public void checkResult(@NotNull String filePath, @NotNull String text, boolean stripTrailingSpaces) {
|
||||
new WriteCommandAction(getProject()) {
|
||||
@Override
|
||||
protected void run(@NotNull Result result) throws Throwable {
|
||||
protected void run(@NotNull Result result) {
|
||||
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
|
||||
PsiFile psiFile = getFileToCheck(filePath);
|
||||
checkResult("TEXT", stripTrailingSpaces, SelectionAndCaretMarkupLoader.fromText(text), psiFile.getText());
|
||||
@@ -1295,7 +1291,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
if (fileTypeManager.getFileTypeByExtension(extension) != fileType) {
|
||||
new WriteCommandAction(getProject()) {
|
||||
@Override
|
||||
protected void run(@NotNull Result result) throws Exception {
|
||||
protected void run(@NotNull Result result) {
|
||||
fileTypeManager.associateExtension(fileType, extension);
|
||||
}
|
||||
}.execute();
|
||||
@@ -1650,7 +1646,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
Arrays.asList(myEditor.getFoldingModel().getAllFoldRegions()),
|
||||
FOLD,
|
||||
foldRegion -> "text=\'" + foldRegion.getPlaceholderText() + "\'"
|
||||
+ (withCollapseStatus ? (" expand=\'" + foldRegion.isExpanded() + "\'") : ""));
|
||||
+ (withCollapseStatus ? " expand=\'" + foldRegion.isExpanded() + "\'" : ""));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -1999,6 +1995,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Disposable getProjectDisposable() {
|
||||
return myProjectFixture.getTestRootDisposable();
|
||||
|
||||
@@ -28,8 +28,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public abstract class UsageToPsiElementProvider {
|
||||
public static final ExtensionPointName<UsageToPsiElementProvider> EP_NAME =
|
||||
new ExtensionPointName<>("com.intellij.usageToPsiElementProvider");
|
||||
public static final ExtensionPointName<UsageToPsiElementProvider> EP_NAME = ExtensionPointName.create("com.intellij.usageToPsiElementProvider");
|
||||
|
||||
@Nullable
|
||||
public abstract PsiElement getAppropriateParentFrom(PsiElement element);
|
||||
|
||||
Reference in New Issue
Block a user