diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/CompileContextImpl.java b/java/compiler/impl/src/com/intellij/compiler/impl/CompileContextImpl.java index 154c7008f0b3..00d0513a483b 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/CompileContextImpl.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/CompileContextImpl.java @@ -22,7 +22,6 @@ package com.intellij.compiler.impl; import com.intellij.compiler.CompilerConfiguration; -import com.intellij.compiler.CompilerMessageImpl; import com.intellij.compiler.CompilerWorkspaceConfiguration; import com.intellij.compiler.ProblemsView; import com.intellij.compiler.progress.CompilerTask; @@ -37,25 +36,21 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.module.Module; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.project.Project; -import com.intellij.openapi.roots.ModuleRootManager; import com.intellij.openapi.roots.ProjectFileIndex; import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.util.UserDataHolderBase; -import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.openapi.vfs.VirtualFileManager; import com.intellij.pom.Navigatable; -import com.intellij.util.containers.HashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.*; +import java.util.UUID; public class CompileContextImpl extends UserDataHolderBase implements CompileContextEx { private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.CompileContextImpl"); private final Project myProject; private final CompilerTask myBuildSession; - private final Map> myMessages = new EnumMap>(CompilerMessageCategory.class); + private final MessagesContainer myMessages; private final boolean myShouldUpdateProblemsView; private CompileScope myCompileScope; private final boolean myMake; @@ -63,9 +58,6 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon private final boolean myIsAnnotationProcessorsEnabled; private boolean myRebuildRequested; private String myRebuildReason; - private final Map myRootToModuleMap = new HashMap(); - private final Map> myModuleToRootsMap = new HashMap>(); - private final Set myGeneratedTestRoots = new HashSet(); private final ProjectFileIndex myProjectFileIndex; // cached for performance reasons private final ProjectCompileScope myProjectCompileScope; private final long myStartCompilationStamp; @@ -76,6 +68,7 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon @NotNull CompileScope compileScope, boolean isMake, boolean isRebuild) { myProject = project; + myMessages = new MessagesContainer(project); myBuildSession = compilerSession; myCompileScope = compileScope; myMake = isMake; @@ -117,37 +110,17 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon @Override public CompilerMessage[] getMessages(CompilerMessageCategory category) { - Collection collection = myMessages.get(category); - if (collection == null) { - return CompilerMessage.EMPTY_ARRAY; - } - return collection.toArray(new CompilerMessage[collection.size()]); + return myMessages.getMessages(category).toArray(CompilerMessage.EMPTY_ARRAY); } @Override public void addMessage(CompilerMessageCategory category, String message, String url, int lineNum, int columnNum) { - final CompilerMessageImpl msg = new CompilerMessageImpl(myProject, category, message, findFileByUrl(url), lineNum, columnNum, null); - addMessage(msg); + addMessage(category, message, url, lineNum, columnNum, null); } @Override - public void addMessage(CompilerMessageCategory category, String message, String url, int lineNum, int columnNum, - Navigatable navigatable) { - final CompilerMessageImpl msg = new CompilerMessageImpl(myProject, category, message, findFileByUrl(url), lineNum, columnNum, navigatable); - addMessage(msg); - } - - @Nullable - private static VirtualFile findFileByUrl(@Nullable String url) { - if (url == null) { - return null; - } - VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(url); - if (file == null) { - // groovy stubs may be placed in completely random directories which aren't refreshed automatically - return VirtualFileManager.getInstance().refreshAndFindFileByUrl(url); - } - return file; + public void addMessage(CompilerMessageCategory category, String message, String url, int lineNum, int columnNum, Navigatable navigatable) { + myMessages.addMessage(category, message, url, lineNum, columnNum, navigatable); } @Override @@ -155,13 +128,7 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon if (ApplicationManager.getApplication().isUnitTestMode()) { LOG.info("addMessage: " + msg + " this=" + this); } - - Collection messages = myMessages.get(msg.getCategory()); - if (messages == null) { - messages = new LinkedHashSet(); - myMessages.put(msg.getCategory(), messages); - } - if (messages.add(msg)) { + if (myMessages.addMessage(msg)) { myBuildSession.addMessage(msg); } if (myShouldUpdateProblemsView && msg.getCategory() == CompilerMessageCategory.ERROR) { @@ -171,17 +138,7 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon @Override public int getMessageCount(CompilerMessageCategory category) { - if (category != null) { - Collection collection = myMessages.get(category); - return collection != null ? collection.size() : 0; - } - int count = 0; - for (Collection collection : myMessages.values()) { - if (collection != null) { - count += collection.size(); - } - } - return count; + return myMessages.getMessageCount(category); } @Override @@ -226,59 +183,9 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon LOG.assertTrue(!module.isDisposed()); return module; } - for (final VirtualFile root : myRootToModuleMap.keySet()) { - if (VfsUtilCore.isAncestor(root, file, false)) { - final Module mod = myRootToModuleMap.get(root); - if (mod != null) { - LOG.assertTrue(!mod.isDisposed()); - } - return mod; - } - } return null; } - - private final Map myModuleToRootsCache = new HashMap(); - - @Override - public VirtualFile[] getSourceRoots(Module module) { - VirtualFile[] cachedRoots = myModuleToRootsCache.get(module); - if (cachedRoots != null) { - if (areFilesValid(cachedRoots)) { - return cachedRoots; - } - else { - myModuleToRootsCache.remove(module); // clear cache for this module and rebuild list of roots - } - } - - Set additionalRoots = myModuleToRootsMap.get(module); - VirtualFile[] moduleRoots = ModuleRootManager.getInstance(module).getSourceRoots(); - if (additionalRoots == null || additionalRoots.isEmpty()) { - myModuleToRootsCache.put(module, moduleRoots); - return moduleRoots; - } - - final VirtualFile[] allRoots = new VirtualFile[additionalRoots.size() + moduleRoots.length]; - System.arraycopy(moduleRoots, 0, allRoots, 0, moduleRoots.length); - int index = moduleRoots.length; - for (final VirtualFile additionalRoot : additionalRoots) { - allRoots[index++] = additionalRoot; - } - myModuleToRootsCache.put(module, allRoots); - return allRoots; - } - - private static boolean areFilesValid(VirtualFile[] files) { - for (VirtualFile file : files) { - if (!file.isValid()) { - return false; - } - } - return true; - } - @Override public VirtualFile getModuleOutputDirectory(Module module) { return CompilerPaths.getModuleOutputDirectory(module, false); @@ -294,6 +201,11 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon return myMake; } + @Override + public boolean isAutomake() { + return false; + } + @Override public boolean isRebuild() { return myIsRebuild; @@ -309,22 +221,6 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon myCompileScope = new CompositeScope(myCompileScope, additionalScope); } - @Override - public boolean isInTestSourceContent(@NotNull final VirtualFile fileOrDir) { - if (myProjectFileIndex.isInTestSourceContent(fileOrDir)) { - return true; - } - return VfsUtilCore.isUnder(fileOrDir, myGeneratedTestRoots); - } - - @Override - public boolean isInSourceContent(@NotNull final VirtualFile fileOrDir) { - if (myProjectFileIndex.isInSourceContent(fileOrDir)) { - return true; - } - return VfsUtilCore.isUnder(fileOrDir, myRootToModuleMap.keySet()); - } - public UUID getSessionId() { return mySessionId; } diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java index 0b351b150220..95c190743443 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java @@ -22,7 +22,10 @@ package com.intellij.compiler.impl; import com.intellij.CommonBundle; -import com.intellij.compiler.*; +import com.intellij.compiler.CompilerWorkspaceConfiguration; +import com.intellij.compiler.ModuleCompilerUtil; +import com.intellij.compiler.ModuleSourceSet; +import com.intellij.compiler.ProblemsView; import com.intellij.compiler.progress.CompilerTask; import com.intellij.compiler.server.BuildManager; import com.intellij.compiler.server.DefaultMessageHandler; @@ -489,27 +492,10 @@ public class CompileDriver { if (!outputs.isEmpty()) { final ProgressIndicator indicator = compileContext.getProgressIndicator(); indicator.setText("Synchronizing output directories..."); - CompilerUtil.refreshOutputDirectories(outputs, _status == ExitStatus.CANCELLED); + CompilerUtil.refreshOutputDirectories(outputs, false); indicator.setText(""); } } - - if (compileContext.isAnnotationProcessorsEnabled() && !myProject.isDisposed()) { - final Set genSourceRoots = new THashSet(FileUtil.FILE_HASHING_STRATEGY); - final CompilerConfiguration config = CompilerConfiguration.getInstance(myProject); - for (Module module : affectedModules) { - if (!module.isDisposed() && config.getAnnotationProcessingConfiguration(module).isEnabled()) { - final String path = CompilerPaths.getAnnotationProcessorsGenerationPath(module); - if (path != null) { - genSourceRoots.add(new File(path)); - } - } - } - if (!genSourceRoots.isEmpty()) { - // refresh generates source roots asynchronously; needed for error highlighting update - LocalFileSystem.getInstance().refreshIoFiles(genSourceRoots, true, true, null); - } - } } SwingUtilities.invokeLater(new Runnable() { public void run() { diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/MessagesContainer.java b/java/compiler/impl/src/com/intellij/compiler/impl/MessagesContainer.java new file mode 100644 index 000000000000..e953fff920db --- /dev/null +++ b/java/compiler/impl/src/com/intellij/compiler/impl/MessagesContainer.java @@ -0,0 +1,94 @@ +/* + * 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.compiler.impl; + +import com.intellij.compiler.CompilerMessageImpl; +import com.intellij.openapi.compiler.CompilerMessage; +import com.intellij.openapi.compiler.CompilerMessageCategory; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.openapi.vfs.VirtualFileManager; +import com.intellij.pom.Navigatable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.*; + +/** + * @author Eugene Zhuravlev + * Date: 27-Jan-16 + */ +public class MessagesContainer { + private final Project myProject; + private final Map> myMessages = new EnumMap>(CompilerMessageCategory.class); + + public MessagesContainer(Project project) { + myProject = project; + } + + @NotNull + public Collection getMessages(CompilerMessageCategory category) { + final Collection collection = myMessages.get(category); + if (collection == null) { + return Collections.emptyList(); + } + return Collections.unmodifiableCollection(collection); + } + + public CompilerMessage addMessage(CompilerMessageCategory category, String message, String url, int lineNum, int columnNum, Navigatable navigatable) { + final CompilerMessageImpl msg = + new CompilerMessageImpl(myProject, category, message, findFileByUrl(url), lineNum, columnNum, navigatable); + addMessage(msg); + return msg; + } + + public boolean addMessage(CompilerMessage msg) { + Collection messages = myMessages.get(msg.getCategory()); + if (messages == null) { + messages = new LinkedHashSet(); + myMessages.put(msg.getCategory(), messages); + } + return messages.add(msg); + } + + @Nullable + private static VirtualFile findFileByUrl(@Nullable String url) { + if (url == null) { + return null; + } + VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(url); + if (file == null) { + // groovy stubs may be placed in completely random directories which aren't refreshed automatically + return VirtualFileManager.getInstance().refreshAndFindFileByUrl(url); + } + return file; + } + + public int getMessageCount(CompilerMessageCategory category) { + if (category != null) { + Collection collection = myMessages.get(category); + return collection != null ? collection.size() : 0; + } + int count = 0; + for (Collection collection : myMessages.values()) { + if (collection != null) { + count += collection.size(); + } + } + return count; + } + +} diff --git a/java/compiler/impl/src/com/intellij/compiler/server/AutoMakeMessageHandler.java b/java/compiler/impl/src/com/intellij/compiler/server/AutoMakeMessageHandler.java index cbdcc3a43475..9f2a284dc88a 100644 --- a/java/compiler/impl/src/com/intellij/compiler/server/AutoMakeMessageHandler.java +++ b/java/compiler/impl/src/com/intellij/compiler/server/AutoMakeMessageHandler.java @@ -18,21 +18,21 @@ package com.intellij.compiler.server; import com.intellij.compiler.CompilerMessageImpl; import com.intellij.compiler.ProblemsView; import com.intellij.notification.Notification; -import com.intellij.openapi.compiler.CompilationStatusListener; -import com.intellij.openapi.compiler.CompilerManager; -import com.intellij.openapi.compiler.CompilerMessageCategory; -import com.intellij.openapi.compiler.CompilerTopics; +import com.intellij.openapi.compiler.*; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.MessageType; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.openapi.vfs.VirtualFileManager; import com.intellij.problems.Problem; import com.intellij.problems.WolfTheProblemSolver; +import org.jetbrains.annotations.Nullable; import org.jetbrains.jps.api.CmdlineRemoteProto; import org.jetbrains.jps.api.GlobalOptions; +import javax.swing.*; import java.util.Collections; import java.util.UUID; @@ -46,12 +46,14 @@ class AutoMakeMessageHandler extends DefaultMessageHandler { private final Project myProject; private final WolfTheProblemSolver myWolf; private volatile boolean myUnprocessedFSChangesDetected = false; + private final AutomakeCompileContext myContext; public AutoMakeMessageHandler(Project project) { super(project); myProject = project; myBuildStatus = CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status.SUCCESS; myWolf = WolfTheProblemSolver.getInstance(project); + myContext = new AutomakeCompileContext(project); } public boolean unprocessedFSChangesDetected() { @@ -69,9 +71,27 @@ class AutoMakeMessageHandler extends DefaultMessageHandler { } switch (event.getEventType()) { case BUILD_COMPLETED: + myContext.getProgressIndicator().stop(); if (event.hasCompletionStatus()) { - myBuildStatus = event.getCompletionStatus(); + final CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status status = event.getCompletionStatus(); + myBuildStatus = status; + if (status == CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status.CANCELED) { + myContext.getProgressIndicator().cancel(); + } } + final int errors = myContext.getMessageCount(CompilerMessageCategory.ERROR); + final int warnings = myContext.getMessageCount(CompilerMessageCategory.WARNING); + //noinspection SSBasedInspection + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + if (myProject.isDisposed()) { + return; + } + final CompilationStatusListener publisher = myProject.getMessageBus().syncPublisher(CompilerTopics.COMPILATION_STATUS); + publisher.automakeCompilationFinished(errors, warnings, myContext); + } + }); return; case FILES_GENERATED: @@ -112,14 +132,29 @@ class AutoMakeMessageHandler extends DefaultMessageHandler { view.setProgress(message.getText()); } } - else if (kind == CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind.ERROR) { - informWolf(myProject, message); + else { + final CompilerMessageCategory category = convertToCategory(kind); + if (category != null) { // only process supported kinds of messages + final String sourceFilePath = message.hasSourceFilePath() ? message.getSourceFilePath() : null; + final String url = sourceFilePath != null ? VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, FileUtil.toSystemIndependentName(sourceFilePath)) : null; + final long line = message.hasLine() ? message.getLine() : -1; + final long column = message.hasColumn() ? message.getColumn() : -1; + final CompilerMessage msg = myContext.createAndAddMessage(category, message.getText(), url, (int)line, (int)column, null); + if (kind == CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind.ERROR) { + informWolf(myProject, message); + ProblemsView.SERVICE.getInstance(myProject).addMessage(msg, sessionId); + } + } + } + } - final String sourceFilePath = message.hasSourceFilePath() ? message.getSourceFilePath() : null; - final VirtualFile vFile = sourceFilePath != null? LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(sourceFilePath)) : null; - final long line = message.hasLine() ? message.getLine() : -1; - final long column = message.hasColumn() ? message.getColumn() : -1; - ProblemsView.SERVICE.getInstance(myProject).addMessage(new CompilerMessageImpl(myProject, CompilerMessageCategory.ERROR, message.getText(), vFile, (int)line, (int)column, null), sessionId); + @Nullable + private static CompilerMessageCategory convertToCategory(CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind kind) { + switch(kind) { + case ERROR: return CompilerMessageCategory.ERROR; + case INFO: return CompilerMessageCategory.INFORMATION; + case WARNING: return CompilerMessageCategory.WARNING; + default: return null; } } diff --git a/java/compiler/impl/src/com/intellij/compiler/server/AutomakeCompileContext.java b/java/compiler/impl/src/com/intellij/compiler/server/AutomakeCompileContext.java new file mode 100644 index 000000000000..1ed51434ae5b --- /dev/null +++ b/java/compiler/impl/src/com/intellij/compiler/server/AutomakeCompileContext.java @@ -0,0 +1,143 @@ +/* + * 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.compiler.server; + +import com.intellij.compiler.CompilerConfiguration; +import com.intellij.compiler.impl.MessagesContainer; +import com.intellij.compiler.impl.ProjectCompileScope; +import com.intellij.openapi.compiler.*; +import com.intellij.openapi.module.Module; +import com.intellij.openapi.progress.EmptyProgressIndicator; +import com.intellij.openapi.progress.ProgressIndicator; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.roots.ProjectRootManager; +import com.intellij.openapi.util.UserDataHolderBase; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.pom.Navigatable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * @author Eugene Zhuravlev + * Date: 27-Jan-16 + */ +final class AutomakeCompileContext extends UserDataHolderBase implements CompileContext { + private final Project myProject; + private final ProjectCompileScope myScope; + private final MessagesContainer myMessages; + private final EmptyProgressIndicator myIndicator; + private final boolean myAnnotationProcessingEnabled; + + public AutomakeCompileContext(Project project) { + myProject = project; + myScope = new ProjectCompileScope(project); + myMessages = new MessagesContainer(project); + myIndicator = new EmptyProgressIndicator(); + myAnnotationProcessingEnabled = CompilerConfiguration.getInstance(project).isAnnotationProcessorsEnabled(); + } + + @Override + public Project getProject() { + return myProject; + } + + @Override + public CompileScope getCompileScope() { + return getProjectCompileScope(); + } + + @Override + public CompileScope getProjectCompileScope() { + return myScope; + } + + @Override + public boolean isMake() { + return true; + } + + @Override + public boolean isAutomake() { + return true; + } + + public void addMessage(CompilerMessageCategory category, String message, @Nullable String url, int lineNum, int columnNum) { + addMessage(category, message, url, lineNum, columnNum, null); + } + + @Override + public void addMessage(CompilerMessageCategory category, String message, @Nullable String url, int lineNum, int columnNum, Navigatable navigatable) { + createAndAddMessage(category, message, url, lineNum, columnNum, navigatable); + } + + @Override + public CompilerMessage[] getMessages(CompilerMessageCategory category) { + return myMessages.getMessages(category).toArray(CompilerMessage.EMPTY_ARRAY); + } + + public CompilerMessage createAndAddMessage(CompilerMessageCategory category, String message, @Nullable String url, int lineNum, int columnNum, Navigatable navigatable) { + return myMessages.addMessage(category, message, url, lineNum, columnNum, navigatable); + } + + @Override + public int getMessageCount(CompilerMessageCategory category) { + return myMessages.getMessageCount(category); + } + + @NotNull + @Override + public ProgressIndicator getProgressIndicator() { + return myIndicator; + } + + @Override + public void requestRebuildNextTime(String message) { + } + + @Override + public boolean isRebuildRequested() { + return false; + } + + @Nullable + @Override + public String getRebuildReason() { + return null; + } + + @Override + public Module getModuleByFile(VirtualFile file) { + return ProjectRootManager.getInstance(myProject).getFileIndex().getModuleForFile(file); + } + + public VirtualFile getModuleOutputDirectory(final Module module) { + return CompilerPaths.getModuleOutputDirectory(module, false); + } + + public VirtualFile getModuleOutputDirectoryForTests(final Module module) { + return CompilerPaths.getModuleOutputDirectory(module, true); + } + + @Override + public boolean isRebuild() { + return false; + } + + @Override + public boolean isAnnotationProcessorsEnabled() { + return myAnnotationProcessingEnabled; + } +} diff --git a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java index 6cd17fab3691..05ad77baf475 100644 --- a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java +++ b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java @@ -42,6 +42,7 @@ import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.application.PathManager; import com.intellij.openapi.compiler.CompilationStatusListener; import com.intellij.openapi.compiler.CompileContext; +import com.intellij.openapi.compiler.CompilerPaths; import com.intellij.openapi.compiler.CompilerTopics; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.EditorFactory; @@ -1504,22 +1505,50 @@ public class BuildManager implements Disposable { }); conn.subscribe(CompilerTopics.COMPILATION_STATUS, new CompilationStatusListener() { private final Set myRootsToRefresh = new THashSet(FileUtil.PATH_HASHING_STRATEGY); + + @Override + public void automakeCompilationFinished(int errors, int warnings, CompileContext compileContext) { + if (!compileContext.getProgressIndicator().isCanceled()) { + refreshSources(compileContext); + } + } + @Override public void compilationFinished(boolean aborted, int errors, int warnings, CompileContext compileContext) { - final String[] roots; + refreshSources(compileContext); + } + + private void refreshSources(CompileContext compileContext) { + if (project.isDisposed()) { + return; + } + final Set candidates = new THashSet(FileUtil.PATH_HASHING_STRATEGY); synchronized (myRootsToRefresh) { - roots = ArrayUtil.toStringArray(myRootsToRefresh); + candidates.addAll(myRootsToRefresh); myRootsToRefresh.clear(); } - if (roots.length != 0) { + if (compileContext.isAnnotationProcessorsEnabled()) { + // annotation processors may have re-generated code + final CompilerConfiguration config = CompilerConfiguration.getInstance(project); + for (Module module : compileContext.getCompileScope().getAffectedModules()) { + if (config.getAnnotationProcessingConfiguration(module).isEnabled()) { + final String path = CompilerPaths.getAnnotationProcessorsGenerationPath(module); + if (path != null) { + candidates.add(path); + } + } + } + } + + if (!candidates.isEmpty()) { ApplicationManager.getApplication().executeOnPooledThread(new Runnable() { @Override public void run() { if (project.isDisposed()) { return; } - final List rootFiles = new ArrayList(roots.length); - for (String root : roots) { + final List rootFiles = new ArrayList(candidates.size()); + for (String root : candidates) { rootFiles.add(new File(root)); } // this will ensure that we'll be able to obtain VirtualFile for existing roots diff --git a/java/compiler/impl/src/com/intellij/openapi/compiler/ex/CompileContextEx.java b/java/compiler/impl/src/com/intellij/openapi/compiler/ex/CompileContextEx.java index 6251b56c5b21..a50e4f4801d1 100644 --- a/java/compiler/impl/src/com/intellij/openapi/compiler/ex/CompileContextEx.java +++ b/java/compiler/impl/src/com/intellij/openapi/compiler/ex/CompileContextEx.java @@ -18,20 +18,11 @@ package com.intellij.openapi.compiler.ex; import com.intellij.openapi.compiler.CompileContext; import com.intellij.openapi.compiler.CompileScope; import com.intellij.openapi.compiler.CompilerMessage; -import com.intellij.openapi.vfs.VirtualFile; -import org.jetbrains.annotations.NotNull; public interface CompileContextEx extends CompileContext { void addMessage(CompilerMessage message); - /** - * the same as FileIndex.isInTestSourceContent(), but takes into account generated output dirs - */ - boolean isInTestSourceContent(@NotNull VirtualFile fileOrDir); - - boolean isInSourceContent(@NotNull VirtualFile fileOrDir); - void addScope(CompileScope additionalScope); } diff --git a/java/compiler/openapi/compiler-openapi.iml b/java/compiler/openapi/compiler-openapi.iml index 9fb5c9321534..e0570144de08 100644 --- a/java/compiler/openapi/compiler-openapi.iml +++ b/java/compiler/openapi/compiler-openapi.iml @@ -1,6 +1,6 @@ - + @@ -161,5 +161,4 @@ - - + \ No newline at end of file diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilationStatusAdapter.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilationStatusAdapter.java index 263919458292..018bf3dae323 100644 --- a/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilationStatusAdapter.java +++ b/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilationStatusAdapter.java @@ -16,6 +16,9 @@ package com.intellij.openapi.compiler; public class CompilationStatusAdapter implements CompilationStatusListener { + public void automakeCompilationFinished(int errors, int warnings, CompileContext compileContext) { + } + public void compilationFinished(boolean aborted, int errors, int warnings, final CompileContext compileContext) { } diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilationStatusListener.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilationStatusListener.java index 11fbe73d9ed0..05f9241fec83 100644 --- a/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilationStatusListener.java +++ b/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilationStatusListener.java @@ -31,7 +31,12 @@ public interface CompilationStatusListener extends EventListener { * @param warnings warning count * @param compileContext context for the finished compilation */ - void compilationFinished(boolean aborted, int errors, int warnings, final CompileContext compileContext); + default void compilationFinished(boolean aborted, int errors, int warnings, final CompileContext compileContext){ + } - void fileGenerated(String outputRoot, String relativePath); + default void automakeCompilationFinished(int errors, int warnings, final CompileContext compileContext) { + } + + default void fileGenerated(String outputRoot, String relativePath) { + } } diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/CompileContext.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/CompileContext.java index 6046c2835194..7817e6522797 100644 --- a/java/compiler/openapi/src/com/intellij/openapi/compiler/CompileContext.java +++ b/java/compiler/openapi/src/com/intellij/openapi/compiler/CompileContext.java @@ -114,13 +114,6 @@ public interface CompileContext extends UserDataHolder { */ Module getModuleByFile(VirtualFile file); - /** - * Returns the source roots for the specified module. - * - * @return module's source roots as well as source roots for generated sources that are attributed to the module - */ - VirtualFile[] getSourceRoots(Module module); - /** * Returns the output directory for the specified module. * @@ -147,6 +140,8 @@ public interface CompileContext extends UserDataHolder { */ boolean isMake(); + boolean isAutomake(); + boolean isRebuild(); Project getProject(); diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerPaths.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerPaths.java index fd749d136449..6ffe84dfdbd7 100644 --- a/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerPaths.java +++ b/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerPaths.java @@ -112,6 +112,9 @@ public class CompilerPaths { @Nullable public static VirtualFile getModuleOutputDirectory(final Module module, boolean forTestClasses) { final CompilerModuleExtension compilerModuleExtension = CompilerModuleExtension.getInstance(module); + if (compilerModuleExtension == null) { + return null; + } VirtualFile outPath; if (forTestClasses) { final VirtualFile path = compilerModuleExtension.getCompilerOutputPathForTests(); @@ -144,6 +147,9 @@ public class CompilerPaths { final String outPathUrl; final Application application = ApplicationManager.getApplication(); final CompilerModuleExtension extension = CompilerModuleExtension.getInstance(module); + if (extension == null) { + return null; + } if (forTestClasses) { if (application.isDispatchThread()) { final String url = extension.getCompilerOutputUrlForTests(); diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/DummyCompileContext.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/DummyCompileContext.java index f308bd980aa5..9cffddabb503 100644 --- a/java/compiler/openapi/src/com/intellij/openapi/compiler/DummyCompileContext.java +++ b/java/compiler/openapi/src/com/intellij/openapi/compiler/DummyCompileContext.java @@ -94,10 +94,6 @@ public class DummyCompileContext implements CompileContext { return false; } - public VirtualFile[] getSourceRoots(Module module) { - return VirtualFile.EMPTY_ARRAY; - } - public VirtualFile getModuleOutputDirectory(final Module module) { return ApplicationManager.getApplication().runReadAction(new Computable() { public VirtualFile compute() { @@ -121,6 +117,11 @@ public class DummyCompileContext implements CompileContext { return false; // stub implementation } + @Override + public boolean isAutomake() { + return false; + } + public boolean isRebuild() { return false; } diff --git a/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSettings.java b/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSettings.java index 5b80d27cd3d3..9edbb0440d71 100644 --- a/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSettings.java +++ b/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSettings.java @@ -16,7 +16,10 @@ package com.intellij.debugger.settings; import com.intellij.debugger.impl.DebuggerUtilsEx; -import com.intellij.openapi.components.*; +import com.intellij.openapi.components.PersistentStateComponent; +import com.intellij.openapi.components.ServiceManager; +import com.intellij.openapi.components.State; +import com.intellij.openapi.components.Storage; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.InvalidDataException; import com.intellij.openapi.util.WriteExternalException; @@ -36,7 +39,10 @@ import java.util.Map; @State( name = "DebuggerSettings", defaultStateAsResource = true, - storages = @Storage(file = StoragePathMacros.APP_CONFIG + "/other.xml") + storages = { + @Storage(file = "debugger.xml"), + @Storage(file = "other.xml", deprecated = true) + } ) public class DebuggerSettings implements Cloneable, PersistentStateComponent { private static final Logger LOG = Logger.getInstance(DebuggerSettings.class); diff --git a/platform/configuration-store-impl/src/ExportSettingsAction.kt b/platform/configuration-store-impl/src/ExportSettingsAction.kt index 249ddfb03858..641045314d54 100644 --- a/platform/configuration-store-impl/src/ExportSettingsAction.kt +++ b/platform/configuration-store-impl/src/ExportSettingsAction.kt @@ -165,7 +165,7 @@ fun getExportableComponentsMap(onlyExisting: Boolean, } } - @Suppress("DEPRECATED_SYMBOL_WITH_MESSAGE") + @Suppress("DEPRECATION") ApplicationManager.getApplication().getComponents(ExportableApplicationComponent::class.java).forEach(processor) ServiceBean.loadServicesFromBeans(ExportableComponent.EXTENSION_POINT, ExportableComponent::class.java).forEach(processor) @@ -189,43 +189,41 @@ fun getExportableComponentsMap(onlyExisting: Boolean, result.keys.removeAll(::isSkipFile) } - ServiceManagerImpl.processAllImplementationClasses(ApplicationManager.getApplication() as ApplicationImpl, object : PairProcessor, PluginDescriptor> { - override fun process(aClass: Class<*>, pluginDescriptor: PluginDescriptor?): Boolean { - val stateAnnotation = StoreUtil.getStateSpec(aClass) - if (stateAnnotation == null || stateAnnotation.name.isNullOrEmpty() || ExportableComponent::class.java.isAssignableFrom(aClass)) { - return true - } - - val storage = sortStoragesByDeprecated(stateAnnotation.storages).firstOrNull() ?: return true - if (!(storage.roamingType != RoamingType.DISABLED && storage.storageClass == StateStorage::class && storage.scheme == StorageScheme.DEFAULT && !storage.file.isNullOrEmpty())) { - return true - } - - var additionalExportFile: File? = null - var additionalExportPath = stateAnnotation.additionalExportFile - if (additionalExportPath.isNotEmpty()) { - // backward compatibility - path can contain macro - if (additionalExportPath[0] != '$') { - additionalExportPath = "$ROOT_CONFIG/$additionalExportPath" - } - additionalExportFile = File(storageManager.expandMacros(additionalExportPath)) - if (isSkipFile(additionalExportFile)) { - additionalExportFile = null - } - } - - val file = File(storageManager.expandMacros(storage.file)) - val isFileIncluded = !isSkipFile(file) - if (isFileIncluded || additionalExportFile != null) { - val files = if (additionalExportFile == null) listOf(file) else if (isFileIncluded) listOf(file, additionalExportFile) else listOf(additionalExportFile) - val item = ExportableItem(files, if (computePresentableNames) getComponentPresentableName(stateAnnotation, aClass, pluginDescriptor) else "", storage.roamingType) - result.putValue(file, item) - if (additionalExportFile != null) { - result.putValue(additionalExportFile, item) - } - } - return true + ServiceManagerImpl.processAllImplementationClasses(ApplicationManager.getApplication() as ApplicationImpl, PairProcessor, PluginDescriptor> { aClass, pluginDescriptor -> + val stateAnnotation = StoreUtil.getStateSpec(aClass) + if (stateAnnotation == null || stateAnnotation.name.isNullOrEmpty() || ExportableComponent::class.java.isAssignableFrom(aClass)) { + return@PairProcessor true } + + val storage = sortStoragesByDeprecated(stateAnnotation.storages).firstOrNull() ?: return@PairProcessor true + if (!(storage.roamingType != RoamingType.DISABLED && storage.storageClass == StateStorage::class && storage.scheme == StorageScheme.DEFAULT && !storage.file.isNullOrEmpty())) { + return@PairProcessor true + } + + var additionalExportFile: File? = null + var additionalExportPath = stateAnnotation.additionalExportFile + if (additionalExportPath.isNotEmpty()) { + // backward compatibility - path can contain macro + if (additionalExportPath[0] != '$') { + additionalExportPath = "$ROOT_CONFIG/$additionalExportPath" + } + additionalExportFile = File(storageManager.expandMacros(additionalExportPath)) + if (isSkipFile(additionalExportFile)) { + additionalExportFile = null + } + } + + val file = File(storageManager.expandMacros(storage.file)) + val isFileIncluded = !isSkipFile(file) + if (isFileIncluded || additionalExportFile != null) { + val files = if (additionalExportFile == null) listOf(file) else if (isFileIncluded) listOf(file, additionalExportFile) else listOf(additionalExportFile) + val item = ExportableItem(files, if (computePresentableNames) getComponentPresentableName(stateAnnotation, aClass, pluginDescriptor) else "", storage.roamingType) + result.putValue(file, item) + if (additionalExportFile != null) { + result.putValue(additionalExportFile, item) + } + } + true }) return result } @@ -242,12 +240,24 @@ private fun getComponentPresentableName(state: State, aClass: Class<*>, pluginDe } val defaultName = state.name - val resourceBundleName = (if (pluginDescriptor is IdeaPluginDescriptor && "com.intellij" != pluginDescriptor.pluginId.idString) { - pluginDescriptor.resourceBundleBaseName + + fun trimDefaultName() = defaultName.removeSuffix("Settings") + + var resourceBundleName: String? + if (pluginDescriptor is IdeaPluginDescriptor && "com.intellij" != pluginDescriptor.pluginId.idString) { + resourceBundleName = pluginDescriptor.resourceBundleBaseName + if (resourceBundleName == null) { + if (pluginDescriptor.vendor == "JetBrains") { + resourceBundleName = OptionsBundle.PATH_TO_BUNDLE + } + else { + return trimDefaultName() + } + } } else { - OptionsBundle.PATH_TO_BUNDLE - }) ?: return defaultName + resourceBundleName = OptionsBundle.PATH_TO_BUNDLE + } var classLoader = pluginDescriptor?.pluginClassLoader ?: aClass.classLoader if (classLoader != null) { @@ -261,7 +271,7 @@ private fun getComponentPresentableName(state: State, aClass: Class<*>, pluginDe return messageOrDefault(classLoader, "org.jetbrains.plugins.ruby.RBundle", defaultName) } } - return defaultName + return trimDefaultName() } private fun messageOrDefault(classLoader: ClassLoader, bundleName: String, defaultName: String): String { diff --git a/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/ex/DefaultColorSchemesManager.java b/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/ex/DefaultColorSchemesManager.java index d58f8414734d..a9a26078d647 100644 --- a/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/ex/DefaultColorSchemesManager.java +++ b/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/ex/DefaultColorSchemesManager.java @@ -29,7 +29,7 @@ import java.util.List; @State( name = "DefaultColorSchemesManager", defaultStateAsResource = true, - storages = @Storage(file = StoragePathMacros.APP_CONFIG + "/other.xml") + storages = @Storage(file = "other.xml", roamingType = RoamingType.DISABLED) ) public class DefaultColorSchemesManager implements PersistentStateComponent { private final List mySchemes; diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/AppCodeStyleSettingsManager.java b/platform/lang-api/src/com/intellij/psi/codeStyle/AppCodeStyleSettingsManager.java index c2116ae3c1e7..cf121bee7a4b 100644 --- a/platform/lang-api/src/com/intellij/psi/codeStyle/AppCodeStyleSettingsManager.java +++ b/platform/lang-api/src/com/intellij/psi/codeStyle/AppCodeStyleSettingsManager.java @@ -13,20 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.intellij.psi.codeStyle; import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; -import com.intellij.openapi.components.StoragePathMacros; - @State( name = "CodeStyleSettingsManager", - storages = { - @Storage( - file = StoragePathMacros.APP_CONFIG + "/other.xml" - )} + storages = { + @Storage(file = "code.style.schemes"), + @Storage(file = "other.xml", deprecated = true) + } ) -public class AppCodeStyleSettingsManager extends CodeStyleSettingsManager{ +public class AppCodeStyleSettingsManager extends CodeStyleSettingsManager { } diff --git a/platform/lang-impl/src/com/intellij/refactoring/RefactoringSettings.java b/platform/lang-impl/src/com/intellij/refactoring/RefactoringSettings.java index c76f9a37adeb..d252087c5f87 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/RefactoringSettings.java +++ b/platform/lang-impl/src/com/intellij/refactoring/RefactoringSettings.java @@ -15,14 +15,17 @@ */ package com.intellij.refactoring; -import com.intellij.openapi.components.*; +import com.intellij.openapi.components.PersistentStateComponent; +import com.intellij.openapi.components.ServiceManager; +import com.intellij.openapi.components.State; +import com.intellij.openapi.components.Storage; import com.intellij.util.xmlb.XmlSerializerUtil; @State( name = "BaseRefactoringSettings", storages = { - @Storage(file = StoragePathMacros.APP_CONFIG + "/baseRefactoring.xml"), - @Storage(file = StoragePathMacros.APP_CONFIG + "/other.xml", deprecated = true) + @Storage(file = "baseRefactoring.xml"), + @Storage(file = "other.xml", deprecated = true) } ) public class RefactoringSettings implements PersistentStateComponent { diff --git a/platform/lang-impl/src/com/intellij/tools/ExternalToolsGroup.java b/platform/lang-impl/src/com/intellij/tools/ExternalToolsGroup.java index 296e70221434..77c8dc0b07fc 100644 --- a/platform/lang-impl/src/com/intellij/tools/ExternalToolsGroup.java +++ b/platform/lang-impl/src/com/intellij/tools/ExternalToolsGroup.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * 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. @@ -16,11 +16,6 @@ package com.intellij.tools; -import com.intellij.openapi.actionSystem.*; -import com.intellij.openapi.project.DumbAware; -import com.intellij.openapi.project.Project; -import org.jetbrains.annotations.Nullable; - import java.util.List; /** diff --git a/platform/platform-api/src/com/intellij/ui/SizedIcon.java b/platform/platform-api/src/com/intellij/ui/SizedIcon.java index b72e8267a9c3..dd0b56e3d208 100644 --- a/platform/platform-api/src/com/intellij/ui/SizedIcon.java +++ b/platform/platform-api/src/com/intellij/ui/SizedIcon.java @@ -1,3 +1,18 @@ +/* + * 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.ui; import javax.swing.*; @@ -19,7 +34,7 @@ public class SizedIcon implements Icon { public void paintIcon(Component c, Graphics g, int x, int y) { int dx = myWidth - myDelegate.getIconWidth(); - int dy = myWidth - myDelegate.getIconHeight(); + int dy = myHeight - myDelegate.getIconHeight(); if (dx > 0 || dy > 0) { myDelegate.paintIcon(c, g, x + dx/2, y + dy/2); } diff --git a/platform/platform-resources-en/src/messages/OptionsBundle.properties b/platform/platform-resources-en/src/messages/OptionsBundle.properties index 8adeb8b3fbe3..866bff94d19e 100644 --- a/platform/platform-resources-en/src/messages/OptionsBundle.properties +++ b/platform/platform-resources-en/src/messages/OptionsBundle.properties @@ -318,9 +318,11 @@ exportable.HttpConfigurable.presentable.name=HTTP Proxy exportable.KeymapManager.presentable.name=Key maps exportable.UsageViewSettings.presentable.name=Usage View exportable.BaseRefactoringSettings.presentable.name=Refactoring +exportable.PropertiesRefactoringSettings.presentable.name=Refactoring: Properties exportable.DuplocatorSettings.presentable.name=Duplocator exportable.MultiLanguageDuplocatorSettings.presentable.name=Duplocator exportable.CodeStyleSchemeSettings.presentable.name=Code Style +exportable.CodeStyleSettingsManager.presentable.name=Code Style exportable.InspectionProfileManager.presentable.name=Inspection profiles exportable.TodoConfiguration.presentable.name=Todo exportable.UISettings.presentable.name=UI Settings @@ -328,6 +330,7 @@ exportable.FileTypeManager.presentable.name=File types exportable.EditorColorsManager.presentable.name=Color schemes exportable.ShortcutPromoterManager.presentable.name=Shortcut Promoter exportable.XDebuggerSettings.presentable.name=Debugger +exportable.DebuggerSettings.presentable.name=Debugger: Java exportable.WebBrowsersConfiguration.presentable.name=Web Browsers exportable.TextDiffSettings.presentable.name=Text Diff exportable.PathMacrosImpl.presentable.name=Path Macros @@ -339,4 +342,6 @@ exportable.ExternalDiffSettings.presentable.name=External Diff exportable.ExportableFileTemplateSettings.presentable.name=File templates exportable.ProjectManager.presentable.name=Default project exportable.com.intellij.ide.ui.customization.CustomActionsSchema.presentable.name=Menus and toolbars customization -exportable.ActionMacroManager.presentable.name=Macros \ No newline at end of file +exportable.ActionMacroManager.presentable.name=Macros +exportable.ImportFilteringUsageViewSetting.presentable.name=Usage View: Imports +exportable.XPathView.XPathViewPlugin.presentable.name=XPath Viewer \ No newline at end of file diff --git a/platform/platform-resources/src/META-INF/LangExtensions.xml b/platform/platform-resources/src/META-INF/LangExtensions.xml index a706a8731e61..ebb16ebb6e4c 100644 --- a/platform/platform-resources/src/META-INF/LangExtensions.xml +++ b/platform/platform-resources/src/META-INF/LangExtensions.xml @@ -132,8 +132,7 @@ - + diff --git a/platform/usageView/src/com/intellij/usages/UsageViewSettings.java b/platform/usageView/src/com/intellij/usages/UsageViewSettings.java index b6444549064d..5c5221dd92c4 100644 --- a/platform/usageView/src/com/intellij/usages/UsageViewSettings.java +++ b/platform/usageView/src/com/intellij/usages/UsageViewSettings.java @@ -15,7 +15,10 @@ */ package com.intellij.usages; -import com.intellij.openapi.components.*; +import com.intellij.openapi.components.PersistentStateComponent; +import com.intellij.openapi.components.ServiceManager; +import com.intellij.openapi.components.State; +import com.intellij.openapi.components.Storage; import com.intellij.util.xmlb.XmlSerializerUtil; import com.intellij.util.xmlb.annotations.Transient; import org.jetbrains.annotations.NonNls; @@ -25,8 +28,8 @@ import java.io.File; @State( name = "UsageViewSettings", storages = { - @Storage(file = StoragePathMacros.APP_CONFIG + "/usageView.xml"), - @Storage(file = StoragePathMacros.APP_CONFIG + "/other.xml", deprecated = true) + @Storage(file = "usageView.xml"), + @Storage(file = "other.xml", deprecated = true) } ) public class UsageViewSettings implements PersistentStateComponent { diff --git a/platform/usageView/src/com/intellij/usages/impl/ImportFilteringUsageViewSetting.java b/platform/usageView/src/com/intellij/usages/impl/ImportFilteringUsageViewSetting.java index 0f95b667e2f0..682c57bab8b7 100644 --- a/platform/usageView/src/com/intellij/usages/impl/ImportFilteringUsageViewSetting.java +++ b/platform/usageView/src/com/intellij/usages/impl/ImportFilteringUsageViewSetting.java @@ -15,7 +15,10 @@ */ package com.intellij.usages.impl; -import com.intellij.openapi.components.*; +import com.intellij.openapi.components.PersistentStateComponent; +import com.intellij.openapi.components.ServiceManager; +import com.intellij.openapi.components.State; +import com.intellij.openapi.components.Storage; import com.intellij.util.xmlb.XmlSerializerUtil; /** @@ -24,9 +27,9 @@ import com.intellij.util.xmlb.XmlSerializerUtil; @State( name = "ImportFilteringUsageViewSetting", storages = { - @Storage( - file = StoragePathMacros.APP_CONFIG + "/other.xml" - )} + @Storage(file = "usageView.xml"), + @Storage(file = "other.xml", deprecated = true) + } ) public class ImportFilteringUsageViewSetting implements PersistentStateComponent { public static ImportFilteringUsageViewSetting getInstance() { diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties index d0850725620e..03d1287f3c16 100644 --- a/platform/util/resources/misc/registry.properties +++ b/platform/util/resources/misc/registry.properties @@ -674,7 +674,6 @@ ide.mac.yosemite.laf.description=Replaces Aqua LaF to enhanced IntelliJ LaF dart.server.vm.options= dart.server.additional.arguments= -dart.server.driven.resolution=true dart.projects.without.pubspec=false editor.breadcrumbs.highlight.on.hover=false diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/SelectedBlockHistoryAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/SelectedBlockHistoryAction.java index fb3a0cd6cb75..d88797b053cd 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/SelectedBlockHistoryAction.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/SelectedBlockHistoryAction.java @@ -26,7 +26,7 @@ import com.intellij.openapi.vcs.history.VcsHistoryProvider; import com.intellij.openapi.vcs.history.VcsHistoryProviderBackgroundableProxy; import com.intellij.openapi.vcs.history.VcsHistorySession; import com.intellij.openapi.vcs.history.impl.CachedRevisionsContents; -import com.intellij.openapi.vcs.history.impl.VcsHistoryDialog; +import com.intellij.openapi.vcs.history.impl.VcsSelectionHistoryDialog; import com.intellij.openapi.vcs.impl.BackgroundableActionEnabledHandler; import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl; import com.intellij.openapi.vcs.impl.VcsBackgroundableActions; @@ -89,16 +89,16 @@ public class SelectedBlockHistoryAction extends AbstractVcsAction { reportError(preloadException[0]); } if (session == null) return; - final VcsHistoryDialog vcsHistoryDialog = - new VcsHistoryDialog(project, - context.getSelectedFiles()[0], - context.getEditor(), - provider, - session, - activeVcs, - Math.min(selectionStart, selectionEnd), - Math.max(selectionStart, selectionEnd), - selection.getDialogTitle(), cachedRevisionsContents); + final VcsSelectionHistoryDialog vcsHistoryDialog = + new VcsSelectionHistoryDialog(project, + context.getSelectedFiles()[0], + context.getEditor(), + provider, + session, + activeVcs, + Math.min(selectionStart, selectionEnd), + Math.max(selectionStart, selectionEnd), + selection.getDialogTitle(), cachedRevisionsContents); vcsHistoryDialog.show(); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/impl/VcsHistoryDialog.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/impl/VcsSelectionHistoryDialog.java similarity index 94% rename from platform/vcs-impl/src/com/intellij/openapi/vcs/history/impl/VcsHistoryDialog.java rename to platform/vcs-impl/src/com/intellij/openapi/vcs/history/impl/VcsSelectionHistoryDialog.java index febe489ad974..736dafc92bbb 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/impl/VcsHistoryDialog.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/impl/VcsSelectionHistoryDialog.java @@ -62,7 +62,7 @@ import java.util.List; import static com.intellij.util.ObjectUtils.notNull; -public class VcsHistoryDialog extends FrameWrapper implements DataProvider { +public class VcsSelectionHistoryDialog extends FrameWrapper implements DataProvider { private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.history.impl.VcsHistoryDialog"); private static final VcsRevisionNumber LOCAL_REVISION_NUMBER = new VcsRevisionNumber() { @@ -143,16 +143,16 @@ public class VcsHistoryDialog extends FrameWrapper implements DataProvider { private boolean myIsDuringUpdate = false; private boolean myIsDisposed = false; - public VcsHistoryDialog(@NotNull Project project, - @NotNull VirtualFile file, - @NotNull Editor editor, - @NotNull VcsHistoryProvider vcsHistoryProvider, - @NotNull VcsHistorySession session, - @NotNull AbstractVcs vcs, - int selectionStart, - int selectionEnd, - @NotNull String title, - @NotNull CachedRevisionsContents cachedContents) { + public VcsSelectionHistoryDialog(@NotNull Project project, + @NotNull VirtualFile file, + @NotNull Editor editor, + @NotNull VcsHistoryProvider vcsHistoryProvider, + @NotNull VcsHistorySession session, + @NotNull AbstractVcs vcs, + int selectionStart, + int selectionEnd, + @NotNull String title, + @NotNull CachedRevisionsContents cachedContents) { super(project); myProject = project; myFile = file; @@ -230,8 +230,8 @@ public class VcsHistoryDialog extends FrameWrapper implements DataProvider { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - if (!VcsHistoryDialog.this.getFrame().isShowing()) return; - PopupUtil.showBalloonForComponent(VcsHistoryDialog.this.getFrame(), canNoLoadMessage(e), MessageType.ERROR, true, myProject); + if (!VcsSelectionHistoryDialog.this.getFrame().isShowing()) return; + PopupUtil.showBalloonForComponent(VcsSelectionHistoryDialog.this.getFrame(), canNoLoadMessage(e), MessageType.ERROR, true, myProject); } }); } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingManagerImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingManagerImpl.java index 7ca13405558d..1ff9d01749d4 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingManagerImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingManagerImpl.java @@ -15,7 +15,10 @@ */ package com.intellij.xdebugger.impl.settings; -import com.intellij.openapi.components.*; +import com.intellij.openapi.components.ComponentSerializationUtil; +import com.intellij.openapi.components.PersistentStateComponent; +import com.intellij.openapi.components.State; +import com.intellij.openapi.components.Storage; import com.intellij.openapi.util.JDOMUtil; import com.intellij.util.SmartList; import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters; @@ -38,8 +41,8 @@ import java.util.*; @State( name = "XDebuggerSettings", storages = { - @Storage(file = StoragePathMacros.APP_CONFIG + "/debugger.xml"), - @Storage(file = StoragePathMacros.APP_CONFIG + "/other.xml", deprecated = true) + @Storage(file = "debugger.xml"), + @Storage(file = "other.xml", deprecated = true) } ) public class XDebuggerSettingManagerImpl extends XDebuggerSettingsManager implements PersistentStateComponent { diff --git a/plugins/github/src/org/jetbrains/plugins/github/util/GithubSettings.java b/plugins/github/src/org/jetbrains/plugins/github/util/GithubSettings.java index e86ffab49e4d..541643c408e9 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/util/GithubSettings.java +++ b/plugins/github/src/org/jetbrains/plugins/github/util/GithubSettings.java @@ -19,7 +19,10 @@ import com.intellij.ide.passwordSafe.PasswordSafe; import com.intellij.ide.passwordSafe.PasswordSafeException; import com.intellij.ide.passwordSafe.config.PasswordSafeSettings; import com.intellij.ide.passwordSafe.impl.PasswordSafeImpl; -import com.intellij.openapi.components.*; +import com.intellij.openapi.components.PersistentStateComponent; +import com.intellij.openapi.components.ServiceManager; +import com.intellij.openapi.components.State; +import com.intellij.openapi.components.Storage; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.ThreeState; @@ -35,8 +38,8 @@ import static org.jetbrains.plugins.github.util.GithubAuthData.AuthType; @SuppressWarnings("MethodMayBeStatic") @State( name = "GithubSettings", - storages = {@Storage( - file = StoragePathMacros.APP_CONFIG + "/github_settings.xml")}) + storages = {@Storage(file = "github_settings.xml")} +) public class GithubSettings implements PersistentStateComponent { private static final Logger LOG = GithubUtil.LOG; private static final String GITHUB_SETTINGS_PASSWORD_KEY = "GITHUB_SETTINGS_PASSWORD_KEY"; diff --git a/plugins/gradle/resources/i18n/GradleBundle.properties b/plugins/gradle/resources/i18n/GradleBundle.properties index ac3ed8153a32..9c17f8086638 100644 --- a/plugins/gradle/resources/i18n/GradleBundle.properties +++ b/plugins/gradle/resources/i18n/GradleBundle.properties @@ -52,3 +52,5 @@ gradle.integrations.maven.notification.not_updated_repository.text=\ The following repositories used in your gradle projects were not indexed yet:
{0}

\ If you want to use dependency completion for these repositories artifacts,
\ Open Repositories List, select required repositories and press \"Update\" button + +exportable.GradleSystemRunningSettings.presentable.name=Gradle: System Running \ No newline at end of file diff --git a/plugins/gradle/src/META-INF/plugin.xml b/plugins/gradle/src/META-INF/plugin.xml index c58b642ad8bb..4f2175cea23d 100644 --- a/plugins/gradle/src/META-INF/plugin.xml +++ b/plugins/gradle/src/META-INF/plugin.xml @@ -42,6 +42,8 @@ JUnit org.jetbrains.idea.maven + i18n.GradleBundle + diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/settings/GradleSystemRunningSettings.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/settings/GradleSystemRunningSettings.java index a59d89487104..a7f0c0c1deb0 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/settings/GradleSystemRunningSettings.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/settings/GradleSystemRunningSettings.java @@ -16,7 +16,10 @@ package org.jetbrains.plugins.gradle.settings; import com.google.common.base.Objects; -import com.intellij.openapi.components.*; +import com.intellij.openapi.components.PersistentStateComponent; +import com.intellij.openapi.components.ServiceManager; +import com.intellij.openapi.components.State; +import com.intellij.openapi.components.Storage; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -27,7 +30,7 @@ import org.jetbrains.annotations.Nullable; @State( name = "GradleSystemRunningSettings", storages = { - @Storage(file = StoragePathMacros.APP_CONFIG + "/gradle.run.settings.xml") + @Storage(file = "gradle.run.settings.xml") } ) public class GradleSystemRunningSettings implements PersistentStateComponent { diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/HgProjectConfigurable.java b/plugins/hg4idea/src/org/zmlx/hg4idea/HgProjectConfigurable.java index b1971b2aa00d..9ff026e1aa6a 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/HgProjectConfigurable.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/HgProjectConfigurable.java @@ -51,7 +51,6 @@ public class HgProjectConfigurable implements SearchableConfigurable { } public void apply() throws ConfigurationException { - myPanel.validate(); myPanel.saveSettings(); if (myPanel.getProjectSettings().isCheckIncomingOutgoing()) { myProject.getMessageBus().syncPublisher(HgVcs.INCOMING_OUTGOING_CHECK_TOPIC).show(); diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgConfigurationProjectPanel.java b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgConfigurationProjectPanel.java index 466a099e4bf1..88622d4d329e 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgConfigurationProjectPanel.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgConfigurationProjectPanel.java @@ -15,7 +15,6 @@ package org.zmlx.hg4idea.ui; import com.intellij.dvcs.branch.DvcsSyncSettings; import com.intellij.dvcs.ui.DvcsBundle; import com.intellij.openapi.components.ServiceManager; -import com.intellij.openapi.options.ConfigurationException; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.ui.TextFieldWithBrowseButton; @@ -25,7 +24,6 @@ import org.zmlx.hg4idea.HgProjectSettings; import org.zmlx.hg4idea.HgVcs; import org.zmlx.hg4idea.HgVcsMessages; import org.zmlx.hg4idea.repo.HgRepositoryManager; -import org.zmlx.hg4idea.util.HgUtil; import org.zmlx.hg4idea.util.HgVersion; import javax.swing.*; @@ -105,16 +103,6 @@ public class HgConfigurationProjectPanel { return myMainPanel; } - public void validate() throws ConfigurationException { - String hgExecutable; - hgExecutable = getCurrentPath(); - if (!HgUtil.isExecutableValid(hgExecutable)) { - throw new ConfigurationException( - HgVcsMessages.message("hg4idea.configuration.executable.error", hgExecutable) - ); - } - } - private void createUIComponents() { myPathSelector = new HgSetExecutablePathPanel(myProjectSettings); } diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/refactoring/PropertiesRefactoringSettings.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/refactoring/PropertiesRefactoringSettings.java index bf84c6b25a12..4c185f3883ac 100644 --- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/refactoring/PropertiesRefactoringSettings.java +++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/refactoring/PropertiesRefactoringSettings.java @@ -15,19 +15,20 @@ */ package com.intellij.lang.properties.refactoring; -import com.intellij.openapi.components.*; +import com.intellij.openapi.components.PersistentStateComponent; +import com.intellij.openapi.components.ServiceManager; +import com.intellij.openapi.components.State; +import com.intellij.openapi.components.Storage; import com.intellij.util.xmlb.XmlSerializerUtil; @State( name = "PropertiesRefactoringSettings", storages = { - @Storage( - file = StoragePathMacros.APP_CONFIG + "/other.xml" - )} + @Storage(file = "baseRefactoring.xml"), + @Storage(file = "other.xml", deprecated = true) + } ) public class PropertiesRefactoringSettings implements PersistentStateComponent { - - public boolean RENAME_SEARCH_IN_COMMENTS = false; public static PropertiesRefactoringSettings getInstance() { diff --git a/plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/XPathAppComponent.java b/plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/XPathAppComponent.java index 6ddd26eec233..0f2f30583514 100644 --- a/plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/XPathAppComponent.java +++ b/plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/XPathAppComponent.java @@ -21,7 +21,10 @@ import com.intellij.codeInsight.hint.HintUtil; import com.intellij.codeInsight.template.impl.DefaultLiveTemplatesProvider; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.components.*; +import com.intellij.openapi.components.ApplicationComponent; +import com.intellij.openapi.components.PersistentStateComponent; +import com.intellij.openapi.components.State; +import com.intellij.openapi.components.Storage; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.ScrollType; import com.intellij.openapi.editor.markup.RangeHighlighter; @@ -49,9 +52,9 @@ import java.util.List; @State( name = "XPathView.XPathViewPlugin", storages = { - @Storage( - file = StoragePathMacros.APP_CONFIG + "/other.xml" - )} + @Storage(file = "xpath.xml"), + @Storage(file = "other.xml", deprecated = true) + } ) public class XPathAppComponent implements ApplicationComponent, PersistentStateComponent, DefaultLiveTemplatesProvider { private static final String ACTION_FIND_NEXT = "FindNext"; diff --git a/python/ide/src/META-INF/pycharm-core.xml b/python/ide/src/META-INF/pycharm-core.xml index 612c27aaded9..e61485813422 100644 --- a/python/ide/src/META-INF/pycharm-core.xml +++ b/python/ide/src/META-INF/pycharm-core.xml @@ -69,8 +69,7 @@ - + diff --git a/resources/src/idea/RichPlatformPlugin.xml b/resources/src/idea/RichPlatformPlugin.xml index 6122c51eba2f..45381666b6d3 100644 --- a/resources/src/idea/RichPlatformPlugin.xml +++ b/resources/src/idea/RichPlatformPlugin.xml @@ -343,8 +343,7 @@ - +