provide help id (IDEA-43171)

This commit is contained in:
anna
2012-10-19 21:08:23 +02:00
parent f71a83bf86
commit 6e83f2d8eb
4 changed files with 40 additions and 2 deletions
@@ -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.ide;
import org.jetbrains.annotations.Nullable;
public interface HelpIdProvider {
@Nullable String getHelpId();
}
@@ -17,6 +17,7 @@ package com.intellij.execution.ui;
import com.intellij.execution.process.ProcessHandler;
import com.intellij.ide.DataManager;
import com.intellij.ide.HelpIdProvider;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.DataProvider;
import com.intellij.openapi.diagnostic.Logger;
@@ -37,6 +38,7 @@ public class RunContentDescriptor implements Disposable {
private JComponent myComponent;
private final String myDisplayName;
private final Icon myIcon;
private final String myHelpId;
/**
* Used to hack {@link com.intellij.execution.runners.RestartAction}
@@ -51,6 +53,7 @@ public class RunContentDescriptor implements Disposable {
myComponent = component;
myDisplayName = displayName;
myIcon = icon;
myHelpId = myExecutionConsole instanceof HelpIdProvider ? ((HelpIdProvider)myExecutionConsole).getHelpId() : null;
DataManager.registerDataProvider(myComponent, new DataProvider() {
@Override
@@ -110,6 +113,10 @@ public class RunContentDescriptor implements Disposable {
return myDisplayName;
}
public String getHelpId() {
return myHelpId;
}
/**
* @see #myContent
*/
@@ -209,7 +209,8 @@ public class RunContentBuilder extends LogConsoleManagerBase {
actionGroup.addSeparator();
actionGroup.add(PinToolwindowTabAction.getPinAction());
actionGroup.add(new CloseAction(myExecutor, contentDescriptor, getProject()));
actionGroup.add(new ContextHelpAction(myExecutor.getHelpId()));
final String helpId = contentDescriptor.getHelpId();
actionGroup.add(new ContextHelpAction(helpId != null ? helpId : myExecutor.getHelpId()));
return actionGroup;
}
@@ -22,14 +22,16 @@ import com.intellij.execution.testframework.*;
import com.intellij.execution.ui.ConsoleView;
import com.intellij.execution.ui.ConsoleViewContentType;
import com.intellij.execution.ui.ObservableConsoleView;
import com.intellij.ide.HelpIdProvider;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.util.Disposer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
public abstract class BaseTestsOutputConsoleView implements ConsoleView, ObservableConsoleView {
public abstract class BaseTestsOutputConsoleView implements ConsoleView, ObservableConsoleView, HelpIdProvider {
private ConsoleView myConsole;
private TestsOutputConsolePrinter myPrinter;
protected TestConsoleProperties myProperties;
@@ -164,4 +166,10 @@ public abstract class BaseTestsOutputConsoleView implements ConsoleView, Observa
public TestConsoleProperties getProperties() {
return myProperties;
}
@Nullable
@Override
public String getHelpId() {
return "reference.runToolWindow.testResultsTab";
}
}