本文整理汇总了Java中com.intellij.util.IconUtil.addText方法的典型用法代码示例。如果您正苦于以下问题:Java IconUtil.addText方法的具体用法?Java IconUtil.addText怎么用?Java IconUtil.addText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.IconUtil
的用法示例。
在下文中一共展示了IconUtil.addText方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setConfigurationIcon
import com.intellij.util.IconUtil; //导入方法依赖的package包/类
private static void setConfigurationIcon(final Presentation presentation,
final RunnerAndConfigurationSettings settings,
final Project project) {
try {
Icon icon = RunManagerEx.getInstanceEx(project).getConfigurationIcon(settings);
ExecutionManagerImpl executionManager = ExecutionManagerImpl.getInstance(project);
List<RunContentDescriptor> runningDescriptors = executionManager.getRunningDescriptors(new Condition<RunnerAndConfigurationSettings>() {
@Override
public boolean value(RunnerAndConfigurationSettings s) {
return s == settings;
}
});
if (runningDescriptors.size() == 1) {
icon = ExecutionUtil.getLiveIndicator(icon);
}
if (runningDescriptors.size() > 1) {
icon = IconUtil.addText(icon, String.valueOf(runningDescriptors.size()));
}
presentation.setIcon(icon);
}
catch (IndexNotReadyException ignored) {
}
}
示例2: getInformativeIcon
import com.intellij.util.IconUtil; //导入方法依赖的package包/类
private Icon getInformativeIcon(Project project, final RunnerAndConfigurationSettings selectedConfiguration) {
final ExecutionManagerImpl executionManager = ExecutionManagerImpl.getInstance(project);
List<RunContentDescriptor> runningDescriptors = executionManager.getRunningDescriptors(s -> s == selectedConfiguration);
runningDescriptors = ContainerUtil.filter(runningDescriptors, descriptor -> {
RunContentDescriptor contentDescriptor = executionManager.getContentManager().findContentDescriptor(myExecutor, descriptor.getProcessHandler());
return contentDescriptor != null && executionManager.getExecutors(contentDescriptor).contains(myExecutor);
});
if (!runningDescriptors.isEmpty() && DefaultRunExecutor.EXECUTOR_ID.equals(myExecutor.getId()) && selectedConfiguration.isSingleton()) {
return AllIcons.Actions.Restart;
}
if (runningDescriptors.isEmpty()) {
return myExecutor.getIcon();
}
if (runningDescriptors.size() == 1) {
return ExecutionUtil.getLiveIndicator(myExecutor.getIcon());
}
else {
return IconUtil.addText(myExecutor.getIcon(), String.valueOf(runningDescriptors.size()));
}
}
示例3: setConfigurationIcon
import com.intellij.util.IconUtil; //导入方法依赖的package包/类
private static void setConfigurationIcon(final Presentation presentation,
final RunnerAndConfigurationSettings settings,
final Project project) {
try {
Icon icon = RunManagerEx.getInstanceEx(project).getConfigurationIcon(settings);
ExecutionManagerImpl executionManager = ExecutionManagerImpl.getInstance(project);
List<RunContentDescriptor> runningDescriptors = executionManager.getRunningDescriptors(new Condition<RunnerAndConfigurationSettings>() {
@Override
public boolean value(RunnerAndConfigurationSettings s) {
return s == settings;
}
});
if (runningDescriptors.size() == 1) {
icon = ExecutionUtil.getLiveIndicator(icon);
}
if (runningDescriptors.size() > 1) {
icon = IconUtil.addText(icon, String.valueOf(runningDescriptors.size()));
}
presentation.setIcon(icon);
}
catch (IndexNotReadyException ignored) {
}
}
示例4: getInformativeIcon
import com.intellij.util.IconUtil; //导入方法依赖的package包/类
private Icon getInformativeIcon(Project project, final RunnerAndConfigurationSettings selectedConfiguration) {
final ExecutionManagerImpl executionManager = ExecutionManagerImpl.getInstance(project);
RunConfiguration configuration = selectedConfiguration.getConfiguration();
if (configuration instanceof RunnerIconProvider) {
RunnerIconProvider provider = (RunnerIconProvider)configuration;
Icon icon = provider.getExecutorIcon(configuration, myExecutor);
if (icon != null) {
return icon;
}
}
List<RunContentDescriptor> runningDescriptors =
executionManager.getRunningDescriptors(new Condition<RunnerAndConfigurationSettings>() {
@Override
public boolean value(RunnerAndConfigurationSettings s) {
return s == selectedConfiguration;
}
});
runningDescriptors = ContainerUtil.filter(runningDescriptors, new Condition<RunContentDescriptor>() {
@Override
public boolean value(RunContentDescriptor descriptor) {
RunContentDescriptor contentDescriptor =
executionManager.getContentManager().findContentDescriptor(myExecutor, descriptor.getProcessHandler());
return contentDescriptor != null && executionManager.getExecutors(contentDescriptor).contains(myExecutor);
}
});
if (!runningDescriptors.isEmpty() && DefaultRunExecutor.EXECUTOR_ID.equals(myExecutor.getId()) && selectedConfiguration.isSingleton()) {
return AllIcons.Actions.Restart;
}
if (runningDescriptors.isEmpty()) {
return myExecutor.getIcon();
}
if (runningDescriptors.size() == 1) {
return ExecutionUtil.getLiveIndicator(myExecutor.getIcon());
}
else {
return IconUtil.addText(myExecutor.getIcon(), String.valueOf(runningDescriptors.size()));
}
}
示例5: update
import com.intellij.util.IconUtil; //导入方法依赖的package包/类
@Override
public void update(final AnActionEvent e) {
boolean enable = false;
Icon icon = getTemplatePresentation().getIcon();
String description = getTemplatePresentation().getDescription();
Presentation presentation = e.getPresentation();
if (isPlaceGlobal(e)) {
List<RunContentDescriptor> stoppableDescriptors = getActiveStoppableDescriptors(e.getDataContext());
List<Pair<TaskInfo, ProgressIndicator>> cancellableProcesses = getCancellableProcesses(e.getProject());
int todoSize = stoppableDescriptors.size() + cancellableProcesses.size();
if (todoSize > 1) {
presentation.setText(getTemplatePresentation().getText()+"...");
}
else if (todoSize == 1) {
if (stoppableDescriptors.size() ==1) {
presentation.setText(ExecutionBundle.message("stop.configuration.action.name", stoppableDescriptors.get(0).getDisplayName()));
} else {
TaskInfo taskInfo = cancellableProcesses.get(0).first;
presentation.setText(taskInfo.getCancelText() + " " + taskInfo.getTitle());
}
} else {
presentation.setText(getTemplatePresentation().getText());
}
enable = todoSize > 0;
if (todoSize > 1) {
icon = IconUtil.addText(icon, String.valueOf(todoSize));
}
}
else {
RunContentDescriptor contentDescriptor = e.getData(LangDataKeys.RUN_CONTENT_DESCRIPTOR);
ProcessHandler processHandler = contentDescriptor == null ? null : contentDescriptor.getProcessHandler();
if (processHandler != null && !processHandler.isProcessTerminated()) {
if (!processHandler.isProcessTerminating()) {
enable = true;
}
else if (processHandler instanceof KillableProcess && ((KillableProcess)processHandler).canKillProcess()) {
enable = true;
icon = AllIcons.Debugger.KillProcess;
description = "Kill process";
}
}
RunProfile runProfile = e.getData(LangDataKeys.RUN_PROFILE);
if (runProfile == null && contentDescriptor == null) {
presentation.setText(getTemplatePresentation().getText());
}
else {
presentation.setText(ExecutionBundle.message("stop.configuration.action.name",
runProfile == null ? contentDescriptor.getDisplayName() : runProfile.getName()));
}
}
presentation.setEnabled(enable);
presentation.setIcon(icon);
presentation.setDescription(description);
}
示例6: update
import com.intellij.util.IconUtil; //导入方法依赖的package包/类
@Override
public void update(final AnActionEvent e) {
boolean enable = false;
Icon icon = getTemplatePresentation().getIcon();
String description = getTemplatePresentation().getDescription();
Presentation presentation = e.getPresentation();
if (isPlaceGlobal(e)) {
List<RunContentDescriptor> stoppableDescriptors = getActiveStoppableDescriptors(e.getDataContext());
List<Pair<TaskInfo, ProgressIndicator>> cancellableProcesses = getCancellableProcesses(e.getProject());
int todoSize = stoppableDescriptors.size() + cancellableProcesses.size();
if (todoSize > 1) {
presentation.setText(getTemplatePresentation().getText() + "...");
}
else if (todoSize == 1) {
if (stoppableDescriptors.size() == 1) {
presentation
.setText(ExecutionBundle.message("stop.configuration.action.name", StringUtil.escapeMnemonics(stoppableDescriptors.get(0).getDisplayName())));
}
else {
TaskInfo taskInfo = cancellableProcesses.get(0).first;
presentation.setText(taskInfo.getCancelText() + " " + taskInfo.getTitle());
}
}
else {
presentation.setText(getTemplatePresentation().getText());
}
enable = todoSize > 0;
if (todoSize > 1) {
icon = IconUtil.addText(icon, String.valueOf(todoSize));
}
}
else {
RunContentDescriptor contentDescriptor = e.getData(LangDataKeys.RUN_CONTENT_DESCRIPTOR);
ProcessHandler processHandler = contentDescriptor == null ? null : contentDescriptor.getProcessHandler();
if (processHandler != null && !processHandler.isProcessTerminated()) {
if (!processHandler.isProcessTerminating()) {
enable = true;
}
else if (processHandler instanceof KillableProcess && ((KillableProcess)processHandler).canKillProcess()) {
enable = true;
icon = AllIcons.Debugger.KillProcess;
description = "Kill process";
}
}
RunProfile runProfile = e.getData(LangDataKeys.RUN_PROFILE);
if (runProfile == null && contentDescriptor == null) {
presentation.setText(getTemplatePresentation().getText());
}
else {
presentation.setText(ExecutionBundle.message("stop.configuration.action.name", StringUtil
.escapeMnemonics(runProfile == null ? contentDescriptor.getDisplayName() : runProfile.getName())));
}
}
presentation.setEnabled(enable);
presentation.setIcon(icon);
presentation.setDescription(description);
}
示例7: addOverlay
import com.intellij.util.IconUtil; //导入方法依赖的package包/类
private static Icon addOverlay(@NotNull Icon i) { return IconUtil.addText(i, OVERLAY); }