diff --git a/build/lib/gant/jps-sources.zip b/build/lib/gant/jps-sources.zip index 426e647bc1b5..77e537d09b3f 100644 Binary files a/build/lib/gant/jps-sources.zip and b/build/lib/gant/jps-sources.zip differ diff --git a/build/lib/gant/lib/jps-programRunner.jar b/build/lib/gant/lib/jps-programRunner.jar index 87b71b0e264c..15799992ceb2 100644 Binary files a/build/lib/gant/lib/jps-programRunner.jar and b/build/lib/gant/lib/jps-programRunner.jar differ diff --git a/build/lib/gant/lib/jps.jar b/build/lib/gant/lib/jps.jar index 95c3711a8841..d379f63b1a06 100644 Binary files a/build/lib/gant/lib/jps.jar and b/build/lib/gant/lib/jps.jar differ diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/util/InspectionValidator.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/util/InspectionValidator.java index 00ae0970c118..64088c825e2b 100644 --- a/java/compiler/openapi/src/com/intellij/openapi/compiler/util/InspectionValidator.java +++ b/java/compiler/openapi/src/com/intellij/openapi/compiler/util/InspectionValidator.java @@ -19,18 +19,20 @@ package com.intellij.openapi.compiler.util; import com.intellij.codeHighlighting.HighlightDisplayLevel; import com.intellij.codeInspection.InspectionToolProvider; import com.intellij.codeInspection.LocalInspectionTool; +import com.intellij.codeInspection.ProblemDescriptor; import com.intellij.openapi.compiler.CompileContext; import com.intellij.openapi.compiler.CompileScope; import com.intellij.openapi.compiler.CompilerMessageCategory; import com.intellij.openapi.extensions.ExtensionPointName; -import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.project.Project; +import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import org.jetbrains.annotations.NotNull; import java.util.Collection; import java.util.Collections; +import java.util.Map; /** * @author peter @@ -86,4 +88,8 @@ public abstract class InspectionValidator { return CompilerMessageCategory.INFORMATION; } + @NotNull + public Map checkAdditionally(PsiFile file) { + return Collections.emptyMap(); + } } diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/UpdatableDebuggerView.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/UpdatableDebuggerView.java index a8c7bbc8e753..f042bf22a7c2 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/UpdatableDebuggerView.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/UpdatableDebuggerView.java @@ -64,7 +64,7 @@ public abstract class UpdatableDebuggerView extends JPanel implements DebuggerVi } protected final boolean isUpdateEnabled() { - return myUpdateEnabled; + return myUpdateEnabled || isShowing(); } public final void setUpdateEnabled(final boolean enabled) { diff --git a/java/idea-ui/src/com/intellij/ide/impl/NewProjectUtil.java b/java/idea-ui/src/com/intellij/ide/impl/NewProjectUtil.java index 91d04d04dc3a..5bb0502d480b 100644 --- a/java/idea-ui/src/com/intellij/ide/impl/NewProjectUtil.java +++ b/java/idea-ui/src/com/intellij/ide/impl/NewProjectUtil.java @@ -142,6 +142,7 @@ public class NewProjectUtil { if (projectBuilder != null) { projectBuilder.commit(newProject, null, ModulesProvider.EMPTY_MODULES_PROVIDER); + newProject.save(); } final boolean need2OpenProjectStructure = projectBuilder == null || projectBuilder.isOpenProjectSettingsAfter(); diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/actions/NewModuleAction.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/actions/NewModuleAction.java index f49b98656919..16d17701194c 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/actions/NewModuleAction.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/actions/NewModuleAction.java @@ -73,6 +73,7 @@ public class NewModuleAction extends AnAction implements DumbAware { ModulesConfigurator.showDialog(project, null, null); } } + project.save(); } } diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java index 461751b00258..6a3acdb9c1fb 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java @@ -903,9 +903,12 @@ public class JavaCompletionUtil { } if (pkgContext) { - PsiFile classFile = psiClass.getContainingFile(); - if (classFile instanceof PsiClassOwner && StringUtil.isEmpty(((PsiClassOwner)classFile).getPackageName())) { - return false; + PsiClass topLevel = PsiUtil.getTopLevelClass(psiClass); + if (topLevel != null) { + String fqName = topLevel.getQualifiedName(); + if (fqName != null && StringUtil.isEmpty(StringUtil.getPackageName(fqName))) { + return false; + } } } diff --git a/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java b/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java index 728c714321cd..3b703fcea897 100644 --- a/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java +++ b/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java @@ -579,8 +579,8 @@ public final class PsiUtil extends PsiUtilCore { @Nullable public static PsiClass getTopLevelClass(@NotNull PsiElement element) { final PsiFile file = element.getContainingFile(); - if (file instanceof PsiJavaFile) { - final PsiClass[] classes = ((PsiJavaFile)file).getClasses(); + if (file instanceof PsiClassOwner) { + final PsiClass[] classes = ((PsiClassOwner)file).getClasses(); for (PsiClass aClass : classes) { if (PsiTreeUtil.isAncestor(aClass, element, false)) return aClass; } diff --git a/jps/jps-builders/src/org/jetbrains/jps/javac/OptimizedFileManager._java b/jps/jps-builders/src/org/jetbrains/jps/javac/OptimizedFileManager.java similarity index 100% rename from jps/jps-builders/src/org/jetbrains/jps/javac/OptimizedFileManager._java rename to jps/jps-builders/src/org/jetbrains/jps/javac/OptimizedFileManager.java diff --git a/jps/jps-builders/src/org/jetbrains/jps/javac/OptimizedFileManager17._java b/jps/jps-builders/src/org/jetbrains/jps/javac/OptimizedFileManager17.java similarity index 100% rename from jps/jps-builders/src/org/jetbrains/jps/javac/OptimizedFileManager17._java rename to jps/jps-builders/src/org/jetbrains/jps/javac/OptimizedFileManager17.java diff --git a/platform/core-api/src/com/intellij/psi/search/ProjectScope.java b/platform/core-api/src/com/intellij/psi/search/ProjectScope.java index 6c502aba52d8..39a239a4cbd8 100644 --- a/platform/core-api/src/com/intellij/psi/search/ProjectScope.java +++ b/platform/core-api/src/com/intellij/psi/search/ProjectScope.java @@ -53,7 +53,7 @@ public class ProjectScope { @NotNull public static GlobalSearchScope getContentScope(@NotNull Project project) { - GlobalSearchScope cached = project.getUserData(LIBRARIES_SCOPE_KEY); + GlobalSearchScope cached = project.getUserData(CONTENT_SCOPE_KEY); return cached != null ? cached : ((UserDataHolderEx)project).putUserDataIfAbsent(CONTENT_SCOPE_KEY, ProjectScopeBuilder.getInstance(project).buildContentScope()); } } diff --git a/platform/lang-impl/src/com/intellij/codeInspection/DefaultHighlightVisitorBasedInspection.java b/platform/lang-impl/src/com/intellij/codeInspection/DefaultHighlightVisitorBasedInspection.java index 9fb5aa36ccc6..1a10a665d7a3 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/DefaultHighlightVisitorBasedInspection.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/DefaultHighlightVisitorBasedInspection.java @@ -23,16 +23,21 @@ import com.intellij.lang.annotation.HighlightSeverity; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.Document; import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElementVisitor; import com.intellij.psi.PsiFile; +import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; +import java.util.List; + public abstract class DefaultHighlightVisitorBasedInspection extends GlobalSimpleInspectionTool { private final boolean highlightErrorElements; private final boolean runAnnotators; @@ -85,13 +90,43 @@ public abstract class DefaultHighlightVisitorBasedInspection extends GlobalSimpl } @Override - public void checkFile(@NotNull PsiFile file, - @NotNull InspectionManager manager, + public void checkFile(@NotNull PsiFile originalFile, + @NotNull final InspectionManager manager, @NotNull ProblemsHolder problemsHolder, - @NotNull GlobalInspectionContext globalContext, - @NotNull ProblemDescriptionsProcessor problemDescriptionsProcessor) { - PsiElementVisitor visitor = new MyPsiElementVisitor(manager, globalContext, problemDescriptionsProcessor, highlightErrorElements,runAnnotators); + @NotNull final GlobalInspectionContext globalContext, + @NotNull final ProblemDescriptionsProcessor problemDescriptionsProcessor) { + for (Pair pair : runGeneralHighlighting(originalFile, highlightErrorElements, runAnnotators)) { + PsiFile file = pair.first; + HighlightInfo info = pair.second; + TextRange range = new TextRange(info.startOffset, info.endOffset); + PsiElement element = file.findElementAt(info.startOffset); + + while (element != null && !element.getTextRange().contains(range)) { + element = element.getParent(); + } + + if (element == null) { + element = file; + } + GlobalInspectionUtil.createProblem( + element, + info.description, + HighlightInfo.convertType(info.type), + range.shiftRight(-element.getNode().getStartOffset()), + manager, + problemDescriptionsProcessor, + globalContext + ); + + } + } + + public static List> runGeneralHighlighting(PsiFile file, + final boolean highlightErrorElements, + final boolean runAnnotators) { + MyPsiElementVisitor visitor = new MyPsiElementVisitor(highlightErrorElements, runAnnotators); file.accept(visitor); + return new ArrayList>(visitor.result); } @Nls @@ -102,20 +137,11 @@ public abstract class DefaultHighlightVisitorBasedInspection extends GlobalSimpl } private static class MyPsiElementVisitor extends PsiElementVisitor { - private final InspectionManager myManager; - private final GlobalInspectionContext myGlobalContext; - private final ProblemDescriptionsProcessor myProblemDescriptionsProcessor; private final boolean highlightErrorElements; private final boolean runAnnotators; + final List> result = ContainerUtil.createEmptyCOWList(); - public MyPsiElementVisitor(final InspectionManager manager, - final GlobalInspectionContext globalContext, - final ProblemDescriptionsProcessor problemDescriptionsProcessor, - boolean highlightErrorElements, - boolean runAnnotators) { - myManager = manager; - myGlobalContext = globalContext; - myProblemDescriptionsProcessor = problemDescriptionsProcessor; + public MyPsiElementVisitor(boolean highlightErrorElements, boolean runAnnotators) { this.highlightErrorElements = highlightErrorElements; this.runAnnotators = runAnnotators; } @@ -147,27 +173,9 @@ public abstract class DefaultHighlightVisitorBasedInspection extends GlobalSimpl if (info == null) return true; if (info.type == HighlightInfoType.INJECTED_LANGUAGE_FRAGMENT) return true; if (info.severity == HighlightSeverity.INFORMATION) return true; - ProblemHighlightType problemHighlightType = HighlightInfo.convertType(info.type); - TextRange range = new TextRange(info.startOffset, info.endOffset); - PsiElement element = file.findElementAt(info.startOffset); - while (element != null && !element.getTextRange().contains(range)) { - element = element.getParent(); - } + result.add(Pair.create(file, info)); - if (element == null) { - element = file; - } - - GlobalInspectionUtil.createProblem( - element, - info.description, - problemHighlightType, - range.shiftRight(-element.getNode().getStartOffset()), - myManager, - myProblemDescriptionsProcessor, - myGlobalContext - ); return true; } }; diff --git a/platform/lang-impl/src/com/intellij/codeInspection/actions/CleanupInspectionIntention.java b/platform/lang-impl/src/com/intellij/codeInspection/actions/CleanupInspectionIntention.java index 6ee9c3ecaa68..988e3cd4b874 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/actions/CleanupInspectionIntention.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/actions/CleanupInspectionIntention.java @@ -63,17 +63,8 @@ public class CleanupInspectionIntention implements IntentionAction, HighPriority public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException { if (!CodeInsightUtilBase.preparePsiElementForWrite(file)) return; - final InspectionManagerEx managerEx = (InspectionManagerEx)InspectionManagerEx.getInstance(project); - final GlobalInspectionContextImpl context = managerEx.createNewGlobalContext(false); - final LocalInspectionToolWrapper tool = new LocalInspectionToolWrapper(myTool); - tool.initialize(context); - ((RefManagerImpl)context.getRefManager()).inspectionReadActionStarted(); - ((ProgressManagerImpl)ProgressManager.getInstance()).executeProcessUnderProgress(new Runnable() { - public void run() { - tool.processFile(file, true, managerEx, true); - } - }, new EmptyProgressIndicator()); - final List descriptions = new ArrayList(tool.getProblemDescriptors()); + final List descriptions = runInspectionOnFile(file, myTool); + Collections.sort(descriptions, new Comparator() { public int compare(final CommonProblemDescriptor o1, final CommonProblemDescriptor o2) { final ProblemDescriptorImpl d1 = (ProblemDescriptorImpl)o1; @@ -95,8 +86,27 @@ public class CleanupInspectionIntention implements IntentionAction, HighPriority } } } - ((RefManagerImpl)context.getRefManager()).inspectionReadActionFinished(); - context.cleanup(managerEx); + } + + public static List runInspectionOnFile(final PsiFile file, + final LocalInspectionTool inspectionTool) { + final InspectionManagerEx managerEx = (InspectionManagerEx)InspectionManager.getInstance(file.getProject()); + final GlobalInspectionContextImpl context = managerEx.createNewGlobalContext(false); + final LocalInspectionToolWrapper tool = new LocalInspectionToolWrapper(inspectionTool); + tool.initialize(context); + ((RefManagerImpl)context.getRefManager()).inspectionReadActionStarted(); + try { + ((ProgressManagerImpl)ProgressManager.getInstance()).executeProcessUnderProgress(new Runnable() { + public void run() { + tool.processFile(file, true, managerEx, true); + } + }, new EmptyProgressIndicator()); + return new ArrayList(tool.getProblemDescriptors()); + } + finally { + ((RefManagerImpl)context.getRefManager()).inspectionReadActionFinished(); + context.cleanup(managerEx); + } } public boolean isAvailable(@NotNull final Project project, final Editor editor, final PsiFile file) { diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/DescriptorProviderInspection.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/DescriptorProviderInspection.java index 6503e871fc90..ea79a754e836 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/DescriptorProviderInspection.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/DescriptorProviderInspection.java @@ -48,6 +48,7 @@ import java.util.*; * @author max */ public abstract class DescriptorProviderInspection extends InspectionTool implements ProblemDescriptionsProcessor { + private static final Object lock = new Object(); private Map myProblemElements; private HashMap> myContents = null; private HashSet myModulesProblems = null; @@ -68,14 +69,12 @@ public abstract class DescriptorProviderInspection extends InspectionTool implem if (descriptions == null || descriptions.length == 0) return; if (filterSuppressed) { if (ourOutputPath == null || !(this instanceof LocalInspectionToolWrapper)) { - CommonProblemDescriptor[] problems = getProblemElements().get(refElement); - if (problems == null) { - problems = descriptions; + synchronized (lock) { + Map problemElements = getProblemElements(); + CommonProblemDescriptor[] problems = problemElements.get(refElement); + problems = problems == null ? descriptions : ArrayUtil.mergeArrays(problems, descriptions); + problemElements.put(refElement, problems); } - else { - problems = ArrayUtil.mergeArrays(problems, descriptions); - } - getProblemElements().put(refElement, problems); for (CommonProblemDescriptor description : descriptions) { getProblemToElements().put(description, refElement); collectQuickFixes(description.getFixes(), refElement); @@ -164,19 +163,22 @@ public abstract class DescriptorProviderInspection extends InspectionTool implem final QuickFix[] fixes = problem.getFixes(); if (isIgnoreProblem(fixes, localQuickFixes, idx)){ getProblemToElements().remove(problem); - CommonProblemDescriptor[] descriptors = getProblemElements().get(refEntity); - if (descriptors != null) { - ArrayList newDescriptors = new ArrayList(Arrays.asList(descriptors)); - newDescriptors.remove(problem); - getQuickFixActions().put(refEntity, null); - if (!newDescriptors.isEmpty()) { - getProblemElements().put(refEntity, newDescriptors.toArray(new CommonProblemDescriptor[newDescriptors.size()])); - for (CommonProblemDescriptor descriptor : newDescriptors) { - collectQuickFixes(descriptor.getFixes(), refEntity); + Map problemElements = getProblemElements(); + synchronized (lock) { + CommonProblemDescriptor[] descriptors = problemElements.get(refEntity); + if (descriptors != null) { + ArrayList newDescriptors = new ArrayList(Arrays.asList(descriptors)); + newDescriptors.remove(problem); + getQuickFixActions().put(refEntity, null); + if (!newDescriptors.isEmpty()) { + problemElements.put(refEntity, newDescriptors.toArray(new CommonProblemDescriptor[newDescriptors.size()])); + for (CommonProblemDescriptor descriptor : newDescriptors) { + collectQuickFixes(descriptor.getFixes(), refEntity); + } + } + else { + ignoreProblemElement(refEntity); } - } - else { - ignoreProblemElement(refEntity); } } } @@ -224,10 +226,13 @@ public abstract class DescriptorProviderInspection extends InspectionTool implem myOldProblemElements = null; } - myProblemElements = null; - myProblemToElements = null; - myQuickFixActions = null; - myIgnoredElements = null; + synchronized (lock) { + myProblemElements = null; + myProblemToElements = null; + myQuickFixActions = null; + myIgnoredElements = null; + } + myContents = null; myModulesProblems = null; } @@ -261,10 +266,12 @@ public abstract class DescriptorProviderInspection extends InspectionTool implem public void exportResults(@NotNull final Element parentNode) { getRefManager().iterate(new RefVisitor() { @Override public void visitElement(final RefEntity refEntity) { - if (getProblemElements().containsKey(refEntity)) { - CommonProblemDescriptor[] descriptions = getDescriptions(refEntity); - if (descriptions != null) { - exportResults(descriptions, refEntity, parentNode); + synchronized (lock) { + if (getProblemElements().containsKey(refEntity)) { + CommonProblemDescriptor[] descriptions = getDescriptions(refEntity); + if (descriptions != null) { + exportResults(descriptions, refEntity, parentNode); + } } } } @@ -524,10 +531,12 @@ public abstract class DescriptorProviderInspection extends InspectionTool implem } public Map getProblemElements() { - if (myProblemElements == null) { - myProblemElements = Collections.synchronizedMap(new THashMap()); + synchronized (lock) { + if (myProblemElements == null) { + myProblemElements = Collections.synchronizedMap(new THashMap()); + } + return myProblemElements; } - return myProblemElements; } @Nullable @@ -536,23 +545,29 @@ public abstract class DescriptorProviderInspection extends InspectionTool implem } private Map getProblemToElements() { - if (myProblemToElements == null) { - myProblemToElements = Collections.synchronizedMap(new THashMap()); + synchronized (lock) { + if (myProblemToElements == null) { + myProblemToElements = Collections.synchronizedMap(new THashMap()); + } + return myProblemToElements; } - return myProblemToElements; } private Map> getQuickFixActions() { - if (myQuickFixActions == null) { - myQuickFixActions = Collections.synchronizedMap(new HashMap>()); + synchronized (lock) { + if (myQuickFixActions == null) { + myQuickFixActions = Collections.synchronizedMap(new HashMap>()); + } + return myQuickFixActions; } - return myQuickFixActions; } private Map getIgnoredElements() { - if (myIgnoredElements == null) { - myIgnoredElements = Collections.synchronizedMap(new HashMap()); + synchronized (lock) { + if (myIgnoredElements == null) { + myIgnoredElements = Collections.synchronizedMap(new HashMap()); + } + return myIgnoredElements; } - return myIgnoredElements; } } diff --git a/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/todo/TodoIndex.java b/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/todo/TodoIndex.java index a652d9baee97..a3285115ea8b 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/todo/TodoIndex.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/todo/TodoIndex.java @@ -20,7 +20,6 @@ import com.intellij.lang.Language; import com.intellij.lang.LanguageParserDefinitions; import com.intellij.lang.ParserDefinition; import com.intellij.openapi.fileTypes.FileType; -import com.intellij.openapi.fileTypes.FileTypeManager; import com.intellij.openapi.fileTypes.LanguageFileType; import com.intellij.openapi.fileTypes.impl.AbstractFileType; import com.intellij.openapi.project.ProjectUtil; @@ -111,7 +110,6 @@ public class TodoIndex extends FileBasedIndexExtension }; private final FileBasedIndex.InputFilter myInputFilter = new FileBasedIndex.InputFilter() { - private final FileTypeManager myFtManager = FileTypeManager.getInstance(); @Override public boolean acceptInput(final VirtualFile file) { if (!(file.getFileSystem() instanceof LocalFileSystem)) { diff --git a/platform/platform-api/src/com/intellij/execution/ExecutionException.java b/platform/platform-api/src/com/intellij/execution/ExecutionException.java index 72c07aa5623b..21fbdd60dcc3 100644 --- a/platform/platform-api/src/com/intellij/execution/ExecutionException.java +++ b/platform/platform-api/src/com/intellij/execution/ExecutionException.java @@ -22,6 +22,10 @@ public class ExecutionException extends Exception { super(s); } + public ExecutionException(final Throwable cause) { + super(cause == null ? null : cause.getMessage(), cause); + } + public ExecutionException(final String s, Throwable cause) { super(s, cause); } diff --git a/platform/platform-resources-en/src/messages/DiagnosticBundle.properties b/platform/platform-resources-en/src/messages/DiagnosticBundle.properties index 661d6dafcb3a..be8ba8439491 100644 --- a/platform/platform-resources-en/src/messages/DiagnosticBundle.properties +++ b/platform/platform-resources-en/src/messages/DiagnosticBundle.properties @@ -64,7 +64,7 @@ log.monitor.is.skipped.column=Skip Content log.monitor.edit.aliases.title=Edit Log Files Aliases log.monitor.edit.aliases.name=&Alias: log.monitor.edit.aliases.location=&Log File Location: -log.monitor.edit.aliases.show.all.checkbox.title=&Show All Files Coverable By Pattern +log.monitor.edit.aliases.show.all.checkbox.title=&Show all files coverable by pattern log.console.filter.show.errors=errors log.console.filter.show.errors.and.warnings=warnings log.console.filter.show.all=all diff --git a/platform/platform-resources-en/src/messages/ProjectBundle.properties b/platform/platform-resources-en/src/messages/ProjectBundle.properties index 1b1c40ee67c0..e77a4be3929a 100644 --- a/platform/platform-resources-en/src/messages/ProjectBundle.properties +++ b/platform/platform-resources-en/src/messages/ProjectBundle.properties @@ -163,7 +163,7 @@ module.add.error.title=Add Module module.add.action=Add module.remove.action=Remove module.remove.last.confirmation=Are you sure you want to remove the only module from this project?\nNo files will be deleted on disk. -module.remove.confirmation=Remove module \"{0}\" from the project?\nNo files will be deleted on disk. +module.remove.confirmation=Remove module ''{0}'' from the project?\nNo files will be deleted on disk. module.remove.confirmation.title=Remove Module module.classpath.button.edit=Ed&it... module.libraries.include.all.button=Include All diff --git a/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java b/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java index a24b83e62008..98067ba583dc 100644 --- a/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java @@ -479,7 +479,7 @@ public abstract class UsefulTestCase extends TestCase { public static T assertInstanceOf(Object o, Class aClass) { Assert.assertNotNull(o); - Assert.assertTrue(o.getClass().getName(), aClass.isInstance(o)); + Assert.assertTrue("Expected instance of: " + aClass.getName() + " actual: " + o.getClass().getName(), aClass.isInstance(o)); return (T)o; } diff --git a/platform/util/src/com/intellij/openapi/util/SystemInfo.java b/platform/util/src/com/intellij/openapi/util/SystemInfo.java index 86a50c9f74e7..b453b01c30b8 100644 --- a/platform/util/src/com/intellij/openapi/util/SystemInfo.java +++ b/platform/util/src/com/intellij/openapi/util/SystemInfo.java @@ -105,12 +105,23 @@ public class SystemInfo { */ public static final boolean isMacOSLion = isLion(); + /** + * Running under MacOS X version 10.8 or later; + * + * @since 11.1 + */ + public static final boolean isMacOSMountainLion = isMountainLion(); + /** * Operating system is supposed to have middle mouse button click occupied by paste action. * @since 6.0 */ public static boolean X11PasteEnabledSystem = isUnix && !isMac; + private static boolean isIntelMac() { + return isMac && "i386".equals(OS_ARCH); + } + private static boolean isTiger() { return isMac && !OS_VERSION.startsWith("10.0") && @@ -119,10 +130,6 @@ public class SystemInfo { !OS_VERSION.startsWith("10.3"); } - private static boolean isIntelMac() { - return isMac && "i386".equals(OS_ARCH); - } - private static boolean isLeopard() { return isMac && isTiger() && !OS_VERSION.startsWith("10.4"); } @@ -135,6 +142,10 @@ public class SystemInfo { return isMac && isSnowLeopard() && !OS_VERSION.startsWith("10.6"); } + private static boolean isMountainLion() { + return isMac && isLion() && !OS_VERSION.startsWith("10.7"); + } + @NotNull public static String getMacOSVersionCode() { return getMacOSVersionCode(OS_VERSION); diff --git a/platform/util/src/com/intellij/util/ui/UIUtil.java b/platform/util/src/com/intellij/util/ui/UIUtil.java index 20e4e38d3bc9..73ecb4d054b5 100644 --- a/platform/util/src/com/intellij/util/ui/UIUtil.java +++ b/platform/util/src/com/intellij/util/ui/UIUtil.java @@ -1553,9 +1553,9 @@ public class UIUtil { if (size == FontSize.MINI) { defFont = defFont.deriveFont(Math.max(defFont.getSize() - 4f, 9f)); } - if (isBold) { - defFont = defFont.deriveFont(Font.BOLD); - } + //if (isBold) { + // defFont = defFont.deriveFont(Font.BOLD); + //} return defFont; } 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 b6700c6a5ea4..39767266e618 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 @@ -32,6 +32,7 @@ import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl; import com.intellij.openapi.vcs.impl.VcsBackgroundableActions; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.Consumer; +import com.intellij.util.WaitForProgressToShow; import com.intellij.vcsUtil.VcsSelection; import com.intellij.vcsUtil.VcsSelectionUtil; @@ -77,11 +78,15 @@ public class SelectedBlockHistoryAction extends AbstractVcsAction { final int selectionStart = selection.getSelectionStartLineNumber(); final int selectionEnd = selection.getSelectionEndLineNumber(); + final VcsException[] preloadException = new VcsException[1]; final CachedRevisionsContents cachedRevisionsContents = new CachedRevisionsContents(project, file); new VcsHistoryProviderBackgroundableProxy(activeVcs, provider, activeVcs.getDiffProvider()). createSessionFor(activeVcs.getKeyInstanceMethod(), new FilePathImpl(file), new Consumer() { public void consume(VcsHistorySession session) { + if (preloadException[0] != null) { + reportError(preloadException[0]); + } if (session == null) return; final VcsHistoryDialog vcsHistoryDialog = new VcsHistoryDialog(project, @@ -103,7 +108,12 @@ public class SelectedBlockHistoryAction extends AbstractVcsAction { cachedRevisionsContents.setRevisions(revisionList); if (VcsConfiguration.getInstance(project).SHOW_ONLY_CHANGED_IN_SELECTION_DIFF) { // preload while in bckgrnd - cachedRevisionsContents.loadContentsFor(revisionList.toArray(new VcsFileRevision[revisionList.size()])); + try { + cachedRevisionsContents.loadContentsFor(revisionList.toArray(new VcsFileRevision[revisionList.size()])); + } + catch (VcsException e) { + preloadException[0] = e; + } } } }); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryUtil.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryUtil.java index 95a1f025e061..27e5bac31e18 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryUtil.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryUtil.java @@ -64,7 +64,7 @@ public class VcsHistoryUtil { } } - private static int compareNumbers(VcsFileRevision first, VcsFileRevision second) { + public static int compareNumbers(VcsFileRevision first, VcsFileRevision second) { return first.getRevisionNumber().compareTo(second.getRevisionNumber()); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/impl/CachedRevisionsContents.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/impl/CachedRevisionsContents.java index a293bb7f1555..87dd5fedc259 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/impl/CachedRevisionsContents.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/impl/CachedRevisionsContents.java @@ -42,7 +42,7 @@ import java.util.*; */ public class CachedRevisionsContents { private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.history.impl.CachedRevisionsContents"); - private final Map myCachedContents = new HashMap(); + private final Map myCachedContents; private final Project myProject; // managed outside, for reference here private List myRevisions; @@ -51,13 +51,14 @@ public class CachedRevisionsContents { public CachedRevisionsContents(final Project project, final VirtualFile file) { myProject = project; myFile = file; + myCachedContents = Collections.synchronizedMap(new HashMap()); } public void setRevisions(List revisions) { myRevisions = revisions; } - public void loadContentsFor(final VcsFileRevision[] revisions) { + public void loadContentsFor(final VcsFileRevision[] revisions) throws VcsException { final VcsFileRevision[] revisionsToLoad = revisionsNeededToBeLoaded(revisions); final List toBeLoaded = new LinkedList(); @@ -67,6 +68,7 @@ public class CachedRevisionsContents { } if (toBeLoaded.isEmpty()) return; + final VcsException[] exception = new VcsException[1]; final Runnable process = new Runnable() { public void run() { ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator(); @@ -91,19 +93,17 @@ public class CachedRevisionsContents { vcsFileRevision.loadContent(); } catch (final VcsException e) { - WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() { - public void run() { - Messages.showErrorDialog(VcsBundle.message("message.text.cannot.load.version.because.of.error", - vcsFileRevision.getRevisionNumber(), e.getLocalizedMessage()), - VcsBundle.message("message.title.load.version")); - } - }, null, myProject); + exception[0] = new VcsException(e); + LOG.info(e); + return; } catch (ProcessCanceledException ex) { return; } catch (IOException e) { - e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. + exception[0] = new VcsException(e); + LOG.info(e); + return; } String content = null; try { @@ -113,13 +113,16 @@ public class CachedRevisionsContents { } } catch (IOException e) { + exception[0] = new VcsException(e); LOG.info(e); + return; } catch (VcsException e) { - e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. + exception[0] = new VcsException(e); + LOG.info(e); + return; } myCachedContents.put(vcsFileRevision.getRevisionNumber(), content); - } } } @@ -136,9 +139,12 @@ public class CachedRevisionsContents { } else { process.run(); } + if (exception[0] != null) { + throw exception[0]; + } } - public String getContentOf(VcsFileRevision revision) { + public String getContentOf(VcsFileRevision revision) throws VcsException { if (! myCachedContents.containsKey(revision.getRevisionNumber())) { loadContentsFor(new VcsFileRevision[]{revision}); } @@ -157,7 +163,7 @@ public class CachedRevisionsContents { private Collection collectRevisionsFromFirstTo(VcsFileRevision revision) { ArrayList result = new ArrayList(); for (VcsFileRevision vcsFileRevision : myRevisions) { - if (VcsHistoryUtil.compare(revision, vcsFileRevision) > 0) continue; + if (VcsHistoryUtil.compareNumbers(revision, vcsFileRevision) > 0) continue; result.add(vcsFileRevision); } return result; 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/VcsHistoryDialog.java index fcd27d07828e..0d573bcf4a06 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/VcsHistoryDialog.java @@ -20,6 +20,7 @@ import com.intellij.diff.FindBlock; import com.intellij.openapi.actionSystem.DataProvider; import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.diff.DiffManager; import com.intellij.openapi.diff.DiffPanel; @@ -29,12 +30,11 @@ import com.intellij.openapi.fileTypes.FileTypeManager; import com.intellij.openapi.help.HelpManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; +import com.intellij.openapi.ui.MessageType; import com.intellij.openapi.ui.Splitter; -import com.intellij.openapi.vcs.AbstractVcs; -import com.intellij.openapi.vcs.VcsBundle; -import com.intellij.openapi.vcs.VcsConfiguration; -import com.intellij.openapi.vcs.VcsDataKeys; +import com.intellij.openapi.vcs.*; import com.intellij.openapi.vcs.history.*; +import com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.ui.ScrollPaneFactory; import com.intellij.ui.table.TableView; @@ -61,6 +61,7 @@ public class VcsHistoryDialog extends DialogWrapper implements DataProvider { private final int mySelectionStart; private final int mySelectionEnd; + // todo equals??? private final Map myRevisionToContentMap = new com.intellij.util.containers.HashMap(); private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.history.impl.VcsHistoryDialog"); @@ -173,11 +174,11 @@ public class VcsHistoryDialog extends DialogWrapper implements DataProvider { }); - myList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { + final ListSelectionListener selectionListener = new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { final VcsFileRevision revision; - if (myList.getSelectedRowCount() == 1) { - revision = (VcsFileRevision) myList.getItems().get(myList.getSelectedRow()); + if (myList.getSelectedRowCount() == 1 && !myList.isEmpty()) { + revision = (VcsFileRevision)myList.getItems().get(myList.getSelectedRow()); myComments.setText(revision.getCommitMessage()); myComments.setCaretPosition(0); } @@ -190,21 +191,34 @@ public class VcsHistoryDialog extends DialogWrapper implements DataProvider { } updateDiff(); } - }); + }; + myList.getSelectionModel().addListSelectionListener(selectionListener); myChangesOnlyCheckBox.setSelected(configuration.SHOW_ONLY_CHANGED_IN_SELECTION_DIFF); - updateRevisionsList(); + try { + updateRevisionsList(); + } + catch (final VcsException e) { + // todo test it, always exception + canNotLoadRevisionMessage(e); + } myChangesOnlyCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { configuration.SHOW_ONLY_CHANGED_IN_SELECTION_DIFF = myChangesOnlyCheckBox.isSelected(); - updateRevisionsList(); + try { + updateRevisionsList(); + } + catch (VcsException e1) { + canNotLoadRevisionMessage(e1); + } } }); init(); - ApplicationManager.getApplication().invokeLater(new Runnable() { + SwingUtilities.invokeLater(new Runnable() { public void run() { + if (! VcsHistoryDialog.this.isShowing()) return; myList.getSelectionModel().addSelectionInterval(0, 0); } }); @@ -212,6 +226,21 @@ public class VcsHistoryDialog extends DialogWrapper implements DataProvider { setTitle(VcsBundle.message("dialog.title.history.for.file", file.getName())); } + private void canNotLoadRevisionMessage(final VcsException e) { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + if (! VcsHistoryDialog.this.isShowing()) return; + VcsBalloonProblemNotifier.showBalloonForComponent(VcsHistoryDialog.this.getRootPane(), + canNoLoadMessage(e), MessageType.ERROR, true); + } + }); + } + + private String canNoLoadMessage(VcsException e) { + return "Can not load revision contents: " + e.getMessage(); + } + @Override public JComponent getPreferredFocusedComponent() { return myList; @@ -235,15 +264,15 @@ public class VcsHistoryDialog extends DialogWrapper implements DataProvider { return result; } - protected String getContentOf(VcsFileRevision revision) { + protected String getContentOf(VcsFileRevision revision) throws VcsException { return myCachedContents.getContentOf(revision); } - private void loadContentsFor(final VcsFileRevision[] revisions) { + private void loadContentsFor(final VcsFileRevision[] revisions) throws VcsException { myCachedContents.loadContentsFor(revisions); } - private void updateRevisionsList() { + private void updateRevisionsList() throws VcsException { if (myIsInLoading) return; if (myChangesOnlyCheckBox.isSelected()) { loadContentsFor(myRevisions.toArray(new VcsFileRevision[myRevisions.size()])); @@ -267,7 +296,7 @@ public class VcsHistoryDialog extends DialogWrapper implements DataProvider { } - private List filteredRevisions() throws FilesTooBigForDiffException { + private List filteredRevisions() throws FilesTooBigForDiffException, VcsException { ArrayList result = new ArrayList(); VcsFileRevision nextRevision = myRevisions.get(myRevisions.size() - 1); result.add(nextRevision); @@ -282,6 +311,7 @@ public class VcsHistoryDialog extends DialogWrapper implements DataProvider { } private synchronized void updateDiff() { + if (myList.isEmpty()) return; int[] selectedIndices = myList.getSelectedRows(); if (selectedIndices.length == 0) { updateDiff(CURRENT, CURRENT); @@ -314,6 +344,12 @@ public class VcsHistoryDialog extends DialogWrapper implements DataProvider { catch (FilesTooBigForDiffException e) { myDiffPanel.setTooBigFileErrorContents(); } + catch (VcsException e) { + final String text = canNoLoadMessage(e); + myDiffPanel.setContents(new SimpleContent(text, myContentFileType), + new SimpleContent(text, myContentFileType)); + canNotLoadRevisionMessage(e); + } myDiffPanel.setTitle1(VcsBundle.message("diff.content.title.revision.number", firstRev.getRevisionNumber())); myDiffPanel.setTitle2(VcsBundle.message("diff.content.title.revision.number", secondRev.getRevisionNumber())); @@ -414,14 +450,14 @@ public class VcsHistoryDialog extends DialogWrapper implements DataProvider { return null; } - protected String getContentToShow(VcsFileRevision revision) throws FilesTooBigForDiffException { + protected String getContentToShow(VcsFileRevision revision) throws FilesTooBigForDiffException, VcsException { final Block block = getBlock(revision); if (block == null) return ""; return block.getBlockContent(); } @Nullable - private Block getBlock(VcsFileRevision revision) throws FilesTooBigForDiffException { + private Block getBlock(VcsFileRevision revision) throws FilesTooBigForDiffException, VcsException { if (myRevisionToContentMap.containsKey(revision)) return myRevisionToContentMap.get(revision); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ui/VcsBalloonProblemNotifier.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/ui/VcsBalloonProblemNotifier.java index 23780caadc75..8adad110695a 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/ui/VcsBalloonProblemNotifier.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ui/VcsBalloonProblemNotifier.java @@ -20,9 +20,17 @@ import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.MessageType; +import com.intellij.openapi.ui.popup.Balloon; +import com.intellij.openapi.ui.popup.BalloonBuilder; +import com.intellij.openapi.ui.popup.JBPopupFactory; import com.intellij.openapi.vcs.changes.ui.ChangesViewContentManager; +import com.intellij.ui.awt.RelativePoint; import org.jetbrains.annotations.NotNull; +import javax.swing.*; +import java.awt.*; +import java.util.concurrent.TimeUnit; + /** * Shows a notification balloon over one of version control related tool windows: Changes View or Version Control View. * By default the notification is shown over the Changes View. @@ -74,4 +82,24 @@ public class VcsBalloonProblemNotifier implements Runnable { public void run() { NOTIFICATION_GROUP.createNotification(myMessage, myMessageType).notify(myProject.isDefault() ? null : myProject); } + + public static void showBalloonForComponent(@NotNull JComponent component, @NotNull final String message, final MessageType type, + final boolean atTop) { + BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(message, type, null); + Balloon balloon = balloonBuilder.createBalloon(); + Dimension size = component.getSize(); + Balloon.Position position; + int x; + int y; + if (size == null) { + x = y = 0; + position = Balloon.Position.above; + } + else { + x = Math.min(10, size.width / 2); + y = size.height; + position = Balloon.Position.below; + } + balloon.show(new RelativePoint(component, new Point(x, y)), position); + } } diff --git a/plugins/android-designer/src/com/intellij/android/designer/designSurface/AndroidDesignerEditorPanel.java b/plugins/android-designer/src/com/intellij/android/designer/designSurface/AndroidDesignerEditorPanel.java index 9dfb452b8223..a4b1faefc92d 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/designSurface/AndroidDesignerEditorPanel.java +++ b/plugins/android-designer/src/com/intellij/android/designer/designSurface/AndroidDesignerEditorPanel.java @@ -25,9 +25,7 @@ import com.android.sdklib.IAndroidTarget; import com.intellij.android.designer.componentTree.AndroidTreeDecorator; import com.intellij.android.designer.model.RadViewComponent; import com.intellij.designer.componentTree.TreeComponentDecorator; -import com.intellij.designer.designSurface.ComponentDecorator; -import com.intellij.designer.designSurface.DecorationLayer; -import com.intellij.designer.designSurface.DesignerEditorPanel; +import com.intellij.designer.designSurface.*; import com.intellij.designer.designSurface.selection.DirectionResizePoint; import com.intellij.designer.designSurface.selection.NonResizeSelectionDecorator; import com.intellij.designer.designSurface.selection.ResizeSelectionDecorator; @@ -193,9 +191,17 @@ public final class AndroidDesignerEditorPanel extends DesignerEditorPanel { @Override protected ComponentDecorator getRootSelectionDecorator() { - return new ResizeSelectionDecorator(Color.RED, 1, new DirectionResizePoint(Position.EAST), - new DirectionResizePoint(Position.SOUTH_EAST), - new DirectionResizePoint(Position.SOUTH)); + return new ResizeSelectionDecorator(Color.RED, 1, new DirectionResizePoint(Position.EAST, "top_resize_"), + new DirectionResizePoint(Position.SOUTH_EAST, "top_resize"), + new DirectionResizePoint(Position.SOUTH, "top_resize")); + } + + @Override + protected EditOperation processRootOperation(OperationContext context) { + if (context.is("top_resize")) { + return new ResizeOperation(context); + } + return null; } private static class RootView extends JComponent { diff --git a/plugins/android-designer/src/com/intellij/android/designer/designSurface/ResizeOperation.java b/plugins/android-designer/src/com/intellij/android/designer/designSurface/ResizeOperation.java new file mode 100644 index 000000000000..6e95d6d8decd --- /dev/null +++ b/plugins/android-designer/src/com/intellij/android/designer/designSurface/ResizeOperation.java @@ -0,0 +1,81 @@ +/* + * 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.android.designer.designSurface; + +import com.intellij.designer.designSurface.EditOperation; +import com.intellij.designer.designSurface.FeedbackLayer; +import com.intellij.designer.designSurface.OperationContext; +import com.intellij.designer.designSurface.feedbacks.AlphaComponent; +import com.intellij.designer.model.RadComponent; +import com.intellij.designer.utils.Position; + +import javax.swing.*; +import java.awt.*; +import java.util.List; + +/** + * @author Alexander Lobas + */ +public class ResizeOperation implements EditOperation { + private final OperationContext myContext; + private RadComponent myComponent; + private JComponent myFeedback; + + public ResizeOperation(OperationContext context) { + myContext = context; + } + + @Override + public void setComponent(RadComponent component) { + myComponent = component; + } + + @Override + public void setComponents(List component) { + } + + @Override + public void showFeedback() { + FeedbackLayer layer = myContext.getArea().getFeedbackLayer(); + + if (myFeedback == null) { + myFeedback = new AlphaComponent(Color.GREEN, Color.LIGHT_GRAY); + layer.add(myFeedback); + } + + myFeedback.setBounds(myContext.getTransformedRectangle(myComponent.getBounds(layer))); + layer.repaint(); + } + + @Override + public void eraseFeedback() { + if (myFeedback != null) { + FeedbackLayer layer = myContext.getArea().getFeedbackLayer(); + layer.remove(myFeedback); + layer.repaint(); + myFeedback = null; + } + } + + @Override + public boolean canExecute() { + return myContext.getResizeDirection() != Position.SOUTH; + } + + @Override + public void execute() throws Exception { + } +} \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/RadViewComponent.java b/plugins/android-designer/src/com/intellij/android/designer/model/RadViewComponent.java index 2aabdf662c38..8788018b1237 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/RadViewComponent.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/RadViewComponent.java @@ -56,6 +56,11 @@ public class RadViewComponent extends RadComponent { return myBounds; } + @Override + public Rectangle getBounds(Component relativeTo) { + return SwingUtilities.convertRectangle(myNativeComponent, myBounds, relativeTo); + } + public void setBounds(int x, int y, int width, int height) { myBounds.setBounds(x, y, width, height); } @@ -68,9 +73,4 @@ public class RadViewComponent extends RadComponent { public Point convertPoint(Component component, int x, int y) { return SwingUtilities.convertPoint(component, x, y, myNativeComponent); } - - @Override - public Point convertPoint(int x, int y, Component component) { - return SwingUtilities.convertPoint(myNativeComponent, x, y, component); - } } \ No newline at end of file diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/extensions/GroovyMethodInfo.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/extensions/GroovyMethodInfo.java index 36dc266865cc..9b9a10f31202 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/extensions/GroovyMethodInfo.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/extensions/GroovyMethodInfo.java @@ -158,7 +158,7 @@ public class GroovyMethodInfo { Map> methodMap = res.get(key); if (methodMap == null) { methodMap = new HashMap>(); - res.put(key.intern(), methodMap); + res.put(key, methodMap); } List methodsList = methodMap.get(methodName); diff --git a/plugins/maven/maven3-server-impl/src/org/jetbrains/idea/maven/server/MavenModelConverter.java b/plugins/maven/maven3-server-impl/src/org/jetbrains/idea/maven/server/MavenModelConverter.java index 2d4248762c8b..8ff4b1119633 100644 --- a/plugins/maven/maven3-server-impl/src/org/jetbrains/idea/maven/server/MavenModelConverter.java +++ b/plugins/maven/maven3-server-impl/src/org/jetbrains/idea/maven/server/MavenModelConverter.java @@ -200,7 +200,8 @@ public class MavenModelConverter { } public static MavenArtifact convertArtifact(Artifact artifact, File localRepository) { - return new MavenArtifact(artifact.getGroupId(), artifact.getArtifactId(), + return new MavenArtifact(artifact.getGroupId(), + artifact.getArtifactId(), artifact.getVersion(), artifact.getBaseVersion(), artifact.getType(), diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectReader.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectReader.java index f1240c95aeaa..ce1cb6907529 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectReader.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectReader.java @@ -422,12 +422,7 @@ public class MavenProjectReader { MavenProjectProblem.ProblemType.PARENT)); } - model = MavenServerManager.getInstance().assembleInheritance(model, parentModel); - List profiles = model.getProfiles(); - for (MavenProfile each : parentModel.getProfiles()) { - addProfileIfDoesNotExist(each, profiles); - } - return model; + return MavenServerManager.getInstance().assembleInheritance(model, parentModel); } finally { recursionGuard.remove(file); diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/server/MavenServerManager.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/server/MavenServerManager.java index 9019e02d8e9d..cd96e0e3f10a 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/server/MavenServerManager.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/server/MavenServerManager.java @@ -208,7 +208,7 @@ public class MavenServerManager extends RemoteObjectWrapper { } params.getVMParametersList().addParametersString("-Xmx512m"); - //params.getVMParametersList().addParametersString("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5009"); + //params.getVMParametersList().addParametersString("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5009"); return params; } diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/StructureImportingTest.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/StructureImportingTest.java index 16f6fc4e89d6..fb31c457f070 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/StructureImportingTest.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/StructureImportingTest.java @@ -24,6 +24,7 @@ import com.intellij.openapi.roots.ModuleRootManager; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.pom.java.LanguageLevel; import org.jetbrains.idea.maven.MavenImportingTestCase; +import org.jetbrains.idea.maven.model.MavenId; import org.jetbrains.idea.maven.project.MavenProject; import java.io.File; @@ -107,6 +108,36 @@ public class StructureImportingTest extends MavenImportingTestCase { assertModules("project", "m1", "m2"); } + public void testModulesAreNotInheritedFromParentsProfiles() throws Exception { + createProjectPom("test" + + "project" + + "1" + + "pom" + + + "\n" + + " \n" + + " one\n" + + " " + + " m" + + " " + + " " + + ""); + + createModulePom("m", "test" + + "m" + + "1" + + "" + + " test" + + " project" + + " 1" + + ""); + + importProjectWithProfiles("one"); + + assertSize(1, myProjectsManager.findProject(new MavenId("test", "project", "1")).getModulePaths()); + assertSize(0, myProjectsManager.findProject(new MavenId("test", "m", "1")).getModulePaths()); + } + public void testModulesWithSlashesAtTheEnds() throws Exception { createProjectPom("test" + "project" + @@ -344,18 +375,18 @@ public class StructureImportingTest extends MavenImportingTestCase { if (!hasMavenInstallation()) return; final VirtualFile parent = createModulePom("parent", - "test" + - "parent" + - "1" + - "pom" + + "test" + + "parent" + + "1" + + "pom" + - "" + - " " + - " junit" + - " junit" + - " 4.0" + - " " + - ""); + "" + + " " + + " junit" + + " junit" + + " 4.0" + + " " + + ""); executeGoal("parent", "install"); new WriteAction() { diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/project/MavenProjectReaderTest.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/project/MavenProjectReaderTest.java index 9a180d612115..912f8b9d1f5a 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/project/MavenProjectReaderTest.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/project/MavenProjectReaderTest.java @@ -23,10 +23,11 @@ import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.ArrayUtil; -import com.intellij.util.Function; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.idea.maven.MavenTestCase; -import org.jetbrains.idea.maven.model.*; +import org.jetbrains.idea.maven.model.MavenId; +import org.jetbrains.idea.maven.model.MavenModel; +import org.jetbrains.idea.maven.model.MavenProjectProblem; +import org.jetbrains.idea.maven.model.MavenResource; import org.jetbrains.idea.maven.utils.MavenUtil; import java.io.File; @@ -493,7 +494,7 @@ public class MavenProjectReaderTest extends MavenTestCase { assertEquals("${prop2}", p.getPackaging()); } - public void testHandlingRecursionProprielyAndDoNotForgetCoClearRecursionGuard() throws Exception { + public void testHandlingRecursionProperlyAndDoNotForgetCoClearRecursionGuard() throws Exception { File repositoryPath = new File(myDir, "repository"); setRepositoryPath(repositoryPath.getPath()); @@ -999,44 +1000,6 @@ public class MavenProjectReaderTest extends MavenTestCase { assertEquals("xxx", p.getBuild().getFinalName()); } - - public void testInheritingParentProfiles() throws Exception { - createProjectPom("test" + - "parent" + - "1" + - - "" + - " " + - " profileFromParent" + - " " + - ""); - - VirtualFile module = createModulePom("module", - "test" + - "module" + - "1" + - - "" + - " test" + - " parent" + - " 1" + - "" + - - "" + - " " + - " profileFromChild" + - " " + - ""); - - MavenModel p = readProject(module); - assertOrderedElementsAreEqual(ContainerUtil.map(p.getProfiles(), new Function() { - @Override - public Object fun(MavenProfile profile) { - return profile.getId(); - } - }), "profileFromChild", "profileFromParent"); - } - public void testCorrectlyCollectProfilesFromDifferentSources() throws Exception { createProjectPom("test" + "parent" + @@ -1116,8 +1079,8 @@ public class MavenProjectReaderTest extends MavenTestCase { p = readProject(module); assertEquals(1, p.getProfiles().size()); - assertEquals("parent", p.getProfiles().get(0).getModules().get(0)); - assertEquals("pom", p.getProfiles().get(0).getSource()); + assertEquals("settings", p.getProfiles().get(0).getModules().get(0)); + assertEquals("settings.xml", p.getProfiles().get(0).getSource()); createProjectPom("test" + "parent" + @@ -1125,8 +1088,8 @@ public class MavenProjectReaderTest extends MavenTestCase { p = readProject(module); assertEquals(1, p.getProfiles().size()); - assertEquals("parentProfiles", p.getProfiles().get(0).getModules().get(0)); - assertEquals("profiles.xml", p.getProfiles().get(0).getSource()); + assertEquals("settings", p.getProfiles().get(0).getModules().get(0)); + assertEquals("settings.xml", p.getProfiles().get(0).getSource()); new WriteCommandAction.Simple(myProject) { @Override @@ -1142,6 +1105,34 @@ public class MavenProjectReaderTest extends MavenTestCase { assertEquals("settings.xml", p.getProfiles().get(0).getSource()); } + public void testModulesAreNotInheritedFromParentsProfiles() throws Exception { + VirtualFile p = createProjectPom("test" + + "project" + + "1" + + "pom" + + + "" + + " " + + " one" + + " " + + " m" + + " " + + " " + + ""); + + VirtualFile m = createModulePom("m", "test" + + "m" + + "1" + + "" + + " test" + + " project" + + " 1" + + ""); + + assertSize(1, readProject(p, "one").getModules()); + assertSize(0, readProject(m, "one").getModules()); + } + public void testActivatingProfilesByDefault() throws Exception { createProjectPom("" + " " + diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn17/SvnChangelistListener.java b/plugins/svn4idea/src/org/jetbrains/idea/svn17/SvnChangelistListener.java index 327ff5b71212..e71d1932c801 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn17/SvnChangelistListener.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn17/SvnChangelistListener.java @@ -31,6 +31,8 @@ import org.tmatesoft.svn.core.SVNErrorCode; import org.tmatesoft.svn.core.SVNException; import org.tmatesoft.svn.core.wc.ISVNChangelistHandler; import org.tmatesoft.svn.core.wc.SVNChangelistClient; +import org.tmatesoft.svn.core.wc.SVNStatus; +import org.tmatesoft.svn.core.wc.SVNStatusClient; import java.io.File; import java.util.ArrayList; @@ -177,21 +179,10 @@ public class SvnChangelistListener implements ChangeListListener { public static String getCurrentMapping(final Project project, final File file) { final SvnVcs17 vcs = SvnVcs17.getInstance(project); final SVNChangelistClient client = vcs.createChangelistClient(); + final SVNStatusClient statusClient = vcs.createStatusClient(); try { - final Ref refResult = new Ref(); - final ISVNChangelistHandler handler = new ISVNChangelistHandler() { - public void handle(final File path, final String changelistName) { - if (refResult.isNull() && Comparing.equal(path, file)) { - refResult.set(changelistName); - } - } - }; - if (file.exists()) { - client.doGetChangeLists(file, null, SVNDepth.EMPTY, handler); - } else if (file.getParentFile() != null) { - client.doGetChangeLists(file.getParentFile(), null, SVNDepth.IMMEDIATES, handler); - } - return refResult.get(); + final SVNStatus status = statusClient.doStatus(file, false); + return status.getChangelistName(); } catch (SVNException e) { final SVNErrorCode errorCode = e.getErrorMessage().getErrorCode(); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn17/commandLine/SvnCommandLineStatusClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn17/commandLine/SvnCommandLineStatusClient.java index 79bfd9a949f5..c99cc95fa0bc 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn17/commandLine/SvnCommandLineStatusClient.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn17/commandLine/SvnCommandLineStatusClient.java @@ -98,13 +98,6 @@ public class SvnCommandLineStatusClient implements SvnStatusClientI { final SVNInfo infoBase = myInfoClient.doInfo(base, revision); - // TODO check file case - // TODO check file case - // TODO check file case - // TODO check file case - // TODO check file case - - // todo can not understand why revision can be used here final SvnSimpleCommand command = new SvnSimpleCommand(myProject, base, SvnCommandName.st); @@ -136,8 +129,10 @@ public class SvnCommandLineStatusClient implements SvnStatusClientI { final PortableStatus pending = svnHandl[0].getPending(); pending.setChangelistName(changelistName[0]); try { - final String append = SVNPathUtil.append(infoBase.getURL().toString(), FileUtil.toSystemIndependentName(pending.getPath())); - pending.setURL(SVNURL.parseURIEncoded(append)); + if (infoBase != null) { + final String append = SVNPathUtil.append(infoBase.getURL().toString(), FileUtil.toSystemIndependentName(pending.getPath())); + pending.setURL(SVNURL.parseURIEncoded(append)); + } handler.handleStatus(pending); } catch (SVNException e) { diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeListsTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeListsTest.java index ab1f83d0b2f9..abadade660e7 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeListsTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeListsTest.java @@ -104,7 +104,6 @@ public class SvnNativeListsTest extends SvnTestCase { verify(runSvn("status"), "", "--- Changelist 'newOne':", "M a.txt"); } - @Bombed(user = "irengrig", month = Calendar.FEBRUARY, day = 20, description = "waiting for svnkit bugfix") @Test public void testEditAndMove() throws Throwable { final LocalChangeList newL = myChangeListManager.addChangeList("newOne", null); @@ -156,7 +155,6 @@ public class SvnNativeListsTest extends SvnTestCase { verify(runSvn("status"), "", "--- Changelist 'newOne':", "A + b.txt", "D a.txt"); } - @Bombed(user = "irengrig", month = Calendar.FEBRUARY, day = 20, description = "waiting for svnkit bugfix") @Test public void testMoveMove() throws Throwable { final LocalChangeList newL = myChangeListManager.addChangeList("newOne", null); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRenameTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRenameTest.java index 54c99ac2b17c..7ed6a12f8417 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRenameTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRenameTest.java @@ -221,7 +221,7 @@ public class SvnRenameTest extends SvnTestCase { } // IDEA-13824 - @Bombed(user = "irengrig", month = Calendar.FEBRUARY, day = 20, description = "waiting for svnkit bugfix") + @Bombed(user = "irengrig", month = Calendar.FEBRUARY, day = 20, description = "waiting for svnkit bugfix SVNKIT-136") @Test public void testRenameFileRenameDir() throws Exception { final VirtualFile child = prepareDirectoriesForRename(); diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/DecorationLayer.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/DecorationLayer.java index 7d3428845855..db8e76a60681 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/DecorationLayer.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/DecorationLayer.java @@ -65,10 +65,4 @@ public class DecorationLayer extends JComponent { } return parent.getLayout().getChildSelectionDecorator(component); } - - public Rectangle getComponentBounds(RadComponent component) { - Rectangle bounds = component.getBounds(); - Point location = component.convertPoint(bounds.x, bounds.y, this); - return new Rectangle(location.x, location.y, bounds.width, bounds.height); - } } \ No newline at end of file diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/DesignerEditorPanel.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/DesignerEditorPanel.java index 03bc9080a430..732037216f70 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/DesignerEditorPanel.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/DesignerEditorPanel.java @@ -30,6 +30,7 @@ import com.intellij.ui.ScrollPaneFactory; import com.intellij.util.ArrayUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; @@ -130,6 +131,11 @@ public abstract class DesignerEditorPanel extends JPanel implements ToolProvider return DesignerEditorPanel.this.getRootSelectionDecorator(); } + @Nullable + public EditOperation processRootOperation(OperationContext context) { + return DesignerEditorPanel.this.processRootOperation(context); + } + @Override public FeedbackLayer getFeedbackLayer() { return myFeedbackLayer; @@ -175,6 +181,9 @@ public abstract class DesignerEditorPanel extends JPanel implements ToolProvider protected abstract ComponentDecorator getRootSelectionDecorator(); + @Nullable + protected abstract EditOperation processRootOperation(OperationContext context); + public InputTool getActiveTool() { return myTool; } @@ -244,6 +253,9 @@ public abstract class DesignerEditorPanel extends JPanel implements ToolProvider int height = 0; if (myRootComponent != null) { + width = Math.max(width, (int)myRootComponent.getBounds().getMaxX()); + height = Math.max(height, (int)myRootComponent.getBounds().getMaxY()); + for (RadComponent component : myRootComponent.getChildren()) { width = Math.max(width, (int)component.getBounds().getMaxX()); height = Math.max(height, (int)component.getBounds().getMaxY()); diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/EditOperation.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/EditOperation.java new file mode 100644 index 000000000000..266a4d711307 --- /dev/null +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/EditOperation.java @@ -0,0 +1,37 @@ +/* + * 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.designer.designSurface; + +import com.intellij.designer.model.RadComponent; + +import java.util.List; + +/** + * @author Alexander Lobas + */ +public interface EditOperation { + void setComponent(RadComponent component); + + void setComponents(List component); + + void showFeedback(); + + void eraseFeedback(); + + boolean canExecute(); + + void execute() throws Exception; +} \ No newline at end of file diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/EditableArea.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/EditableArea.java index a4b4b37a7695..8f38c638b2e2 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/EditableArea.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/EditableArea.java @@ -92,7 +92,21 @@ public abstract class EditableArea { public abstract ComponentDecorator getRootSelectionDecorator(); + @Nullable + public EditOperation processRootOperation(OperationContext context) { + return null; + } + public abstract FeedbackLayer getFeedbackLayer(); public abstract RadComponent getRootComponent(); + + public boolean isTree() { + return false; + } + + @Nullable + public FeedbackTreeLayer getFeedbackTreeLayer() { + return null; + } } \ No newline at end of file diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/FeedbackTreeLayer.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/FeedbackTreeLayer.java new file mode 100644 index 000000000000..2c3bf8b39dd3 --- /dev/null +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/FeedbackTreeLayer.java @@ -0,0 +1,22 @@ +/* + * 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.designer.designSurface; + +/** + * @author Alexander Lobas + */ +public interface FeedbackTreeLayer { +} \ No newline at end of file diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/OperationContext.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/OperationContext.java new file mode 100644 index 000000000000..5b937871456c --- /dev/null +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/OperationContext.java @@ -0,0 +1,118 @@ +/* + * 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.designer.designSurface; + +import com.intellij.designer.model.RadComponent; + +import java.awt.*; +import java.awt.event.InputEvent; +import java.util.ArrayList; +import java.util.List; + +/** + * @author Alexander Lobas + */ +public final class OperationContext { + private final Object myType; + private EditableArea myArea; + private List myComponents; + private InputEvent myInputEvent; + private Point myLocation; + private Point myMoveDelta; + private Dimension mySizeDelta; + private int myResizeDirection; + private Object myNewObject; + + public OperationContext(Object type) { + myType = type; + } + + public Object getType() { + return myType; + } + + public boolean is(Object type) { + return type == null ? myType == null : type.equals(myType); + } + + public EditableArea getArea() { + return myArea; + } + + public void setArea(EditableArea area) { + myArea = area; + } + + public List getComponents() { + return myComponents; + } + + public void setComponents(List components) { + myComponents = components; + } + + public InputEvent getInputEvent() { + return myInputEvent; + } + + public void setInputEvent(InputEvent inputEvent) { + myInputEvent = inputEvent; + } + + public Point getLocation() { + return myLocation; + } + + public void setLocation(Point location) { + myLocation = location; + } + + public Point getMoveDelta() { + return myMoveDelta; + } + + public void setMoveDelta(Point moveDelta) { + myMoveDelta = moveDelta; + } + + public Dimension getSizeDelta() { + return mySizeDelta; + } + + public void setSizeDelta(Dimension sizeDelta) { + mySizeDelta = sizeDelta; + } + + public Rectangle getTransformedRectangle(Rectangle r) { + return new Rectangle(r.x + myMoveDelta.x, r.y + myMoveDelta.y, r.width + mySizeDelta.width, r.height + mySizeDelta.height); + } + + public int getResizeDirection() { + return myResizeDirection; + } + + public void setResizeDirection(int resizeDirection) { + myResizeDirection = resizeDirection; + } + + public Object getNewObject() { + return myNewObject; + } + + public void setNewObject(Object newObject) { + myNewObject = newObject; + } +} \ No newline at end of file diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/feedbacks/AlphaComponent.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/feedbacks/AlphaComponent.java new file mode 100644 index 000000000000..313d77a3e05d --- /dev/null +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/feedbacks/AlphaComponent.java @@ -0,0 +1,57 @@ +/* + * 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.designer.designSurface.feedbacks; + +import javax.swing.*; +import java.awt.*; + +/** + * @author Alexander Lobas + */ +public class AlphaComponent extends JComponent { + private static final AlphaComposite myComposite1 = AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 0.3f); + private static final AlphaComposite myComposite2 = AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 0.6f); + + private final Color myColor; + private final Color myBorderColor; + + public AlphaComponent(Color color) { + this(color, color); + } + + public AlphaComponent(Color color, Color borderColor) { + myColor = color; + myBorderColor = borderColor; + } + + protected void paintComponent(final Graphics g) { + Graphics2D g2d = (Graphics2D)g; + super.paintComponent(g); + final Composite oldComposite = g2d.getComposite(); + final Color oldColor = g2d.getColor(); + + g2d.setColor(myColor); + g2d.setComposite(myComposite1); + g2d.fillRect(0, 0, getWidth(), getHeight()); + + g2d.setColor(myBorderColor); + g2d.setComposite(myComposite2); + g2d.drawRect(0, 0, getWidth() - 1, getHeight() - 1); + + g2d.setColor(oldColor); + g2d.setComposite(oldComposite); + } +} \ No newline at end of file diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/selection/DirectionResizePoint.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/selection/DirectionResizePoint.java index 038ae1189ba8..37ee2c0596a8 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/selection/DirectionResizePoint.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/selection/DirectionResizePoint.java @@ -28,16 +28,19 @@ import java.awt.*; */ public class DirectionResizePoint extends ResizePoint { private int myDirection; + private Object myType; private double myXSeparator; private double myYSeparator; - public DirectionResizePoint(int direction) { + public DirectionResizePoint(int direction, Object type) { setDirection(direction); + myType = type; } - public DirectionResizePoint(Color color, Color border, int direction) { + public DirectionResizePoint(Color color, Color border, int direction, Object type) { super(color, border); setDirection(direction); + myType = type; } private void setDirection(int direction) { @@ -68,12 +71,12 @@ public class DirectionResizePoint extends ResizePoint { @Override protected InputTool createTool(RadComponent component) { - return new ResizeTracker(myDirection); + return new ResizeTracker(myDirection, myType); } @Override protected Point getLocation(DecorationLayer layer, RadComponent component) { - Rectangle bounds = layer.getComponentBounds(component); + Rectangle bounds = component.getBounds(layer); int size = (getSize() + 1) / 2; int x = bounds.x + (int) (bounds.width * myXSeparator) - size; int y = bounds.y + (int) (bounds.height * myYSeparator) - size; diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/selection/NonResizeSelectionDecorator.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/selection/NonResizeSelectionDecorator.java index 29fd19de5d8d..73cb484afab0 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/selection/NonResizeSelectionDecorator.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/selection/NonResizeSelectionDecorator.java @@ -17,7 +17,6 @@ package com.intellij.designer.designSurface.selection; import com.intellij.designer.designSurface.ComponentDecorator; import com.intellij.designer.designSurface.DecorationLayer; -import com.intellij.designer.designSurface.EditableArea; import com.intellij.designer.designSurface.tools.DragTracker; import com.intellij.designer.designSurface.tools.InputTool; import com.intellij.designer.model.RadComponent; @@ -38,7 +37,7 @@ public class NonResizeSelectionDecorator implements ComponentDecorator { @Override public InputTool findTargetTool(DecorationLayer layer, RadComponent component, int x, int y) { - Rectangle bounds = layer.getComponentBounds(component); + Rectangle bounds = component.getBounds(layer); int lineWidth = Math.max(myLineWidth, 2); Rectangle top = new Rectangle(bounds.x, bounds.y, bounds.width, lineWidth); @@ -60,7 +59,7 @@ public class NonResizeSelectionDecorator implements ComponentDecorator { g.setStroke(new BasicStroke(myLineWidth)); } - Rectangle bounds = layer.getComponentBounds(component); + Rectangle bounds = component.getBounds(layer); g.drawRect(bounds.x, bounds.y, bounds.width, bounds.height); } } \ No newline at end of file diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/tools/DragTracker.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/tools/DragTracker.java index db1262543bd7..5334fd01f004 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/tools/DragTracker.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/tools/DragTracker.java @@ -18,13 +18,22 @@ package com.intellij.designer.designSurface.tools; import com.intellij.designer.model.RadComponent; import com.intellij.designer.utils.Cursors; +import java.awt.*; + /** * @author Alexander Lobas */ public class DragTracker extends SelectionTracker { + private static final Cursor myDragCursor = Cursors.getMoveCursor(); + public DragTracker(RadComponent component) { super(component); setDefaultCursor(Cursors.RESIZE_ALL); setDisabledCursor(Cursors.getNoCursor()); } + + @Override + protected Cursor getDefaultCursor() { + return myState == STATE_NONE ? super.getDefaultCursor() : myDragCursor; + } } \ No newline at end of file diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/tools/InputTool.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/tools/InputTool.java index dcb9aefedd73..68d98a917da8 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/tools/InputTool.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/tools/InputTool.java @@ -37,7 +37,7 @@ public abstract class InputTool { protected ToolProvider myToolProvider; protected EditableArea myArea; - private Object myCommand; + protected Object myCommand; private boolean myActive; private boolean myCanUnload = true; @@ -100,10 +100,6 @@ public abstract class InputTool { } } - protected final boolean unloadWhenFinished() { - return myCanUnload; - } - public final void setUnloadWhenFinished(boolean value) { myCanUnload = value; } @@ -144,7 +140,7 @@ public abstract class InputTool { return getDefaultCursor(); } - protected final Cursor getDefaultCursor() { + protected Cursor getDefaultCursor() { return myDefaultCursor; } @@ -228,7 +224,7 @@ public abstract class InputTool { protected void handleAreaExited() { } - protected void handleFinished() { + protected final void handleFinished() { if (myCanUnload) { myToolProvider.loadDefaultTool(); } diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/tools/MarqueeTracker.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/tools/MarqueeTracker.java index fa352b45c4ec..64b9479a31b1 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/tools/MarqueeTracker.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/tools/MarqueeTracker.java @@ -18,6 +18,7 @@ package com.intellij.designer.designSurface.tools; import com.intellij.designer.designSurface.FeedbackLayer; import com.intellij.designer.model.RadComponent; import com.intellij.designer.model.RadComponentVisitor; +import com.intellij.designer.designSurface.feedbacks.AlphaComponent; import com.intellij.designer.utils.Cursors; import javax.swing.*; @@ -30,8 +31,6 @@ import java.util.List; * @author Alexander Lobas */ public class MarqueeTracker extends InputTool { - private static final AlphaComposite myComposite1 = AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 0.3f); - private static final AlphaComposite myComposite2 = AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 0.6f); private static final Color myColor = new Color(47, 67, 96); private static final int TOGGLE_MODE = 1; @@ -111,24 +110,7 @@ public class MarqueeTracker extends InputTool { FeedbackLayer layer = myArea.getFeedbackLayer(); if (myFeedback == null) { - myFeedback = new JComponent() { - protected void paintComponent(final Graphics g) { - Graphics2D g2d = (Graphics2D)g; - super.paintComponent(g); - final Composite oldComposite = g2d.getComposite(); - final Color oldColor = g2d.getColor(); - g2d.setColor(myColor); - - g2d.setComposite(myComposite1); - g2d.fillRect(0, 0, getWidth(), getHeight()); - - g2d.setComposite(myComposite2); - g2d.drawRect(0, 0, getWidth() - 1, getHeight() - 1); - - g2d.setColor(oldColor); - g2d.setComposite(oldComposite); - } - }; + myFeedback = new AlphaComponent(myColor); layer.add(myFeedback); } @@ -156,11 +138,7 @@ public class MarqueeTracker extends InputTool { myArea.getRootComponent().accept(new RadComponentVisitor() { @Override public void endVisit(RadComponent component) { - Rectangle bounds = component.getBounds(); - Point location = component.convertPoint(bounds.x, bounds.y, myArea.getNativeComponent()); - - if (selectionRectangle.contains(location) && - selectionRectangle.contains(location.x + bounds.width, location.y + bounds.height)) { + if (selectionRectangle.contains(component.getBounds(myArea.getNativeComponent()))) { newSelection.add(component); } } diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/tools/ResizeTracker.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/tools/ResizeTracker.java index 5008ad3efff8..51fd16846d38 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/tools/ResizeTracker.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/tools/ResizeTracker.java @@ -15,13 +15,180 @@ */ package com.intellij.designer.designSurface.tools; +import com.intellij.designer.designSurface.EditOperation; +import com.intellij.designer.designSurface.OperationContext; +import com.intellij.designer.model.RadComponent; import com.intellij.designer.utils.Cursors; +import com.intellij.designer.utils.Position; +import org.jetbrains.annotations.Nullable; + +import java.awt.*; +import java.util.ArrayList; +import java.util.List; /** * @author Alexander Lobas */ public class ResizeTracker extends InputTool { - public ResizeTracker(int direction) { + private OperationContext myContext; + private List myOperations; + private boolean myShowFeedback; + private final int myDirection; + + public ResizeTracker(int direction, Object type) { + myDirection = direction; + myContext = new OperationContext(type); + myContext.setResizeDirection(direction); setDefaultCursor(Cursors.getResizeCursor(direction)); + setDisabledCursor(Cursors.getNoCursor()); + } + + @Override + public void deactivate() { + eraseFeedback(); + myContext = null; + myOperations = null; + super.deactivate(); + } + + @Override + protected Cursor calculateCursor() { + if (myState == STATE_DRAG) { + return getDefaultCursor(); + } + return super.calculateCursor(); + } + + @Override + protected void handleButtonDown(int button) { + if (button == 1) { + if (myState == STATE_INIT) { + myState = STATE_DRAG; + } + } + else { + myState = STATE_INVALID; + eraseFeedback(); + setCommand(null); + } + } + + @Override + protected void handleButtonUp(int button) { + if (myState == STATE_DRAG_IN_PROGRESS) { + myState = STATE_NONE; + eraseFeedback(); + executeCommand(); + } + } + + @Override + protected void handleDragStarted() { + if (myState == STATE_DRAG) { + myState = STATE_DRAG_IN_PROGRESS; + } + } + + @Override + protected void handleDragInProgress() { + if (myState == STATE_DRAG_IN_PROGRESS) { + updateContext(); + showFeedback(); + setCommand(); + } + } + + private void showFeedback() { + for (EditOperation operation : getOperations()) { + operation.showFeedback(); + } + myShowFeedback = true; + } + + private void eraseFeedback() { + if (myShowFeedback) { + myShowFeedback = false; + for (EditOperation operation : getOperations()) { + operation.eraseFeedback(); + } + } + } + + private void executeCommand() { + if (myCommand != null) { + try { + for (EditOperation operation : getOperations()) { + if (operation.canExecute()) { + operation.execute(); + } + } + } + catch (Exception e) { + myToolProvider.showError("Execute command: ", e); + } + } + } + + private void setCommand() { + for (EditOperation operation : getOperations()) { + if (operation.canExecute()) { + setCommand(this); + return; + } + } + setCommand(null); + } + + private void updateContext() { + myContext.setArea(myArea); + myContext.setInputEvent(myInputEvent); + + Point corner = new Point(); + Dimension resize = new Dimension(); + + int moveDeltaHeight = myCurrentScreenY - myStartScreenY; + if ((myDirection & Position.NORTH) != 0) { + corner.y += moveDeltaHeight; + resize.height -= moveDeltaHeight; + } + else if ((myDirection & Position.SOUTH) != 0) { + resize.height += moveDeltaHeight; + } + + int moveDeltaWidth = myCurrentScreenX - myStartScreenX; + if ((myDirection & Position.WEST) != 0) { + corner.x += moveDeltaWidth; + resize.width -= moveDeltaWidth; + } + else if ((myDirection & Position.EAST) != 0) { + resize.width += moveDeltaWidth; + } + + myContext.setMoveDelta(corner); + myContext.setSizeDelta(resize); + myContext.setLocation(new Point(myCurrentScreenX, myCurrentScreenY)); + } + + private List getOperations() { + if (myOperations == null) { + myContext.setComponents(new ArrayList(myArea.getSelection())); + myOperations = new ArrayList(); + + for (RadComponent component : myContext.getComponents()) { + EditOperation operation; + RadComponent parent = component.getParent(); + if (parent == null) { + operation = myArea.processRootOperation(myContext); + } + else { + operation = parent.getLayout().processChildOperation(myContext); + } + if (operation != null) { + myOperations.add(operation); + operation.setComponent(component); + } + } + } + return myOperations; } } \ No newline at end of file diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/tools/SelectionTool.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/tools/SelectionTool.java index e7c478361d7b..fb2c18780aa2 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/tools/SelectionTool.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/tools/SelectionTool.java @@ -32,26 +32,43 @@ import java.util.List; public class SelectionTool extends InputTool { private InputTool myTracker; + @Override + public void deactivate() { + deactivateTracker(); + super.deactivate(); + } + + @Override + public void refreshCursor() { + if (myTracker == null) { + super.refreshCursor(); + } + } + @Override protected void handleButtonDown(int button) { if (myState == STATE_INIT) { myState = STATE_DRAG; deactivateTracker(); - if (myInputEvent.isAltDown()) { - setTracker(new MarqueeTracker()); - return; - } + if (!myArea.isTree()) { + if (myInputEvent.isAltDown()) { + setTracker(new MarqueeTracker()); + return; + } - InputTool tracker = myArea.findTargetTool(myCurrentScreenX, myCurrentScreenY); - if (tracker != null) { - setTracker(tracker); - return; + InputTool tracker = myArea.findTargetTool(myCurrentScreenX, myCurrentScreenY); + if (tracker != null) { + setTracker(tracker); + return; + } } RadComponent component = myArea.findTarget(myCurrentScreenX, myCurrentScreenY); if (component == null) { - setTracker(new MarqueeTracker()); + if (!myArea.isTree()) { + setTracker(new MarqueeTracker()); + } } else { setTracker(component.getDragTracker()); @@ -78,19 +95,6 @@ public class SelectionTool extends InputTool { } } - @Override - public void deactivate() { - deactivateTracker(); - super.deactivate(); - } - - @Override - public void refreshCursor() { - if (myTracker == null) { - super.refreshCursor(); - } - } - private void setTracker(@Nullable InputTool tracker) { if (myTracker != tracker) { deactivateTracker(); diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadComponent.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadComponent.java index c04497da738e..ed637eaa4f82 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadComponent.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadComponent.java @@ -36,6 +36,12 @@ public abstract class RadComponent { private RadLayout myLayout; private final Map myClientProperties = new HashMap(); + ////////////////////////////////////////////////////////////////////////////////////////// + // + // Hierarchy + // + ////////////////////////////////////////////////////////////////////////////////////////// + public RadComponent getRoot() { return myParent == null ? this : myParent.getRoot(); } @@ -56,15 +62,21 @@ public abstract class RadComponent { return getChildren().toArray(); } + ////////////////////////////////////////////////////////////////////////////////////////// + // + // Visual + // + ////////////////////////////////////////////////////////////////////////////////////////// + public Rectangle getBounds() { return null; } - public Point convertPoint(Component component, int x, int y) { + public Rectangle getBounds(Component relativeTo) { return null; } - public Point convertPoint(int x, int y, Component component) { + public Point convertPoint(Component relativeFrom, int x, int y) { return null; } @@ -72,6 +84,12 @@ public abstract class RadComponent { return new DragTracker(this); } + ////////////////////////////////////////////////////////////////////////////////////////// + // + // layout + // + ////////////////////////////////////////////////////////////////////////////////////////// + public RadLayout getLayout() { return myLayout; } @@ -85,6 +103,12 @@ public abstract class RadComponent { return null; } + ////////////////////////////////////////////////////////////////////////////////////////// + // + // Properties + // + ////////////////////////////////////////////////////////////////////////////////////////// + public List getProperties() { return null; } @@ -97,6 +121,12 @@ public abstract class RadComponent { myClientProperties.put(key, value); } + ////////////////////////////////////////////////////////////////////////////////////////// + // + // Visitor + // + ////////////////////////////////////////////////////////////////////////////////////////// + public void accept(RadComponentVisitor visitor, boolean forward) { if (visitor.visit(this)) { List children = getChildren(); diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadLayout.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadLayout.java index 094b581827a2..a4a3e310c691 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadLayout.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadLayout.java @@ -16,10 +16,18 @@ package com.intellij.designer.model; import com.intellij.designer.designSurface.ComponentDecorator; +import com.intellij.designer.designSurface.EditOperation; +import com.intellij.designer.designSurface.OperationContext; +import org.jetbrains.annotations.Nullable; /** * @author Alexander Lobas */ public abstract class RadLayout { public abstract ComponentDecorator getChildSelectionDecorator(RadComponent component); + + @Nullable + public EditOperation processChildOperation(OperationContext context) { + return null; + } } \ No newline at end of file diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/utils/Cursors.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/utils/Cursors.java index d5ea30834506..4686a5c8fddb 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/utils/Cursors.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/utils/Cursors.java @@ -35,6 +35,26 @@ public final class Cursors { } } + // TODO: replace on better cursor (self image) + public static Cursor getMoveCursor() { + try { + return Cursor.getSystemCustomCursor("MoveDrop.32x32"); + } + catch (Exception ex) { + return Cursor.getDefaultCursor(); + } + } + + // TODO: replace on better cursor (self image) + public static Cursor getCopyCursor() { + try { + return Cursor.getSystemCustomCursor("CopyDrop.32x32"); + } + catch (Exception ex) { + return Cursor.getDefaultCursor(); + } + } + @Nullable public static Cursor getResizeCursor(int direction) { int cursor; diff --git a/xml/impl/src/com/intellij/psi/impl/source/xml/XsContentDFA.java b/xml/impl/src/com/intellij/psi/impl/source/xml/XsContentDFA.java index 11fefd140226..3aff250f2d54 100644 --- a/xml/impl/src/com/intellij/psi/impl/source/xml/XsContentDFA.java +++ b/xml/impl/src/com/intellij/psi/impl/source/xml/XsContentDFA.java @@ -124,6 +124,7 @@ class XsContentDFA extends XmlContentDFA { } private static QName createQName(XmlTag tag) { + //todo don't use intern to not pollute PermGen String namespace = tag.getNamespace(); return new QName(tag.getNamespacePrefix().intern(), tag.getLocalName().intern(),