• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EditorNotificationPanel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.ui.EditorNotificationPanel的典型用法代码示例。如果您正苦于以下问题:Java EditorNotificationPanel类的具体用法?Java EditorNotificationPanel怎么用?Java EditorNotificationPanel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EditorNotificationPanel类属于com.intellij.ui包,在下文中一共展示了EditorNotificationPanel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:25,代码来源:CCSubtaskEditorNotificationProvider.java


示例2: createNotificationPanel

import com.intellij.ui.EditorNotificationPanel; //导入依赖的package包/类
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
  if (file.getFileType() == JavaClassFileType.INSTANCE) return null;

  final PsiFile psiFile = PsiManager.getInstance(myProject).findFile(file);
  if (psiFile == null) {
    return null;
  }

  if (psiFile.getLanguage() != JavaLanguage.INSTANCE) {
    return null;
  }

  Module module = ModuleUtilCore.findModuleForPsiElement(psiFile);
  if (module == null) {
    return null;
  }

  Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
  if (sdk != null) {
    return null;
  }

  return createPanel(myProject, psiFile);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:SetupSDKNotificationProvider.java


示例3: 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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:SetupSDKNotificationProvider.java


示例4: createNotificationPanel

import com.intellij.ui.EditorNotificationPanel; //导入依赖的package包/类
@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
  if (file.getFileType() != PlainTextFileType.INSTANCE) return null;

  final String extension = file.getExtension();
  final String fileName = file.getName();
  if (extension != null && isIgnored("*." + extension) || isIgnored(fileName)) return null;

  final PluginsAdvertiser.KnownExtensions knownExtensions = PluginsAdvertiser.loadExtensions();
  if (knownExtensions != null) {
    final EditorNotificationPanel panel = extension != null ? createPanel("*." + extension, knownExtensions) : null;
    if (panel != null) {
      return panel;
    }
    return createPanel(fileName, knownExtensions);
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:PluginAdvertiserEditorNotificationProvider.java


示例5: createNotificationPanel

import com.intellij.ui.EditorNotificationPanel; //导入依赖的package包/类
@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
  if (!myProject.isDisposed() && !GeneralSettings.getInstance().isSyncOnFrameActivation()) {
    VirtualFileSystem fs = file.getFileSystem();
    if (fs instanceof LocalFileSystem) {
      FileAttributes attributes = ((LocalFileSystem)fs).getAttributes(file);
      if (attributes == null || file.getTimeStamp() != attributes.lastModified || file.getLength() != attributes.length) {
        LogUtil.debug(LOG, "%s: (%s,%s) -> %s", file, file.getTimeStamp(), file.getLength(), attributes);
        return createPanel(file);
      }
    }
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:FileChangedNotificationProvider.java


示例6: createNotificationPanel

import com.intellij.ui.EditorNotificationPanel; //导入依赖的package包/类
@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
  if (file.getFileType() != XmlFileType.INSTANCE) {
    return null;
  }
  final Module module = ModuleUtilCore.findModuleForFile(file, myProject);
  final AndroidFacet facet = module != null ? AndroidFacet.getInstance(module) : null;

  if (facet == null) {
    return null;
  }
  if (!facet.isGradleProject() && (isResourceFile(file, facet) || file.equals(AndroidRootUtil.getPrimaryManifestFile(facet)))) {
    final AndroidPlatform platform = AndroidPlatform.getInstance(module);

    if (platform == null) {
      return new MySdkNotConfiguredNotificationPanel(module);
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:AndroidSdkNotConfiguredNotificationProvider.java


示例7: createNotificationPanel

import com.intellij.ui.EditorNotificationPanel; //导入依赖的package包/类
@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
  if (!Projects.isGradleProject(myProject) || myIsImporting.get()) {
    return null;
  }
  GradleSyncState syncState = GradleSyncState.getInstance(myProject);
  if (Projects.lastGradleSyncFailed(myProject) ||
      syncState.isSyncInProgress() ||
      syncState.isSyncNeeded() != ThreeState.NO) {
    return null;
  }
  if (!isGradleBuildFile(file) || isImportedGradleProjectRoot(file, myProject)) {
    return null;
  }
  return new UnimportedModuleNotificationPanel(myProject, file.getParent());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:UnimportedModuleNotificationProvider.java


示例8: getEditorNotificationLabels

import com.intellij.ui.EditorNotificationPanel; //导入依赖的package包/类
/** Looks up the main label for a given editor notification panel */
private List<String> getEditorNotificationLabels(@NotNull EditorNotificationPanel panel) {
  final List<String> allText = Lists.newArrayList();
  final Collection<JLabel> labels = robot().finder().findAll(panel, JLabelMatcher.any().andShowing());
  for (final JLabel label : labels) {
    String text = execute(new GuiQuery<String>() {
      @Override
      @Nullable
      protected String executeInEDT() throws Throwable {
        return label.getText();
      }
    });
    if (isNotEmpty(text)) {
      allText.add(text);
    }
  }
  return allText;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:IdeFrameFixture.java


示例9: createNotificationPanel

import com.intellij.ui.EditorNotificationPanel; //导入依赖的package包/类
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
  if (file.getFileType() != SquirrelFileType.INSTANCE) return null;

  PsiFile psiFile = PsiManager.getInstance(myProject).findFile(file);
  if (psiFile == null) return null;

  if (psiFile.getLanguage() != SquirrelLanguage.INSTANCE) return null;

  Module module = ModuleUtilCore.findModuleForPsiElement(psiFile);
  if (module == null) return null;

  String sdkHomePath = SquirrelSdkService.getInstance(myProject).getSdkHomePath(module);
  if (StringUtil.isEmpty(sdkHomePath)) {
    return createMissingSdkPanel(myProject, module);
  }

  return null;
}
 
开发者ID:shvetsgroup,项目名称:squirrel-lang-idea-plugin,代码行数:20,代码来源:WrongSdkConfigurationNotificationProvider.java


示例10: createNotificationPanel

import com.intellij.ui.EditorNotificationPanel; //导入依赖的package包/类
@Override
@RequiredReadAction
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor)
{
	final PsiFile psiFile = PsiManager.getInstance(myProject).findFile(file);
	if(psiFile == null)
	{
		return null;
	}

	Unity3dRootModuleExtension rootModuleExtension = Unity3dModuleExtensionUtil.getRootModuleExtension(myProject);
	if(rootModuleExtension == null)
	{
		return null;
	}
	if(rootModuleExtension.getSdk() == null)
	{
		return createPanel(rootModuleExtension.getInheritableSdk().isNull() ? null : rootModuleExtension.getInheritableSdk().getName(), rootModuleExtension.getModule());
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-unity3d,代码行数:22,代码来源:SetupUnitySDKProvider.java


示例11: createNotificationPanel

import com.intellij.ui.EditorNotificationPanel; //导入依赖的package包/类
@Override
public EditorNotificationPanel createNotificationPanel(VirtualFile file, FileEditor fileEditor) {
  if (file.getFileType() == JavaClassFileType.INSTANCE) return null;

  final PsiFile psiFile = PsiManager.getInstance(myProject).findFile(file);
  if (psiFile == null) {
    return null;
  }

  if (psiFile.getLanguage() != JavaLanguage.INSTANCE) {
    return null;
  }

  if (ProjectRootManager.getInstance(myProject).getProjectSdk() != null) {
    return null;
  }

  return createPanel(myProject, psiFile);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:SetupSDKNotificationProvider.java


示例12: 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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:SetupSDKNotificationProvider.java


示例13: 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);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:GroovyCompilerLoader.java


示例14: createNotificationPanel

import com.intellij.ui.EditorNotificationPanel; //导入依赖的package包/类
@RequiredReadAction
@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@Nonnull VirtualFile file, @Nonnull FileEditor fileEditor) {
  if (!myProject.isDisposed() && !GeneralSettings.getInstance().isSyncOnFrameActivation()) {
    VirtualFileSystem fs = file.getFileSystem();
    if (fs instanceof LocalFileSystem) {
      FileAttributes attributes = ((LocalFileSystem)fs).getAttributes(file);
      if (attributes == null || file.getTimeStamp() != attributes.lastModified || file.getLength() != attributes.length) {
        LogUtil.debug(LOG, "%s: (%s,%s) -> %s", file, file.getTimeStamp(), file.getLength(), attributes);
        return createPanel(file);
      }
    }
  }

  return null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:FileChangedNotificationProvider.java


示例15: createNotificationPanel

import com.intellij.ui.EditorNotificationPanel; //导入依赖的package包/类
@RequiredReadAction
@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@Nonnull VirtualFile file, @Nonnull FileEditor fileEditor) {
  if (file.getFileType() != PlainTextFileType.INSTANCE && !(file.getFileType() instanceof AbstractFileType)) return null;

  final String extension = file.getExtension();
  if (extension == null) {
    return null;
  }

  if (myEnabledExtensions.contains(extension) || UnknownFeaturesCollector.getInstance(myProject).isIgnored(createFileFeatureForIgnoring(file))) return null;

  UnknownExtension fileFeatureForChecking = new UnknownExtension(FileTypeFactory.FILE_TYPE_FACTORY_EP.getName(), file.getName());

  List<IdeaPluginDescriptor> allPlugins = PluginsAdvertiserHolder.getLoadedPluginDescriptors();

  Set<IdeaPluginDescriptor> byFeature = PluginsAdvertiser.findByFeature(allPlugins, fileFeatureForChecking);
  if (!byFeature.isEmpty()) {
    return createPanel(file, byFeature, allPlugins);

  }
  return null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:PluginAdvertiserEditorNotificationProvider.java


示例16: 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;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:18,代码来源:SetupJDKNotificationProvider.java


示例17: createNotification

import com.intellij.ui.EditorNotificationPanel; //导入依赖的package包/类
@NotNull
public static JPanel createNotification(@NotNull String text, @NotNull final Color background) {
  return new EditorNotificationPanel() {
    @Override
    public Color getBackground() {
      return background;
    }
  }.text(text);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:DiffNotifications.java


示例18: createPanel

import com.intellij.ui.EditorNotificationPanel; //导入依赖的package包/类
private EditorNotificationPanel createPanel(String extension, PluginsAdvertiser.KnownExtensions knownExtensions) {
  final Set<PluginsAdvertiser.Plugin> plugins = knownExtensions.find(extension);
  if (plugins != null && !plugins.isEmpty()) {
    return createPanel(extension, plugins);
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PluginAdvertiserEditorNotificationProvider.java


示例19: tryInitView

import com.intellij.ui.EditorNotificationPanel; //导入依赖的package包/类
private void tryInitView() {
  if (!hasAllEditors()) return;
  if (myMergeList != null) return;
  myMergeList = MergeList.create(myData);
  myMergeList.addListener(myDividersRepainter);
  myStatusUpdater = StatusUpdater.install(myMergeList, myPanel);
  Editor left = getEditor(0);
  Editor base = getEditor(1);
  Editor right = getEditor(2);

  setupHighlighterSettings(left, base, right);

  myMergeList.setMarkups(left, base, right);
  EditingSides[] sides = {getFirstEditingSide(), getSecondEditingSide()};
  myScrollSupport.install(sides);
  for (int i = 0; i < myDividers.length; i++) {
    myDividers[i].listenEditors(sides[i]);
  }
  if (myScrollToFirstDiff) {
    myPanel.requestScrollEditors();
  }
  if (myMergeList.getErrorMessage() != null) {
    myPanel.insertTopComponent(new EditorNotificationPanel() {
      {
        myLabel.setText(myMergeList.getErrorMessage());
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:MergePanel2.java


示例20: 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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:ForcedSoftWrapsNotificationProvider.java



注:本文中的com.intellij.ui.EditorNotificationPanel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Nifty类代码示例发布时间:2022-05-21
下一篇:
Java PreferenceChangeEvent类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap