cleanup, spelling, @Nullable

This commit is contained in:
Yann Cebron
2012-02-12 18:00:15 +01:00
parent d10093c8a4
commit ecf82f6690
10 changed files with 32 additions and 27 deletions
@@ -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);
}
@@ -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);
}
@@ -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);
}
@@ -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);
}
@@ -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<String> usedJarNames, final String preferredName) {
private static String getLibraryJarName(final String fileName, Set<String> 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();
@@ -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<PsiClass> checkModule(Module module, PsiClass psiClass, Set<PsiClass> types, boolean includeActions) {
@Nullable
private static Set<PsiClass> checkModule(Module module, PsiClass psiClass, @Nullable Set<PsiClass> types, boolean includeActions) {
final XmlFile pluginXml = PluginModuleType.getPluginXml(module, false);
if (!isPluginXml(pluginXml)) return types;
assert pluginXml != null;
@@ -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) {
@@ -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;
+1 -1
View File
@@ -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<VirtualFile> result) {
private static void appendIdeaLibrary(final String path, @Nullable @NonNls final String forbidden, final ArrayList<VirtualFile> result) {
final JarFileSystem jfs = JarFileSystem.getInstance();
final File lib = new File(path);
if (lib.isDirectory()) {
@@ -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);