本文整理汇总了Java中com.intellij.ui.EditorNotificationPanel类的典型用法代码示例。如果您正苦于以下问题:Java EditorNotificationPanel类的具体用法?Java EditorNotificationPanel怎么用?Java EditorNotificationPanel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EditorNotificationPanel类属于com.intellij.ui包,在下文中一共展示了EditorNotificationPanel类的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: 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);
}
示例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;
}
示例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;
}
示例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());
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}