@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; }
@Nls @Nonnull @Override public String getText() { String text = myLabel.getText(); return StringUtil.isEmpty(text) ? EditorBundle.message("editor.notification.default.action.name") : StringUtil.shortenTextWithEllipsis(text, 50, 0); }
@RequiredReadAction @RequiredDispatchThread @Nullable @Override public EditorNotificationPanel createNotificationPanel(@Nonnull final VirtualFile file, @Nonnull 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; }
@Override public boolean isTypingActionInProgress() { return StringUtils.equals( this.commandProcessor.getCurrentCommandName(), EditorBundle.message("typing.in.editor.command.name") ); }
protected IncreaseEditorFontSize() { super(EditorBundle.message("increase.editor.font"), 1); }
protected DecreaseEditorFontSize() { super(EditorBundle.message("decrease.editor.font"), -1); }
@Override public void handle(ReadOnlyFragmentModificationException e) { Messages.showErrorDialog(EditorBundle.message("guarded.block.modification.attempt.error.message"), EditorBundle.message("guarded.block.modification.attempt.error.title")); }
@Nls @Nonnull @Override public String getText() { return EditorBundle.message("editor.notification.settings.option.name"); }