From e183125b99be12c71566db1586ea401194f7f8a3 Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Thu, 9 Jun 2016 22:51:04 +0300 Subject: [PATCH] init remote path action (cherry picked from commit 271c880) --- .../ConfigureTestDiscoveryAction.java | 43 +++++++++++++++++++ resources/src/META-INF/IdeaPlugin.xml | 3 ++ 2 files changed, 46 insertions(+) create mode 100644 java/execution/impl/src/com/intellij/execution/testDiscovery/ConfigureTestDiscoveryAction.java diff --git a/java/execution/impl/src/com/intellij/execution/testDiscovery/ConfigureTestDiscoveryAction.java b/java/execution/impl/src/com/intellij/execution/testDiscovery/ConfigureTestDiscoveryAction.java new file mode 100644 index 000000000000..f5012bc876d9 --- /dev/null +++ b/java/execution/impl/src/com/intellij/execution/testDiscovery/ConfigureTestDiscoveryAction.java @@ -0,0 +1,43 @@ +/* + * 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. + */ +package com.intellij.execution.testDiscovery; + +import com.intellij.openapi.actionSystem.AnAction; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.fileChooser.FileChooser; +import com.intellij.openapi.fileChooser.FileChooserDescriptor; +import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; +import com.intellij.openapi.util.registry.Registry; +import com.intellij.openapi.vfs.VirtualFile; + +public class ConfigureTestDiscoveryAction extends AnAction { + @Override + public void update(AnActionEvent e) { + e.getPresentation().setEnabled(Registry.is("testDiscovery.enabled") && e.getProject() != null); + } + + @Override + public void actionPerformed(AnActionEvent e) { + final FileChooserDescriptor folderDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor(); + folderDescriptor.setTitle("Choose External Discovery Index Directory"); + folderDescriptor.setDescription("Local directory with indices retrieved from CI\n" + + "to be replaced within TeamCity IDEA plugin"); + final VirtualFile virtualFile = FileChooser.chooseFile(folderDescriptor, e.getProject(), null); + if (virtualFile != null) { + TestDiscoveryIndex.getInstance(e.getProject()).setRemoteTestRunDataPath(virtualFile.getPath()); + } + } +} diff --git a/resources/src/META-INF/IdeaPlugin.xml b/resources/src/META-INF/IdeaPlugin.xml index 81496f423164..45058ed3ffa0 100644 --- a/resources/src/META-INF/IdeaPlugin.xml +++ b/resources/src/META-INF/IdeaPlugin.xml @@ -1777,6 +1777,9 @@ + + +