@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; }
@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); }
@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; }
@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; }
@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; }
@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; }
@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()); }
/** 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; }
@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; }
@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; }
@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); }
@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; }
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); }
@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; }
@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; }
@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; }
@NotNull public static JPanel createNotification(@NotNull String text, @NotNull final Color background) { return new EditorNotificationPanel() { @Override public Color getBackground() { return background; } }.text(text); }
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; }
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()); } }); } }
@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; }
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; }
@Nullable @Override public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) { if (!myChangeTracker.isEditedGeneratedFile(file)) return null; EditorNotificationPanel panel = new EditorNotificationPanel(); panel.setText("Generated source files should not be edited. The changes will be lost when sources are regenerated."); return panel; }
@Override public void syncStarted(@NotNull Project project) { if (myUiInitialized) { myNotificationPanel.removeAll(); EditorNotificationPanel notification = new EditorNotificationPanel(); notification.setText("Gradle project sync in progress..."); myNotificationPanel.add(notification); revalidateAndRepaint(myNotificationPanel); } }
@Nullable @Override public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) { String name = file.getName(); if (SdkConstants.FN_BUILD_GRADLE.equals(name) || SdkConstants.FN_SETTINGS_GRADLE.equals(name)) { GradleProjectSettings settings = GradleUtil.getGradleProjectSettings(myProject); if (AndroidStudioSpecificInitializer.isAndroidStudio() && settings != null && settings.isUseAutoImport()) { return new DisableAutoImportNotificationPanel(settings); } } return null; }
@Nullable @Override public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) { AndroidProject androidProject = getAndroidProject(file); if (androidProject == null) { return null; } VirtualFile buildFolder = VfsUtil.findFileByIoFile(androidProject.getBuildFolder(), false); if (buildFolder == null || !buildFolder.isDirectory()) { return null; } if (VfsUtilCore.isAncestor(buildFolder, file, false)) { if (myGeneratedSourceFileChangeTracker.isEditedGeneratedFile(file)) { // A warning is already being displayed by GeneratedFileEditingNotificationProvider return null; } VirtualFile explodedBundled = buildFolder.findChild(EXPLODED_BUNDLES); if (explodedBundled == null) { // 0.8.2+ explodedBundled = buildFolder.findChild(EXPLODED_AAR); } boolean inAar = explodedBundled != null && VfsUtilCore.isAncestor(explodedBundled, file, true); String text; if (inAar) { text = "Resource files inside Android library archive files (.aar) should not be edited"; } else { text = "Files under the build folder are generated and should not be edited."; } EditorNotificationPanel panel = new EditorNotificationPanel(); panel.setText(text); return panel; } return null; }
@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; }
@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; }
@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; }
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; }
@Nullable @Override public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) { if (file.getName().endsWith(".java") && file.getPath().contains(GROOVY_STUBS)) { final PsiClass psiClass = findClassByStub(myProject, file); if (psiClass != null) { return decorateStubFile(file, myProject); } } return null; }
public void hideCoverageData() { if (myEditor == null) return; final FileEditorManager fileEditorManager = FileEditorManager.getInstance(myProject); final List<RangeHighlighter> highlighters = myEditor.getUserData(COVERAGE_HIGHLIGHTERS); if (highlighters != null) { for (final RangeHighlighter highlighter : highlighters) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { highlighter.dispose(); } }); } myEditor.putUserData(COVERAGE_HIGHLIGHTERS, null); } final Map<FileEditor, EditorNotificationPanel> map = myFile.getCopyableUserData(NOTIFICATION_PANELS); if (map != null) { final VirtualFile vFile = myFile.getVirtualFile(); LOG.assertTrue(vFile != null); boolean freeAll = !fileEditorManager.isFileOpen(vFile); myFile.putCopyableUserData(NOTIFICATION_PANELS, null); for (FileEditor fileEditor : map.keySet()) { if (!freeAll && !isCurrentEditor(fileEditor)) { continue; } fileEditorManager.removeTopComponent(fileEditor, map.get(fileEditor)); } } final DocumentListener documentListener = myEditor.getUserData(COVERAGE_DOCUMENT_LISTENER); if (documentListener != null) { myDocument.removeDocumentListener(documentListener); myEditor.putUserData(COVERAGE_DOCUMENT_LISTENER, null); } }
@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; }
@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; }
@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; }
@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; }
private void tryInitView() { if (!hasAllEditors()) return; if (myMergeList != null) return; try { myMergeList = MergeList.create(myData); myMergeList.addListener(myDividersRepainter); myStatusUpdater = StatusUpdater.install(myMergeList, myPanel); Editor left = getEditor(0); Editor base = getEditor(1); Editor right = getEditor(2); 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(); } } catch (final FilesTooBigForDiffException e) { myPanel.insertTopComponent(new EditorNotificationPanel() { { myLabel.setText(e.getMessage()); } }); } }
@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) { return createPanel(file); } } } return null; }
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()) { RefreshQueue.getInstance().refresh(false, false, null, file); EditorNotifications.getInstance(myProject).updateNotifications(file); } } }); return panel; }
@Override public EditorNotificationPanel createConfigureNotificationPanel(final @NotNull Module module) { final EditorNotificationPanel panel = new EditorNotificationPanel(); panel.setText(framework.getFrameworkName() + " SDK is not configured for module '"+ module.getName() + '\''); panel.createActionLabel("Configure " + framework.getFrameworkName() + " SDK", new Runnable() { @Override public void run() { configure(framework, module); } }); return panel; }
@Override public EditorNotificationPanel createConfigureNotificationPanel(final @NotNull 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() { AddFrameworkSupportDialog dialog = AddFrameworkSupportDialog.createDialog(module); if (dialog != null) { dialog.show(); } } }); return panel; }