use of com.perl5.lang.perl.idea.configuration.settings.PerlLocalSettings in project Perl5-IDEA by Camelcade.
the class PerlAssociationEditorNotification method createNotificationPanel.
@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
PerlLocalSettings perlLocalSettings = PerlLocalSettings.getInstance(myProject);
if (perlLocalSettings.DISABLE_ASSOCIATIONS_CHECKING) {
return null;
}
Optional<Map.Entry<FileNameMatcher, FileType>> matchedEntry = PERL_FILE_TYPES.entrySet().stream().filter(entry -> entry.getKey().accept(file.getName())).findFirst();
if (matchedEntry == null || !matchedEntry.isPresent()) {
return null;
}
FileType expectedType = matchedEntry.get().getValue();
if (file.getFileType() == expectedType) {
return null;
}
EditorNotificationPanel panel = new EditorNotificationPanel();
panel.setText(PerlBundle.message("perl.notification.wrong.association", matchedEntry.get().getKey(), expectedType.getName(), file.getFileType().getName()));
panel.createActionLabel(PerlBundle.message("perl.configure.plugins"), () -> ShowSettingsUtil.getInstance().showSettingsDialog(null, PluginManagerConfigurable.class));
panel.createActionLabel(PerlBundle.message("perl.configure.associations"), () -> ShowSettingsUtil.getInstance().showSettingsDialog(null, FileTypeConfigurable.class));
panel.createActionLabel(PerlBundle.message("perl.notification.disable.notification"), () -> {
perlLocalSettings.DISABLE_ASSOCIATIONS_CHECKING = true;
EditorNotifications.getInstance(myProject).updateAllNotifications();
});
return panel;
}
use of com.perl5.lang.perl.idea.configuration.settings.PerlLocalSettings in project Perl5-IDEA by Camelcade.
the class PerlCriticAnnotator method getPerlCriticExecutable.
protected GeneralCommandLine getPerlCriticExecutable(Project project) throws ExecutionException {
PerlSharedSettings sharedSettings = PerlSharedSettings.getInstance(project);
PerlLocalSettings localSettings = PerlLocalSettings.getInstance(project);
String executable = localSettings.PERL_CRITIC_PATH;
if (StringUtil.isEmpty(executable)) {
throw new ExecutionException("Path to Perl::Critic executable must be configured in perl settings");
}
GeneralCommandLine commandLine = new GeneralCommandLine(executable).withWorkDirectory(project.getBasePath());
if (StringUtil.isNotEmpty(sharedSettings.PERL_CRITIC_ARGS)) {
commandLine.addParameters(StringUtil.split(sharedSettings.PERL_CRITIC_ARGS, " "));
}
return commandLine;
}
use of com.perl5.lang.perl.idea.configuration.settings.PerlLocalSettings in project Perl5-IDEA by Camelcade.
the class PerlFormatWithPerlTidyAction method getPerlTidyCommandLine.
protected GeneralCommandLine getPerlTidyCommandLine(Project project) throws ExecutionException {
PerlSharedSettings sharedSettings = PerlSharedSettings.getInstance(project);
PerlLocalSettings localSettings = PerlLocalSettings.getInstance(project);
String executable = localSettings.PERL_TIDY_PATH;
if (StringUtil.isEmpty(executable)) {
throw new ExecutionException(PerlBundle.message("perl.action.perl.tidy.execution.exception"));
}
GeneralCommandLine commandLine = new GeneralCommandLine(executable, "-st", "-se").withWorkDirectory(project.getBasePath());
if (StringUtil.isNotEmpty(sharedSettings.PERL_TIDY_ARGS)) {
commandLine.addParameters(StringUtil.split(sharedSettings.PERL_TIDY_ARGS, " "));
}
return commandLine;
}
use of com.perl5.lang.perl.idea.configuration.settings.PerlLocalSettings 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;
}
Aggregations