Merge remote-tracking branch 'origin/master'

This commit is contained in:
Alexander Lobas
2012-05-02 20:06:19 +04:00
32 changed files with 268 additions and 160 deletions
@@ -647,7 +647,7 @@ public class CompileDriver {
final String contentName =
forceCompile ? CompilerBundle.message("compiler.content.name.compile") : CompilerBundle.message("compiler.content.name.make");
final boolean compileInBackground = useServer? true : CompilerWorkspaceConfiguration.getInstance(myProject).COMPILE_IN_BACKGROUND;
final boolean compileInBackground = true;
final CompilerTask compileTask =
new CompilerTask(myProject, compileInBackground, contentName, ApplicationManager.getApplication().isUnitTestMode());
@@ -1301,6 +1301,8 @@ public class CompileDriver {
final Function<Pair<int[], Set<VirtualFile>>, Pair<int[], Set<VirtualFile>>> dependencyFilter = new DependentClassesCumulativeFilter();
do {
generatedTypes.clear();
snapshot = null;
for (int currentCompiler = 0, translatorsLength = translators.length; currentCompiler < translatorsLength; currentCompiler++) {
sink.setCurrentCompilerIndex(currentCompiler);
final TranslatingCompiler compiler = translators[currentCompiler];
@@ -1310,18 +1312,16 @@ public class CompileDriver {
dumbService.waitForSmartMode();
if (round == 0) {
if (snapshot == null || ContainerUtil.intersects(generatedTypes, compilerManager.getRegisteredInputTypes(compiler))) {
// rescan snapshot if previously generated files may influence the input of this compiler
snapshot = ApplicationManager.getApplication().runReadAction(new Computable<VirtualFile[]>() {
public VirtualFile[] compute() {
return context.getCompileScope().getFiles(null, true);
}
});
recalculateChunkToFilesMap(context, sortedChunks, snapshot, chunkMap);
chunkFiles = chunkMap.get(currentChunk);
total = snapshot.length * translatorsLength;
}
if (snapshot == null || ContainerUtil.intersects(generatedTypes, compilerManager.getRegisteredInputTypes(compiler))) {
// rescan snapshot if previously generated files may influence the input of this compiler
snapshot = ApplicationManager.getApplication().runReadAction(new Computable<VirtualFile[]>() {
public VirtualFile[] compute() {
return context.getCompileScope().getFiles(null, true);
}
});
recalculateChunkToFilesMap(context, sortedChunks, snapshot, chunkMap);
chunkFiles = chunkMap.get(currentChunk);
total = snapshot.length * translatorsLength;
}
final CompileContextEx _context;
@@ -2250,7 +2250,7 @@ public class CompileDriver {
public void executeCompileTask(final CompileTask task, final CompileScope scope, final String contentName, final Runnable onTaskFinished) {
final CompilerTask progressManagerTask =
new CompilerTask(myProject, CompilerWorkspaceConfiguration.getInstance(myProject).COMPILE_IN_BACKGROUND, contentName, false);
new CompilerTask(myProject, true, contentName, false);
final CompileContextImpl compileContext = new CompileContextImpl(myProject, progressManagerTask, scope, null, false, false);
FileDocumentManager.getInstance().saveAllDocuments();
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.compiler.options.CompilerUIConfigurable">
<grid id="1663f" binding="myPanel" layout-manager="GridLayoutManager" row-count="8" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="1663f" binding="myPanel" layout-manager="GridLayoutManager" row-count="7" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="28" y="24" width="883" height="379"/>
@@ -10,7 +10,7 @@
<children>
<vspacer id="67edf">
<constraints>
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<grid id="b341d" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
@@ -69,17 +69,9 @@
<text resource-bundle="messages/CompilerBundle" key="add.notnull.assertions"/>
</properties>
</component>
<component id="660fd" class="javax.swing.JCheckBox" binding="myCbCompileInBackground">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/CompilerBundle" key="label.option.compile.in.background"/>
</properties>
</component>
<component id="348ee" class="javax.swing.JCheckBox" binding="myCbAutoShowFirstError">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/CompilerBundle" key="label.option.autoshow.first.error"/>
@@ -87,7 +79,7 @@
</component>
<component id="ce617" class="javax.swing.JCheckBox" binding="myCbUseCompileServer" default-binding="true">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Use compile server for project compilation"/>
@@ -95,7 +87,7 @@
</component>
<component id="b9b2d" class="javax.swing.JCheckBox" binding="myCbMakeProjectOnSave">
<constraints>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Make project automatically"/>
@@ -39,7 +39,6 @@ public class CompilerUIConfigurable implements SearchableConfigurable, Configura
private final Project myProject;
private JTextField myResourcePatternsField;
private JCheckBox myCbCompileInBackground;
private JCheckBox myCbClearOutputDirectory;
private JCheckBox myCbAssertNotNull;
private JLabel myPatternLegendLabel;
@@ -71,7 +70,6 @@ public class CompilerUIConfigurable implements SearchableConfigurable, Configura
final CompilerConfigurationImpl configuration = (CompilerConfigurationImpl)CompilerConfiguration.getInstance(myProject);
final CompilerWorkspaceConfiguration workspaceConfiguration = CompilerWorkspaceConfiguration.getInstance(myProject);
myCbCompileInBackground.setSelected(workspaceConfiguration.COMPILE_IN_BACKGROUND);
myCbAutoShowFirstError.setSelected(workspaceConfiguration.AUTO_SHOW_ERRORS_IN_EDITOR);
myCbClearOutputDirectory.setSelected(workspaceConfiguration.CLEAR_OUTPUT_DIRECTORY);
myCbAssertNotNull.setSelected(configuration.isAddNotNullAssertions());
@@ -99,7 +97,6 @@ public class CompilerUIConfigurable implements SearchableConfigurable, Configura
CompilerConfigurationImpl configuration = (CompilerConfigurationImpl)CompilerConfiguration.getInstance(myProject);
final CompilerWorkspaceConfiguration workspaceConfiguration = CompilerWorkspaceConfiguration.getInstance(myProject);
workspaceConfiguration.COMPILE_IN_BACKGROUND = myCbCompileInBackground.isSelected();
workspaceConfiguration.AUTO_SHOW_ERRORS_IN_EDITOR = myCbAutoShowFirstError.isSelected();
workspaceConfiguration.CLEAR_OUTPUT_DIRECTORY = myCbClearOutputDirectory.isSelected();
boolean wasUsing = workspaceConfiguration.USE_COMPILE_SERVER;
@@ -165,7 +162,6 @@ public class CompilerUIConfigurable implements SearchableConfigurable, Configura
public boolean isModified() {
boolean isModified = false;
final CompilerWorkspaceConfiguration workspaceConfiguration = CompilerWorkspaceConfiguration.getInstance(myProject);
isModified |= ComparingUtils.isModified(myCbCompileInBackground, workspaceConfiguration.COMPILE_IN_BACKGROUND);
isModified |= ComparingUtils.isModified(myCbAutoShowFirstError, workspaceConfiguration.AUTO_SHOW_ERRORS_IN_EDITOR);
isModified |= ComparingUtils.isModified(myCbUseCompileServer, workspaceConfiguration.USE_COMPILE_SERVER);
isModified |= ComparingUtils.isModified(myCbMakeProjectOnSave, workspaceConfiguration.MAKE_PROJECT_ON_SAVE);
@@ -37,7 +37,6 @@ import com.intellij.util.xmlb.XmlSerializerUtil;
)
public class CompilerWorkspaceConfiguration implements PersistentStateComponent<CompilerWorkspaceConfiguration> {
public boolean COMPILE_IN_BACKGROUND = true;
public boolean AUTO_SHOW_ERRORS_IN_EDITOR = true;
@Deprecated public boolean CLOSE_MESSAGE_VIEW_IF_SUCCESS = true;
public boolean CLEAR_OUTPUT_DIRECTORY = true;
@@ -17,10 +17,13 @@ package com.intellij.codeInsight.completion;
import com.intellij.codeInsight.ExpectedTypeInfo;
import com.intellij.codeInsight.ExpectedTypeInfoImpl;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.codeInsight.lookup.LookupElementWeigher;
import com.intellij.codeInsight.lookup.PsiTypeLookupItem;
import com.intellij.codeInsight.completion.impl.CompletionSorterImpl;
import com.intellij.codeInsight.completion.impl.LiftShorterItemsClassifier;
import com.intellij.codeInsight.lookup.*;
import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.patterns.PsiJavaPatterns;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
@@ -31,6 +34,7 @@ import com.intellij.psi.util.PropertyUtil;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.psi.util.TypeConversionUtil;
import com.intellij.util.ProcessingContext;
import com.intellij.util.containers.ContainerUtil;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NotNull;
@@ -75,6 +79,32 @@ public class JavaCompletionSorting {
CompletionSorter sorter = CompletionSorter.defaultSorter(parameters, result.getPrefixMatcher());
if (!smart && afterNew) {
sorter = sorter.weighBefore("liftShorter", new PreferExpected(true, expectedTypes));
} else {
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(position.getProject()).getFileIndex();
sorter = ((CompletionSorterImpl)sorter).withClassifier("liftShorter", true, new ClassifierFactory<LookupElement>("liftShorterClasses") {
@Override
public Classifier<LookupElement> createClassifier(Classifier<LookupElement> next) {
return new LiftShorterItemsClassifier(next, new LiftShorterItemsClassifier.LiftingCondition() {
@Override
public boolean shouldLift(LookupElement shorterElement, LookupElement longerElement, ProcessingContext context) {
if (super.shouldLift(shorterElement, longerElement, context)) {
return true;
}
Object object = shorterElement.getObject();
if (object instanceof PsiClass) {
PsiFile file = ((PsiClass)object).getContainingFile();
if (file != null) {
VirtualFile vFile = file.getOriginalFile().getVirtualFile();
if (vFile != null && fileIndex.isInSource(vFile)) {
return true;
}
}
}
return false;
}
});
}
});
}
if (smart) {
sorter = sorter.weighBefore("negativeStats", new PreferDefaultTypeWeigher(expectedTypes, parameters));
@@ -101,7 +101,7 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase {
public void testDispreferImpls() throws Throwable {
myFixture.addClass("package foo; public class Xxx {}");
configureSecondCompletion();
assertPreferredItems(1, "Xxx", "XxxEx", "XxxImpl", "Xxy");
assertPreferredItems(0, "Xxx", "XxxEx", "XxxImpl", "Xxy");
}
public void testPreferOwnInnerClasses() throws Throwable {
@@ -128,7 +128,7 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase {
myFixture.addClass("package foo; public interface XaYa {}");
myFixture.addClass("package foo; public interface XyYa {}");
configureSecondCompletion();
assertPreferredItems(1, "XaYa", "XaYaEx", "XaYaImpl", "XyYa", "XyYaXa");
assertPreferredItems(0, "XaYa", "XaYaEx", "XaYaImpl", "XyYa", "XyYaXa");
}
public void testPreferLessParameters() throws Throwable {
@@ -219,7 +219,7 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase {
}
public void testPreferClassStaticMembers() {
checkPreferredItems(1, "Zoo", "Zoo.A", "Zoo.B", "Zoo.C", "Zoo.D", "Zoo.E", "Zoo.F", "Zoo.G", "Zoo.H");
checkPreferredItems(0, "Zoo", "Zoo.A", "Zoo.B", "Zoo.C", "Zoo.D", "Zoo.E", "Zoo.F", "Zoo.G", "Zoo.H");
}
public void testPreferFinallyToFinal() {
@@ -21,7 +21,7 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase {
}
public void testJComponentAdd() throws Throwable {
checkPreferredItems(0, "name", "b", "fooBean239", "this", "getName");
checkPreferredItems(0, "name", "b", "foo", "fooBean239", "this", "getName");
}
public void testJComponentAddNew() throws Throwable {
@@ -3,6 +3,7 @@ package org.jetbrains.jps.incremental;
import com.intellij.openapi.Forceable;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.LowMemoryWatcher;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.io.MappingFailedException;
@@ -39,7 +40,6 @@ import java.util.concurrent.TimeUnit;
*/
public class IncProjectBuilder {
private static final Logger LOG = Logger.getInstance("#org.jetbrains.jps.incremental.IncProjectBuilder");
private static final Logger LocalLOG = Logger.getInstance("#org.jetbrains.jps.incremental.Builder");
public static final String COMPILE_SERVER_NAME = "COMPILE SERVER";
private static final String CLASSPATH_INDEX_FINE_NAME = "classpath.index";
@@ -235,6 +235,23 @@ public class IncProjectBuilder {
private void cleanOutputRoots(CompileContext context) throws ProjectBuildException {
// whole project is affected
final boolean shouldClear = context.getProject().getCompilerConfiguration().isClearOutputDirectoryOnRebuild();
try {
if (shouldClear) {
clearOutputs(context);
}
else {
for (Module module : context.getProject().getModules().values()) {
final String moduleName = module.getName();
clearOutputFiles(context, moduleName, true);
clearOutputFiles(context, moduleName, false);
}
}
}
catch (IOException e) {
throw new ProjectBuildException("Error cleaning output files", e);
}
try {
context.getTimestamps().clean();
}
@@ -248,19 +265,33 @@ public class IncProjectBuilder {
throw new ProjectBuildException("Error cleaning compiler storages", e);
}
myProjectDescriptor.fsState.clearAll();
}
private static void clearOutputFiles(CompileContext context, final String moduleName, boolean forTests) throws IOException {
final SourceToOutputMapping map = context.getDataManager().getSourceToOutputMap(moduleName, forTests);
for (String srcPath : map.getKeys()) {
final Collection<String> outs = map.getState(srcPath);
if (outs != null) {
for (String out : outs) {
new File(out).delete();
}
}
}
}
private static void clearOutputs(CompileContext context) throws ProjectBuildException, IOException {
final Collection<Module> modulesToClean = context.getProject().getModules().values();
final Set<File> rootsToDelete = new HashSet<File>();
final Map<File, Set<Pair<String, Boolean>>> rootsToDelete = new HashMap<File, Set<Pair<String, Boolean>>>(); // map: outputRoot-> setOfPairs([module, isTest])
final Set<File> allSourceRoots = new HashSet<File>();
for (Module module : modulesToClean) {
final File out = context.getProjectPaths().getModuleOutputDir(module, false);
if (out != null) {
rootsToDelete.add(out);
appendRootInfo(rootsToDelete, out, module, false);
}
final File testOut = context.getProjectPaths().getModuleOutputDir(module, true);
if (testOut != null) {
rootsToDelete.add(testOut);
appendRootInfo(rootsToDelete, testOut, module, true);
}
final List<RootDescriptor> moduleRoots = context.getModuleRoots(module);
for (RootDescriptor d : moduleRoots) {
@@ -270,9 +301,10 @@ public class IncProjectBuilder {
// check that output and source roots are not overlapping
final List<File> filesToDelete = new ArrayList<File>();
for (File outputRoot : rootsToDelete) {
for (Map.Entry<File, Set<Pair<String, Boolean>>> entry : rootsToDelete.entrySet()) {
context.checkCanceled();
boolean okToDelete = true;
final File outputRoot = entry.getKey();
if (PathUtil.isUnder(allSourceRoots, outputRoot)) {
okToDelete = false;
}
@@ -294,6 +326,10 @@ public class IncProjectBuilder {
}
else {
context.processMessage(new CompilerMessage(COMPILE_SERVER_NAME, BuildMessage.Kind.WARNING, "Output path " + outputRoot.getPath() + " intersects with a source root. The output cannot be cleaned."));
// clean only those files we are aware of
for (Pair<String, Boolean> info : entry.getValue()) {
clearOutputFiles(context, info.first, info.second);
}
}
}
@@ -301,6 +337,15 @@ public class IncProjectBuilder {
FileUtil.asyncDelete(filesToDelete);
}
private static void appendRootInfo(Map<File, Set<Pair<String, Boolean>>> rootsToDelete, File out, Module module, boolean isTest) {
Set<Pair<String, Boolean>> infos = rootsToDelete.get(out);
if (infos == null) {
infos = new HashSet<Pair<String, Boolean>>();
rootsToDelete.put(out, infos);
}
infos.add(Pair.create(module.getName(), isTest));
}
private static void runTasks(CompileContext context, final List<BuildTask> tasks) throws ProjectBuildException {
for (BuildTask task : tasks) {
task.build(context);
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.openapi.vfs.newvfs.persistent;
package com.intellij.openapi.vfs;
import com.intellij.openapi.application.ApplicationManager;
import org.jetbrains.annotations.NonNls;
@@ -34,7 +34,7 @@ import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.UserDataHolderBase;
import com.intellij.openapi.vfs.NonPhysicalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.newvfs.persistent.PersistentFSConstants;
import com.intellij.openapi.vfs.PersistentFSConstants;
import com.intellij.psi.impl.PsiFileEx;
import com.intellij.psi.impl.PsiManagerEx;
import com.intellij.psi.impl.PsiManagerImpl;
Binary file not shown.

After

Width:  |  Height:  |  Size: 639 B

@@ -107,6 +107,7 @@ public class InspectionEP extends LanguageExtensionPoint {
public String level;
public HighlightDisplayLevel getDefaultLevel() {
if (level == null) return HighlightDisplayLevel.WARNING;
HighlightDisplayLevel displayLevel = HighlightDisplayLevel.find(level);
if (displayLevel == null) {
LOG.error("Can't find highlight display level: " + level);
@@ -292,7 +292,7 @@ public class CompletionServiceImpl extends CompletionService{
return sorter.withClassifier("priority", true, new ClassifierFactory<LookupElement>("liftShorter") {
@Override
public Classifier<LookupElement> createClassifier(final Classifier<LookupElement> next) {
return new LiftShorterItemsClassifier(next);
return new LiftShorterItemsClassifier(next, new LiftShorterItemsClassifier.LiftingCondition());
}
});
}
@@ -30,14 +30,16 @@ import java.util.*;
/**
* @author peter
*/
class LiftShorterItemsClassifier extends Classifier<LookupElement> {
public class LiftShorterItemsClassifier extends Classifier<LookupElement> {
private final TreeSet<String> mySortedStrings;
private final MultiMap<String, LookupElement> myElements;
private final MultiMap<String, String> myPrefixes;
private final Classifier<LookupElement> myNext;
private final LiftingCondition myCondition;
public LiftShorterItemsClassifier(Classifier<LookupElement> next) {
public LiftShorterItemsClassifier(Classifier<LookupElement> next, LiftingCondition condition) {
myNext = next;
myCondition = condition;
mySortedStrings = new TreeSet<String>();
myElements = new MultiMap<String, LookupElement>();
myPrefixes = new MultiMap<String, String>();
@@ -76,9 +78,6 @@ class LiftShorterItemsClassifier extends Classifier<LookupElement> {
@Override
public Iterable<LookupElement> classify(Iterable<LookupElement> source, ProcessingContext context) {
if (context.get(CompletionLookupArranger.PURE_RELEVANCE) == Boolean.TRUE) {
return myNext.classify(source, context);
}
return liftShorterElements(source, new THashSet<LookupElement>(TObjectHashingStrategy.IDENTITY), context);
}
@@ -99,7 +98,7 @@ class LiftShorterItemsClassifier extends Classifier<LookupElement> {
for (String prefix : prefixes) {
List<LookupElement> shorter = new SmartList<LookupElement>();
for (LookupElement shorterElement : myElements.get(prefix)) {
if (srcSet.contains(shorterElement) && processed.add(shorterElement)) {
if (srcSet.contains(shorterElement) && myCondition.shouldLift(shorterElement, element, context) && processed.add(shorterElement)) {
shorter.add(shorterElement);
}
}
@@ -134,4 +133,10 @@ class LiftShorterItemsClassifier extends Classifier<LookupElement> {
}
myNext.describeItems(map, context);
}
public static class LiftingCondition {
public boolean shouldLift(LookupElement shorterElement, LookupElement longerElement, ProcessingContext context) {
return context.get(CompletionLookupArranger.PURE_RELEVANCE) != Boolean.TRUE;
}
}
}
@@ -16,6 +16,7 @@
package com.intellij.codeInsight.intention.impl;
import com.intellij.codeInsight.lookup.LookupManager;
import com.intellij.codeInsight.template.TemplateManager;
import com.intellij.lang.Language;
import com.intellij.lang.injection.InjectedLanguageManager;
import com.intellij.openapi.Disposable;
@@ -126,7 +127,9 @@ public class QuickEditHandler extends DocumentAdapter implements Disposable {
@Override
public void update(AnActionEvent e) {
Editor editor = PlatformDataKeys.EDITOR.getData(e.getDataContext());
e.getPresentation().setEnabled(editor != null && LookupManager.getActiveLookup(editor) == null);
e.getPresentation().setEnabled(
editor != null && LookupManager.getActiveLookup(editor) == null &&
TemplateManager.getInstance(myProject).getActiveTemplate(editor) == null);
}
@Override
@@ -24,6 +24,7 @@ import com.intellij.openapi.keymap.KeymapManager;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.IconLoader;
import javax.swing.*;
@@ -31,10 +32,13 @@ import javax.swing.*;
* @author dyoma
*/
public class RestartAction extends AnAction implements DumbAware {
private static final Icon STOP_AND_START_ICON = IconLoader.getIcon("/actions/restart.png");
private ProcessHandler myProcessHandler;
private final ProgramRunner myRunner;
private final RunContentDescriptor myDescriptor;
private final Executor myExecutor;
private final Icon myIcon;
private final ExecutionEnvironment myEnvironment;
public RestartAction(final Executor executor,
@@ -44,6 +48,7 @@ public class RestartAction extends AnAction implements DumbAware {
final RunContentDescriptor descritor,
final ExecutionEnvironment env) {
super(null, null, icon);
myIcon = icon;
myEnvironment = env;
getTemplatePresentation().setEnabled(false);
myProcessHandler = processHandler;
@@ -55,6 +60,7 @@ public class RestartAction extends AnAction implements DumbAware {
public void actionPerformed(final AnActionEvent e) {
final DataContext dataContext = e.getDataContext();
ActionManager.getInstance().getAction(IdeActions.ACTION_STOP_PROGRAM).actionPerformed(e);
doRestart(dataContext);
}
@@ -65,7 +71,7 @@ public class RestartAction extends AnAction implements DumbAware {
private void doRestart(final DataContext dataContext) {
final Project project = PlatformDataKeys.PROJECT.getData(dataContext);
if (ExecutorRegistry.getInstance().isStarting(project, myExecutor.getId(), myRunner.getRunnerId())) {
return;
return;
}
try {
final ExecutionEnvironment old = myEnvironment;
@@ -86,8 +92,9 @@ public class RestartAction extends AnAction implements DumbAware {
if (myProcessHandler != null && !isRunning) {
myProcessHandler = null; // already terminated
}
presentation.setIcon(isRunning ? STOP_AND_START_ICON : myIcon);
presentation.setEnabled(!isRunning /*&& myRunner.canRun(, myProfile)*/ && !ExecutorRegistry.getInstance().isStarting(myEnvironment.getProject(), myExecutor.getId(), myRunner.getRunnerId()));
presentation.setEnabled(true);
}
public void registerShortcut(final JComponent component) {
@@ -32,11 +32,9 @@ public class SmartTreeStructure extends AbstractTreeStructure {
public SmartTreeStructure(@NotNull Project project, @NotNull TreeModel model) {
myModel = model;
myProject = project;
}
public void commit() {
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
}
@NotNull
@@ -54,7 +52,6 @@ public class SmartTreeStructure extends AbstractTreeStructure {
public Object getRootElement() {
if (myRootElementWrapper == null){
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
myRootElementWrapper = createTree();
}
return myRootElementWrapper;
@@ -1,3 +1,18 @@
/*
* 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.fileEditor.impl;
import com.intellij.ide.ui.UISettings;
@@ -15,6 +30,7 @@ public class UniqueNameEditorTabTitleProvider implements EditorTabTitleProvider
if (!UISettings.getInstance().SHOW_DIRECTORY_FOR_NON_UNIQUE_FILENAMES || DumbService.isDumb(project)) {
return null;
}
return UniqueVFilePathBuilder.getInstance().getUniqueVirtualFilePath(project, file);
final String uniqueName = UniqueVFilePathBuilder.getInstance().getUniqueVirtualFilePath(project, file);
return uniqueName.equals(file.getName()) ? null : uniqueName;
}
}
@@ -35,7 +35,7 @@ public class UniqueVFilePathBuilderImpl extends UniqueVFilePathBuilder {
public String getUniqueVirtualFilePath(Project project, VirtualFile file) {
final Collection<VirtualFile> filesWithSameName = FilenameIndex.getVirtualFilesByName(project, file.getName(),
ProjectScope.getProjectScope(project));
if (filesWithSameName.size() > 1) {
if (filesWithSameName.size() > 1 && filesWithSameName.contains(file)) {
String path = project.getBasePath();
path = path == null ? "" : FileUtil.toSystemIndependentName(path);
UniqueNameBuilder<VirtualFile> builder = new UniqueNameBuilder<VirtualFile>(path, File.separator, 25);
@@ -39,19 +39,21 @@ public class FileReferenceSet {
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet");
private static final FileType[] EMPTY_FILE_TYPES = {};
private static final char SEPARATOR = '/';
private static final String SEPARATOR_STRING = "/";
public static final CustomizableReferenceProvider.CustomizationKey<Function<PsiFile, Collection<PsiFileSystemItem>>> DEFAULT_PATH_EVALUATOR_OPTION =
new CustomizableReferenceProvider.CustomizationKey<Function<PsiFile, Collection<PsiFileSystemItem>>>(PsiBundle.message("default.path.evaluator.option"));
public static final Function<PsiFile, Collection<PsiFileSystemItem>> ABSOLUTE_TOP_LEVEL = new Function<PsiFile, Collection<PsiFileSystemItem>>() {
@Override
@Nullable
public Collection<PsiFileSystemItem> fun(final PsiFile file) {
return getAbsoluteTopLevelDirLocations(file);
}
};
public static final Condition<PsiFileSystemItem> FILE_FILTER = new Condition<PsiFileSystemItem>() {
public static final CustomizableReferenceProvider.CustomizationKey<Function<PsiFile, Collection<PsiFileSystemItem>>>
DEFAULT_PATH_EVALUATOR_OPTION =
new CustomizableReferenceProvider.CustomizationKey<Function<PsiFile, Collection<PsiFileSystemItem>>>(
PsiBundle.message("default.path.evaluator.option"));
public static final Function<PsiFile, Collection<PsiFileSystemItem>> ABSOLUTE_TOP_LEVEL =
new Function<PsiFile, Collection<PsiFileSystemItem>>() {
@Override
@Nullable
public Collection<PsiFileSystemItem> fun(final PsiFile file) {
return getAbsoluteTopLevelDirLocations(file);
}
};
public static final Condition<PsiFileSystemItem> FILE_FILTER = new Condition<PsiFileSystemItem>() {
@Override
public boolean value(final PsiFileSystemItem item) {
return item instanceof PsiFile;
@@ -114,7 +116,14 @@ public class FileReferenceSet {
return absoluteUrlNeedsStartSlash() ? "/" + relativePath : relativePath;
}
public static FileReferenceSet createSet(PsiElement element, final boolean soft, boolean endingSlashNotAllowed, final boolean urlEncoded) {
public String getSeparatorString() {
return "/";
}
public static FileReferenceSet createSet(PsiElement element,
final boolean soft,
boolean endingSlashNotAllowed,
final boolean urlEncoded) {
String text;
int offset;
@@ -202,23 +211,34 @@ public class FileReferenceSet {
String str = myPathStringNonTrimmed;
final List<FileReference> referencesList = new ArrayList<FileReference>();
String separatorString = getSeparatorString(); // separator's length can be more then 1 char
int sepLen = separatorString.length();
int currentSlash = -sepLen;
// skip white space
int currentSlash = -1;
while (currentSlash + 1 < str.length() && Character.isWhitespace(str.charAt(currentSlash + 1))) currentSlash++;
if (currentSlash + 1 < str.length() && str.charAt(currentSlash + 1) == SEPARATOR) currentSlash++;
while (currentSlash + sepLen < str.length() && Character.isWhitespace(str.charAt(currentSlash + sepLen))) {
currentSlash++;
}
if (currentSlash + sepLen + sepLen < str.length() &&
str.substring(currentSlash + sepLen, currentSlash + sepLen + sepLen).equals(separatorString)) {
currentSlash+=sepLen;
}
int index = 0;
if (str.equals(SEPARATOR_STRING)) {
if (str.equals(separatorString)) {
final FileReference fileReference =
createFileReference(new TextRange(myStartInElement, myStartInElement + 1), index++, SEPARATOR_STRING);
createFileReference(new TextRange(myStartInElement, myStartInElement + 1), index++, separatorString);
referencesList.add(fileReference);
}
while (true) {
final int nextSlash = str.indexOf(SEPARATOR, currentSlash + 1);
final String subreferenceText = nextSlash > 0 ? str.substring(currentSlash + 1, nextSlash) : str.substring(currentSlash + 1);
final int nextSlash = str.indexOf(separatorString, currentSlash + sepLen);
final String subreferenceText = nextSlash > 0 ? str.substring(currentSlash + sepLen, nextSlash) : str.substring(currentSlash + sepLen);
final FileReference ref = createFileReference(
new TextRange(myStartInElement + currentSlash + 1, myStartInElement + (nextSlash > 0 ? nextSlash : str.length())),
new TextRange(myStartInElement + currentSlash + sepLen, myStartInElement + (nextSlash > 0 ? nextSlash : str.length())),
index++,
subreferenceText);
referencesList.add(ref);
@@ -259,7 +279,7 @@ public class FileReferenceSet {
public Collection<PsiFileSystemItem> computeDefaultContexts() {
final PsiFile file = getContainingFile();
if (file == null) return Collections.emptyList();
if (myOptions != null) {
final Function<PsiFile, Collection<PsiFileSystemItem>> value = DEFAULT_PATH_EVALUATOR_OPTION.getValue(myOptions);
@@ -294,7 +314,7 @@ public class FileReferenceSet {
private Collection<PsiFileSystemItem> getContextByFile(@NotNull PsiFile file) {
final PsiElement context = file.getContext();
if (context != null) file = context.getContainingFile();
if (useIncludingFileAsContext()) {
final FileContextProvider contextProvider = FileContextProvider.getProvider(file);
if (contextProvider != null) {
@@ -317,7 +337,7 @@ public class FileReferenceSet {
final Project project = file.getProject();
for (FileReferenceHelper helper : helpers) {
if (helper.isMine(project, virtualFile)) {
list.addAll(helper.getContexts(project, virtualFile));
list.addAll(helper.getContexts(project, virtualFile));
}
}
if (list.size() > 0) {
@@ -339,7 +359,7 @@ public class FileReferenceSet {
}
public boolean isAbsolutePathReference() {
return myPathString.startsWith(SEPARATOR_STRING);
return myPathString.startsWith(getSeparatorString());
}
protected boolean useIncludingFileAsContext() {
@@ -64,7 +64,7 @@ public abstract class FileBasedIndexExtension<K, V> {
*
* Use carefully, because indexing large files may influence index update speed dramatically.
*
* @see com.intellij.openapi.vfs.newvfs.persistent.PersistentFSConstants#MAX_INTELLISENSE_FILESIZE
* @see com.intellij.openapi.vfs.PersistentFSConstants#MAX_INTELLISENSE_FILESIZE
*/
@NotNull
public Collection<FileType> getFileTypesWithSizeLimitNotApplicable() {
@@ -71,7 +71,7 @@ public abstract class QuickSwitchSchemeAction extends AnAction implements DumbAw
}
protected JBPopupFactory.ActionSelectionAid getAidMethod() {
return JBPopupFactory.ActionSelectionAid.NUMBERING;
return JBPopupFactory.ActionSelectionAid.ALPHA_NUMBERING;
}
protected String getPopupTitle(AnActionEvent e) {
@@ -77,7 +77,7 @@ public interface FileEditor extends UserDataHolder, Disposable {
void setState(@NotNull FileEditorState state);
/**
* @return whether the editor's content is modified in comparision with its file.
* @return whether the editor's content is modified in comparison with its file.
*/
boolean isModified();
@@ -26,6 +26,7 @@ import com.intellij.openapi.fileTypes.FileTypes;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.util.ActionCallback;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.vfs.PersistentFSConstants;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.pom.Navigatable;
@@ -179,6 +180,9 @@ public abstract class AutoScrollToSourceHandler {
// Attempt to navigate to the virtual file with unknown file type will show a modal dialog
// asking to register some file type for this file. This behaviour is undesirable when autoscrolling.
if (vFile.getFileType() == FileTypes.UNKNOWN) return;
//IDEA-84881 Don't autoscroll to very large files
if (vFile.getLength() > PersistentFSConstants.getMaxIntellisenseFileSize()) return;
}
Navigatable[] navigatables = PlatformDataKeys.NAVIGATABLE_ARRAY.getData(context);
if (navigatables != null) {
@@ -2069,6 +2069,8 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
* tool window depending on decoration type.
*/
public void resized(final InternalDecorator source) {
if (!source.isShowing()) return; // do not recalculate the tool window size if it is not yet shown (and, therefore, has 0,0,0,0 bounds)
final WindowInfoImpl info = getInfo(source.getToolWindow().getId());
if (info.isFloating()) {
final Window owner = SwingUtilities.getWindowAncestor(source);
@@ -45,28 +45,23 @@ public class GitQuickListContentProvider implements VcsQuickListContentProvider
final ActionManager manager = ActionManager.getInstance();
final List<AnAction> actions = new ArrayList<AnAction>();
// Basic
actions.add(new Separator(activeVcs.getDisplayName()));
add("ChangesView.AddUnversioned", manager, actions);
add("CheckinProject", manager, actions);
add("CheckinFiles", manager, actions);
add("ChangesView.Rollback", manager, actions);
// History, Diff
addSeparator(actions);
add("Vcs.ShowTabbedFileHistory", manager, actions);
add("Annotate", manager, actions);
add("Compare.SameVersion", manager, actions);
// Pull/Push
addSeparator(actions);
add("Git.Branches", manager, actions);
add("Git.Fetch", manager, actions);
add("Git.Push", manager, actions);
// misc
add("Git.Stash", manager, actions);
add("Git.Unstash", manager, actions);
add("ChangesView.AddUnversioned", manager, actions);
add("Git.ResolveConflicts", manager, actions);
// Github
addSeparator(actions);
final AnAction githubRebase = manager.getAction("Github.Rebase");
@@ -90,11 +85,11 @@ public class GitQuickListContentProvider implements VcsQuickListContentProvider
return true;
}
private void addSeparator(@NotNull final List<AnAction> actions) {
private static void addSeparator(@NotNull final List<AnAction> actions) {
actions.add(new Separator());
}
private void add(String actionName, ActionManager manager, List<AnAction> actions) {
private static void add(String actionName, ActionManager manager, List<AnAction> actions) {
final AnAction action = manager.getAction(actionName);
assert action != null;
actions.add(action);
@@ -608,9 +608,9 @@ public class GitCheckinEnvironment implements CheckinEnvironment {
c.weightx = 1;
c.fill = GridBagConstraints.HORIZONTAL;
final List<String> usersList = getUsersList(project, roots);
final List<String> authors = usersList == null ? new ArrayList<String>() : new ArrayList<String>(usersList);
final Set<String> authors = usersList == null ? new HashSet<String>() : new HashSet<String>(usersList);
ContainerUtil.addAll(authors, mySettings.getCommitAuthors());
Collections.sort(authors);
Collections.sort(new ArrayList<String>(authors));
myAuthor = new JComboBox(ArrayUtil.toObjectArray(authors));
myAuthor.insertItemAt("", 0);
myAuthor.setSelectedItem("");
@@ -39,7 +39,7 @@ import java.util.Set;
/**
* <p>
* Stores files which are untracked by the Git repository.
* Should be updated by calling {@link #add(com.intellij.openapi.vfs.VirtualFile)} and {@link #remove(com.intellij.openapi.vfs.VirtualFile)}
* Should be updated by calling {@link #add(com.intellij.openapi.vfs.VirtualFile)} and {@link #remove(java.util.Collection)}
* whenever the list of unversioned files changes.
* Able to get the list of unversioned files from Git.
* </p>
@@ -68,10 +68,18 @@ import java.util.Set;
* In some cases (file creation/deletion) the file is not silently added/removed from the list - instead the file is marked as
* "possibly untracked" and Git is asked for the exact status of this file.
* It is needed, since the file may be created and added to the index independently, and events may race.
* <br/>
* </p>
* <p>
* Also, if .git/index changes, then a full refresh is initiated. The reason is not only untracked files tracking, but also handling
* committing outside IDEA, etc.
* </p>
* <p>
* Synchronization policy used in this class:<br/>
* myDefinitelyUntrackedFiles is accessed under the myDefinitelyUntrackedFiles lock.<br/>
* myPossiblyUntrackedFiles and myReady is accessed under the LOCK lock.<br/>
* This is done so, because the latter two variables are accessed from the AWT in after() and we don't want to lock the AWT long,
* while myDefinitelyUntrackedFiles is modified along with native request to Git.
* </p>
*
* @author Kirill Likhodedov
*/
@@ -84,9 +92,8 @@ public class GitUntrackedFilesHolder implements Disposable, BulkFileListener {
private final GitRepositoryFiles myRepositoryFiles;
private final Git myGit;
private Set<VirtualFile> myDefinitelyUntrackedFiles = new HashSet<VirtualFile>();
private Set<VirtualFile> myPossiblyUntrackedFiles = new HashSet<VirtualFile>();
private Set<VirtualFile> myPossiblyTrackedFiles = new HashSet<VirtualFile>();
private final Set<VirtualFile> myDefinitelyUntrackedFiles = new HashSet<VirtualFile>();
private final Set<VirtualFile> myPossiblyUntrackedFiles = new HashSet<VirtualFile>();
private boolean myReady; // if false, total refresh is needed
private final Object LOCK = new Object();
private final GitRepositoryManager myRepositoryManager;
@@ -112,10 +119,11 @@ public class GitUntrackedFilesHolder implements Disposable, BulkFileListener {
@Override
public void dispose() {
synchronized (LOCK) {
synchronized (myDefinitelyUntrackedFiles) {
myDefinitelyUntrackedFiles.clear();
}
synchronized (LOCK) {
myPossiblyUntrackedFiles.clear();
myPossiblyTrackedFiles.clear();
}
}
@@ -123,32 +131,8 @@ public class GitUntrackedFilesHolder implements Disposable, BulkFileListener {
* Adds the file to the list of untracked.
*/
public void add(@NotNull VirtualFile file) {
synchronized (LOCK) {
if (myReady) {
myDefinitelyUntrackedFiles.add(file);
}
}
}
/**
* Adds several files to the list of untracked.
*/
public void add(@NotNull Collection<VirtualFile> files) {
synchronized (LOCK) {
if (myReady) {
myDefinitelyUntrackedFiles.addAll(files);
}
}
}
/**
* Removes the file from untracked.
*/
public void remove(@NotNull VirtualFile file) {
synchronized (LOCK) {
if (myReady) {
myDefinitelyUntrackedFiles.remove(file);
}
synchronized (myDefinitelyUntrackedFiles) {
myDefinitelyUntrackedFiles.add(file);
}
}
@@ -156,10 +140,8 @@ public class GitUntrackedFilesHolder implements Disposable, BulkFileListener {
* Removes several files from untracked.
*/
public void remove(@NotNull Collection<VirtualFile> files) {
synchronized (LOCK) {
if (myReady) {
myDefinitelyUntrackedFiles.removeAll(files);
}
synchronized (myDefinitelyUntrackedFiles) {
myDefinitelyUntrackedFiles.removeAll(files);
}
}
@@ -176,7 +158,7 @@ public class GitUntrackedFilesHolder implements Disposable, BulkFileListener {
} else {
rescanAll();
}
synchronized (LOCK) {
synchronized (myDefinitelyUntrackedFiles) {
return myDefinitelyUntrackedFiles;
}
}
@@ -192,10 +174,12 @@ public class GitUntrackedFilesHolder implements Disposable, BulkFileListener {
*/
public void rescanAll() throws VcsException {
Set<VirtualFile> untrackedFiles = myGit.untrackedFiles(myProject, myRoot, null);
synchronized (myDefinitelyUntrackedFiles) {
myDefinitelyUntrackedFiles.clear();
myDefinitelyUntrackedFiles.addAll(untrackedFiles);
}
synchronized (LOCK) {
myDefinitelyUntrackedFiles = untrackedFiles;
myPossiblyUntrackedFiles.clear();
myPossiblyTrackedFiles.clear();
myReady = true;
}
}
@@ -216,17 +200,15 @@ public class GitUntrackedFilesHolder implements Disposable, BulkFileListener {
Set<VirtualFile> suspiciousFiles = new HashSet<VirtualFile>();
synchronized (LOCK) {
suspiciousFiles.addAll(myPossiblyUntrackedFiles);
suspiciousFiles.addAll(myPossiblyTrackedFiles);
myPossiblyUntrackedFiles.clear();
}
Set<VirtualFile> untrackedFiles = myGit.untrackedFiles(myProject, myRoot, suspiciousFiles);
suspiciousFiles.removeAll(untrackedFiles);
// files that were suspicious (and thus passed to 'git ls-files'), but are not untracked, are definitely tracked.
Set<VirtualFile> trackedFiles = suspiciousFiles;
synchronized (myDefinitelyUntrackedFiles) {
Set<VirtualFile> untrackedFiles = myGit.untrackedFiles(myProject, myRoot, suspiciousFiles);
suspiciousFiles.removeAll(untrackedFiles);
// files that were suspicious (and thus passed to 'git ls-files'), but are not untracked, are definitely tracked.
Set<VirtualFile> trackedFiles = suspiciousFiles;
synchronized (LOCK) {
myPossiblyUntrackedFiles.clear();
myPossiblyTrackedFiles.clear();
myDefinitelyUntrackedFiles.addAll(untrackedFiles);
myDefinitelyUntrackedFiles.removeAll(trackedFiles);
}
@@ -615,6 +615,20 @@ public class Main {
shouldFail { compileModule(myModule) }
}
public void "test stubs generated while processing groovy class file dependencies"() {
def foo = myFixture.addFileToProject('Foo.groovy', 'class Foo { }')
def bar = myFixture.addFileToProject('Bar.groovy', 'class Bar extends Foo { }')
def client = myFixture.addFileToProject('Client.groovy', 'class Client { Bar bar = new Bar() }')
def java = myFixture.addFileToProject('Java.java', 'class Java extends Client { String getName(Bar bar) { return bar.toString(); } }')
assertEmpty(make())
setFileText(bar, 'class Bar { }')
assertEmpty(make())
assert findClassFile("Client")
}
public static class IdeaModeTest extends GroovyCompilerTest {
@Override protected boolean useJps() { false }
}
@@ -15,7 +15,6 @@
*/
package org.jetbrains.idea.maven;
import com.intellij.compiler.CompilerWorkspaceConfiguration;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.Result;
import com.intellij.openapi.application.WriteAction;
@@ -67,7 +66,6 @@ public abstract class MavenTestCase extends UsefulTestCase {
protected VirtualFile myProjectPom;
protected List<VirtualFile> myAllPoms = new ArrayList<VirtualFile>();
private boolean myCompileInBackground;
static {
IdeaTestCase.initPlatformPrefix();
@@ -112,8 +110,6 @@ public abstract class MavenTestCase extends UsefulTestCase {
}
});
myCompileInBackground = CompilerWorkspaceConfiguration.getInstance(myProject).COMPILE_IN_BACKGROUND;
CompilerWorkspaceConfiguration.getInstance(myProject).COMPILE_IN_BACKGROUND = false;
}
private static void ensureTempDirCreated() {
@@ -137,8 +133,6 @@ public abstract class MavenTestCase extends UsefulTestCase {
@Override
protected void tearDown() throws Exception {
CompilerWorkspaceConfiguration.getInstance(myProject).COMPILE_IN_BACKGROUND = myCompileInBackground;
myProject = null;
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
@Override
@@ -300,7 +300,12 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit
private final Alarm myUpdateEditorAlarm = new Alarm();
private void selectionChanged() {
myBackSlashPressed.clear();
updateEditorsFromProperties();
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
updateEditorsFromProperties();
}
});
}
private void updateEditorsFromProperties() {
@@ -210,10 +210,9 @@ public final class GuiEditor extends JPanel implements DataProvider {
* @param file file to be edited
* @throws java.lang.IllegalArgumentException
* if the <code>file</code>
* is <code>null</code> or <code>file</code> is not falid PsiFile
* is <code>null</code> or <code>file</code> is not valid PsiFile
*/
public GuiEditor(@NotNull final Module module, @NotNull final VirtualFile file) {
ApplicationManager.getApplication().assertIsDispatchThread();
LOG.assertTrue(file.isValid());
myModule = module;
@@ -474,7 +473,9 @@ public final class GuiEditor extends JPanel implements DataProvider {
}
// Standard Swing cut/copy/paste actions should work if user is editing something inside property inspector
final UIDesignerToolWindowManager manager = UIDesignerToolWindowManager.getInstance(getProject());
Project project = getProject();
if (project.isDisposed()) return null;
final UIDesignerToolWindowManager manager = UIDesignerToolWindowManager.getInstance(project);
final PropertyInspector inspector = manager.getPropertyInspector();
if (inspector != null && inspector.isEditing()) {
return null;