From ecf82f6690b26d61be210aa6a4c42ee8c33db9f3 Mon Sep 17 00:00:00 2001 From: Yann Cebron Date: Sun, 12 Feb 2012 18:00:15 +0100 Subject: [PATCH] cleanup, spelling, @Nullable --- ...erateClassAndPatchPluginXmlActionBase.java | 5 +++-- .../actions/GeneratePluginClassAction.java | 4 ++-- .../devkit/src/actions/NewActionDialog.java | 4 ++-- .../src/build/PluginBuildParticipant.java | 5 +++-- .../src/build/PrepareToDeployAction.java | 20 ++++++++++--------- .../src/inspections/DevKitInspectionBase.java | 5 +++-- .../RegistrationProblemsInspection.java | 4 ++-- .../src/inspections/quickfix/BaseFix.java | 4 ++-- plugins/devkit/src/projectRoots/IdeaJdk.java | 2 +- .../devkit/src/util/ChooseModulesDialog.java | 6 +++--- 10 files changed, 32 insertions(+), 27 deletions(-) diff --git a/plugins/devkit/src/actions/GenerateClassAndPatchPluginXmlActionBase.java b/plugins/devkit/src/actions/GenerateClassAndPatchPluginXmlActionBase.java index c2cfc4635b43..322316ab8851 100644 --- a/plugins/devkit/src/actions/GenerateClassAndPatchPluginXmlActionBase.java +++ b/plugins/devkit/src/actions/GenerateClassAndPatchPluginXmlActionBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 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. @@ -22,6 +22,7 @@ import com.intellij.psi.PsiDirectory; import com.intellij.psi.PsiElement; import com.intellij.psi.xml.XmlFile; import com.intellij.util.IncorrectOperationException; +import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.devkit.util.ComponentType; import javax.swing.*; @@ -30,7 +31,7 @@ import javax.swing.*; * @author max */ public abstract class GenerateClassAndPatchPluginXmlActionBase extends GeneratePluginClassAction { - public GenerateClassAndPatchPluginXmlActionBase(String text, String description, Icon icon) { + public GenerateClassAndPatchPluginXmlActionBase(String text, String description, @Nullable Icon icon) { super(text, description, icon); } diff --git a/plugins/devkit/src/actions/GeneratePluginClassAction.java b/plugins/devkit/src/actions/GeneratePluginClassAction.java index b26e0dd00756..6ee75b2b1a6f 100644 --- a/plugins/devkit/src/actions/GeneratePluginClassAction.java +++ b/plugins/devkit/src/actions/GeneratePluginClassAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 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. @@ -53,7 +53,7 @@ public abstract class GeneratePluginClassAction extends CreateElementActionBase // module selection is canceled. That's some weird interface actually... private static final PsiElement[] CANCELED = new PsiElement[1]; - public GeneratePluginClassAction(String text, String description, Icon icon) { + public GeneratePluginClassAction(String text, String description, @Nullable Icon icon) { super(text, description, icon); } diff --git a/plugins/devkit/src/actions/NewActionDialog.java b/plugins/devkit/src/actions/NewActionDialog.java index d486c73b4444..332fd6310942 100644 --- a/plugins/devkit/src/actions/NewActionDialog.java +++ b/plugins/devkit/src/actions/NewActionDialog.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 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. @@ -290,7 +290,7 @@ public class NewActionDialog extends DialogWrapper implements ActionData { private KeyStroke myKeyStroke; public ShortcutTextField() { - enableEvents(KeyEvent.KEY_EVENT_MASK); + enableEvents(AWTEvent.KEY_EVENT_MASK); setFocusTraversalKeysEnabled(false); } diff --git a/plugins/devkit/src/build/PluginBuildParticipant.java b/plugins/devkit/src/build/PluginBuildParticipant.java index 025d22aa08f0..0d2f3b3866e5 100644 --- a/plugins/devkit/src/build/PluginBuildParticipant.java +++ b/plugins/devkit/src/build/PluginBuildParticipant.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 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. @@ -27,6 +27,7 @@ import com.intellij.openapi.roots.libraries.Library; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.JarFileSystem; import com.intellij.openapi.vfs.VfsUtil; +import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.packaging.artifacts.Artifact; import com.intellij.packaging.elements.ArtifactRootElement; @@ -144,7 +145,7 @@ public class PluginBuildParticipant extends BuildParticipant { hasDirsOnly = false; file = ((JarFileSystem)file.getFileSystem()).getVirtualFileForJar(file); } - if (libDir != null && file != null && VfsUtil.isAncestor(libDir, file, false)) { + if (libDir != null && file != null && VfsUtilCore.isAncestor(libDir, file, false)) { context.addMessage(CompilerMessageCategory.ERROR, DevKitBundle.message("dont.add.idea.libs.to.classpath", file.getName()), null, -1, -1); } diff --git a/plugins/devkit/src/build/PrepareToDeployAction.java b/plugins/devkit/src/build/PrepareToDeployAction.java index 00d5164aeeb5..4a450c0f0ad8 100644 --- a/plugins/devkit/src/build/PrepareToDeployAction.java +++ b/plugins/devkit/src/build/PrepareToDeployAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 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. @@ -18,6 +18,7 @@ package org.jetbrains.idea.devkit.build; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.LangDataKeys; +import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.compiler.CompileContext; import com.intellij.openapi.compiler.CompileStatusNotification; @@ -41,6 +42,7 @@ import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.io.ZipUtil; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.devkit.DevKitBundle; import org.jetbrains.idea.devkit.module.PluginModuleType; @@ -69,7 +71,7 @@ public class PrepareToDeployAction extends AnAction { public void actionPerformed(final AnActionEvent e) { final Module module = LangDataKeys.MODULE.getData(e.getDataContext()); if (module != null && ModuleType.get(module) instanceof PluginModuleType) { - doPrepare(Arrays.asList(module), LangDataKeys.PROJECT.getData(e.getDataContext())); + doPrepare(Arrays.asList(module), PlatformDataKeys.PROJECT.getData(e.getDataContext())); } } @@ -97,7 +99,7 @@ public class PrepareToDeployAction extends AnAction { Messages.showErrorDialog(errorMessages.iterator().next(), DevKitBundle.message("error.occurred")); } else if (!successMessages.isEmpty()) { - StringBuffer messageBuf = new StringBuffer(); + StringBuilder messageBuf = new StringBuilder(); for (String message : successMessages) { if (messageBuf.length() != 0) { messageBuf.append('\n'); @@ -177,13 +179,13 @@ public class PrepareToDeployAction extends AnAction { return vfile == null || !ReadonlyStatusHandler.getInstance(project).ensureFilesWritable(vfile).hasReadonlyFiles(); } - private static FileFilter createFilter(final ProgressIndicator progressIndicator, final FileTypeManager fileTypeManager) { + private static FileFilter createFilter(final ProgressIndicator progressIndicator, @Nullable final FileTypeManager fileTypeManager) { return new FileFilter() { - public boolean accept(File pathname) { + public boolean accept(File pathName) { if (progressIndicator != null) { progressIndicator.setText2(""); } - return fileTypeManager == null || !fileTypeManager.isFileIgnored(FileUtil.toSystemIndependentName(pathname.getName())); + return fileTypeManager == null || !fileTypeManager.isFileIgnored(FileUtil.toSystemIndependentName(pathName.getName())); } }; } @@ -252,7 +254,7 @@ public class PrepareToDeployAction extends AnAction { ZipUtil.addFileOrDirRecursively(zos, zipFile, libraryJar, getZipPath(pluginName, jarName), createFilter(progressIndicator, null), null); } - private static String getLibraryJarName(final String fileName, Set usedJarNames, final String preferredName) { + private static String getLibraryJarName(final String fileName, Set usedJarNames, @Nullable final String preferredName) { String uniqueName; if (preferredName != null && !usedJarNames.contains(preferredName)) { uniqueName = preferredName; @@ -313,8 +315,8 @@ public class PrepareToDeployAction extends AnAction { createFilter(progressIndicator, myFileTypeManager), writtenItemRelativePaths); } final String pluginXmlPath = pluginModuleBuildProperties.getPluginXmlPath(); - @NonNls final String metainf = "/META-INF/plugin.xml"; - ZipUtil.addFileToZip(jarPlugin, new File(pluginXmlPath), metainf, writtenItemRelativePaths, createFilter(progressIndicator, null)); + @NonNls final String metaInf = "/META-INF/plugin.xml"; + ZipUtil.addFileToZip(jarPlugin, new File(pluginXmlPath), metaInf, writtenItemRelativePaths, createFilter(progressIndicator, null)); } finally { if (jarPlugin != null) jarPlugin.close(); diff --git a/plugins/devkit/src/inspections/DevKitInspectionBase.java b/plugins/devkit/src/inspections/DevKitInspectionBase.java index cc2964147aaa..1491c25aff75 100644 --- a/plugins/devkit/src/inspections/DevKitInspectionBase.java +++ b/plugins/devkit/src/inspections/DevKitInspectionBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 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. @@ -73,7 +73,8 @@ public abstract class DevKitInspectionBase extends BaseJavaLocalInspectionTool { } } - private static Set checkModule(Module module, PsiClass psiClass, Set types, boolean includeActions) { + @Nullable + private static Set checkModule(Module module, PsiClass psiClass, @Nullable Set types, boolean includeActions) { final XmlFile pluginXml = PluginModuleType.getPluginXml(module, false); if (!isPluginXml(pluginXml)) return types; assert pluginXml != null; diff --git a/plugins/devkit/src/inspections/RegistrationProblemsInspection.java b/plugins/devkit/src/inspections/RegistrationProblemsInspection.java index 1e0ef779773a..4ec5e76adf0f 100644 --- a/plugins/devkit/src/inspections/RegistrationProblemsInspection.java +++ b/plugins/devkit/src/inspections/RegistrationProblemsInspection.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 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. @@ -298,7 +298,7 @@ public class RegistrationProblemsInspection extends DevKitInspectionBase { } public boolean process(ActionType type, XmlTag action) { - final XmlAttribute attribute = action.getAttribute("class", null); + final XmlAttribute attribute = action.getAttribute("class"); if (attribute != null) { final PsiElement token = getAttValueToken(attribute); if (token != null) { diff --git a/plugins/devkit/src/inspections/quickfix/BaseFix.java b/plugins/devkit/src/inspections/quickfix/BaseFix.java index 027c11766e37..6dd775740ca5 100644 --- a/plugins/devkit/src/inspections/quickfix/BaseFix.java +++ b/plugins/devkit/src/inspections/quickfix/BaseFix.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 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. @@ -42,7 +42,7 @@ abstract class BaseFix implements LocalQuickFix { } public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { - // can happen during batch-inspection if resoution has already been applied + // can happen during batch-inspection if resolution has already been applied // to plugin.xml or java class if (!myElement.isValid()) return; diff --git a/plugins/devkit/src/projectRoots/IdeaJdk.java b/plugins/devkit/src/projectRoots/IdeaJdk.java index f76c4b3af5ec..f80571b3f6f4 100644 --- a/plugins/devkit/src/projectRoots/IdeaJdk.java +++ b/plugins/devkit/src/projectRoots/IdeaJdk.java @@ -193,7 +193,7 @@ public class IdeaJdk extends SdkType implements JavaSdkType { return VfsUtil.toVirtualFileArray(result); } - private static void appendIdeaLibrary(final String path, @NonNls final String forbidden, final ArrayList result) { + private static void appendIdeaLibrary(final String path, @Nullable @NonNls final String forbidden, final ArrayList result) { final JarFileSystem jfs = JarFileSystem.getInstance(); final File lib = new File(path); if (lib.isDirectory()) { diff --git a/plugins/devkit/src/util/ChooseModulesDialog.java b/plugins/devkit/src/util/ChooseModulesDialog.java index 48729d290c66..5f7271f3e0e6 100644 --- a/plugins/devkit/src/util/ChooseModulesDialog.java +++ b/plugins/devkit/src/util/ChooseModulesDialog.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 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. @@ -21,7 +21,6 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.ui.MultiLineLabelUI; -import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.xml.XmlFile; @@ -188,7 +187,8 @@ public class ChooseModulesDialog extends DialogWrapper { final VirtualFile virtualFile = pluginXml.getVirtualFile(); assert virtualFile != null; final VirtualFile projectPath = myProject.getBaseDir(); - if (VfsUtil.isAncestor(projectPath, virtualFile, false)) { + assert projectPath != null; + if (VfsUtilCore.isAncestor(projectPath, virtualFile, false)) { append(" (" + VfsUtilCore.getRelativePath(virtualFile, projectPath, File.separatorChar) + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES); } else { append(" (" + virtualFile.getPresentableUrl() + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES);