Merge remote-tracking branch 'origin/master'

This commit is contained in:
Ekaterina Tuzova
2014-01-24 15:00:53 +04:00
6 changed files with 59 additions and 78 deletions
@@ -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());
@@ -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;
}
}
@@ -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<ProjectTemplate>());
ArrayList<ProjectTemplate> templates = new ArrayList<ProjectTemplate>();
templates.add(new ProjectCategoryTemplate(category));
myTemplatesMap.put(new TemplatesGroup(category), templates);
}
if (context.isCreatingNewProject()) {
MultiMap<String, ProjectTemplate> localTemplates = loadLocalTemplates();
@@ -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();
}
}
@@ -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() {
@@ -7,7 +7,6 @@
</extensions>
<extensions defaultExtensionNs="com.intellij">
<patterns.patternClass className="com.jetbrains.python.patterns.PythonPatterns" alias="py"/>
<multiHostInjector implementation="com.jetbrains.python.intelliLang.PyCommentInjector"/>
<multiHostInjector implementation="com.jetbrains.python.intelliLang.PyConfigurationInjector"/>
<multiHostInjector implementation="com.jetbrains.python.intelliLang.PyTemporaryInjector"/>
</extensions>