本文整理汇总了Java中com.intellij.ui.EditorNotificationPanel.createActionLabel方法的典型用法代码示例。如果您正苦于以下问题:Java EditorNotificationPanel.createActionLabel方法的具体用法?Java EditorNotificationPanel.createActionLabel怎么用?Java EditorNotificationPanel.createActionLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ui.EditorNotificationPanel
的用法示例。
在下文中一共展示了EditorNotificationPanel.createActionLabel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createNotificationPanel
import com.intellij.ui.EditorNotificationPanel; //导入方法依赖的package包/类
@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
if (!CCUtils.isCourseCreator(myProject)) {
return null;
}
boolean isTestFile = CCUtils.isTestsFile(myProject, file);
if (!isTestFile && StudyUtils.getTaskFile(myProject, file) == null) {
return null;
}
Task task = StudyUtils.getTaskForFile(myProject, file);
if (task instanceof TaskWithSubtasks) {
final TaskWithSubtasks withSubtasks = (TaskWithSubtasks)task;
EditorNotificationPanel panel = new EditorNotificationPanel(EditorColors.GUTTER_BACKGROUND);
String header = (isTestFile ? "test" : "task") + " file";
int activeSubtaskIndex = withSubtasks.getActiveSubtaskIndex() + 1;
int subtaskSize = withSubtasks.getLastSubtaskIndex() + 1;
panel.setText("This is a " + header + " for " + EduNames.SUBTASK + " " + activeSubtaskIndex + "/" + subtaskSize);
panel
.createActionLabel(SWITCH_SUBTASK, () -> createPopup(withSubtasks, myProject).show(RelativePoint.getSouthEastOf(panel)));
return panel;
}
return null;
}
示例2: createPanel
import com.intellij.ui.EditorNotificationPanel; //导入方法依赖的package包/类
@NotNull
private static EditorNotificationPanel createPanel(@NotNull final Project project, @NotNull final PsiFile file) {
final EditorNotificationPanel panel = new EditorNotificationPanel();
panel.setText(ProjectBundle.message("project.sdk.not.defined"));
panel.createActionLabel(ProjectBundle.message("project.sdk.setup"), new Runnable() {
@Override
public void run() {
final Sdk projectSdk = ProjectSettingsService.getInstance(project).chooseAndSetSdk();
if (projectSdk == null) return;
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
final Module module = ModuleUtilCore.findModuleForPsiElement(file);
if (module != null) {
ModuleRootModificationUtil.setSdkInherited(module);
}
}
});
}
});
return panel;
}
示例3: createPanel
import com.intellij.ui.EditorNotificationPanel; //导入方法依赖的package包/类
@NotNull
private static EditorNotificationPanel createPanel(final @NotNull Project project, final @NotNull PsiFile file) {
final EditorNotificationPanel panel = new EditorNotificationPanel();
panel.setText(ProjectBundle.message("project.sdk.not.defined"));
panel.createActionLabel(ProjectBundle.message("project.sdk.setup"), new Runnable() {
@Override
public void run() {
final Sdk projectSdk = ProjectSettingsService.getInstance(project).chooseAndSetSdk();
if (projectSdk == null) return;
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
final Module module = ModuleUtilCore.findModuleForPsiElement(file);
if (module != null) {
ModuleRootModificationUtil.setSdkInherited(module);
}
}
});
}
});
return panel;
}
示例4: decorateStubFile
import com.intellij.ui.EditorNotificationPanel; //导入方法依赖的package包/类
private void decorateStubFile(final VirtualFile file, FileEditorManager fileEditorManager, FileEditor editor) {
final EditorNotificationPanel panel = new EditorNotificationPanel();
panel.setText("This stub is generated for Groovy class to make Groovy-Java cross-compilation possible");
panel.createActionLabel("Go to the Groovy class", new Runnable() {
@Override
public void run() {
final PsiClass original = GroovycStubGenerator.findClassByStub(myProject, file);
if (original != null) {
original.navigate(true);
}
}
});
panel.createActionLabel("Exclude from stub generation", new Runnable() {
@Override
public void run() {
final PsiClass psiClass = GroovycStubGenerator.findClassByStub(myProject, file);
if (psiClass != null) {
ExcludeFromStubGenerationAction.doExcludeFromStubGeneration(psiClass.getContainingFile());
}
}
});
fileEditorManager.addTopComponent(editor, panel);
}
示例5: createPanel
import com.intellij.ui.EditorNotificationPanel; //导入方法依赖的package包/类
@NotNull
private static EditorNotificationPanel createPanel(final @NotNull Project project, final @NotNull PsiFile file)
{
EditorNotificationPanel panel = new EditorNotificationPanel();
panel.setText(JavaCoreBundle.message("module.jdk.not.defined"));
panel.createActionLabel(JavaCoreBundle.message("module.jdk.setup"), () ->
{
final Module moduleForPsiElement = ModuleUtilCore.findModuleForPsiElement(file);
if(moduleForPsiElement == null)
{
return;
}
ProjectSettingsService.getInstance(project).openModuleSettings(moduleForPsiElement);
});
return panel;
}
示例6: createNotificationPanel
import com.intellij.ui.EditorNotificationPanel; //导入方法依赖的package包/类
@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull final VirtualFile file, @NotNull final FileEditor fileEditor) {
if (!(fileEditor instanceof TextEditor)) return null;
final Editor editor = ((TextEditor)fileEditor).getEditor();
final Project project = editor.getProject();
if (project == null
|| !Boolean.TRUE.equals(editor.getUserData(EditorImpl.FORCED_SOFT_WRAPS))
|| PropertiesComponent.getInstance().isTrueValue(DISABLED_NOTIFICATION_KEY)) return null;
final EditorNotificationPanel panel = new EditorNotificationPanel();
panel.setText(EditorBundle.message("forced.soft.wrap.message"));
panel.createActionLabel(EditorBundle.message("forced.soft.wrap.hide.message"), new Runnable() {
@Override
public void run() {
editor.putUserData(EditorImpl.FORCED_SOFT_WRAPS, null);
EditorNotifications.getInstance(project).updateNotifications(file);
}
});
panel.createActionLabel(EditorBundle.message("forced.soft.wrap.dont.show.again.message"), new Runnable() {
@Override
public void run() {
PropertiesComponent.getInstance().setValue(DISABLED_NOTIFICATION_KEY, "true");
EditorNotifications.getInstance(project).updateAllNotifications();
}
});
return panel;
}
示例7: createPanel
import com.intellij.ui.EditorNotificationPanel; //导入方法依赖的package包/类
private EditorNotificationPanel createPanel(@NotNull final VirtualFile file) {
EditorNotificationPanel panel = new EditorNotificationPanel();
panel.setText(IdeBundle.message("file.changed.externally.message"));
panel.createActionLabel(IdeBundle.message("file.changed.externally.reload"), new Runnable() {
@Override
public void run() {
if (!myProject.isDisposed()) {
file.refresh(false, false);
EditorNotifications.getInstance(myProject).updateNotifications(file);
}
}
});
return panel;
}
示例8: createNotificationPanel
import com.intellij.ui.EditorNotificationPanel; //导入方法依赖的package包/类
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull final VirtualFile file, @NotNull final FileEditor fileEditor) {
if (!(fileEditor instanceof TextEditor)) return null;
final Project project = ((TextEditor)fileEditor).getEditor().getProject();
final CodeStyleSettings settings = CodeStyleSettingsManager.getInstance(project).getCurrentSettings();
if (!Utils.isEnabled(settings) || PropertiesComponent.getInstance(project).getBoolean(EDITOR_CONFIG_ACCEPTED)) return null;
final List<EditorConfig.OutPair> pairs = SettingsProviderComponent.getInstance().getOutPairs(project, Utils.getFilePath(project, file));
if (!pairs.isEmpty()) {
final EditorNotificationPanel panel = new EditorNotificationPanel() {
@Override
public Color getBackground() {
return LightColors.GREEN;
}
}.text("EditorConfig is overriding Code Style settings for this file").
icon(EditorconfigIcons.Editorconfig);
panel.createActionLabel("OK", new Runnable() {
@Override
public void run() {
PropertiesComponent.getInstance(project).setValue(EDITOR_CONFIG_ACCEPTED, true);
EditorNotifications.getInstance(project).updateAllNotifications();
}
});
panel.createActionLabel("Disable EditorConfig support", new Runnable() {
@Override
public void run() {
settings.getCustomSettings(EditorConfigSettings.class).ENABLED = false;
EditorNotifications.getInstance(project).updateAllNotifications();
}
});
return panel;
}
return null;
}
示例9: createConfigureNotificationPanel
import com.intellij.ui.EditorNotificationPanel; //导入方法依赖的package包/类
@Override
public EditorNotificationPanel createConfigureNotificationPanel(@NotNull final Module module) {
final EditorNotificationPanel panel = new EditorNotificationPanel();
panel.setText(framework.getFrameworkName() + " SDK is not configured for module '" + module.getName() + '\'');
for (Entry<String, Runnable> action : framework.createConfigureActions(module).entrySet()) {
panel.createActionLabel(action.getKey(), action.getValue());
}
return panel;
}
示例10: createConfigureNotificationPanel
import com.intellij.ui.EditorNotificationPanel; //导入方法依赖的package包/类
@Override
public EditorNotificationPanel createConfigureNotificationPanel(@NotNull final Module module) {
final EditorNotificationPanel panel = new EditorNotificationPanel();
panel.setText(GroovyBundle.message("groovy.library.is.not.configured.for.module", module.getName()));
panel.createActionLabel(GroovyBundle.message("configure.groovy.library"), new Runnable() {
@Override
public void run() {
AddCustomLibraryDialog.createDialog(new GroovyLibraryDescription(), module, null).show();
}
});
return panel;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:DefaultGroovyFrameworkConfigNotification.java
示例11: decorateStubFile
import com.intellij.ui.EditorNotificationPanel; //导入方法依赖的package包/类
private static EditorNotificationPanel decorateStubFile(final VirtualFile file, final Project project) {
final EditorNotificationPanel panel = new EditorNotificationPanel();
panel.setText("This stub is generated for Groovy class to make Groovy-Java cross-compilation possible");
panel.createActionLabel("Go to the Groovy class", new Runnable() {
@Override
public void run() {
DumbService.getInstance(project).withAlternativeResolveEnabled(new Runnable() {
@Override
public void run() {
final PsiClass original = findClassByStub(project, file);
if (original != null) {
original.navigate(true);
}
}
});
}
});
panel.createActionLabel("Exclude from stub generation", new Runnable() {
@Override
public void run() {
DumbService.getInstance(project).withAlternativeResolveEnabled(new Runnable() {
@Override
public void run() {
final PsiClass psiClass = findClassByStub(project, file);
if (psiClass != null) {
ExcludeFromStubGenerationAction.doExcludeFromStubGeneration(psiClass.getContainingFile());
}
}
});
}
});
return panel;
}
示例12: createMissingSdkPanel
import com.intellij.ui.EditorNotificationPanel; //导入方法依赖的package包/类
@NotNull
private static EditorNotificationPanel createMissingSdkPanel(@NotNull final Project project, @Nullable final Module module) {
EditorNotificationPanel panel = new EditorNotificationPanel();
panel.setText(SquirrelBundle.message("squirrel.sdk.not.configured"));
panel.createActionLabel(SquirrelBundle.message("setup.squirrel.sdk"), new Runnable() {
@Override
public void run() {
SquirrelSdkService.getInstance(project).chooseAndSetSdk(module);
}
});
return panel;
}
开发者ID:shvetsgroup,项目名称:squirrel-lang-idea-plugin,代码行数:13,代码来源:WrongSdkConfigurationNotificationProvider.java
示例13: createNotificationPanel
import com.intellij.ui.EditorNotificationPanel; //导入方法依赖的package包/类
@RequiredReadAction
@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor)
{
if(file.getFileType() != Unity3dYMLAssetFileType.INSTANCE || !ArrayUtil.contains(file.getExtension(), Unity3dAssetFileTypeDetector.ourAssetExtensions))
{
return null;
}
final String uuid = Unity3dAssetUtil.getGUID(myProject, file);
if(uuid == null)
{
return null;
}
MultiMap<VirtualFile, Unity3dYMLAsset> map = Unity3dYMLAsset.findAssetAsAttach(myProject, file);
if(map.isEmpty())
{
return null;
}
PsiFile psiFile = PsiManager.getInstance(myProject).findFile(file);
if(psiFile == null)
{
return null;
}
final EditorNotificationPanel panel = new EditorNotificationPanel();
panel.text("Used asset...");
panel.createActionLabel("Find usages...", () -> FindManager.getInstance(myProject).findUsages(psiFile));
return panel;
}
示例14: createPanel
import com.intellij.ui.EditorNotificationPanel; //导入方法依赖的package包/类
@NotNull
private static EditorNotificationPanel createPanel(@Nullable String name, @NotNull final Module rootModule)
{
EditorNotificationPanel panel = new EditorNotificationPanel();
if(StringUtil.isEmpty(name))
{
panel.setText(Unity3dBundle.message("unity.sdk.is.not.defiled"));
}
else
{
panel.setText(Unity3dBundle.message("unity.0.sdk.is.not.defined", name));
}
panel.createActionLabel("Open Settings", () -> ProjectSettingsService.getInstance(rootModule.getProject()).openModuleSettings(rootModule));
return panel;
}
示例15: createNotificationPanel
import com.intellij.ui.EditorNotificationPanel; //导入方法依赖的package包/类
@RequiredReadAction
@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull final VirtualFile file, @NotNull FileEditor fileEditor)
{
if(file.getFileType() != JsonFileType.INSTANCE)
{
return null;
}
final PsiFile jsonFile = PsiManager.getInstance(myProject).findFile(file);
if(jsonFile == null)
{
return null;
}
JomFileElement<JomElement> fileElement = JomManager.getInstance(myProject).getFileElement(jsonFile);
if(fileElement == null)
{
return null;
}
EditorNotificationPanel panel = new EditorNotificationPanel();
panel.text("'npm' package manager");
panel.createActionLabel("'update'", new Runnable()
{
@Override
@RequiredDispatchThread
public void run()
{
NpmRunUtil.run(myProject, file, NpmRunUtil.UPDATE);
}
});
return panel;
}