use of com.intellij.testFramework.LightVirtualFile in project Perl5-IDEA by Camelcade.
the class PerlInterpreterEditorNotification method createNotificationPanel.
@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile virtualFile, @NotNull FileEditor fileEditor) {
if (virtualFile.getFileType() instanceof PerlFileType && !(virtualFile instanceof LightVirtualFile)) {
final PerlLocalSettings perlLocalSettings = PerlLocalSettings.getInstance(myProject);
if (perlLocalSettings.DISABLE_NO_INTERPRETER_WARNING) {
return null;
}
EditorNotificationPanel panel;
String sdkPath = PerlProjectManager.getSdkPath(myProject, virtualFile);
if (sdkPath != null && VfsUtil.findFileByIoFile(new File(sdkPath), true) != null) {
return null;
}
panel = new EditorNotificationPanel();
panel.setText(PerlBundle.message("perl.notification.sdk.not.configured"));
panel.createActionLabel(PerlBundle.message("perl.notification.configure"), () -> Perl5SettingsConfigurable.open(myProject));
panel.createActionLabel(PerlBundle.message("perl.notification.disable.notification"), () -> {
perlLocalSettings.DISABLE_NO_INTERPRETER_WARNING = true;
EditorNotifications.getInstance(myProject).updateAllNotifications();
});
return panel;
}
return null;
}
use of com.intellij.testFramework.LightVirtualFile in project azure-tools-for-java by Microsoft.
the class IDEHelperImpl method createVirtualFile.
@SneakyThrows
private LightVirtualFile createVirtualFile(final String fileId, final String fullName, FileEditorManager manager) {
final LightVirtualFile virtualFile = new LightVirtualFile(fullName);
virtualFile.setFileType(FileTypeManager.getInstance().getFileTypeByFileName(fullName));
virtualFile.setCharset(StandardCharsets.UTF_8);
virtualFile.putUserData(APP_SERVICE_FILE_ID, fileId);
virtualFile.setWritable(true);
return virtualFile;
}
use of com.intellij.testFramework.LightVirtualFile in project azure-tools-for-java by Microsoft.
the class UIHelperImpl method closeSpringCloudAppPropertyView.
public void closeSpringCloudAppPropertyView(@NotNull Object projectObject, String appId) {
final FileEditorManager fileEditorManager = FileEditorManager.getInstance((Project) projectObject);
LightVirtualFile file = searchExistingFile(fileEditorManager, SPRING_CLOUD_APP_PROPERTY_TYPE, appId);
if (file != null) {
AzureTaskManager.getInstance().runLater(() -> fileEditorManager.closeFile(file));
}
}
use of com.intellij.testFramework.LightVirtualFile in project azure-tools-for-java by Microsoft.
the class UIHelperImpl method openSqlServerPropertyView.
@Override
public void openSqlServerPropertyView(@NotNull String id, @NotNull Object project) {
EventUtil.executeWithLog(ActionConstants.SqlServer.SHOW_PROPERTIES, (operation) -> {
final ResourceId resourceId = ResourceId.fromString(id);
final FileEditorManager fileEditorManager = getFileEditorManager(resourceId.subscriptionId(), resourceId.id(), (Project) project);
if (fileEditorManager == null) {
return;
}
LightVirtualFile itemVirtualFile = searchExistingFile(fileEditorManager, SqlServerPropertyViewProvider.TYPE, resourceId.id());
if (itemVirtualFile == null) {
itemVirtualFile = createVirtualFile(resourceId.name(), resourceId.subscriptionId(), resourceId.id());
itemVirtualFile.setFileType(new AzureFileType(SqlServerPropertyViewProvider.TYPE, AzureIconLoader.loadIcon(AzureIconSymbol.SqlServer.MODULE)));
}
FileEditor[] editors = fileEditorManager.openFile(itemVirtualFile, true, true);
for (FileEditor editor : editors) {
if (editor.getName().equals(SqlServerPropertyView.ID) && editor instanceof SqlServerPropertyView) {
((SqlServerPropertyView) editor).onReadProperty(resourceId.subscriptionId(), resourceId.resourceGroupName(), resourceId.name());
}
}
});
}
use of com.intellij.testFramework.LightVirtualFile in project azure-tools-for-java by Microsoft.
the class WhatsNewAction method createVirtualFile.
@Nonnull
private static LightVirtualFile createVirtualFile(String content) {
final FileType fileType = FileTypeManagerEx.getInstance().getFileTypeByExtension("md");
final LightVirtualFile virtualFile = new LightVirtualFile(AZURE_TOOLKIT_FOR_JAVA);
virtualFile.setFileType(fileType);
virtualFile.setContent(null, content, true);
virtualFile.putUserData(CONTENT_KEY, CONTENT_PATH);
virtualFile.setWritable(false);
return virtualFile;
}
Aggregations