From de95f90b0182695e1e5b41d463ba2d15a8d0d7d1 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 11 Oct 2018 15:03:17 +0200 Subject: [PATCH] IDEA-200366 No way to configure Run Configuration Templates for a new projects in non-IDEA IDEs --- .../actions/TemplateProjectSettingsGroup.java | 49 ------------------- .../TemplateProjectStructureAction.java | 24 ++++----- .../src/idea/PlatformActions.xml | 1 + resources/src/idea/RichPlatformActions.xml | 7 ++- 4 files changed, 13 insertions(+), 68 deletions(-) delete mode 100644 java/idea-ui/src/com/intellij/ide/actions/TemplateProjectSettingsGroup.java diff --git a/java/idea-ui/src/com/intellij/ide/actions/TemplateProjectSettingsGroup.java b/java/idea-ui/src/com/intellij/ide/actions/TemplateProjectSettingsGroup.java deleted file mode 100644 index 9e924524ccf5..000000000000 --- a/java/idea-ui/src/com/intellij/ide/actions/TemplateProjectSettingsGroup.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * @author max - */ -package com.intellij.ide.actions; - -import com.intellij.execution.actions.EditRunConfigurationsAction; -import com.intellij.icons.AllIcons; -import com.intellij.openapi.actionSystem.AnAction; -import com.intellij.openapi.actionSystem.DefaultActionGroup; -import com.intellij.openapi.actionSystem.Presentation; - -import javax.swing.*; - -public class TemplateProjectSettingsGroup extends DefaultActionGroup { - public TemplateProjectSettingsGroup() { - setPopup(true); - - Presentation presentation = getTemplatePresentation(); - presentation.setText("Project Defaults"); - presentation.setIcon(AllIcons.General.Settings); - - add(withTextAndIcon(new TemplateProjectPropertiesAction(), "Settings", AllIcons.General.Settings)); - add(withTextAndIcon(new TemplateProjectStructureAction(), "Project Structure", AllIcons.General.ProjectStructure)); - add(withTextAndIcon(new EditRunConfigurationsAction(), "Run Configurations", AllIcons.ToolbarDecorator.Import)); - } - - private static AnAction withTextAndIcon(AnAction action, String text, Icon icon) { - Presentation presentation = action.getTemplatePresentation(); - presentation.setText(text); - presentation.setIcon(icon); - return action; - } -} \ No newline at end of file diff --git a/java/idea-ui/src/com/intellij/ide/actions/TemplateProjectStructureAction.java b/java/idea-ui/src/com/intellij/ide/actions/TemplateProjectStructureAction.java index 83e2ea362382..cf35f329c21a 100644 --- a/java/idea-ui/src/com/intellij/ide/actions/TemplateProjectStructureAction.java +++ b/java/idea-ui/src/com/intellij/ide/actions/TemplateProjectStructureAction.java @@ -1,21 +1,8 @@ -/* - * 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.actions; import com.intellij.idea.ActionsBundle; +import com.intellij.openapi.actionSystem.ActionPlaces; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.project.ProjectManager; import com.intellij.openapi.util.text.StringUtil; @@ -33,4 +20,11 @@ public class TemplateProjectStructureAction extends ShowStructureSettingsAction public void actionPerformed(@NotNull AnActionEvent e) { showDialog(ProjectManager.getInstance().getDefaultProject()); } + + @Override + public void update(@NotNull AnActionEvent e) { + if (e.getPlace().equals(ActionPlaces.WELCOME_SCREEN)) { + e.getPresentation().setText(StringUtil.trimEnd(getTemplatePresentation().getText(), "...")); + } + } } \ No newline at end of file diff --git a/platform/platform-resources/src/idea/PlatformActions.xml b/platform/platform-resources/src/idea/PlatformActions.xml index e6f17619d91a..4bf79b78f04a 100644 --- a/platform/platform-resources/src/idea/PlatformActions.xml +++ b/platform/platform-resources/src/idea/PlatformActions.xml @@ -678,6 +678,7 @@ + diff --git a/resources/src/idea/RichPlatformActions.xml b/resources/src/idea/RichPlatformActions.xml index 9e4f42681642..c7cb23324949 100644 --- a/resources/src/idea/RichPlatformActions.xml +++ b/resources/src/idea/RichPlatformActions.xml @@ -385,10 +385,9 @@ - - - - + + +