use of com.intellij.ui.EditorNotificationPanel in project intellij-community by JetBrains.
the class MergePanel2 method tryInitView.
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());
}
});
}
}
use of com.intellij.ui.EditorNotificationPanel in project intellij-community by JetBrains.
the class LargeFileNotificationProvider method createNotificationPanel.
@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
if (!(fileEditor instanceof LargeFileEditorProvider.LargeTextFileEditor))
return null;
Editor editor = ((TextEditor) fileEditor).getEditor();
Project project = editor.getProject();
if (project == null || editor.getUserData(HIDDEN_KEY) != null || PropertiesComponent.getInstance().isTrueValue(DISABLE_KEY)) {
return null;
}
EditorNotificationPanel panel = new EditorNotificationPanel();
panel.createActionLabel("Hide notification", () -> {
editor.putUserData(HIDDEN_KEY, "true");
update(file, project);
});
panel.createActionLabel("Don't show again", () -> {
PropertiesComponent.getInstance().setValue(DISABLE_KEY, "true");
update(file, project);
});
return panel.text(String.format("This file is too large for editing (%s). Read only preview mode is activated.", StringUtil.formatFileSize(file.getLength())));
}
use of com.intellij.ui.EditorNotificationPanel in project android by JetBrains.
the class GeneratedFileNotificationProvider method createNotificationPanel.
@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
AndroidModuleModel androidModel = GradleProjectInfo.getInstance(myProject).findAndroidModelInModule(file);
if (androidModel == null) {
return null;
}
VirtualFile buildFolder = VfsUtil.findFileByIoFile(androidModel.getAndroidProject().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_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;
}
use of com.intellij.ui.EditorNotificationPanel in project intellij-community by JetBrains.
the class GeneratedFileEditingNotificationProvider method createNotificationPanel.
@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;
}
use of com.intellij.ui.EditorNotificationPanel in project intellij-community by JetBrains.
the class SdkSetupNotificationTest method testProjectSdk.
public void testProjectSdk() throws Exception {
final EditorNotificationPanel panel = configureBySdkAndText(IdeaTestUtil.getMockJdk18(), false, "Sample.java", "class Sample {}");
assertNull(panel);
}
Aggregations