mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Generate icon classes (ex icons.gant)" type="JetRunConfigurationType" factoryName="Kotlin">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="MAIN_CLASS_NAME" value="org.jetbrains.intellij.build.images.GenerateIconClassesKt" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/build/scripts" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="platform-build-scripts" />
|
||||
<envs />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
@@ -0,0 +1,15 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Optimize images for tips&tricks" type="JetRunConfigurationType" factoryName="Kotlin">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="MAIN_CLASS_NAME" value="org.jetbrains.intellij.build.images.OptimizeTipsImagesKt" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/build/scripts" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="platform-build-scripts" />
|
||||
<envs />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
@@ -6,7 +6,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class RegExpSupportIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports empty branches in a RegExp alternation. For example:<br> <code>a<b>|</b></code>
|
||||
Reports empty branches in a RegExp alternation. For example:<br> <code>a<b>||</b>b</code>
|
||||
<p>An empty branch will only match the empty string, and in most cases that is not what is desired.
|
||||
This inspection will not report a single empty branch at the start or the end of an alternation.
|
||||
<!-- tooltip end -->
|
||||
<p><small>New in 2017.2</small>
|
||||
</body>
|
||||
|
||||
+14
-20
@@ -57,29 +57,28 @@ public class EmptyAlternationBranchInspection extends LocalInspectionTool {
|
||||
if (branches.length < 2) {
|
||||
return;
|
||||
}
|
||||
boolean nonEmptyBranchSeen = false;
|
||||
for (final RegExpBranch branch : branches) {
|
||||
if (branch.getAtoms().length != 0) {
|
||||
nonEmptyBranchSeen = true;
|
||||
boolean emptyBranchSeen = false;
|
||||
for (int i = 0; i < branches.length; i++) {
|
||||
final RegExpBranch branch = branches[i];
|
||||
if (branch.getAtoms().length > 0) {
|
||||
continue;
|
||||
}
|
||||
final DuplicateAlternationBranchFix fix = new DuplicateAlternationBranchFix(nonEmptyBranchSeen);
|
||||
final PsiElement element = nonEmptyBranchSeen ? branch.getPrevSibling() : branch.getNextSibling();
|
||||
if (element != null) {
|
||||
myHolder.registerProblem(element, "Empty branch in alternation", fix);
|
||||
if (i == 0) {
|
||||
// empty branch at beginning allowed
|
||||
emptyBranchSeen = true;
|
||||
continue;
|
||||
}
|
||||
if (!emptyBranchSeen && i == branches.length - 1) {
|
||||
// empty branch at end allowed, if no empty branch at beginning
|
||||
continue;
|
||||
}
|
||||
myHolder.registerProblem(branch.getPrevSibling(), "Empty branch in alternation", new DuplicateAlternationBranchFix());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class DuplicateAlternationBranchFix implements LocalQuickFix {
|
||||
|
||||
private final boolean myDeleteNext;
|
||||
|
||||
public DuplicateAlternationBranchFix(boolean deleteNext) {
|
||||
myDeleteNext = deleteNext;
|
||||
}
|
||||
|
||||
@Nls
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -90,12 +89,7 @@ public class EmptyAlternationBranchInspection extends LocalInspectionTool {
|
||||
@Override
|
||||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
|
||||
final PsiElement element = descriptor.getPsiElement();
|
||||
if (myDeleteNext) {
|
||||
element.getNextSibling().delete();
|
||||
}
|
||||
else {
|
||||
element.getPrevSibling().delete();
|
||||
}
|
||||
element.getNextSibling().delete();
|
||||
element.delete();
|
||||
}
|
||||
}
|
||||
|
||||
+14
-2
@@ -28,11 +28,23 @@ public class EmptyAlternationBranchInspectionTest extends RegExpInspectionTestCa
|
||||
}
|
||||
|
||||
public void testEmptyLeft() {
|
||||
quickfixTest("<warning descr=\"Empty branch in alternation\">|</warning>right", "right", "Remove empty branch");
|
||||
highlightTest("|right");
|
||||
}
|
||||
|
||||
public void testEmptyRight() {
|
||||
quickfixTest("left<warning descr=\"Empty branch in alternation\">|<caret></warning>", "left", "Remove empty branch");
|
||||
highlightTest("left|");
|
||||
}
|
||||
|
||||
public void testEmptyLeftAndRight() {
|
||||
quickfixTest("|m<warning descr=\"Empty branch in alternation\">|<caret></warning>", "|m", "Remove empty branch");
|
||||
}
|
||||
|
||||
public void testEmptyMiddle() {
|
||||
quickfixTest("a<warning descr=\"Empty branch in alternation\"><caret>|</warning>|b", "a|b", "Remove empty branch");
|
||||
}
|
||||
|
||||
public void testLogbackUnit() {
|
||||
highlightTest("(|kb|mb|gb)s?");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -21,7 +21,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class ImagesIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class OpenapiIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
+1
-1
@@ -125,7 +125,7 @@ class IconsClassGenerator(val projectHome: File, val util: JpsModule) {
|
||||
// please do corresponding changes in IconsGeneratedSourcesFilter as well
|
||||
append(answer, "/**", 0)
|
||||
append(answer, " * NOTE THIS FILE IS AUTO-GENERATED", 0)
|
||||
append(answer, " * DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead", 0)
|
||||
append(answer, " * DO NOT EDIT IT BY HAND, run \"Generate icon classes\" configuration instead", 0)
|
||||
append(answer, " */", 0)
|
||||
|
||||
append(answer, "public class $className {", 0)
|
||||
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.intellij.build.images
|
||||
|
||||
import com.intellij.openapi.application.PathManager
|
||||
import org.jetbrains.jps.model.serialization.JpsSerializationManager
|
||||
import java.io.File
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val homePath = PathManager.getHomePath()
|
||||
val home = File(homePath)
|
||||
val project = JpsSerializationManager.getInstance().loadModel(homePath, null).project
|
||||
|
||||
val util = project.modules.find { it.name == "util" } ?: throw IllegalStateException("Can't load module 'util'")
|
||||
|
||||
val generator = IconsClassGenerator(home, util)
|
||||
project.modules.forEach { module ->
|
||||
generator.processModule(module)
|
||||
}
|
||||
generator.printStats()
|
||||
|
||||
val optimizer = ImageSizeOptimizer(home)
|
||||
project.modules.forEach { module ->
|
||||
optimizer.optimizeIcons(module)
|
||||
}
|
||||
optimizer.printStats()
|
||||
|
||||
val checker = ImageSanityChecker(home)
|
||||
project.modules.forEach { module ->
|
||||
checker.check(module)
|
||||
}
|
||||
// checker.printInfo()
|
||||
checker.printWarnings()
|
||||
|
||||
println()
|
||||
println("Done")
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.intellij.build.images
|
||||
|
||||
import com.intellij.openapi.application.PathManager
|
||||
import org.jetbrains.jps.model.java.JavaModuleSourceRootTypes
|
||||
import org.jetbrains.jps.model.serialization.JpsSerializationManager
|
||||
import java.io.File
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val homePath = PathManager.getHomePath()
|
||||
val home = File(homePath)
|
||||
val project = JpsSerializationManager.getInstance().loadModel(homePath, null).project
|
||||
|
||||
val optimizer = ImageSizeOptimizer(home)
|
||||
project.modules.forEach { module ->
|
||||
module.sourceRoots.forEach { root ->
|
||||
val imagesDir = File(root.file, "tips/images")
|
||||
if (JavaModuleSourceRootTypes.PRODUCTION.contains(root.rootType) && imagesDir.isDirectory) {
|
||||
val images = optimizer.optimizeImages(imagesDir)
|
||||
println("Processed root ${root.file} with $images images")
|
||||
}
|
||||
}
|
||||
}
|
||||
optimizer.printStats()
|
||||
|
||||
println()
|
||||
println("Done")
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class DvcsImplIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class ExternalSystemIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -28,8 +28,6 @@ import com.intellij.ide.ui.laf.darcula.DarculaLookAndFeelInfo;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.components.*;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.JBPopupMenu;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
@@ -39,11 +37,8 @@ import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.wm.ToolWindow;
|
||||
import com.intellij.openapi.wm.ToolWindowManager;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.ui.ScreenUtil;
|
||||
import com.intellij.ui.content.Content;
|
||||
import com.intellij.ui.mac.MacPopupMenuUI;
|
||||
import com.intellij.ui.popup.OurHeavyWeightPopup;
|
||||
import com.intellij.util.IJSwingUtilities;
|
||||
@@ -476,8 +471,6 @@ public final class LafManagerImpl extends LafManager implements PersistentStateC
|
||||
|
||||
fixSeparatorColor(uiDefaults);
|
||||
|
||||
updateToolWindows();
|
||||
|
||||
for (Frame frame : Frame.getFrames()) {
|
||||
// OSX/Aqua fix: Some image caching components like ToolWindowHeader use
|
||||
// com.apple.laf.AquaNativeResources$CColorPaintUIResource
|
||||
@@ -533,25 +526,6 @@ public final class LafManagerImpl extends LafManager implements PersistentStateC
|
||||
defaults.put("hidpi.scaleFactor", JBUI.scale(1f));
|
||||
}
|
||||
|
||||
public static void updateToolWindows() {
|
||||
for (Project project : ProjectManager.getInstance().getOpenProjects()) {
|
||||
final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
|
||||
for (String id : toolWindowManager.getToolWindowIds()) {
|
||||
final ToolWindow toolWindow = toolWindowManager.getToolWindow(id);
|
||||
for (Content content : toolWindow.getContentManager().getContents()) {
|
||||
final JComponent component = content.getComponent();
|
||||
if (component != null) {
|
||||
IJSwingUtilities.updateComponentTreeUI(component);
|
||||
}
|
||||
}
|
||||
final JComponent c = toolWindow.getComponent();
|
||||
if (c != null) {
|
||||
IJSwingUtilities.updateComponentTreeUI(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void fixMenuIssues(UIDefaults uiDefaults) {
|
||||
if (UIUtil.isUnderAquaLookAndFeel() || (SystemInfo.isMac && UIUtil.isUnderIntelliJLaF())) {
|
||||
// update ui for popup menu to get round corners
|
||||
|
||||
@@ -59,7 +59,10 @@ import javax.swing.event.TreeSelectionListener;
|
||||
import javax.swing.plaf.ColorUIResource;
|
||||
import javax.swing.plaf.UIResource;
|
||||
import javax.swing.table.*;
|
||||
import javax.swing.tree.*;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import javax.swing.tree.DefaultTreeModel;
|
||||
import javax.swing.tree.TreeModel;
|
||||
import javax.swing.tree.TreePath;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.lang.reflect.Field;
|
||||
@@ -1322,17 +1325,15 @@ public class UiInspectorAction extends ToggleAction implements DumbAware {
|
||||
JTree tree = (JTree)component;
|
||||
TreePath path = tree.getClosestPathForLocation(me.getX(), me.getY());
|
||||
if (path != null) {
|
||||
TreeNode value = ((TreeNode)path.getLastPathComponent());
|
||||
if (value instanceof DefaultMutableTreeNode) {
|
||||
DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
|
||||
|
||||
Component rendererComponent = tree.getCellRenderer()
|
||||
.getTreeCellRendererComponent(tree, node, tree.getSelectionModel().isPathSelected(path),
|
||||
tree.isExpanded(path), node.isLeaf(), tree.getRowForPath(path), tree.hasFocus());
|
||||
clickInfo.add(new PropertyBean(RENDERER_BOUNDS, tree.getPathBounds(path)));
|
||||
clickInfo.addAll(new InspectorTableModel(rendererComponent).myProperties);
|
||||
return clickInfo;
|
||||
}
|
||||
Object object = path.getLastPathComponent();
|
||||
Component rendererComponent = tree.getCellRenderer().getTreeCellRendererComponent(
|
||||
tree, object, tree.getSelectionModel().isPathSelected(path),
|
||||
tree.isExpanded(path),
|
||||
tree.getModel().isLeaf(object),
|
||||
tree.getRowForPath(path), tree.hasFocus());
|
||||
clickInfo.add(new PropertyBean(RENDERER_BOUNDS, tree.getPathBounds(path)));
|
||||
clickInfo.addAll(new InspectorTableModel(rendererComponent).myProperties);
|
||||
return clickInfo;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -6,7 +6,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class PlatformImplIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class RemoteServersIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class TasksIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -907,6 +907,9 @@ cidr.show.compiler.info=false
|
||||
cidr.show.clangtidy.info=false
|
||||
cidr.cygwin.cmakePermissionsFix=true
|
||||
cidr.cygwin.cmakePermissionsFix.description=Update permissions for the bin/ folder inside the installed IDE so that the bundled CMake could run
|
||||
cidr.indexer.thread.count=0
|
||||
cidr.indexer.thread.count.description=Number of CPU cores which will be used to build symbols. Zero and negative values determine \
|
||||
how many cores should NOT be involved, e.g. "0" equals to "use every available CPU core", "-1" means "use every core but one".
|
||||
cidr.max.intellisense.file.length=500000
|
||||
cidr.max.intellisense.file.length.description=Maximum length of C-based language file (in characters) IDE should provide code assistance for.
|
||||
cidr.cmake.cacheResetFix=true
|
||||
|
||||
@@ -21,7 +21,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class AllIcons {
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class VcsLogIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
+2
-2
@@ -2018,8 +2018,8 @@ missing.package.info.problem.descriptor=Package ''{0}'' is missing a <code>packa
|
||||
missing.package.html.problem.descriptor=Package ''{0}'' is missing a <code>package.html</code> file
|
||||
package.info.java.without.package.display.name='package-info.java' without 'package' statement
|
||||
package.info.without.package.problem.descriptor='package-info.java' does not have a 'package' statement
|
||||
package.info.without.package.quickfix=add ''package {0};''
|
||||
package.info.without.package.family.quickfix=add package statement
|
||||
package.info.without.package.quickfix=Add ''package {0};''
|
||||
package.info.without.package.family.quickfix=Add package statement
|
||||
auto.closeable.resource.display.name=AutoCloseable used without 'try'-with-resources
|
||||
auto.closeable.resource.problem.descriptor=''{0}'' used without ''try''-with-resources statement #loc
|
||||
auto.closeable.resource.quickfix=Ignore 'AutoCloseable' returned by this method
|
||||
|
||||
+9
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -77,9 +77,13 @@ public class PackageInfoWithoutPackageInspection extends BaseInspection {
|
||||
return;
|
||||
}
|
||||
final PsiJavaFile file = (PsiJavaFile)element;
|
||||
final PsiElementFactory factory = JavaPsiFacade.getElementFactory(project);
|
||||
final PsiPackageStatement packageStatement = factory.createPackageStatement(myPackageName);
|
||||
file.add(packageStatement);
|
||||
// can't use file.setPackageName(myPackageName) here because it will put the package in the wrong place and screw up formatting.
|
||||
PsiElement anchor = file.getFirstChild();
|
||||
while (anchor instanceof PsiWhiteSpace || anchor instanceof PsiComment) {
|
||||
anchor = anchor.getNextSibling();
|
||||
}
|
||||
final PsiPackageStatement packageStatement = JavaPsiFacade.getElementFactory(project).createPackageStatement(myPackageName);
|
||||
file.addBefore(packageStatement, anchor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,9 +104,8 @@ public class PackageInfoWithoutPackageInspection extends BaseInspection {
|
||||
if (packageStatement != null) {
|
||||
return;
|
||||
}
|
||||
final JavaDirectoryService directoryService = JavaDirectoryService.getInstance();
|
||||
final PsiDirectory directory = file.getContainingDirectory();
|
||||
final PsiPackage aPackage = directoryService.getPackage(directory);
|
||||
final PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(directory);
|
||||
if (aPackage == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class AntIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class DevkitIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -33,7 +33,10 @@ public class IconsGeneratedSourcesFilter extends GeneratedSourcesFilter {
|
||||
for (PsiClass aClass : ((PsiJavaFile)psiFile).getClasses()) {
|
||||
if (aClass.isValid() && aClass.hasModifierProperty(PsiModifier.PUBLIC)) {
|
||||
PsiDocComment comment = aClass.getDocComment();
|
||||
return comment != null && comment.getText().contains("run build/scripts/icons.gant instead");
|
||||
if (comment == null) return false;
|
||||
String docText = comment.getText();
|
||||
return docText.contains("NOTE THIS FILE IS AUTO-GENERATED") &&
|
||||
docText.contains("DO NOT EDIT IT BY HAND");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,16 @@ public class IconsGeneratedSourcesTest extends LightCodeInsightFixtureTestCase {
|
||||
assertTrue(new IconsGeneratedSourcesFilter().isGeneratedSource(file.getVirtualFile(), myFixture.getProject()));
|
||||
}
|
||||
|
||||
public void testNewGeneratedFile() {
|
||||
PsiFile file = myFixture.configureByText("MyIcons.java", "package icons;\n" +
|
||||
"/**\n" +
|
||||
" * NOTE THIS FILE IS AUTO-GENERATED\n" +
|
||||
" * DO NOT EDIT IT BY HAND, run \"Generate icon classes\" configuration instead\n" +
|
||||
" */\n" +
|
||||
"public class RubyIcons {}");
|
||||
assertTrue(new IconsGeneratedSourcesFilter().isGeneratedSource(file.getVirtualFile(), myFixture.getProject()));
|
||||
}
|
||||
|
||||
public void testFilterByName() {
|
||||
PsiFile file = myFixture.configureByText("MyIconsTest.java", "package icons;\n" +
|
||||
"/**\n" +
|
||||
|
||||
@@ -6,7 +6,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class EclipseIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class EditorconfigIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class Git4ideaIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class GithubIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class GoogleAppEngineIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class GradleIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class JetgroovyIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class MavenIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class PropertiesIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class SvnIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class TasksCoreIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class TerminalIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class TestngIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class UIDesignerNewIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class UIDesignerIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class XpathIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class XsltDebuggerIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class EducationalCoreIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class PythonEducationalIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class PythonIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class PythonPsiApiIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class RestIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public class SpellcheckerIcons {
|
||||
private static Icon load(String path) {
|
||||
|
||||
Reference in New Issue
Block a user