fix yellow code - rationalize static call

GitOrigin-RevId: 2dc783a75d852bd9c8a537ef6ed6bfac07640177
This commit is contained in:
Vladimir Krivosheev
2019-06-04 08:10:41 +03:00
committed by intellij-monorepo-bot
parent 2ad37d8194
commit a8c510ae57
76 changed files with 259 additions and 706 deletions
@@ -32,6 +32,7 @@ import com.intellij.util.ObjectUtils;
import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.JBIterable; import com.intellij.util.containers.JBIterable;
import com.intellij.util.ui.JBUI; import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.StartupUiUtil;
import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.update.UiNotifyConnector; import com.intellij.util.ui.update.UiNotifyConnector;
import org.intellij.images.fileTypes.ImageFileTypeManager; import org.intellij.images.fileTypes.ImageFileTypeManager;
@@ -455,7 +456,7 @@ public class BackgroundImageDialog extends DialogWrapper {
@NotNull @NotNull
private static Color getSelectionBackground() { private static Color getSelectionBackground() {
return ColorUtil.mix(UIUtil.getListSelectionBackground(), UIUtil.getLabelBackground(), UIUtil.isUnderDarcula() ? .5 : .75); return ColorUtil.mix(UIUtil.getListSelectionBackground(), UIUtil.getLabelBackground(), StartupUiUtil.isUnderDarcula() ? .5 : .75);
} }
private static void initFlipPanel(@NotNull JPanel p, @NotNull JBCheckBox flipHorCb, @NotNull JBCheckBox flipVerCb) { private static void initFlipPanel(@NotNull JPanel p, @NotNull JBCheckBox flipHorCb, @NotNull JBCheckBox flipVerCb) {
@@ -1,18 +1,4 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* 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.intellij.images.thumbnail.impl; package org.intellij.images.thumbnail.impl;
import com.intellij.ide.CopyPasteDelegator; import com.intellij.ide.CopyPasteDelegator;
@@ -667,7 +653,7 @@ final class ThumbnailViewUI extends JPanel implements DataProvider, Disposable {
public void fileDeleted(@NotNull VirtualFileEvent event) { public void fileDeleted(@NotNull VirtualFileEvent event) {
VirtualFile file = event.getFile(); VirtualFile file = event.getFile();
VirtualFile root = thumbnailView.getRoot(); VirtualFile root = thumbnailView.getRoot();
if (root != null && VfsUtil.isAncestor(file, root, false)) { if (root != null && VfsUtilCore.isAncestor(file, root, false)) {
refresh(); refresh();
} }
if (list != null) { if (list != null) {
@@ -1,20 +1,7 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2009 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.intellij.images.ui; package org.intellij.images.ui;
import com.intellij.util.ui.StartupUiUtil;
import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.UIUtil;
import org.intellij.images.editor.ImageDocument; import org.intellij.images.editor.ImageDocument;
@@ -115,7 +102,7 @@ public class ImageComponentUI extends ComponentUI {
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
} }
UIUtil.drawImage(g, image, new Rectangle(0, 0, size.width, size.height), ic); StartupUiUtil.drawImage(g, image, new Rectangle(0, 0, size.width, size.height), ic);
g2d.setRenderingHints(oldHints); g2d.setRenderingHints(oldHints);
} }
@@ -1,25 +1,11 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2015 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.intellij.images.ui; package org.intellij.images.ui;
import com.intellij.ide.ui.UISettings; import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.ui.Messages; import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.JBColor; import com.intellij.ui.JBColor;
import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.StartupUiUtil;
import icons.ImagesIcons; import icons.ImagesIcons;
import org.intellij.images.ImagesBundle; import org.intellij.images.ImagesBundle;
import org.intellij.images.editor.ImageDocument; import org.intellij.images.editor.ImageDocument;
@@ -202,7 +188,7 @@ public class ThumbnailComponentUI extends ComponentUI {
} }
private void paintFileName(Graphics g, ThumbnailComponent tc) { private void paintFileName(Graphics g, ThumbnailComponent tc) {
Font font = UIUtil.getLabelFont(); Font font = StartupUiUtil.getLabelFont();
FontMetrics fontMetrics = g.getFontMetrics(font); FontMetrics fontMetrics = g.getFontMetrics(font);
g.setFont(font); g.setFont(font);
@@ -262,13 +248,13 @@ public class ThumbnailComponentUI extends ComponentUI {
} }
private static Font getSmallFont() { private static Font getSmallFont() {
Font labelFont = UIUtil.getLabelFont(); Font labelFont = StartupUiUtil.getLabelFont();
return labelFont.deriveFont(labelFont.getSize2D() - 2.0f); return labelFont.deriveFont(labelFont.getSize2D() - 2.0f);
} }
@Override @Override
public Dimension getPreferredSize(JComponent c) { public Dimension getPreferredSize(JComponent c) {
Font labelFont = UIUtil.getLabelFont(); Font labelFont = StartupUiUtil.getLabelFont();
FontMetrics fontMetrics = c.getFontMetrics(labelFont); FontMetrics fontMetrics = c.getFontMetrics(labelFont);
return new Dimension( return new Dimension(
ImagesIcons.ThumbnailBlank.getIconWidth() + 10, ImagesIcons.ThumbnailBlank.getIconWidth() + 10,
@@ -17,7 +17,10 @@ import com.intellij.openapi.progress.Task;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages; import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.*; import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.ReadonlyStatusHandler;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -98,7 +101,7 @@ public class GenerateAntBuildAction extends CompileActionBase {
try { try {
if (genOptions.generateSingleFile) { if (genOptions.generateSingleFile) {
final File projectBuildFileDestDir = VfsUtil.virtualToIoFile(project.getBaseDir()); final File projectBuildFileDestDir = VfsUtilCore.virtualToIoFile(project.getBaseDir());
final File destFile = new File(projectBuildFileDestDir, genOptions.getBuildFileName()); final File destFile = new File(projectBuildFileDestDir, genOptions.getBuildFileName());
final File propertiesFile = new File(projectBuildFileDestDir, genOptions.getPropertiesFileName()); final File propertiesFile = new File(projectBuildFileDestDir, genOptions.getPropertiesFileName());
@@ -107,7 +110,7 @@ public class GenerateAntBuildAction extends CompileActionBase {
else { else {
final List<File> allFiles = new ArrayList<>(); final List<File> allFiles = new ArrayList<>();
final File projectBuildFileDestDir = VfsUtil.virtualToIoFile(project.getBaseDir()); final File projectBuildFileDestDir = VfsUtilCore.virtualToIoFile(project.getBaseDir());
allFiles.add(new File(projectBuildFileDestDir, genOptions.getBuildFileName())); allFiles.add(new File(projectBuildFileDestDir, genOptions.getBuildFileName()));
allFiles.add(new File(projectBuildFileDestDir, genOptions.getPropertiesFileName())); allFiles.add(new File(projectBuildFileDestDir, genOptions.getPropertiesFileName()));
@@ -198,7 +201,7 @@ public class GenerateAntBuildAction extends CompileActionBase {
} }
private File[] generateSingleFileBuild(Project project, GenerationOptions genOptions, List<? super File> filesToRefresh) throws IOException { private File[] generateSingleFileBuild(Project project, GenerationOptions genOptions, List<? super File> filesToRefresh) throws IOException {
final File projectBuildFileDestDir = VfsUtil.virtualToIoFile(project.getBaseDir()); final File projectBuildFileDestDir = VfsUtilCore.virtualToIoFile(project.getBaseDir());
projectBuildFileDestDir.mkdirs(); projectBuildFileDestDir.mkdirs();
final File destFile = new File(projectBuildFileDestDir, genOptions.getBuildFileName()); final File destFile = new File(projectBuildFileDestDir, genOptions.getBuildFileName());
final File propertiesFile = new File(projectBuildFileDestDir, genOptions.getPropertiesFileName()); final File propertiesFile = new File(projectBuildFileDestDir, genOptions.getPropertiesFileName());
@@ -1,18 +1,4 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2009 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 com.intellij.compiler.ant.artifacts; package com.intellij.compiler.ant.artifacts;
import com.intellij.compiler.ant.BuildProperties; import com.intellij.compiler.ant.BuildProperties;
@@ -22,7 +8,7 @@ import com.intellij.compiler.ant.Generator;
import com.intellij.compiler.ant.taskdefs.Mkdir; import com.intellij.compiler.ant.taskdefs.Mkdir;
import com.intellij.compiler.ant.taskdefs.Property; import com.intellij.compiler.ant.taskdefs.Property;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.packaging.artifacts.Artifact; import com.intellij.packaging.artifacts.Artifact;
import com.intellij.packaging.elements.ArtifactAntGenerationContext; import com.intellij.packaging.elements.ArtifactAntGenerationContext;
import com.intellij.packaging.impl.artifacts.ArtifactUtil; import com.intellij.packaging.impl.artifacts.ArtifactUtil;
@@ -105,7 +91,7 @@ public class ArtifactAntGenerationContextImpl implements ArtifactAntGenerationCo
@Override @Override
public String getSubstitutedPath(String path) { public String getSubstitutedPath(String path) {
return GenerationUtils.toRelativePath(path, VfsUtil.virtualToIoFile(myProject.getBaseDir()), BuildProperties.getProjectBaseDirProperty(), myGenerationOptions); return GenerationUtils.toRelativePath(path, VfsUtilCore.virtualToIoFile(myProject.getBaseDir()), BuildProperties.getProjectBaseDirProperty(), myGenerationOptions);
} }
@Override @Override
@@ -11,7 +11,7 @@ import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.fileEditor.OpenFileDescriptor; import com.intellij.openapi.fileEditor.OpenFileDescriptor;
import com.intellij.openapi.module.LanguageLevelUtil; import com.intellij.openapi.module.EffectiveLanguageLevelUtil;
import com.intellij.openapi.module.Module; import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtilCore; import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
@@ -113,7 +113,7 @@ public class CompilerErrorTreeView extends NewErrorTreeViewPanel {
if (psiFile == null) { if (psiFile == null) {
return; return;
} }
if (LanguageLevelUtil.getEffectiveLanguageLevel(module).compareTo(LanguageLevel.JDK_1_5) < 0) return; if (EffectiveLanguageLevelUtil.getEffectiveLanguageLevel(module).compareTo(LanguageLevel.JDK_1_5) < 0) return;
final PsiElement context = psiFile.findElementAt(fileDescriptor.getOffset()); final PsiElement context = psiFile.findElementAt(fileDescriptor.getOffset());
if (context == null) { if (context == null) {
return; return;
@@ -1,25 +1,11 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2009 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 com.intellij.compiler.impl; package com.intellij.compiler.impl;
import com.intellij.openapi.compiler.CompileScope; import com.intellij.openapi.compiler.CompileScope;
import com.intellij.openapi.compiler.ExportableUserDataHolderBase; import com.intellij.openapi.compiler.ExportableUserDataHolderBase;
import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.roots.FileIndex; import com.intellij.openapi.roots.FileIndex;
import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -41,6 +27,6 @@ public abstract class FileIndexCompileScope extends ExportableUserDataHolderBase
for (final FileIndex fileIndex : fileIndices) { for (final FileIndex fileIndex : fileIndices) {
fileIndex.iterateContent(new CompilerContentIterator(fileType, fileIndex, inSourceOnly, files)); fileIndex.iterateContent(new CompilerContentIterator(fileType, fileIndex, inSourceOnly, files));
} }
return VfsUtil.toVirtualFileArray(files); return VfsUtilCore.toVirtualFileArray(files);
} }
} }
@@ -1,18 +1,4 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2009 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 com.intellij.compiler.impl; package com.intellij.compiler.impl;
import com.intellij.openapi.compiler.CompileScope; import com.intellij.openapi.compiler.CompileScope;
@@ -20,13 +6,13 @@ import com.intellij.openapi.compiler.ExportableUserDataHolderBase;
import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.module.Module; import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtil; import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ContentIterator; import com.intellij.openapi.roots.ContentIterator;
import com.intellij.openapi.roots.ProjectFileIndex; import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -58,7 +44,7 @@ public class OneProjectItemCompileScope extends ExportableUserDataHolderBase imp
else{ else{
iterator.processFile(myFile); iterator.processFile(myFile);
} }
return VfsUtil.toVirtualFileArray(files); return VfsUtilCore.toVirtualFileArray(files);
} }
@Override @Override
@@ -72,7 +58,7 @@ public class OneProjectItemCompileScope extends ExportableUserDataHolderBase imp
@Override @Override
@NotNull @NotNull
public Module[] getAffectedModules() { public Module[] getAffectedModules() {
final Module module = ModuleUtil.findModuleForFile(myFile, myProject); final Module module = ModuleUtilCore.findModuleForFile(myFile, myProject);
if (module == null) { if (module == null) {
LOG.error("Module is null for file " + myFile.getPresentableUrl()); LOG.error("Module is null for file " + myFile.getPresentableUrl());
return Module.EMPTY_ARRAY; return Module.EMPTY_ARRAY;
@@ -1,24 +1,10 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2009 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 com.intellij.openapi.deployment; package com.intellij.openapi.deployment;
import com.intellij.openapi.compiler.CompilerBundle; import com.intellij.openapi.compiler.CompilerBundle;
import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.psi.PsiFile; import com.intellij.psi.PsiFile;
import com.intellij.psi.xml.XmlDocument; import com.intellij.psi.xml.XmlDocument;
import com.intellij.psi.xml.XmlFile; import com.intellij.psi.xml.XmlFile;
@@ -55,7 +41,7 @@ public class DeploymentUtilImpl extends DeploymentUtil {
@Nullable @Nullable
public String getConfigFileErrorMessage(final ConfigFile configFile) { public String getConfigFileErrorMessage(final ConfigFile configFile) {
if (configFile.getVirtualFile() == null) { if (configFile.getVirtualFile() == null) {
String path = FileUtil.toSystemDependentName(VfsUtil.urlToPath(configFile.getUrl())); String path = FileUtil.toSystemDependentName(VfsUtilCore.urlToPath(configFile.getUrl()));
return CompilerBundle.message("mesage.text.deployment.descriptor.file.not.exist", path); return CompilerBundle.message("mesage.text.deployment.descriptor.file.not.exist", path);
} }
PsiFile psiFile = configFile.getPsiFile(); PsiFile psiFile = configFile.getPsiFile();
@@ -66,7 +52,8 @@ public class DeploymentUtilImpl extends DeploymentUtil {
if (psiFile instanceof XmlFile) { if (psiFile instanceof XmlFile) {
XmlDocument document = ((XmlFile)psiFile).getDocument(); XmlDocument document = ((XmlFile)psiFile).getDocument();
if (document == null || document.getRootTag() == null) { if (document == null || document.getRootTag() == null) {
return CompilerBundle.message("message.text.xml.file.invalid", FileUtil.toSystemDependentName(VfsUtil.urlToPath(configFile.getUrl()))); return CompilerBundle.message("message.text.xml.file.invalid", FileUtil.toSystemDependentName(
VfsUtilCore.urlToPath(configFile.getUrl())));
} }
} }
return null; return null;
@@ -1,18 +1,4 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2015 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 com.intellij.packaging.impl.elements; package com.intellij.packaging.impl.elements;
import com.intellij.CommonBundle; import com.intellij.CommonBundle;
@@ -38,6 +24,7 @@ import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.packaging.artifacts.ArtifactType; import com.intellij.packaging.artifacts.ArtifactType;
import com.intellij.packaging.elements.CompositePackagingElement; import com.intellij.packaging.elements.CompositePackagingElement;
@@ -143,7 +130,7 @@ public class ManifestFileUtil {
if (file != null) { if (file != null) {
for (VirtualFile contentRoot : contentRoots) { for (VirtualFile contentRoot : contentRoots) {
if (VfsUtil.isAncestor(contentRoot, file, false)) { if (VfsUtilCore.isAncestor(contentRoot, file, false)) {
return contentRoot; return contentRoot;
} }
} }
@@ -1,18 +1,4 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2009 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 com.intellij.compiler.ant; package com.intellij.compiler.ant;
@@ -22,7 +8,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.ModuleRootManager; import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NonNls;
@@ -213,7 +199,7 @@ public abstract class BuildProperties extends CompositeGenerator {
public static File getProjectBaseDir(final Project project) { public static File getProjectBaseDir(final Project project) {
final VirtualFile baseDir = project.getBaseDir(); final VirtualFile baseDir = project.getBaseDir();
assert baseDir != null; assert baseDir != null;
return VfsUtil.virtualToIoFile(baseDir); return VfsUtilCore.virtualToIoFile(baseDir);
} }
/** /**
@@ -1,25 +1,11 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2016 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 com.intellij.openapi.compiler.options; package com.intellij.openapi.compiler.options;
import com.intellij.openapi.Disposable; import com.intellij.openapi.Disposable;
import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.pointers.VirtualFilePointer; import com.intellij.openapi.vfs.pointers.VirtualFilePointer;
import com.intellij.openapi.vfs.pointers.VirtualFilePointerManager; import com.intellij.openapi.vfs.pointers.VirtualFilePointerManager;
@@ -47,7 +33,7 @@ public class ExcludeEntryDescription implements Disposable {
} }
void setPresentableUrl(String newUrl) { void setPresentableUrl(String newUrl) {
myFilePointer = VirtualFilePointerManager.getInstance().create(VfsUtil.pathToUrl(FileUtil.toSystemIndependentName(newUrl)), myParentDisposable, null); myFilePointer = VirtualFilePointerManager.getInstance().create(VfsUtilCore.pathToUrl(FileUtil.toSystemIndependentName(newUrl)), myParentDisposable, null);
final VirtualFile file = getVirtualFile(); final VirtualFile file = getVirtualFile();
if (file != null) { if (file != null) {
myIsFile = !file.isDirectory(); myIsFile = !file.isDirectory();
@@ -1,3 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.compiler.artifacts; package com.intellij.compiler.artifacts;
import com.intellij.compiler.BaseCompilerTestCase; import com.intellij.compiler.BaseCompilerTestCase;
@@ -7,7 +8,7 @@ import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.JarFileSystem; import com.intellij.openapi.vfs.JarFileSystem;
import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.packaging.artifacts.Artifact; import com.intellij.packaging.artifacts.Artifact;
import com.intellij.packaging.artifacts.ArtifactType; import com.intellij.packaging.artifacts.ArtifactType;
@@ -102,7 +103,7 @@ public abstract class ArtifactCompilerTestCase extends BaseCompilerTestCase {
public static void assertOutput(Artifact artifact, TestFileSystemBuilder item) { public static void assertOutput(Artifact artifact, TestFileSystemBuilder item) {
final VirtualFile outputFile = getOutputDir(artifact); final VirtualFile outputFile = getOutputDir(artifact);
outputFile.refresh(false, true); outputFile.refresh(false, true);
item.build().assertDirectoryEqual(VfsUtil.virtualToIoFile(outputFile)); item.build().assertDirectoryEqual(VfsUtilCore.virtualToIoFile(outputFile));
} }
protected static VirtualFile getOutputDir(Artifact artifact) { protected static VirtualFile getOutputDir(Artifact artifact) {
@@ -1,24 +1,10 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2016 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 com.intellij.debugger.memory.ui; package com.intellij.debugger.memory.ui;
import com.intellij.debugger.memory.filtering.FilteringResult; import com.intellij.debugger.memory.filtering.FilteringResult;
import com.intellij.icons.AllIcons; import com.intellij.icons.AllIcons;
import com.intellij.ui.components.JBLabel; import com.intellij.ui.components.JBLabel;
import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.StartupUiUtil;
import com.intellij.util.ui.components.BorderLayoutPanel; import com.intellij.util.ui.components.BorderLayoutPanel;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -33,7 +19,7 @@ class FilteringProgressView extends BorderLayoutPanel {
private final JProgressBar myProgressBar = new JProgressBar(); private final JProgressBar myProgressBar = new JProgressBar();
private final BorderLayoutPanel myProgressPanel = new BorderLayoutPanel(); private final BorderLayoutPanel myProgressPanel = new BorderLayoutPanel();
private final JBLabel myStopButton = new JBLabel(UIUtil.isUnderDarcula() private final JBLabel myStopButton = new JBLabel(StartupUiUtil.isUnderDarcula()
? AllIcons.Actions.Clean : AllIcons.Actions.CleanLight); ? AllIcons.Actions.Clean : AllIcons.Actions.CleanLight);
private final JBLabel myProgressText = new JBLabel(); private final JBLabel myProgressText = new JBLabel();
@@ -1,18 +1,4 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2014 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 com.intellij.facet.impl.ui.libraries; package com.intellij.facet.impl.ui.libraries;
@@ -30,7 +16,7 @@ import com.intellij.openapi.roots.OrderRootType;
import com.intellij.openapi.roots.libraries.Library; import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.ui.configuration.libraries.AddCustomLibraryDialog; import com.intellij.openapi.roots.ui.configuration.libraries.AddCustomLibraryDialog;
import com.intellij.openapi.roots.ui.configuration.libraries.CustomLibraryDescription; import com.intellij.openapi.roots.ui.configuration.libraries.CustomLibraryDescription;
import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -82,7 +68,7 @@ public class FacetLibrariesValidatorImpl extends FacetLibrariesValidator {
} }
List<VirtualFile> roots = collectRoots(myContext.getRootModel()); List<VirtualFile> roots = collectRoots(myContext.getRootModel());
RequiredLibrariesInfo.RequiredClassesNotFoundInfo info = myRequiredLibraries.checkLibraries(VfsUtil.toVirtualFileArray(roots)); RequiredLibrariesInfo.RequiredClassesNotFoundInfo info = myRequiredLibraries.checkLibraries(VfsUtilCore.toVirtualFileArray(roots));
if (info == null) { if (info == null) {
return ValidationResult.OK; return ValidationResult.OK;
} }
@@ -1,10 +1,10 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.projectView.actions; package com.intellij.ide.projectView.actions;
import com.intellij.application.options.ModulesComboBox; import com.intellij.application.options.ModulesComboBox;
import com.intellij.openapi.application.WriteAction; import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.module.Module; import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtil; import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ModifiableRootModel; import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.ModuleRootManager; import com.intellij.openapi.roots.ModuleRootManager;
@@ -97,10 +97,10 @@ public class CreateLibraryFromFilesDialog extends DialogWrapper {
Module module = null; Module module = null;
final VirtualFile local = JarFileSystem.getInstance().getVirtualFileForJar(root.getFile()); final VirtualFile local = JarFileSystem.getInstance().getVirtualFileForJar(root.getFile());
if (local != null) { if (local != null) {
module = ModuleUtil.findModuleForFile(local, myProject); module = ModuleUtilCore.findModuleForFile(local, myProject);
} }
if (module == null) { if (module == null) {
module = ModuleUtil.findModuleForFile(root.getFile(), myProject); module = ModuleUtilCore.findModuleForFile(root.getFile(), myProject);
} }
if (module != null) { if (module != null) {
return module; return module;
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.util.importProject; package com.intellij.ide.util.importProject;
import com.intellij.facet.Facet; import com.intellij.facet.Facet;
@@ -10,7 +10,7 @@ import com.intellij.framework.detection.impl.FrameworkDetectionContextBase;
import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.containers.MultiMap; import com.intellij.util.containers.MultiMap;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -33,7 +33,7 @@ public abstract class FrameworkDetectionInWizardContext extends FrameworkDetecti
final List<ModuleDescriptor> descriptors = getModuleDescriptors(); final List<ModuleDescriptor> descriptors = getModuleDescriptors();
MultiMap<ModuleDescriptor, VirtualFile> filesByModule = new MultiMap<>(); MultiMap<ModuleDescriptor, VirtualFile> filesByModule = new MultiMap<>();
for (VirtualFile file : files) { for (VirtualFile file : files) {
final File ioFile = VfsUtil.virtualToIoFile(file); final File ioFile = VfsUtilCore.virtualToIoFile(file);
ModuleDescriptor descriptor = findDescriptorByFile(descriptors, ioFile); ModuleDescriptor descriptor = findDescriptorByFile(descriptors, ioFile);
if (descriptor != null) { if (descriptor != null) {
filesByModule.putValue(descriptor, file); filesByModule.putValue(descriptor, file);
@@ -1,18 +1,4 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2016 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 com.intellij.ide.util.projectWizard; package com.intellij.ide.util.projectWizard;
@@ -28,6 +14,7 @@ import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.concurrency.SwingWorker; import com.intellij.util.concurrency.SwingWorker;
import com.intellij.util.ui.JBUI; import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.StartupUiUtil;
import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.update.UiNotifyConnector; import com.intellij.util.ui.update.UiNotifyConnector;
import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NonNls;
@@ -46,7 +33,7 @@ public abstract class AbstractStepWithProgress<Result> extends ModuleWizardStep
@NonNls private static final String PROGRESS_PANEL = "progress_panel"; @NonNls private static final String PROGRESS_PANEL = "progress_panel";
@NonNls private static final String RESULTS_PANEL = "results_panel"; @NonNls private static final String RESULTS_PANEL = "results_panel";
private JPanel myPanel; private JPanel myPanel;
private JLabel myTitleLabel; private JLabel myTitleLabel;
private JLabel myProgressLabel; private JLabel myProgressLabel;
private JLabel myProgressLabel2; private JLabel myProgressLabel2;
@@ -70,11 +57,11 @@ public abstract class AbstractStepWithProgress<Result> extends ModuleWizardStep
} }
protected abstract JComponent createResultsPanel(); protected abstract JComponent createResultsPanel();
protected abstract String getProgressText(); protected abstract String getProgressText();
protected abstract boolean shouldRunProgress(); protected abstract boolean shouldRunProgress();
protected abstract Result calculate(); protected abstract Result calculate();
protected abstract void onFinished(Result result, boolean canceled); protected abstract void onFinished(Result result, boolean canceled);
@@ -82,7 +69,7 @@ public abstract class AbstractStepWithProgress<Result> extends ModuleWizardStep
private JPanel createProgressPanel() { private JPanel createProgressPanel() {
final JPanel progressPanel = new JPanel(new GridBagLayout()); final JPanel progressPanel = new JPanel(new GridBagLayout());
myTitleLabel = new JLabel(); myTitleLabel = new JLabel();
myTitleLabel.setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD)); myTitleLabel.setFont(StartupUiUtil.getLabelFont().deriveFont(Font.BOLD));
progressPanel.add(myTitleLabel, new GridBagConstraints(0, RELATIVE, 2, 1, 1.0, 0.0, NORTHWEST, HORIZONTAL, JBUI.insets(8, 10, 5, 10), 0, 0)); progressPanel.add(myTitleLabel, new GridBagConstraints(0, RELATIVE, 2, 1, 1.0, 0.0, NORTHWEST, HORIZONTAL, JBUI.insets(8, 10, 5, 10), 0, 0));
myProgressLabel = new JLabel(); myProgressLabel = new JLabel();
@@ -119,8 +106,8 @@ public abstract class AbstractStepWithProgress<Result> extends ModuleWizardStep
private synchronized boolean isProgressRunning() { private synchronized boolean isProgressRunning() {
return myProgressIndicator != null && myProgressIndicator.isRunning(); return myProgressIndicator != null && myProgressIndicator.isRunning();
} }
@Override @Override
public void updateStep() { public void updateStep() {
if (shouldRunProgress()) { if (shouldRunProgress()) {
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.util.projectWizard; package com.intellij.ide.util.projectWizard;
import com.intellij.ide.IdeBundle; import com.intellij.ide.IdeBundle;
@@ -17,7 +17,7 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.DocumentAdapter; import com.intellij.ui.DocumentAdapter;
import com.intellij.ui.FieldPanel; import com.intellij.ui.FieldPanel;
import com.intellij.util.ui.JBUI; import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.StartupUiUtil;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.swing.*; import javax.swing.*;
@@ -77,7 +77,7 @@ public class NamePathComponent extends JPanel {
myTfPath.setPreferredSize(new Dimension(200, myTfPath.getPreferredSize().height)); myTfPath.setPreferredSize(new Dimension(200, myTfPath.getPreferredSize().height));
myNameLabel = new JLabel(nameLabelText); myNameLabel = new JLabel(nameLabelText);
if (bold) myNameLabel.setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD)); if (bold) myNameLabel.setFont(StartupUiUtil.getLabelFont().deriveFont(Font.BOLD));
myNameLabel.setLabelFor(myTfName); myNameLabel.setLabelFor(myTfName);
FileChooserDescriptor chooserDescriptor = (FileChooserDescriptor)BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR.clone(); FileChooserDescriptor chooserDescriptor = (FileChooserDescriptor)BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR.clone();
@@ -92,7 +92,7 @@ public class NamePathComponent extends JPanel {
myPathPanel = new FieldPanel(myTfPath, null, null, browseButtonActionListener, null); myPathPanel = new FieldPanel(myTfPath, null, null, browseButtonActionListener, null);
JLabel pathLabel = new JLabel(pathLabelText); JLabel pathLabel = new JLabel(pathLabelText);
if (bold) pathLabel.setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD)); if (bold) pathLabel.setFont(StartupUiUtil.getLabelFont().deriveFont(Font.BOLD));
pathLabel.setLabelFor(myTfPath); pathLabel.setLabelFor(myTfPath);
add(myNameLabel, new GridBagConstraints(0, RELATIVE, 1, 1, 0.0, 0.0, WEST, NONE, JBUI.insets(0, 0, 5, 4), 0, 0)); add(myNameLabel, new GridBagConstraints(0, RELATIVE, 1, 1, 0.0, 0.0, WEST, NONE, JBUI.insets(0, 0, 5, 4), 0, 0));
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.util.projectWizard; package com.intellij.ide.util.projectWizard;
import com.intellij.ide.IdeBundle; import com.intellij.ide.IdeBundle;
@@ -17,7 +17,7 @@ import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel;
import com.intellij.openapi.ui.Messages; import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.MultiLineLabelUI; import com.intellij.openapi.ui.MultiLineLabelUI;
import com.intellij.util.ui.JBUI; import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.StartupUiUtil;
import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -59,7 +59,7 @@ public class ProjectJdkForModuleStep extends ModuleWizardStep {
GridBagConstraints.HORIZONTAL, JBUI.insets(8, 10), 0, 0)); GridBagConstraints.HORIZONTAL, JBUI.insets(8, 10), 0, 0));
final JLabel jdkLabel = new JLabel(IdeBundle.message("label.project.jdk")); final JLabel jdkLabel = new JLabel(IdeBundle.message("label.project.jdk"));
jdkLabel.setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD)); jdkLabel.setFont(StartupUiUtil.getLabelFont().deriveFont(Font.BOLD));
myPanel.add(jdkLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, myPanel.add(jdkLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST,
GridBagConstraints.NONE, JBUI.insets(8, 10, 0, 10), 0, 0)); GridBagConstraints.NONE, JBUI.insets(8, 10, 0, 10), 0, 0));
@@ -1,18 +1,4 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* 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 com.intellij.openapi.roots.ui.configuration; package com.intellij.openapi.roots.ui.configuration;
import com.intellij.openapi.Disposable; import com.intellij.openapi.Disposable;
@@ -28,6 +14,7 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.*; import com.intellij.ui.*;
import com.intellij.ui.awt.RelativePoint; import com.intellij.ui.awt.RelativePoint;
import com.intellij.util.Alarm; import com.intellij.util.Alarm;
import com.intellij.util.ui.StartupUiUtil;
import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.update.MergingUpdateQueue; import com.intellij.util.ui.update.MergingUpdateQueue;
import com.intellij.util.ui.update.Update; import com.intellij.util.ui.update.Update;
@@ -127,23 +114,23 @@ public class ErrorPaneConfigurable extends JPanel implements Configurable, Dispo
myAlarm.cancelAllRequests(); myAlarm.cancelAllRequests();
myAlarm.addRequest(() -> { myAlarm.addRequest(() -> {
final String header = "<html>" + final String header = "<html>" +
"<header><style type='text/css'>" + "<header><style type='text/css'>" +
"body {" + "body {" +
" color: #" + ColorUtil.toHex(new JBColor(Gray.x33, UIUtil.getLabelForeground())) + ";" + " color: #" + ColorUtil.toHex(new JBColor(Gray.x33, UIUtil.getLabelForeground())) + ";" +
" font-family: '" + UIUtil.getLabelFont().getName() + ",serif';" + " font-family: '" + StartupUiUtil.getLabelFont().getName() + ",serif';" +
" font-size: " + UIUtil.getLabelFont().getSize() + ";" + " font-size: " + StartupUiUtil.getLabelFont().getSize() + ";" +
"}" + "}" +
"li {" + "li {" +
" margin-bottom: 5;" + " margin-bottom: 5;" +
"}" + "}" +
"ol {" + "ol {" +
"}" + "}" +
"a {" + "a {" +
" text-decoration: none;" + " text-decoration: none;" +
"}" + "}" +
"</style>" + "</style>" +
"</header>" + "</header>" +
"<body>"; "<body>";
final StringBuilder html = new StringBuilder(header); final StringBuilder html = new StringBuilder(header);
int i = 0; int i = 0;
html.append("<ol>"); html.append("<ol>");
@@ -41,6 +41,7 @@ import com.intellij.ui.border.CustomLineBorder;
import com.intellij.util.EventDispatcher; import com.intellij.util.EventDispatcher;
import com.intellij.util.IconUtil; import com.intellij.util.IconUtil;
import com.intellij.util.ui.JBUI; import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.StartupUiUtil;
import com.intellij.util.ui.ThreeStateCheckBox; import com.intellij.util.ui.ThreeStateCheckBox;
import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -199,13 +200,13 @@ public class ArtifactEditorImpl implements ArtifactEditorEx {
final JBSplitter splitter = new OnePixelSplitter(false); final JBSplitter splitter = new OnePixelSplitter(false);
final JPanel leftPanel = new JPanel(new BorderLayout()); final JPanel leftPanel = new JPanel(new BorderLayout());
JPanel treePanel = myLayoutTreeComponent.getTreePanel(); JPanel treePanel = myLayoutTreeComponent.getTreePanel();
if (UIUtil.isUnderDarcula()) { if (StartupUiUtil.isUnderDarcula()) {
treePanel.setBorder(JBUI.Borders.emptyTop(3)); treePanel.setBorder(JBUI.Borders.emptyTop(3));
} else { } else {
treePanel.setBorder(new LineBorder(JBColor.border())); treePanel.setBorder(new LineBorder(JBColor.border()));
} }
leftPanel.add(treePanel, BorderLayout.CENTER); leftPanel.add(treePanel, BorderLayout.CENTER);
if (UIUtil.isUnderDarcula()) { if (StartupUiUtil.isUnderDarcula()) {
CompoundBorder border = CompoundBorder border =
new CompoundBorder(new CustomLineBorder(0, 0, 0, 1), JBUI.Borders.empty()); new CompoundBorder(new CustomLineBorder(0, 0, 0, 1), JBUI.Borders.empty());
leftPanel.setBorder(border); leftPanel.setBorder(border);
@@ -238,14 +239,14 @@ public class ArtifactEditorImpl implements ArtifactEditorEx {
JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(mySourceItemsTree, true); JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(mySourceItemsTree, true);
JPanel scrollPaneWrap = new JPanel(new BorderLayout()); JPanel scrollPaneWrap = new JPanel(new BorderLayout());
scrollPaneWrap.add(scrollPane, BorderLayout.CENTER); scrollPaneWrap.add(scrollPane, BorderLayout.CENTER);
if (UIUtil.isUnderDarcula()) { if (StartupUiUtil.isUnderDarcula()) {
scrollPaneWrap.setBorder(JBUI.Borders.emptyTop(3)); scrollPaneWrap.setBorder(JBUI.Borders.emptyTop(3));
} else { } else {
scrollPaneWrap.setBorder(new LineBorder(JBColor.border())); scrollPaneWrap.setBorder(new LineBorder(JBColor.border()));
} }
rightPanel.add(scrollPaneWrap, BorderLayout.CENTER); rightPanel.add(scrollPaneWrap, BorderLayout.CENTER);
if (UIUtil.isUnderDarcula()) { if (StartupUiUtil.isUnderDarcula()) {
rightPanel.setBorder(new CompoundBorder(new CustomLineBorder(0, 1, 0, 0), JBUI.Borders.empty())); rightPanel.setBorder(new CompoundBorder(new CustomLineBorder(0, 1, 0, 0), JBUI.Borders.empty()));
} else { } else {
rightPanel.setBorder(JBUI.Borders.empty(3, 0, 3, 3)); rightPanel.setBorder(JBUI.Borders.empty(3, 0, 3, 3));
@@ -276,7 +277,7 @@ public class ArtifactEditorImpl implements ArtifactEditorEx {
ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("ProjectStructureArtifactEditor", createToolbarActionGroup(), true); ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("ProjectStructureArtifactEditor", createToolbarActionGroup(), true);
JComponent toolbarComponent = toolbar.getComponent(); JComponent toolbarComponent = toolbar.getComponent();
if (UIUtil.isUnderDarcula()) { if (StartupUiUtil.isUnderDarcula()) {
toolbarComponent.setBorder(new CustomLineBorder(0, 0, 1, 0)); toolbarComponent.setBorder(new CustomLineBorder(0, 0, 1, 0));
} }
leftPanel.add(toolbarComponent, BorderLayout.NORTH); leftPanel.add(toolbarComponent, BorderLayout.NORTH);
@@ -1,24 +1,10 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* 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.
* 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 com.intellij.openapi.roots.ui.configuration.libraryEditor; package com.intellij.openapi.roots.ui.configuration.libraryEditor;
import com.intellij.ide.util.treeView.NodeDescriptor; import com.intellij.ide.util.treeView.NodeDescriptor;
import com.intellij.ui.ColoredTreeCellRenderer; import com.intellij.ui.ColoredTreeCellRenderer;
import com.intellij.ui.SimpleTextAttributes; import com.intellij.ui.SimpleTextAttributes;
import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.StartupUiUtil;
import javax.swing.*; import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultMutableTreeNode;
@@ -40,7 +26,7 @@ public class LibraryTreeRenderer extends ColoredTreeCellRenderer {
public Font getFont() { public Font getFont() {
Font font = super.getFont(); Font font = super.getFont();
if (font == null) { if (font == null) {
font = UIUtil.getLabelFont(); font = StartupUiUtil.getLabelFont();
} }
return font; return font;
} }
@@ -35,6 +35,7 @@ import com.intellij.util.JavaPsiConstructorUtil;
import com.intellij.util.ObjectUtils; import com.intellij.util.ObjectUtils;
import com.intellij.util.VisibilityUtil; import com.intellij.util.VisibilityUtil;
import com.intellij.util.containers.MostlySingularMultiMap; import com.intellij.util.containers.MostlySingularMultiMap;
import com.intellij.util.ui.StartupUiUtil;
import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.UIUtil;
import com.intellij.xml.util.XmlStringUtil; import com.intellij.xml.util.XmlStringUtil;
import org.intellij.lang.annotations.Language; import org.intellij.lang.annotations.Language;
@@ -47,7 +48,7 @@ import java.util.stream.Stream;
public class HighlightMethodUtil { public class HighlightMethodUtil {
private static final QuickFixFactory QUICK_FIX_FACTORY = QuickFixFactory.getInstance(); private static final QuickFixFactory QUICK_FIX_FACTORY = QuickFixFactory.getInstance();
private static final String MISMATCH_COLOR = UIUtil.isUnderDarcula() ? "ff6464" : "red"; private static final String MISMATCH_COLOR = StartupUiUtil.isUnderDarcula() ? "ff6464" : "red";
private static final Logger LOG = Logger.getInstance(HighlightMethodUtil.class); private static final Logger LOG = Logger.getInstance(HighlightMethodUtil.class);
private HighlightMethodUtil() { } private HighlightMethodUtil() { }
@@ -632,7 +633,7 @@ public class HighlightMethodUtil {
return XmlStringUtil.wrapInHtml("<body>" + XmlStringUtil.escapeString(message) + return XmlStringUtil.wrapInHtml("<body>" + XmlStringUtil.escapeString(message) +
" <a href=\"#assignment/" + XmlStringUtil.escapeString(createMismatchedArgumentsHtmlTooltip(candidateInfo, list)) + "\"" + " <a href=\"#assignment/" + XmlStringUtil.escapeString(createMismatchedArgumentsHtmlTooltip(candidateInfo, list)) + "\"" +
(UIUtil.isUnderDarcula() ? " color=\"7AB4C9\" " : "") + (StartupUiUtil.isUnderDarcula() ? " color=\"7AB4C9\" " : "") +
">" + DaemonBundle.message("inspection.extended.description") + "</a></body>"); ">" + DaemonBundle.message("inspection.extended.description") + "</a></body>");
} }
} }
@@ -878,8 +879,8 @@ public class HighlightMethodUtil {
PsiType expectedTypeByParent = PsiTypesUtil.getExpectedTypeByParent(methodCall); PsiType expectedTypeByParent = PsiTypesUtil.getExpectedTypeByParent(methodCall);
if (expectedTypeByParent != null) { if (expectedTypeByParent != null) {
PsiType methodCallType = methodCall.getType(); PsiType methodCallType = methodCall.getType();
if (methodCallType != null && if (methodCallType != null &&
TypeConversionUtil.areTypesConvertible(methodCallType, expectedTypeByParent) && TypeConversionUtil.areTypesConvertible(methodCallType, expectedTypeByParent) &&
!TypeConversionUtil.isAssignable(expectedTypeByParent, methodCallType)) { !TypeConversionUtil.isAssignable(expectedTypeByParent, methodCallType)) {
QuickFixAction.registerQuickFixAction(highlightInfo, QUICK_FIX_FACTORY.createAddTypeCastFix(expectedTypeByParent, methodCall)); QuickFixAction.registerQuickFixAction(highlightInfo, QUICK_FIX_FACTORY.createAddTypeCastFix(expectedTypeByParent, methodCall));
} }
@@ -970,7 +971,7 @@ public class HighlightMethodUtil {
); );
} }
@NotNull @NotNull
private static String escTrim(@NotNull String s) { private static String escTrim(@NotNull String s) {
return XmlStringUtil.escapeString(trimNicely(s)); return XmlStringUtil.escapeString(trimNicely(s));
} }
@@ -1032,12 +1033,12 @@ public class HighlightMethodUtil {
PsiParameter parameter = i < parameters.length ? parameters[i] : null; PsiParameter parameter = i < parameters.length ? parameters[i] : null;
PsiExpression expression = i < expressions.length ? expressions[i] : null; PsiExpression expression = i < expressions.length ? expressions[i] : null;
boolean showShort = showShortType(i, parameters, expressions, substitutor); boolean showShort = showShortType(i, parameters, expressions, substitutor);
String mismatchColor = showShort ? null : UIUtil.isUnderDarcula() ? "FF6B68" : "red"; String mismatchColor = showShort ? null : StartupUiUtil.isUnderDarcula() ? "FF6B68" : "red";
s.append("<tr"); s.append("<tr");
if (i % 2 == 0) { if (i % 2 == 0) {
//noinspection SpellCheckingInspection //noinspection SpellCheckingInspection
String bg = UIUtil.isUnderDarcula() ? ColorUtil.toHex(ColorUtil.shift(UIUtil.getToolTipBackground(), 1.1)) : "eeeeee"; String bg = StartupUiUtil.isUnderDarcula() ? ColorUtil.toHex(ColorUtil.shift(UIUtil.getToolTipBackground(), 1.1)) : "eeeeee";
s.append(" style='background-color: #").append(bg).append("'"); s.append(" style='background-color: #").append(bg).append("'");
} }
s.append(">"); s.append(">");
@@ -1713,7 +1714,7 @@ public class HighlightMethodUtil {
else { else {
applicable = false; applicable = false;
} }
} }
else { else {
applicable = result != null && result.isApplicable(); applicable = result != null && result.isApplicable();
} }
@@ -49,7 +49,7 @@ import com.intellij.util.ObjectUtils;
import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.MultiMap; import com.intellij.util.containers.MultiMap;
import com.intellij.util.containers.hash.HashSet; import com.intellij.util.containers.hash.HashSet;
import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.StartupUiUtil;
import com.intellij.xml.util.XmlStringUtil; import com.intellij.xml.util.XmlStringUtil;
import com.siyeh.ig.psiutils.ControlFlowUtils; import com.siyeh.ig.psiutils.ControlFlowUtils;
import gnu.trove.THashMap; import gnu.trove.THashMap;
@@ -2751,7 +2751,7 @@ public class HighlightUtil extends HighlightUtilBase {
@NotNull @NotNull
private static String redIfNotMatch(@Nullable PsiType type, boolean matches) { private static String redIfNotMatch(@Nullable PsiType type, boolean matches) {
if (matches) return getFQName(type, false); if (matches) return getFQName(type, false);
String color = UIUtil.isUnderDarcula() ? "FF6B68" : "red"; String color = StartupUiUtil.isUnderDarcula() ? "FF6B68" : "red";
return "<font color='" + color +"'><b>" + getFQName(type, true) + "</b></font>"; return "<font color='" + color +"'><b>" + getFQName(type, true) + "</b></font>";
} }
@@ -1,18 +1,4 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* 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.
* 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 com.intellij.codeInsight.completion; package com.intellij.codeInsight.completion;
import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.codeInsight.lookup.LookupElement;
@@ -20,10 +6,9 @@ import com.intellij.codeInsight.lookup.LookupElementDecorator;
import com.intellij.codeInsight.lookup.LookupElementPresentation; import com.intellij.codeInsight.lookup.LookupElementPresentation;
import com.intellij.codeInsight.lookup.LookupElementRenderer; import com.intellij.codeInsight.lookup.LookupElementRenderer;
import com.intellij.openapi.module.Module; import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtil; import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.psi.PsiClass; import com.intellij.psi.PsiClass;
import com.intellij.refactoring.ui.ClassNameReferenceEditor; import com.intellij.refactoring.ui.ClassNameReferenceEditor;
import com.intellij.util.Consumer;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@@ -35,12 +20,12 @@ public class RefactoringCompletionContributor extends CompletionContributor {
if (parameters.getOriginalFile().getUserData(ClassNameReferenceEditor.CLASS_NAME_REFERENCE_FRAGMENT) == null) { if (parameters.getOriginalFile().getUserData(ClassNameReferenceEditor.CLASS_NAME_REFERENCE_FRAGMENT) == null) {
return; return;
} }
resultSet.runRemainingContributors(parameters, result -> { resultSet.runRemainingContributors(parameters, result -> {
LookupElement element = result.getLookupElement(); LookupElement element = result.getLookupElement();
Object object = element.getObject(); Object object = element.getObject();
if (object instanceof PsiClass) { if (object instanceof PsiClass) {
Module module = ModuleUtil.findModuleForPsiElement((PsiClass)object); Module module = ModuleUtilCore.findModuleForPsiElement((PsiClass)object);
if (module != null) { if (module != null) {
resultSet.consume(LookupElementDecorator.withRenderer(element, new AppendModuleName(module))); resultSet.consume(LookupElementDecorator.withRenderer(element, new AppendModuleName(module)));
return; return;
@@ -1,18 +1,4 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2009 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 com.intellij.codeInsight.generation; package com.intellij.codeInsight.generation;
import com.intellij.codeInsight.hint.HintManager; import com.intellij.codeInsight.hint.HintManager;
@@ -47,7 +33,7 @@ public class JavaImplementMethodsHandler implements ContextAwareActionHandler, L
if (aClass == null) { if (aClass == null) {
return; return;
} }
if (OverrideImplementUtil.getMethodSignaturesToImplement(aClass).isEmpty()) { if (OverrideImplementExploreUtil.getMethodSignaturesToImplement(aClass).isEmpty()) {
HintManager.getInstance().showErrorHint(editor, "No methods to implement have been found"); HintManager.getInstance().showErrorHint(editor, "No methods to implement have been found");
return; return;
} }
@@ -62,6 +48,6 @@ public class JavaImplementMethodsHandler implements ContextAwareActionHandler, L
@Override @Override
public boolean isAvailableForQuickList(@NotNull Editor editor, @NotNull PsiFile file, @NotNull DataContext dataContext) { public boolean isAvailableForQuickList(@NotNull Editor editor, @NotNull PsiFile file, @NotNull DataContext dataContext) {
PsiClass aClass = OverrideImplementUtil.getContextClass(file.getProject(), editor, file, PsiUtil.isLanguageLevel8OrHigher(file)); PsiClass aClass = OverrideImplementUtil.getContextClass(file.getProject(), editor, file, PsiUtil.isLanguageLevel8OrHigher(file));
return aClass != null && !OverrideImplementUtil.getMethodSignaturesToImplement(aClass).isEmpty(); return aClass != null && !OverrideImplementExploreUtil.getMethodSignaturesToImplement(aClass).isEmpty();
} }
} }
@@ -1,18 +1,4 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2009 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 com.intellij.codeInsight.generation; package com.intellij.codeInsight.generation;
import com.intellij.codeInsight.hint.HintManager; import com.intellij.codeInsight.hint.HintManager;
@@ -45,7 +31,7 @@ public class JavaOverrideMethodsHandler implements ContextAwareActionHandler, La
PsiClass aClass = OverrideImplementUtil.getContextClass(project, editor, file, true); PsiClass aClass = OverrideImplementUtil.getContextClass(project, editor, file, true);
if (aClass == null) return; if (aClass == null) return;
if (OverrideImplementUtil.getMethodSignaturesToOverride(aClass).isEmpty()) { if (OverrideImplementExploreUtil.getMethodSignaturesToOverride(aClass).isEmpty()) {
HintManager.getInstance().showErrorHint(editor, "No methods to override have been found"); HintManager.getInstance().showErrorHint(editor, "No methods to override have been found");
return; return;
} }
@@ -60,6 +46,6 @@ public class JavaOverrideMethodsHandler implements ContextAwareActionHandler, La
@Override @Override
public boolean isAvailableForQuickList(@NotNull Editor editor, @NotNull PsiFile file, @NotNull DataContext dataContext) { public boolean isAvailableForQuickList(@NotNull Editor editor, @NotNull PsiFile file, @NotNull DataContext dataContext) {
PsiClass aClass = OverrideImplementUtil.getContextClass(file.getProject(), editor, file, true); PsiClass aClass = OverrideImplementUtil.getContextClass(file.getProject(), editor, file, true);
return aClass != null && !OverrideImplementUtil.getMethodSignaturesToOverride(aClass).isEmpty(); return aClass != null && !OverrideImplementExploreUtil.getMethodSignaturesToOverride(aClass).isEmpty();
} }
} }
@@ -38,6 +38,7 @@ import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.text.CharArrayUtil; import com.intellij.util.text.CharArrayUtil;
import com.intellij.util.text.DateFormatUtil; import com.intellij.util.text.DateFormatUtil;
import com.intellij.util.ui.JBUI; import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.StartupUiUtil;
import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.UIUtil;
import org.jdom.Element; import org.jdom.Element;
import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NonNls;
@@ -654,7 +655,7 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta
css.addRule("p.problem-description-group {text-indent: " + JBUI.scale(9) + "px;font-weight:bold;}"); css.addRule("p.problem-description-group {text-indent: " + JBUI.scale(9) + "px;font-weight:bold;}");
css.addRule("div.problem-description {margin-left: " + JBUI.scale(9) + "px;}"); css.addRule("div.problem-description {margin-left: " + JBUI.scale(9) + "px;}");
css.addRule("ul {margin-left:" + JBUI.scale(10) + "px;text-indent: 0}"); css.addRule("ul {margin-left:" + JBUI.scale(10) + "px;text-indent: 0}");
css.addRule("code {font-family:" + UIUtil.getLabelFont().getFamily() + "}"); css.addRule("code {font-family:" + StartupUiUtil.getLabelFont().getFamily() + "}");
final StringBuffer buf = new StringBuffer(); final StringBuffer buf = new StringBuffer();
getComposer().compose(buf, entity, false); getComposer().compose(buf, entity, false);
final String text = buf.toString(); final String text = buf.toString();
@@ -1,6 +1,7 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.hierarchy.method; package com.intellij.ide.hierarchy.method;
import com.intellij.codeInsight.generation.OverrideImplementExploreUtil;
import com.intellij.codeInsight.generation.OverrideImplementUtil; import com.intellij.codeInsight.generation.OverrideImplementUtil;
import com.intellij.ide.hierarchy.HierarchyNodeDescriptor; import com.intellij.ide.hierarchy.HierarchyNodeDescriptor;
import com.intellij.ide.hierarchy.MethodHierarchyBrowserBase; import com.intellij.ide.hierarchy.MethodHierarchyBrowserBase;
@@ -132,8 +133,8 @@ abstract class OverrideImplementMethodAction extends AnAction {
final MethodSignature signature = baseMethod.getSignature(PsiSubstitutor.EMPTY); final MethodSignature signature = baseMethod.getSignature(PsiSubstitutor.EMPTY);
Collection<MethodSignature> allOriginalSignatures = toImplement Collection<MethodSignature> allOriginalSignatures = toImplement
? OverrideImplementUtil.getMethodSignaturesToImplement(psiClass) ? OverrideImplementExploreUtil.getMethodSignaturesToImplement(psiClass)
: OverrideImplementUtil.getMethodSignaturesToOverride(psiClass); : OverrideImplementExploreUtil.getMethodSignaturesToOverride(psiClass);
for (final MethodSignature originalSignature : allOriginalSignatures) { for (final MethodSignature originalSignature : allOriginalSignatures) {
if (originalSignature.equals(signature)) { if (originalSignature.equals(signature)) {
return true; return true;
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.util; package com.intellij.ide.util;
import com.intellij.ide.IdeBundle; import com.intellij.ide.IdeBundle;
@@ -8,7 +8,7 @@ import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module; import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtil; import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectBundle; import com.intellij.openapi.project.ProjectBundle;
import com.intellij.openapi.projectRoots.impl.ProjectRootUtil; import com.intellij.openapi.projectRoots.impl.ProjectRootUtil;
@@ -295,7 +295,7 @@ public class PackageUtil {
private static PsiDirectory getWritableModuleDirectory(@NotNull Query<? extends VirtualFile> vFiles, @NotNull Module module, PsiManager manager) { private static PsiDirectory getWritableModuleDirectory(@NotNull Query<? extends VirtualFile> vFiles, @NotNull Module module, PsiManager manager) {
for (VirtualFile vFile : vFiles) { for (VirtualFile vFile : vFiles) {
if (ModuleUtil.findModuleForFile(vFile, module.getProject()) != module) continue; if (ModuleUtilCore.findModuleForFile(vFile, module.getProject()) != module) continue;
PsiDirectory directory = manager.findDirectory(vFile); PsiDirectory directory = manager.findDirectory(vFile);
if (directory != null && directory.isValid() && directory.isWritable()) { if (directory != null && directory.isValid() && directory.isWritable()) {
return directory; return directory;
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.refactoring.extractMethod.preview; package com.intellij.refactoring.extractMethod.preview;
import com.intellij.openapi.editor.colors.EditorColorsScheme; import com.intellij.openapi.editor.colors.EditorColorsScheme;
@@ -8,7 +8,7 @@ import com.intellij.ui.SimpleTextAttributes;
import com.intellij.usageView.UsageTreeColors; import com.intellij.usageView.UsageTreeColors;
import com.intellij.usageView.UsageTreeColorsScheme; import com.intellij.usageView.UsageTreeColorsScheme;
import com.intellij.usages.TextChunk; import com.intellij.usages.TextChunk;
import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.StartupUiUtil;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -48,7 +48,7 @@ class PreviewTreeRenderer extends ColoredTreeCellRenderer {
append(node.getLineNumberChunk(), node); append(node.getLineNumberChunk(), node);
} }
else { else {
SimpleTextAttributes attributes = UIUtil.isUnderDarcula() ? ourInvalidAttributesDarcula : ourInvalidAttributes; SimpleTextAttributes attributes = StartupUiUtil.isUnderDarcula() ? ourInvalidAttributesDarcula : ourInvalidAttributes;
append("Invalid ", patchMainTextAttrs(attributes, node)); append("Invalid ", patchMainTextAttrs(attributes, node));
} }
@@ -1,24 +1,10 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2013 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 com.intellij.refactoring.extractSuperclass; package com.intellij.refactoring.extractSuperclass;
import com.intellij.codeInsight.generation.OverrideImplementExploreUtil; import com.intellij.codeInsight.generation.OverrideImplementExploreUtil;
import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module; import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtil; import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.DialogWrapper;
@@ -39,15 +25,11 @@ import com.intellij.refactoring.util.DocCommentPolicy;
import com.intellij.refactoring.util.RefactoringUtil; import com.intellij.refactoring.util.RefactoringUtil;
import com.intellij.refactoring.util.classMembers.MemberInfo; import com.intellij.refactoring.util.classMembers.MemberInfo;
import com.intellij.util.IncorrectOperationException; import com.intellij.util.IncorrectOperationException;
import java.util.HashMap;
import com.intellij.util.containers.MultiMap; import com.intellij.util.containers.MultiMap;
import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.Collection; import java.util.*;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/** /**
* @author dsl * @author dsl
@@ -238,7 +220,7 @@ public class ExtractSuperClassUtil {
final VirtualFile virtualFile = subclass.getContainingFile().getVirtualFile(); final VirtualFile virtualFile = subclass.getContainingFile().getVirtualFile();
if (virtualFile != null) { if (virtualFile != null) {
final boolean inTestSourceContent = ProjectRootManager.getInstance(subclass.getProject()).getFileIndex().isInTestSourceContent(virtualFile); final boolean inTestSourceContent = ProjectRootManager.getInstance(subclass.getProject()).getFileIndex().isInTestSourceContent(virtualFile);
final Module module = ModuleUtil.findModuleForFile(virtualFile, subclass.getProject()); final Module module = ModuleUtilCore.findModuleForFile(virtualFile, subclass.getProject());
if (targetDirectory != null && if (targetDirectory != null &&
module != null && module != null &&
!GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module, inTestSourceContent).contains(targetDirectory.getVirtualFile())) { !GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module, inTestSourceContent).contains(targetDirectory.getVirtualFile())) {
@@ -1,4 +1,4 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.refactoring.inline; package com.intellij.refactoring.inline;
import com.intellij.codeInsight.AnnotationUtil; import com.intellij.codeInsight.AnnotationUtil;
@@ -39,7 +39,7 @@ import com.intellij.refactoring.RefactoringBundle;
import com.intellij.refactoring.introduceParameter.Util; import com.intellij.refactoring.introduceParameter.Util;
import com.intellij.refactoring.listeners.RefactoringEventData; import com.intellij.refactoring.listeners.RefactoringEventData;
import com.intellij.refactoring.rename.NonCodeUsageInfoFactory; import com.intellij.refactoring.rename.NonCodeUsageInfoFactory;
import com.intellij.refactoring.rename.RenameJavaVariableProcessor; import com.intellij.refactoring.rename.RenameJavaMemberProcessor;
import com.intellij.refactoring.util.*; import com.intellij.refactoring.util.*;
import com.intellij.usageView.UsageInfo; import com.intellij.usageView.UsageInfo;
import com.intellij.usageView.UsageViewDescriptor; import com.intellij.usageView.UsageViewDescriptor;
@@ -206,8 +206,8 @@ public class InlineMethodProcessor extends BaseRefactoringProcessor {
final PsiMethod[] superMethods = myMethod.findSuperMethods(); final PsiMethod[] superMethods = myMethod.findSuperMethods();
for (PsiMethod method : superMethods) { for (PsiMethod method : superMethods) {
String className = Objects.requireNonNull(method.getContainingClass()).getQualifiedName(); String className = Objects.requireNonNull(method.getContainingClass()).getQualifiedName();
final String message = method.hasModifierProperty(PsiModifier.ABSTRACT) ? final String message = method.hasModifierProperty(PsiModifier.ABSTRACT) ?
RefactoringBundle.message("inlined.method.implements.method.from.0", className) : RefactoringBundle.message("inlined.method.implements.method.from.0", className) :
RefactoringBundle.message("inlined.method.overrides.method.from.0", className); RefactoringBundle.message("inlined.method.overrides.method.from.0", className);
conflicts.putValue(method, message); conflicts.putValue(method, message);
} }
@@ -751,7 +751,7 @@ public class InlineMethodProcessor extends BaseRefactoringProcessor {
if (myMethod.isPhysical()) { if (myMethod.isPhysical()) {
// Could be specialized // Could be specialized
LOG.assertTrue(myManager.areElementsEquivalent(resolveResult.getElement(), myMethod)); LOG.assertTrue(myManager.areElementsEquivalent(resolveResult.getElement(), myMethod));
} }
if (resolveResult.getSubstitutor() != PsiSubstitutor.EMPTY) { if (resolveResult.getSubstitutor() != PsiSubstitutor.EMPTY) {
Iterator<PsiTypeParameter> oldTypeParameters = PsiUtil.typeParametersIterator(myMethod); Iterator<PsiTypeParameter> oldTypeParameters = PsiUtil.typeParametersIterator(myMethod);
Iterator<PsiTypeParameter> newTypeParameters = PsiUtil.typeParametersIterator(myMethodCopy); Iterator<PsiTypeParameter> newTypeParameters = PsiUtil.typeParametersIterator(myMethodCopy);
@@ -1240,7 +1240,7 @@ public class InlineMethodProcessor extends BaseRefactoringProcessor {
if (modifiers != null && modifiers.getAnnotations().length != 0) return; if (modifiers != null && modifiers.getAnnotations().length != 0) return;
boolean effectivelyFinal = HighlightControlFlowUtil.isEffectivelyFinal(variable, context, null); boolean effectivelyFinal = HighlightControlFlowUtil.isEffectivelyFinal(variable, context, null);
if (!effectivelyFinal && !VariableAccessUtils.canUseAsNonFinal(target)) return; if (!effectivelyFinal && !VariableAccessUtils.canUseAsNonFinal(target)) return;
for (PsiReferenceExpression reference : references) { for (PsiReferenceExpression reference : references) {
ExpressionUtils.bindReferenceTo(reference, name); ExpressionUtils.bindReferenceTo(reference, name);
} }
@@ -1368,7 +1368,7 @@ public class InlineMethodProcessor extends BaseRefactoringProcessor {
PsiExpressionStatement statement = (PsiExpressionStatement)myFactory.createStatementFromText(field.getName() + " = 0;", body); PsiExpressionStatement statement = (PsiExpressionStatement)myFactory.createStatementFromText(field.getName() + " = 0;", body);
statement = (PsiExpressionStatement)body.add(statement); statement = (PsiExpressionStatement)body.add(statement);
final PsiAssignmentExpression assignment = (PsiAssignmentExpression)statement.getExpression(); final PsiAssignmentExpression assignment = (PsiAssignmentExpression)statement.getExpression();
assignment.getLExpression().replace(RenameJavaVariableProcessor.createMemberReference(field, assignment)); assignment.getLExpression().replace(RenameJavaMemberProcessor.createMemberReference(field, assignment));
assignment.getRExpression().replace(initializer); assignment.getRExpression().replace(initializer);
addMarkedElements(refsVector, statement); addMarkedElements(refsVector, statement);
if (field.hasModifierProperty(PsiModifier.STATIC)) { if (field.hasModifierProperty(PsiModifier.STATIC)) {
@@ -1,18 +1,4 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* 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 com.intellij.refactoring.introduceField; package com.intellij.refactoring.introduceField;
@@ -53,7 +39,7 @@ import com.intellij.refactoring.IntroduceHandlerBase;
import com.intellij.refactoring.RefactoringBundle; import com.intellij.refactoring.RefactoringBundle;
import com.intellij.refactoring.introduce.inplace.AbstractInplaceIntroducer; import com.intellij.refactoring.introduce.inplace.AbstractInplaceIntroducer;
import com.intellij.refactoring.introduceVariable.IntroduceVariableBase; import com.intellij.refactoring.introduceVariable.IntroduceVariableBase;
import com.intellij.refactoring.rename.RenameJavaVariableProcessor; import com.intellij.refactoring.rename.RenameJavaMemberProcessor;
import com.intellij.refactoring.util.CommonRefactoringUtil; import com.intellij.refactoring.util.CommonRefactoringUtil;
import com.intellij.refactoring.util.EnumConstantsUtil; import com.intellij.refactoring.util.EnumConstantsUtil;
import com.intellij.refactoring.util.RefactoringChangeUtil; import com.intellij.refactoring.util.RefactoringChangeUtil;
@@ -447,7 +433,7 @@ public abstract class BaseExpressionToFieldHandler extends IntroduceHandlerBase
final PsiExpression rExpression = expr.getRExpression(); final PsiExpression rExpression = expr.getRExpression();
LOG.assertTrue(rExpression != null); LOG.assertTrue(rExpression != null);
rExpression.replace(initializerExpr); rExpression.replace(initializerExpr);
final PsiReferenceExpression fieldReference = RenameJavaVariableProcessor.createMemberReference(field, context); final PsiReferenceExpression fieldReference = RenameJavaMemberProcessor.createMemberReference(field, context);
expr.getLExpression().replace(fieldReference); expr.getLExpression().replace(fieldReference);
return statement; return statement;
@@ -1,23 +1,9 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2016 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 com.intellij.refactoring.move.moveClassesOrPackages; package com.intellij.refactoring.move.moveClassesOrPackages;
import com.intellij.openapi.application.WriteAction; import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.module.Module; import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtil; import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFile;
@@ -98,7 +84,7 @@ public class AutocreatingSingleSourceRootMoveDestination extends AutocreatingMov
@Override @Override
public boolean isTargetAccessible(Project project, VirtualFile place) { public boolean isTargetAccessible(Project project, VirtualFile place) {
final boolean inTestSourceContent = ProjectRootManager.getInstance(project).getFileIndex().isInTestSourceContent(place); final boolean inTestSourceContent = ProjectRootManager.getInstance(project).getFileIndex().isInTestSourceContent(place);
final Module module = ModuleUtil.findModuleForFile(place, project); final Module module = ModuleUtilCore.findModuleForFile(place, project);
if (mySourceRoot != null && if (mySourceRoot != null &&
module != null && module != null &&
!GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module, inTestSourceContent).contains(mySourceRoot)) { !GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module, inTestSourceContent).contains(mySourceRoot)) {
@@ -1,11 +1,11 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.refactoring.move.moveClassesOrPackages; package com.intellij.refactoring.move.moveClassesOrPackages;
import com.intellij.ide.util.DirectoryChooser; import com.intellij.ide.util.DirectoryChooser;
import com.intellij.openapi.editor.event.DocumentEvent; import com.intellij.openapi.editor.event.DocumentEvent;
import com.intellij.openapi.editor.event.DocumentListener; import com.intellij.openapi.editor.event.DocumentListener;
import com.intellij.openapi.module.Module; import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtil; import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.JavaProjectRootsUtil; import com.intellij.openapi.roots.JavaProjectRootsUtil;
import com.intellij.openapi.roots.ProjectFileIndex; import com.intellij.openapi.roots.ProjectFileIndex;
@@ -71,7 +71,7 @@ public abstract class DestinationFolderComboBox extends ComboboxWithBrowseButton
if (element == NULL_WRAPPER) return LEAVE_IN_SAME_SOURCE_ROOT; if (element == NULL_WRAPPER) return LEAVE_IN_SAME_SOURCE_ROOT;
if (element instanceof DirectoryChooser.ItemWrapper) { if (element instanceof DirectoryChooser.ItemWrapper) {
final VirtualFile virtualFile = ((DirectoryChooser.ItemWrapper)element).getDirectory().getVirtualFile(); final VirtualFile virtualFile = ((DirectoryChooser.ItemWrapper)element).getDirectory().getVirtualFile();
final Module module = ModuleUtil.findModuleForFile(virtualFile, project); final Module module = ModuleUtilCore.findModuleForFile(virtualFile, project);
if (module != null) { if (module != null) {
return module.getName(); return module.getName();
} }
@@ -289,7 +289,7 @@ public abstract class DestinationFolderComboBox extends ComboboxWithBrowseButton
final VirtualFile virtualFile, final VirtualFile virtualFile,
final VirtualFile targetVirtualFile) { final VirtualFile targetVirtualFile) {
final boolean inTestSourceContent = ProjectRootManager.getInstance(project).getFileIndex().isInTestSourceContent(virtualFile); final boolean inTestSourceContent = ProjectRootManager.getInstance(project).getFileIndex().isInTestSourceContent(virtualFile);
final Module module = ModuleUtil.findModuleForFile(virtualFile, project); final Module module = ModuleUtilCore.findModuleForFile(virtualFile, project);
if (targetVirtualFile != null && if (targetVirtualFile != null &&
module != null && module != null &&
!GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module, inTestSourceContent).contains(targetVirtualFile)) { !GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module, inTestSourceContent).contains(targetVirtualFile)) {
@@ -1,18 +1,4 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2016 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 com.intellij.refactoring.move.moveClassesOrPackages; package com.intellij.refactoring.move.moveClassesOrPackages;
import com.intellij.ide.util.DirectoryChooserUtil; import com.intellij.ide.util.DirectoryChooserUtil;
@@ -26,7 +12,7 @@ import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.TextRange; import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*; import com.intellij.psi.*;
import com.intellij.psi.search.GlobalSearchScope; import com.intellij.psi.search.GlobalSearchScope;
@@ -185,7 +171,7 @@ public class MoveClassesOrPackagesUtil {
} }
final PsiDirectory subdirectoryInDest; final PsiDirectory subdirectoryInDest;
final boolean isSourceRoot = RefactoringUtil.isSourceRoot(dir); final boolean isSourceRoot = RefactoringUtil.isSourceRoot(dir);
if (VfsUtil.isAncestor(sourceVFile, destVFile, false) || isSourceRoot) { if (VfsUtilCore.isAncestor(sourceVFile, destVFile, false) || isSourceRoot) {
PsiDirectory exitsingSubdir = destination.findSubdirectory(targetName); PsiDirectory exitsingSubdir = destination.findSubdirectory(targetName);
if (exitsingSubdir == null) { if (exitsingSubdir == null) {
subdirectoryInDest = destination.createSubdirectory(targetName); subdirectoryInDest = destination.createSubdirectory(targetName);
@@ -273,7 +259,7 @@ public class MoveClassesOrPackagesUtil {
if (newPackage != null && file instanceof PsiClassOwner && !FileTypeUtils.isInServerPageFile(file) && if (newPackage != null && file instanceof PsiClassOwner && !FileTypeUtils.isInServerPageFile(file) &&
!PsiUtil.isModuleFile(file)) { !PsiUtil.isModuleFile(file)) {
String qualifiedName = newPackage.getQualifiedName(); String qualifiedName = newPackage.getQualifiedName();
if (!Comparing.strEqual(qualifiedName, ((PsiClassOwner)file).getPackageName()) && if (!Comparing.strEqual(qualifiedName, ((PsiClassOwner)file).getPackageName()) &&
(qualifiedName.isEmpty() || PsiNameHelper.getInstance(file.getProject()).isQualifiedName(qualifiedName))) { (qualifiedName.isEmpty() || PsiNameHelper.getInstance(file.getProject()).isQualifiedName(qualifiedName))) {
// Do not rely on class instance identity retention after setPackageName (Scala) // Do not rely on class instance identity retention after setPackageName (Scala)
String aClassName = aClass.getName(); String aClassName = aClass.getName();
@@ -370,7 +356,7 @@ public class MoveClassesOrPackagesUtil {
for (VirtualFile root : contentSourceRoots) { for (VirtualFile root : contentSourceRoots) {
if (!root.isDirectory()) continue; if (!root.isDirectory()) continue;
for (PsiDirectory directory : directories) { for (PsiDirectory directory : directories) {
if (VfsUtil.isAncestor(root, directory.getVirtualFile(), false)) { if (VfsUtilCore.isAncestor(root, directory.getVirtualFile(), false)) {
targetDirectories.add(directory); targetDirectories.add(directory);
continue sourceRoots; continue sourceRoots;
} }
@@ -1,23 +1,9 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2009 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 com.intellij.refactoring.move.moveClassesOrPackages; package com.intellij.refactoring.move.moveClassesOrPackages;
import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module; import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtil; import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFile;
@@ -90,7 +76,7 @@ public class SingleSourceRootMoveDestination implements MoveDestination {
@Override @Override
public boolean isTargetAccessible(Project project, VirtualFile place) { public boolean isTargetAccessible(Project project, VirtualFile place) {
final boolean inTestSourceContent = ProjectRootManager.getInstance(project).getFileIndex().isInTestSourceContent(place); final boolean inTestSourceContent = ProjectRootManager.getInstance(project).getFileIndex().isInTestSourceContent(place);
final Module module = ModuleUtil.findModuleForFile(place, project); final Module module = ModuleUtilCore.findModuleForFile(place, project);
final VirtualFile targetVirtualFile = myTargetDirectory.getVirtualFile(); final VirtualFile targetVirtualFile = myTargetDirectory.getVirtualFile();
if (module != null && if (module != null &&
!GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module, inTestSourceContent).contains(targetVirtualFile)) { !GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module, inTestSourceContent).contains(targetVirtualFile)) {
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.refactoring.util; package com.intellij.refactoring.util;
import com.intellij.codeInsight.ExpectedTypeInfo; import com.intellij.codeInsight.ExpectedTypeInfo;
@@ -18,7 +18,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.*; import com.intellij.openapi.util.*;
import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*; import com.intellij.psi.*;
import com.intellij.psi.codeStyle.CodeStyleManager; import com.intellij.psi.codeStyle.CodeStyleManager;
@@ -381,7 +381,7 @@ public class RefactoringUtil {
if (infos.length > 0) { if (infos.length > 0) {
type = infos[0].getType(); type = infos[0].getType();
if (type instanceof PsiPrimitiveType) { if (type instanceof PsiPrimitiveType) {
type = infos.length > 1 && !(infos[1].getType() instanceof PsiPrimitiveType) ? infos[1].getType() type = infos.length > 1 && !(infos[1].getType() instanceof PsiPrimitiveType) ? infos[1].getType()
: ((PsiPrimitiveType)type).getBoxedType(expr); : ((PsiPrimitiveType)type).getBoxedType(expr);
} }
} }
@@ -1210,7 +1210,7 @@ public class RefactoringUtil {
throws IncorrectOperationException { throws IncorrectOperationException {
final PsiDirectory[] directories = aPackage.getDirectories(); final PsiDirectory[] directories = aPackage.getDirectories();
for (PsiDirectory directory : directories) { for (PsiDirectory directory : directories) {
if (VfsUtil.isAncestor(sourceRoot, directory.getVirtualFile(), false)) { if (VfsUtilCore.isAncestor(sourceRoot, directory.getVirtualFile(), false)) {
return directory; return directory;
} }
} }
@@ -1252,7 +1252,7 @@ public class RefactoringUtil {
public static PsiDirectory findPackageDirectoryInSourceRoot(PackageWrapper aPackage, final VirtualFile sourceRoot) { public static PsiDirectory findPackageDirectoryInSourceRoot(PackageWrapper aPackage, final VirtualFile sourceRoot) {
final PsiDirectory[] directories = aPackage.getDirectories(); final PsiDirectory[] directories = aPackage.getDirectories();
for (PsiDirectory directory : directories) { for (PsiDirectory directory : directories) {
if (VfsUtil.isAncestor(sourceRoot, directory.getVirtualFile(), false)) { if (VfsUtilCore.isAncestor(sourceRoot, directory.getVirtualFile(), false)) {
return directory; return directory;
} }
} }
@@ -1,18 +1,4 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2014 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 com.intellij.ide.structureView.impl.java; package com.intellij.ide.structureView.impl.java;
import com.intellij.ide.structureView.StructureViewTreeElement; import com.intellij.ide.structureView.StructureViewTreeElement;
@@ -29,7 +15,7 @@ import com.intellij.psi.impl.light.LightElement;
import com.intellij.psi.search.searches.SuperMethodsSearch; import com.intellij.psi.search.searches.SuperMethodsSearch;
import com.intellij.psi.util.MethodSignatureBackedByPsiMethod; import com.intellij.psi.util.MethodSignatureBackedByPsiMethod;
import com.intellij.psi.util.PsiFormatUtil; import com.intellij.psi.util.PsiFormatUtil;
import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.StartupUiUtil;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
@@ -80,9 +66,9 @@ public class PsiMethodTreeElement extends JavaClassTreeElementBase<PsiMethod> im
final PsiMethod psiMethod = getElement(); final PsiMethod psiMethod = getElement();
if (psiMethod == null) return ""; if (psiMethod == null) return "";
final boolean dumb = DumbService.isDumb(psiMethod.getProject()); final boolean dumb = DumbService.isDumb(psiMethod.getProject());
String method = PsiFormatUtil.formatMethod(psiMethod, String method = PsiFormatUtil.formatMethod(psiMethod,
PsiSubstitutor.EMPTY, PsiSubstitutor.EMPTY,
SHOW_NAME | TYPE_AFTER | SHOW_PARAMETERS | (dumb ? 0 : SHOW_TYPE), SHOW_NAME | TYPE_AFTER | SHOW_PARAMETERS | (dumb ? 0 : SHOW_TYPE),
dumb ? SHOW_NAME : SHOW_TYPE); dumb ? SHOW_NAME : SHOW_TYPE);
return StringUtil.replace(method, ":", ": "); return StringUtil.replace(method, ":", ": ");
} }
@@ -116,7 +102,7 @@ public class PsiMethodTreeElement extends JavaClassTreeElementBase<PsiMethod> im
myLocation = ""; myLocation = "";
} else { } else {
char upArrow = '\u2191'; char upArrow = '\u2191';
myLocation = UIUtil.getLabelFont().canDisplay(upArrow) ? upArrow + myLocation : myLocation; myLocation = StartupUiUtil.getLabelFont().canDisplay(upArrow) ? upArrow + myLocation : myLocation;
} }
} }
} }
@@ -1,18 +1,4 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* 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 com.intellij.java.psi; package com.intellij.java.psi;
import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ApplicationManager;
@@ -24,6 +10,7 @@ import com.intellij.openapi.roots.LanguageLevelProjectExtension;
import com.intellij.openapi.roots.impl.PushedFilePropertiesUpdater; import com.intellij.openapi.roots.impl.PushedFilePropertiesUpdater;
import com.intellij.openapi.util.Conditions; import com.intellij.openapi.util.Conditions;
import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.pom.java.LanguageLevel; import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.*; import com.intellij.psi.*;
@@ -104,7 +91,7 @@ public class MiscPsiTest extends LightCodeInsightFixtureTestCase {
PsiFile newFile = (PsiFile)dir.add(fileCopy); PsiFile newFile = (PsiFile)dir.add(fileCopy);
assertInstanceOf(newFile, PsiPlainTextFile.class); assertInstanceOf(newFile, PsiPlainTextFile.class);
assertEquals(text, VfsUtil.loadText(newFile.getVirtualFile())); assertEquals(text, VfsUtilCore.loadText(newFile.getVirtualFile()));
assertEquals(newFile.getVirtualFile().getModificationStamp(), newFile.getViewProvider().getModificationStamp()); assertEquals(newFile.getVirtualFile().getModificationStamp(), newFile.getViewProvider().getModificationStamp());
assertFalse(FileDocumentManager.getInstance().isFileModified(newFile.getVirtualFile())); assertFalse(FileDocumentManager.getInstance().isFileModified(newFile.getVirtualFile()));
} }
@@ -356,7 +343,7 @@ public class MiscPsiTest extends LightCodeInsightFixtureTestCase {
catch (Throwable e) { catch (Throwable e) {
assertTrue(e.getMessage(), e.getMessage().contains("Wrong line separators")); assertTrue(e.getMessage(), e.getMessage().contains("Wrong line separators"));
} }
assertEquals("class A{}", getPsiManager().findFile(vFile).getText()); assertEquals("class A{}", getPsiManager().findFile(vFile).getText());
VfsUtil.saveText(vFile, "class C {}"); VfsUtil.saveText(vFile, "class C {}");
@@ -1,18 +1,4 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* 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 com.intellij.java.psi; package com.intellij.java.psi;
import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ApplicationManager;
@@ -24,7 +10,7 @@ import com.intellij.psi.JavaDirectoryService;
import com.intellij.psi.PsiDirectory; import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile; import com.intellij.psi.PsiFile;
import com.intellij.psi.util.PsiUtilBase; import com.intellij.psi.util.PsiUtilCore;
import com.intellij.testFramework.PsiTestCase; import com.intellij.testFramework.PsiTestCase;
import com.intellij.testFramework.PsiTestUtil; import com.intellij.testFramework.PsiTestUtil;
@@ -109,7 +95,7 @@ public class OverlappingSourceRootsTest extends PsiTestCase {
} }
private PsiDirectory findSourceRootDirectory(PsiElement element) { private PsiDirectory findSourceRootDirectory(PsiElement element) {
final VirtualFile virtualFile = PsiUtilBase.getVirtualFile(element); final VirtualFile virtualFile = PsiUtilCore.getVirtualFile(element);
final VirtualFile sourceRoot = ProjectRootManager.getInstance(myProject).getFileIndex().getSourceRootForFile(virtualFile); final VirtualFile sourceRoot = ProjectRootManager.getInstance(myProject).getFileIndex().getSourceRootForFile(virtualFile);
return myPsiManager.findDirectory(sourceRoot); return myPsiManager.findDirectory(sourceRoot);
} }
@@ -18,7 +18,7 @@ import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.ModuleRootManager; import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.ModuleRootModificationUtil; import com.intellij.openapi.roots.ModuleRootModificationUtil;
import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiClass; import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiDocumentManager;
@@ -127,7 +127,7 @@ public class FindClassTest extends PsiTestCase {
FileDocumentManager.getInstance().saveAllDocuments(); FileDocumentManager.getInstance().saveAllDocuments();
PsiClass psiClass = myJavaFacade.findClass("p.A"); PsiClass psiClass = myJavaFacade.findClass("p.A");
final VirtualFile vFile = psiClass.getContainingFile().getVirtualFile(); final VirtualFile vFile = psiClass.getContainingFile().getVirtualFile();
File ioFile = VfsUtil.virtualToIoFile(vFile); File ioFile = VfsUtilCore.virtualToIoFile(vFile);
ioFile.setLastModified(5); ioFile.setLastModified(5);
LocalFileSystem.getInstance().refresh(false); LocalFileSystem.getInstance().refresh(false);
@@ -1,23 +1,9 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* 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 com.intellij.java.psi.impl.cache.impl; package com.intellij.java.psi.impl.cache.impl;
import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.module.Module; import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtil; import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiClass; import com.intellij.psi.PsiClass;
@@ -68,14 +54,14 @@ public class SameSourceRootInTwoModulesTest extends PsiTestCase {
assertEquals(psiFile, psiClass.getContainingFile()); assertEquals(psiFile, psiClass.getContainingFile());
VirtualFile file = psiFile.getVirtualFile(); VirtualFile file = psiFile.getVirtualFile();
assertEquals(myModule, ModuleUtil.findModuleForFile(file, myProject)); assertEquals(myModule, ModuleUtilCore.findModuleForFile(file, myProject));
Module anotherModule = createModule("another"); Module anotherModule = createModule("another");
myFilesToDelete.add(new File(anotherModule.getModuleFilePath())); myFilesToDelete.add(new File(anotherModule.getModuleFilePath()));
PsiTestUtil.addSourceRoot(anotherModule, mySrcDir1); PsiTestUtil.addSourceRoot(anotherModule, mySrcDir1);
assertEquals(anotherModule, ModuleUtil.findModuleForFile(file, myProject)); assertEquals(anotherModule, ModuleUtilCore.findModuleForFile(file, myProject));
}); });
} }
} }
@@ -198,7 +198,7 @@ public class SliceTreeTest extends SliceTestCase {
public void testNullness() throws Exception { public void testNullness() throws Exception {
SliceTreeStructure treeStructure = configureTree("Nulls"); SliceTreeStructure treeStructure = configureTree("Nulls");
final SliceRootNode root = (SliceRootNode)treeStructure.getRootElement(); final SliceRootNode root = (SliceRootNode)treeStructure.getRootElement();
Map<SliceNode, JavaSliceNullnessAnalyzer.NullAnalysisResult> map = JavaSliceNullnessAnalyzer.createMap(); Map<SliceNode, JavaSliceNullnessAnalyzer.NullAnalysisResult> map = SliceNullnessAnalyzerBase.createMap();
JavaSliceNullnessAnalyzer analyzer = new JavaSliceNullnessAnalyzer(); JavaSliceNullnessAnalyzer analyzer = new JavaSliceNullnessAnalyzer();
JavaSliceNullnessAnalyzer.NullAnalysisResult leaves = analyzer.calcNullableLeaves(root, treeStructure, map); JavaSliceNullnessAnalyzer.NullAnalysisResult leaves = analyzer.calcNullableLeaves(root, treeStructure, map);
@@ -319,7 +319,7 @@ public class SliceTreeTest extends SliceTestCase {
public void testDoubleNullness() throws Exception { public void testDoubleNullness() throws Exception {
SliceTreeStructure treeStructure = configureTree("DoubleNulls"); SliceTreeStructure treeStructure = configureTree("DoubleNulls");
final SliceRootNode root = (SliceRootNode)treeStructure.getRootElement(); final SliceRootNode root = (SliceRootNode)treeStructure.getRootElement();
Map<SliceNode, JavaSliceNullnessAnalyzer.NullAnalysisResult> map = JavaSliceNullnessAnalyzer.createMap(); Map<SliceNode, JavaSliceNullnessAnalyzer.NullAnalysisResult> map = SliceNullnessAnalyzerBase.createMap();
JavaSliceNullnessAnalyzer analyzer = new JavaSliceNullnessAnalyzer(); JavaSliceNullnessAnalyzer analyzer = new JavaSliceNullnessAnalyzer();
JavaSliceNullnessAnalyzer.NullAnalysisResult leaves = analyzer.calcNullableLeaves(root, treeStructure, map); JavaSliceNullnessAnalyzer.NullAnalysisResult leaves = analyzer.calcNullableLeaves(root, treeStructure, map);
@@ -1,22 +1,9 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* 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.
* 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 jetbrains.antlayout.datatypes; package jetbrains.antlayout.datatypes;
import org.apache.tools.ant.Main; import org.apache.tools.ant.Main;
import org.apache.tools.ant.taskdefs.*; import org.apache.tools.ant.taskdefs.*;
import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.ZipFileSet; import org.apache.tools.ant.types.ZipFileSet;
import java.io.File; import java.io.File;
@@ -36,7 +23,7 @@ public class JarContainer extends ZipContainer {
task = new Jar(); task = new Jar();
} }
task.setTaskName("jar"); task.setTaskName("jar");
task.setWhenmanifestonly((Zip.WhenEmpty) Zip.WhenEmpty.getInstance(Zip.WhenEmpty.class, "skip")); task.setWhenmanifestonly((Zip.WhenEmpty)EnumeratedAttribute.getInstance(Zip.WhenEmpty.class, "skip"));
return task; return task;
} }
@@ -3,7 +3,7 @@
package com.intellij.ui; package com.intellij.ui;
import com.intellij.util.ui.JBUI; import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.StartupUiUtil;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -15,7 +15,7 @@ import java.awt.event.MouseEvent;
public class CaptionPanel extends JPanel { public class CaptionPanel extends JPanel {
public static final Color CNT_ACTIVE_COLOR = new JBColor(Gray._202, Gray._55); public static final Color CNT_ACTIVE_COLOR = new JBColor(Gray._202, Gray._55);
public static final Color CNT_ACTIVE_BORDER_COLOR = new JBColor(() -> UIUtil.isUnderDarcula() ? JBColor.border() : CNT_ACTIVE_COLOR); public static final Color CNT_ACTIVE_BORDER_COLOR = new JBColor(() -> StartupUiUtil.isUnderDarcula() ? JBColor.border() : CNT_ACTIVE_COLOR);
/** /**
* @deprecated use {@link JBUI.CurrentTheme.Popup#borderColor} instead, * @deprecated use {@link JBUI.CurrentTheme.Popup#borderColor} instead,
@@ -2,6 +2,7 @@
package com.intellij.ui; package com.intellij.ui;
import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.StartupUiUtil;
import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NonNls;
@@ -73,7 +74,7 @@ public class CollapsiblePanel extends JPanel {
0)); 0));
if (title != null) { if (title != null) {
myTitleLabel = new Label(title); myTitleLabel = new Label(title);
myTitleLabel.setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD)); myTitleLabel.setFont(StartupUiUtil.getLabelFont().deriveFont(Font.BOLD));
myTitleLabel.setBackground(content.getBackground()); myTitleLabel.setBackground(content.getBackground());
add(myTitleLabel, add(myTitleLabel,
new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0,
@@ -5,7 +5,7 @@
*/ */
package com.intellij.ui; package com.intellij.ui;
import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.StartupUiUtil;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@@ -27,7 +27,7 @@ public class EngravedLabel extends JLabel {
@Override @Override
protected void paintComponent(Graphics graphics) { protected void paintComponent(Graphics graphics) {
if (!UIUtil.isUnderDarcula()) { if (!StartupUiUtil.isUnderDarcula()) {
graphics = new EngravedTextGraphics((Graphics2D)graphics, 0, 1, getShadowColor()); graphics = new EngravedTextGraphics((Graphics2D)graphics, 0, 1, getShadowColor());
} }
super.paintComponent(graphics); super.paintComponent(graphics);
@@ -3,6 +3,7 @@ package com.intellij.ui;
import com.intellij.util.NotNullProducer; import com.intellij.util.NotNullProducer;
import com.intellij.util.ui.JBUI; import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.StartupUiUtil;
import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -25,7 +26,7 @@ public class JBColor extends Color {
public static final Color PanelBackground = namedColor("Panel.background", 0xffffff); public static final Color PanelBackground = namedColor("Panel.background", 0xffffff);
private static class Lazy { private static class Lazy {
private static volatile boolean DARK = UIUtil.isUnderDarcula(); private static volatile boolean DARK = StartupUiUtil.isUnderDarcula();
} }
private final Color darkColor; private final Color darkColor;
@@ -322,7 +323,7 @@ public class JBColor extends Color {
private static final Map<String, Color> defaultThemeColors = new HashMap<>(); private static final Map<String, Color> defaultThemeColors = new HashMap<>();
@NotNull @NotNull
public static Color get(@NotNull final String colorId, @NotNull final Color defaultColor) { public static Color get(@NotNull final String colorId, @NotNull final Color defaultColor) {
return new JBColor(() -> { return new JBColor(() -> {
Color color = defaultThemeColors.get(colorId); Color color = defaultThemeColors.get(colorId);
@@ -6,7 +6,7 @@ import com.intellij.ui.paint.PaintUtil.ParityMode;
import com.intellij.ui.paint.PaintUtil.RoundingMode; import com.intellij.ui.paint.PaintUtil.RoundingMode;
import com.intellij.util.ui.JBUIScale.ScaleContext; import com.intellij.util.ui.JBUIScale.ScaleContext;
import com.intellij.util.ui.JBUIScale.ScaleType; import com.intellij.util.ui.JBUIScale.ScaleType;
import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.StartupUiUtil;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -266,7 +266,7 @@ public class LinePainter2D {
@NotNull Object valueAA) @NotNull Object valueAA)
{ {
double x1, x2, y1, y2; double x1, x2, y1, y2;
boolean thickPixel = UIUtil.isJreHiDPIEnabled() && PaintUtil.devValue(strokeWidth, g) > 1; boolean thickPixel = StartupUiUtil.isJreHiDPIEnabled() && PaintUtil.devValue(strokeWidth, g) > 1;
boolean prevStraight = nPoints <= 1 || isStraightLine(xPoints, yPoints, nPoints, nPoints); boolean prevStraight = nPoints <= 1 || isStraightLine(xPoints, yPoints, nPoints, nPoints);
for (int p = 0; p < nPoints; p++) { for (int p = 0; p < nPoints; p++) {
@@ -1,7 +1,7 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.util; package com.intellij.util;
import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.StartupUiUtil;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.awt.*; import java.awt.*;
@@ -36,7 +36,7 @@ public class FontUtil {
@NotNull @NotNull
public static String thinSpace() { public static String thinSpace() {
return canDisplay(UIUtil.getLabelFont(), '\u2009', " "); return canDisplay(StartupUiUtil.getLabelFont(), '\u2009', " ");
} }
@NotNull @NotNull
@@ -14,7 +14,7 @@ import com.intellij.util.ui.EmptyIcon;
import com.intellij.util.ui.ImageUtil; import com.intellij.util.ui.ImageUtil;
import com.intellij.util.ui.JBUI; import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.JBUIScale.ScaleContext; import com.intellij.util.ui.JBUIScale.ScaleContext;
import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.StartupUiUtil;
import org.apache.xmlgraphics.java2d.Dimension2DDouble; import org.apache.xmlgraphics.java2d.Dimension2DDouble;
import org.imgscalr.Scalr; import org.imgscalr.Scalr;
import org.intellij.lang.annotations.MagicConstant; import org.intellij.lang.annotations.MagicConstant;
@@ -428,7 +428,7 @@ public final class ImageLoader implements Serializable {
if (useCache) { if (useCache) {
flags |= USE_CACHE; flags |= USE_CACHE;
} }
if (UIUtil.isUnderDarcula()) { if (StartupUiUtil.isUnderDarcula()) {
flags |= DARK; flags |= DARK;
} }
return loadFromUrl(url, null, flags, filters, ctx); return loadFromUrl(url, null, flags, filters, ctx);
@@ -526,7 +526,7 @@ public final class ImageLoader implements Serializable {
public static Image loadFromResource(@NonNls @NotNull String path, @NotNull Class aClass) { public static Image loadFromResource(@NonNls @NotNull String path, @NotNull Class aClass) {
ScaleContext scaleContext = ScaleContext.create(); ScaleContext scaleContext = ScaleContext.create();
int flags = FIND_SVG | ALLOW_FLOAT_SCALING; int flags = FIND_SVG | ALLOW_FLOAT_SCALING;
if (UIUtil.isUnderDarcula()) { if (StartupUiUtil.isUnderDarcula()) {
flags |= DARK; flags |= DARK;
} }
return ImageDescriptorList.create(path, flags, scaleContext) return ImageDescriptorList.create(path, flags, scaleContext)
@@ -70,7 +70,7 @@ public class AppleBoldDottedPainter {
try { try {
g.setComposite(AlphaComposite.SrcOver); g.setComposite(AlphaComposite.SrcOver);
g.setClip(lineClip); g.setClip(lineClip);
UIUtil.drawImage(g, myImage, dotX0, y, null); StartupUiUtil.drawImage(g, myImage, dotX0, y, null);
} }
finally { finally {
g.setComposite(oldComposite); g.setComposite(oldComposite);
@@ -131,7 +131,7 @@ public class ImageUtil {
@Contract("null, _ -> null; !null, _ -> !null") @Contract("null, _ -> null; !null, _ -> !null")
public static Image ensureHiDPI(@Nullable Image image, @NotNull ScaleContext ctx) { public static Image ensureHiDPI(@Nullable Image image, @NotNull ScaleContext ctx) {
if (image == null) return null; if (image == null) return null;
if (UIUtil.isJreHiDPI(ctx)) { if (StartupUiUtil.isJreHiDPI(ctx)) {
return RetinaImage.createFrom(image, ctx.getScale(SYS_SCALE), null); return RetinaImage.createFrom(image, ctx.getScale(SYS_SCALE), null);
} }
return image; return image;
@@ -162,7 +162,7 @@ public class ImageUtil {
@Contract("null, _, _, _ -> null; !null, _, _, _ -> !null") @Contract("null, _, _, _ -> null; !null, _, _, _ -> !null")
public static Image ensureHiDPI(@Nullable Image image, @NotNull ScaleContext ctx, double userWidth, double userHeight) { public static Image ensureHiDPI(@Nullable Image image, @NotNull ScaleContext ctx, double userWidth, double userHeight) {
if (image == null) return null; if (image == null) return null;
if (UIUtil.isJreHiDPI(ctx)) { if (StartupUiUtil.isJreHiDPI(ctx)) {
return new JBHiDPIScaledImage(image, userWidth, userHeight, BufferedImage.TYPE_INT_ARGB); return new JBHiDPIScaledImage(image, userWidth, userHeight, BufferedImage.TYPE_INT_ARGB);
} }
return image; return image;
@@ -21,6 +21,6 @@ public class JBImageIcon extends ImageIcon {
public synchronized void paintIcon(final Component c, final Graphics g, final int x, final int y) { public synchronized void paintIcon(final Component c, final Graphics g, final int x, final int y) {
final ImageObserver observer = getImageObserver(); final ImageObserver observer = getImageObserver();
UIUtil.drawImage(g, getImage(), x, y, observer == null ? c : observer); StartupUiUtil.drawImage(g, getImage(), x, y, observer == null ? c : observer);
} }
} }
@@ -631,7 +631,7 @@ public class JBUIScale {
@Override @Override
public double getScale(@NotNull DerivedScaleType type) { public double getScale(@NotNull DerivedScaleType type) {
switch (type) { switch (type) {
case DEV_SCALE: return UIUtil.isJreHiDPIEnabled() ? sysScale.value : 1; case DEV_SCALE: return StartupUiUtil.isJreHiDPIEnabled() ? sysScale.value : 1;
case EFF_USR_SCALE: return usrScale.value * objScale.value; case EFF_USR_SCALE: return usrScale.value * objScale.value;
case PIX_SCALE: return pixScale; case PIX_SCALE: return pixScale;
} }
@@ -127,7 +127,7 @@ public interface RegionPainter<T> {
updateImage(myImage); updateImage(myImage);
} }
if (myImage != null) { if (myImage != null) {
UIUtil.drawImage(g, myImage, null, x, y); StartupUiUtil.drawImage(g, myImage, null, x, y);
} }
} }
} }
@@ -120,7 +120,8 @@ public class ThreeStateCheckBox extends JCheckBox {
@Override @Override
protected void paintComponent(Graphics g) { protected void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
if (UIUtil.isUnderAquaLookAndFeel() || UIUtil.isUnderDefaultMacTheme() || UIUtil.isUnderWin10LookAndFeel() || UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF()) { if (UIUtil.isUnderAquaLookAndFeel() || UIUtil.isUnderDefaultMacTheme() || UIUtil.isUnderWin10LookAndFeel() ||
StartupUiUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF()) {
return; return;
} }
@@ -129,7 +130,7 @@ public class ThreeStateCheckBox extends JCheckBox {
if (icon == null) { if (icon == null) {
icon = UIManager.getIcon("CheckBox.icon"); icon = UIManager.getIcon("CheckBox.icon");
} }
if (UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF()) { if (StartupUiUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF()) {
icon = JBUI.scale(EmptyIcon.create(20, 18)); icon = JBUI.scale(EmptyIcon.create(20, 18));
} }
if (icon != null) { if (icon != null) {
@@ -66,7 +66,7 @@ public class WavePainter2D extends WavePainter {
g2d.setClip(waveClip); g2d.setClip(waveClip);
xStart -= xStart % 4; xStart -= xStart % 4;
g2d.translate(xStart, y - 3); g2d.translate(xStart, y - 3);
UIUtil.drawImage(g2d, myImage, 0, 0, null); StartupUiUtil.drawImage(g2d, myImage, 0, 0, null);
} finally { } finally {
g2d.dispose(); g2d.dispose();
} }
@@ -7,6 +7,7 @@ import com.intellij.openapi.util.Conditions;
import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.util.registry.Registry;
import com.intellij.util.ui.JBUI; import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.MouseEventAdapter; import com.intellij.util.ui.MouseEventAdapter;
import com.intellij.util.ui.StartupUiUtil;
import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -229,7 +230,7 @@ public class WideSelectionTreeUI extends BasicTreeUI {
} }
private boolean shouldPaintLines() { private boolean shouldPaintLines() {
if (UIUtil.isUnderAquaBasedLookAndFeel() || UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF()) { if (UIUtil.isUnderAquaBasedLookAndFeel() || StartupUiUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF()) {
return false; return false;
} }
return myForceDontPaintLines || !"None".equals(tree.getClientProperty("JTree.lineStyle")); return myForceDontPaintLines || !"None".equals(tree.getClientProperty("JTree.lineStyle"));
@@ -304,7 +305,7 @@ public class WideSelectionTreeUI extends BasicTreeUI {
} }
} }
else { else {
if (selected && (UIUtil.isUnderAquaBasedLookAndFeel() || UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF())) { if (selected && (UIUtil.isUnderAquaBasedLookAndFeel() || StartupUiUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF())) {
Color bg = getSelectionBackground(tree, true); Color bg = getSelectionBackground(tree, true);
if (myWideSelectionCondition.value(row)) { if (myWideSelectionCondition.value(row)) {
@@ -328,7 +329,7 @@ public class WideSelectionTreeUI extends BasicTreeUI {
@Override @Override
public void paint(Graphics g, JComponent c) { public void paint(Graphics g, JComponent c) {
if (myWideSelection && !UIUtil.isUnderAquaBasedLookAndFeel() && !UIUtil.isUnderDarcula() && !UIUtil.isUnderIntelliJLaF()) { if (myWideSelection && !UIUtil.isUnderAquaBasedLookAndFeel() && !StartupUiUtil.isUnderDarcula() && !UIUtil.isUnderIntelliJLaF()) {
paintSelectedRows(g, ((JTree)c)); paintSelectedRows(g, ((JTree)c));
} }
if (myWideSelection) { if (myWideSelection) {
@@ -1,22 +1,8 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2014 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 com.jetbrains.python.psi.impl; package com.jetbrains.python.psi.impl;
import com.intellij.openapi.module.Module; import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtil; import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiClass; import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElement;
@@ -36,7 +22,7 @@ public class PyJavaImportCandidateProvider implements PyImportCandidateProvider
public void addImportCandidates(PsiReference reference, String name, AutoImportQuickFix quickFix) { public void addImportCandidates(PsiReference reference, String name, AutoImportQuickFix quickFix) {
final PsiElement element = reference.getElement(); final PsiElement element = reference.getElement();
final Project project = element.getProject(); final Project project = element.getProject();
Module module = ModuleUtil.findModuleForPsiElement(element); Module module = ModuleUtilCore.findModuleForPsiElement(element);
GlobalSearchScope scope = module == null ? ProjectScope.getAllScope(project) : module.getModuleWithDependenciesAndLibrariesScope(false); GlobalSearchScope scope = module == null ? ProjectScope.getAllScope(project) : module.getModuleWithDependenciesAndLibrariesScope(false);
PsiShortNamesCache cache = PsiShortNamesCache.getInstance(project); PsiShortNamesCache cache = PsiShortNamesCache.getInstance(project);
final PsiClass[] classesByName = cache.getClassesByName(name, scope); final PsiClass[] classesByName = cache.getClassesByName(name, scope);
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.rest.run.docutils; package com.jetbrains.rest.run.docutils;
import com.intellij.execution.Location; import com.intellij.execution.Location;
@@ -6,7 +6,7 @@ import com.intellij.execution.RunnerAndConfigurationSettings;
import com.intellij.execution.actions.ConfigurationContext; import com.intellij.execution.actions.ConfigurationContext;
import com.intellij.execution.junit.RuntimeConfigurationProducer; import com.intellij.execution.junit.RuntimeConfigurationProducer;
import com.intellij.openapi.module.Module; import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtil; import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.LocalFileSystem;
@@ -40,7 +40,7 @@ public class DocutilsConfigurationProducer extends RuntimeConfigurationProducer
if (script == null || script.getFileType() != RestFileType.INSTANCE) { if (script == null || script.getFileType() != RestFileType.INSTANCE) {
return null; return null;
} }
Module module = ModuleUtil.findModuleForPsiElement(script); Module module = ModuleUtilCore.findModuleForPsiElement(script);
storeSourceElement(script); storeSourceElement(script);
final Project project = script.getProject(); final Project project = script.getProject();
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.rest.run.sphinx; package com.jetbrains.rest.run.sphinx;
import com.intellij.execution.Location; import com.intellij.execution.Location;
@@ -6,7 +6,7 @@ import com.intellij.execution.RunnerAndConfigurationSettings;
import com.intellij.execution.actions.ConfigurationContext; import com.intellij.execution.actions.ConfigurationContext;
import com.intellij.execution.junit.RuntimeConfigurationProducer; import com.intellij.execution.junit.RuntimeConfigurationProducer;
import com.intellij.openapi.module.Module; import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtil; import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFile;
@@ -65,7 +65,7 @@ public class SphinxConfigurationProducer extends RuntimeConfigurationProducer im
configuration.setWorkingDirectory(parent.getPath()); configuration.setWorkingDirectory(parent.getPath());
} }
configuration.setName(configuration.suggestedName()); configuration.setName(configuration.suggestedName());
Module module = ModuleUtil.findModuleForPsiElement(element); Module module = ModuleUtilCore.findModuleForPsiElement(element);
if (module != null) { if (module != null) {
configuration.setUseModuleSdk(true); configuration.setUseModuleSdk(true);
configuration.setModule(module); configuration.setModule(module);
@@ -5,7 +5,7 @@ import com.intellij.lang.xml.XMLLanguage;
import com.intellij.openapi.fileTypes.INativeFileType; import com.intellij.openapi.fileTypes.INativeFileType;
import com.intellij.openapi.fileTypes.LanguageFileType; import com.intellij.openapi.fileTypes.LanguageFileType;
import com.intellij.openapi.module.Module; import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtil; import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.ui.Messages; import com.intellij.openapi.ui.Messages;
@@ -76,7 +76,7 @@ public abstract class QtFileType extends LanguageFileType implements INativeFile
@Override @Override
public boolean openFileInAssociatedApplication(Project project, @NotNull VirtualFile file) { public boolean openFileInAssociatedApplication(Project project, @NotNull VirtualFile file) {
String qtTool = findQtTool(ModuleUtil.findModuleForFile(file, project), getToolName()); String qtTool = findQtTool(ModuleUtilCore.findModuleForFile(file, project), getToolName());
if (qtTool == null) { if (qtTool == null) {
return false; return false;
} }
@@ -198,7 +198,7 @@ public class BuildoutFacet extends LibraryContributingFacet<BuildoutFacetConfigu
*/ */
@Nullable @Nullable
public static List<String> extractFromScript(@NotNull VirtualFile script) throws IOException { public static List<String> extractFromScript(@NotNull VirtualFile script) throws IOException {
String text = VfsUtil.loadText(script); String text = VfsUtilCore.loadText(script);
Pattern pat = Pattern.compile("(?:^\\s*(['\"])(.*)(\\1),\\s*$)|(\\])", Pattern.MULTILINE); Pattern pat = Pattern.compile("(?:^\\s*(['\"])(.*)(\\1),\\s*$)|(\\])", Pattern.MULTILINE);
final String bait_string = "sys.path[0:0]"; final String bait_string = "sys.path[0:0]";
int pos = text.indexOf(bait_string); int pos = text.indexOf(bait_string);
@@ -231,7 +231,7 @@ public class BuildoutFacet extends LibraryContributingFacet<BuildoutFacetConfigu
*/ */
public static List<String> extractFromSitePy(VirtualFile vFile) throws IOException { public static List<String> extractFromSitePy(VirtualFile vFile) throws IOException {
List<String> result = new ArrayList<>(); List<String> result = new ArrayList<>();
String text = VfsUtil.loadText(vFile); String text = VfsUtilCore.loadText(vFile);
String[] lines = LineTokenizer.tokenize(text, false); String[] lines = LineTokenizer.tokenize(text, false);
int index = 0; int index = 0;
while (index < lines.length && !lines[index].startsWith("def addsitepackages(")) { while (index < lines.length && !lines[index].startsWith("def addsitepackages(")) {
@@ -137,9 +137,9 @@ public class PyProjectScopeBuilder extends ProjectScopeBuilderImpl {
} }
private static GlobalSearchScope buildUnionScope(Project project, List<VirtualFile> testDirs) { private static GlobalSearchScope buildUnionScope(Project project, List<VirtualFile> testDirs) {
GlobalSearchScope scope = GlobalSearchScopes.directoryScope(project, testDirs.get(0), true); GlobalSearchScope scope = GlobalSearchScopesCore.directoryScope(project, testDirs.get(0), true);
for (int i = 1; i < testDirs.size(); i++) { for (int i = 1; i < testDirs.size(); i++) {
scope = scope.union(GlobalSearchScopes.directoryScope(project, testDirs.get(i), true)); scope = scope.union(GlobalSearchScopesCore.directoryScope(project, testDirs.get(i), true));
} }
return scope; return scope;
} }
@@ -2028,11 +2028,11 @@ public class PythonDebuggerTest extends PyEnvTestCase {
} }
private void loadEnvTags() { private void loadEnvTags() {
List<String> roots = PythonDebuggerTest.getPythonRoots(); List<String> roots = PyEnvTestCase.getPythonRoots();
roots.forEach((root) -> { roots.forEach((root) -> {
Set<String> tags = Sets.newHashSet(); Set<String> tags = Sets.newHashSet();
tags.addAll(PythonDebuggerTest.loadEnvTags(root)); tags.addAll(PyEnvTestCase.loadEnvTags(root));
myEnvTags.put(root, tags); myEnvTags.put(root, tags);
}); });
} }
@@ -1,22 +1,8 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2013 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 com.jetbrains.python.fixtures; package com.jetbrains.python.fixtures;
import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile; import com.intellij.psi.PsiFile;
@@ -66,7 +52,7 @@ public abstract class LightMarkedTestCase extends PyTestCase {
final String text; final String text;
try { try {
text = VfsUtil.loadText(vFile); text = VfsUtilCore.loadText(vFile);
} }
catch (IOException e) { catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
@@ -1,11 +1,11 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.fixtures; package com.jetbrains.python.fixtures;
import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Document;
import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.ex.temp.TempFileSystem; import com.intellij.openapi.vfs.ex.temp.TempFileSystem;
import com.intellij.psi.*; import com.intellij.psi.*;
@@ -33,7 +33,7 @@ public abstract class PyResolveTestCase extends PyTestCase {
String fileText; String fileText;
try { try {
fileText = StringUtil.convertLineSeparators(VfsUtil.loadText(file)); fileText = StringUtil.convertLineSeparators(VfsUtilCore.loadText(file));
} }
catch (IOException e) { catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
@@ -1,25 +1,11 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2014 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 com.jetbrains.python.refactoring; package com.jetbrains.python.refactoring;
import com.intellij.codeInsight.codeFragment.CannotCreateCodeFragmentException; import com.intellij.codeInsight.codeFragment.CannotCreateCodeFragmentException;
import com.intellij.codeInsight.codeFragment.CodeFragment; import com.intellij.codeInsight.codeFragment.CodeFragment;
import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElement;
import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.PsiTreeUtil;
@@ -49,7 +35,7 @@ public class PyCodeFragmentTest extends LightMarkedTestCase {
final String fullPath = getTestDataPath() + testName + ".test"; final String fullPath = getTestDataPath() + testName + ".test";
final VirtualFile vFile = getVirtualFileByName(fullPath); final VirtualFile vFile = getVirtualFileByName(fullPath);
String fileText = StringUtil.convertLineSeparators(VfsUtil.loadText(vFile), "\n"); String fileText = StringUtil.convertLineSeparators(VfsUtilCore.loadText(vFile), "\n");
final int beginMarker = fileText.indexOf(BEGIN_MARKER); final int beginMarker = fileText.indexOf(BEGIN_MARKER);
final int endMarker = fileText.indexOf(END_MARKER); final int endMarker = fileText.indexOf(END_MARKER);
@@ -1,23 +1,9 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2014 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 com.intellij.util.xml.model.impl; package com.intellij.util.xml.model.impl;
import com.intellij.openapi.module.Module; import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtil; import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElement;
import com.intellij.psi.xml.XmlFile; import com.intellij.psi.xml.XmlFile;
@@ -43,7 +29,7 @@ public abstract class DomModelFactory<T extends DomElement, M extends DomModel<T
@Override @Override
protected Module getModelScope(final XmlFile file) { protected Module getModelScope(final XmlFile file) {
return ModuleUtil.findModuleForPsiElement(file); return ModuleUtilCore.findModuleForPsiElement(file);
} }
@NotNull @NotNull
@@ -1,18 +1,4 @@
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2014 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 com.intellij.codeInsight.editorActions; package com.intellij.codeInsight.editorActions;
import com.intellij.application.options.editor.WebEditorOptions; import com.intellij.application.options.editor.WebEditorOptions;
@@ -96,7 +82,7 @@ public class XmlSlashTypedHandler extends TypedHandlerDelegate {
if (tag != null && StringUtil.isNotEmpty(tag.getName()) && TreeUtil.findSibling(prevLeaf, XmlTokenType.XML_NAME) == null) { if (tag != null && StringUtil.isNotEmpty(tag.getName()) && TreeUtil.findSibling(prevLeaf, XmlTokenType.XML_NAME) == null) {
// check for template language like JSP // check for template language like JSP
if (provider instanceof MultiplePsiFilesPerDocumentFileViewProvider) { if (provider instanceof MultiplePsiFilesPerDocumentFileViewProvider) {
PsiElement element1 = SingleRootFileViewProvider.findElementAt(file, offset - 1); PsiElement element1 = AbstractFileViewProvider.findElementAt(file, offset - 1);
if (element1 != null) { if (element1 != null) {
// case of top-level jsp tag // case of top-level jsp tag
XmlTag tag1 = PsiTreeUtil.getParentOfType(element1, XmlTag.class); XmlTag tag1 = PsiTreeUtil.getParentOfType(element1, XmlTag.class);
@@ -28,7 +28,7 @@ import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.ui.ComponentWithBrowseButton; import com.intellij.openapi.ui.ComponentWithBrowseButton;
import com.intellij.openapi.ui.TextComponentAccessor; import com.intellij.openapi.ui.TextComponentAccessor;
import com.intellij.openapi.ui.TextFieldWithBrowseButton; import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile; import com.intellij.psi.PsiFile;
import org.intellij.plugins.relaxNG.compact.RncFileType; import org.intellij.plugins.relaxNG.compact.RncFileType;
@@ -120,12 +120,12 @@ class NoNamespaceConfigPanel extends HectorComponentPanel {
private String getMapping() { private String getMapping() {
final String s = mySchemaFile.getText().trim(); final String s = mySchemaFile.getText().trim();
return s.length() > 0 ? VfsUtil.pathToUrl(s.replace(File.separatorChar, '/')) : null; return s.length() > 0 ? VfsUtilCore.pathToUrl(s.replace(File.separatorChar, '/')) : null;
} }
@Override @Override
public void reset() { public void reset() {
mySchemaFile.setText(myMapping != null ? VfsUtil.urlToPath(myMapping).replace('/', File.separatorChar) : ""); mySchemaFile.setText(myMapping != null ? VfsUtilCore.urlToPath(myMapping).replace('/', File.separatorChar) : "");
} }
@Override @Override