From 1ae36ceb850c6e8bcca85070f22513b488235f50 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Fri, 24 Jan 2014 13:23:57 +0400 Subject: [PATCH 1/3] ProjectCategoryTemplate --- ...ojectType.java => ModuleTypeCategory.java} | 6 +- .../ProjectCategoryTemplate.java | 42 +++++++++++ .../ide/projectWizard/ProjectTypeStep.java | 4 +- .../TemplateBasedProjectType.java | 69 ------------------- 4 files changed, 48 insertions(+), 73 deletions(-) rename java/idea-ui/src/com/intellij/ide/projectWizard/{BuilderBasedProjectType.java => ModuleTypeCategory.java} (76%) create mode 100644 java/idea-ui/src/com/intellij/ide/projectWizard/ProjectCategoryTemplate.java delete mode 100644 java/idea-ui/src/com/intellij/ide/projectWizard/TemplateBasedProjectType.java diff --git a/java/idea-ui/src/com/intellij/ide/projectWizard/BuilderBasedProjectType.java b/java/idea-ui/src/com/intellij/ide/projectWizard/ModuleTypeCategory.java similarity index 76% rename from java/idea-ui/src/com/intellij/ide/projectWizard/BuilderBasedProjectType.java rename to java/idea-ui/src/com/intellij/ide/projectWizard/ModuleTypeCategory.java index bb1b224542a6..ed2665d199ba 100644 --- a/java/idea-ui/src/com/intellij/ide/projectWizard/BuilderBasedProjectType.java +++ b/java/idea-ui/src/com/intellij/ide/projectWizard/ModuleTypeCategory.java @@ -9,11 +9,11 @@ import org.jetbrains.annotations.NotNull; * @author Dmitry Avdeev * Date: 20.09.13 */ -public class BuilderBasedProjectType extends ProjectCategory { +public class ModuleTypeCategory extends ProjectCategory { private final ModuleType myModuleType; - public BuilderBasedProjectType(ModuleType moduleType) { + public ModuleTypeCategory(ModuleType moduleType) { myModuleType = moduleType; } @@ -23,7 +23,7 @@ public class BuilderBasedProjectType extends ProjectCategory { return myModuleType.createModuleBuilder(); } - public static class Java extends BuilderBasedProjectType { + public static class Java extends ModuleTypeCategory { public Java() { super(JavaModuleType.getModuleType()); diff --git a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectCategoryTemplate.java b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectCategoryTemplate.java new file mode 100644 index 000000000000..1e5a05b2af06 --- /dev/null +++ b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectCategoryTemplate.java @@ -0,0 +1,42 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.ide.projectWizard; + +import com.intellij.platform.templates.BuilderBasedTemplate; +import org.jetbrains.annotations.NotNull; + +/** + * @author Dmitry Avdeev + */ +public class ProjectCategoryTemplate extends BuilderBasedTemplate { + + private final ProjectCategory myCategory; + + public ProjectCategoryTemplate(ProjectCategory category) { + super(category.createModuleBuilder()); + myCategory = category; + } + + @NotNull + @Override + public String getName() { + return myCategory.getDisplayName(); + } + + public ProjectCategory getCategory() { + return myCategory; + } +} diff --git a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTypeStep.java b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTypeStep.java index 69d674cf07be..c397b5ffe44e 100644 --- a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTypeStep.java +++ b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTypeStep.java @@ -135,7 +135,9 @@ public class ProjectTypeStep extends ModuleWizardStep implements Disposable, Act myTemplatesMap.putAllValues(CreateFromTemplateMode.getTemplatesMap(context)); for (ProjectCategory category : ProjectCategory.EXTENSION_POINT_NAME.getExtensions()) { - myTemplatesMap.put(new TemplatesGroup(category), new ArrayList()); + ArrayList templates = new ArrayList(); + templates.add(new ProjectCategoryTemplate(category)); + myTemplatesMap.put(new TemplatesGroup(category), templates); } if (context.isCreatingNewProject()) { MultiMap localTemplates = loadLocalTemplates(); diff --git a/java/idea-ui/src/com/intellij/ide/projectWizard/TemplateBasedProjectType.java b/java/idea-ui/src/com/intellij/ide/projectWizard/TemplateBasedProjectType.java deleted file mode 100644 index e9eefe505881..000000000000 --- a/java/idea-ui/src/com/intellij/ide/projectWizard/TemplateBasedProjectType.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2000-2013 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.ide.projectWizard; - -import com.intellij.ide.util.projectWizard.ModuleBuilder; -import com.intellij.platform.ProjectTemplate; -import com.intellij.platform.templates.LocalArchivedTemplate; -import org.jetbrains.annotations.NotNull; - -import javax.swing.*; -import java.net.URL; - -/** - * @author Dmitry Avdeev - * Date: 20.09.13 - */ -public class TemplateBasedProjectType extends ProjectCategory { - - private final ProjectTemplate myTemplate; - - public TemplateBasedProjectType(String templatePath) { - URL resource = getClass().getResource(templatePath); - assert resource != null : templatePath; - myTemplate = new LocalArchivedTemplate(resource, getClass().getClassLoader()); - } - - public TemplateBasedProjectType(ProjectTemplate template) { - myTemplate = template; - } - - @NotNull - @Override - public ModuleBuilder createModuleBuilder() { - return (ModuleBuilder)myTemplate.createModuleBuilder(); - } - - @Override - public String getId() { - return getDisplayName(); - } - - @Override - public String getDisplayName() { - return myTemplate.getName(); - } - - @Override - public String getDescription() { - return myTemplate.getDescription(); - } - - @Override - public Icon getIcon() { - return myTemplate.getIcon(); - } -} From 228266b83daf6d5d7e834a6c721ee7db342d7d17 Mon Sep 17 00:00:00 2001 From: Denis Fokin Date: Fri, 24 Jan 2014 13:49:33 +0400 Subject: [PATCH 2/3] IDEA-117522 Some dialogs are not disposed with the escape key --- .../src/com/intellij/ui/mac/MacMessagesImpl.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ui/mac/MacMessagesImpl.java b/platform/platform-impl/src/com/intellij/ui/mac/MacMessagesImpl.java index b9cf1e39fdb7..3954b2b3579b 100644 --- a/platform/platform-impl/src/com/intellij/ui/mac/MacMessagesImpl.java +++ b/platform/platform-impl/src/com/intellij/ui/mac/MacMessagesImpl.java @@ -120,6 +120,8 @@ public class MacMessagesImpl extends MacMessages { // invoke(invoke(alert, "buttons"), "objectAtIndex:", count == 1 ? 0 : 1)); //} + enableEscapeToCloseTheMessage(alert); + String doNotAsk = toStringViaUTF8(doNotAskText); if (!"-1".equals(doNotAsk)) { invoke(alert, "setShowsSuppressionButton:", 1); @@ -161,10 +163,10 @@ public class MacMessagesImpl extends MacMessages { //invoke(window, "makeFirstResponder:", // invoke(invoke(alert, "buttons"), "objectAtIndex:", alternateExist ? 2 : otherExist ? 1 : 0)); // - ////it is impossible to override ESCAPE key behavior -> key should be named "Cancel" to be bound to ESC - //if (!alternateExist) { - // invoke(invoke(invoke(alert, "buttons"), "objectAtIndex:", 1), "setKeyEquivalent:", nsString("\\e")); - //} + + if (!alternateExist) { + enableEscapeToCloseTheMessage(alert); + } String doNotAsk = toStringViaUTF8(doNotAskText); if (!"-1".equals(doNotAsk)) { @@ -200,6 +202,11 @@ public class MacMessagesImpl extends MacMessages { } } + private static ID enableEscapeToCloseTheMessage(ID alert) { + return invoke(invoke(invoke(alert, "buttons"), "objectAtIndex:", + invoke(invoke(alert, "buttons"), "count").intValue() - 1), "setKeyEquivalent:", nsString("\033")); + } + private MacMessagesImpl() {} private static final Callback windowDidBecomeMainCallback = new Callback() { From a185876d3a23f0966111567e91fe177833fbf25a Mon Sep 17 00:00:00 2001 From: Andrey Vlasovskikh Date: Fri, 24 Jan 2014 14:31:53 +0400 Subject: [PATCH 3/3] Disabled comment injector for Python for performance reasons Searching for comments in the AST takes some time, we need to improve it. --- .../src/META-INF/intellilang-python-support.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/python/IntelliLang-python/src/META-INF/intellilang-python-support.xml b/python/IntelliLang-python/src/META-INF/intellilang-python-support.xml index ce37b6ba8beb..44bab2c91b05 100644 --- a/python/IntelliLang-python/src/META-INF/intellilang-python-support.xml +++ b/python/IntelliLang-python/src/META-INF/intellilang-python-support.xml @@ -7,7 +7,6 @@ -