@Override public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { final PsiElement psiElement = descriptor.getPsiElement(); if (psiElement == null) return; final PsiFile file = psiElement.getContainingFile(); if (file == null || !JavaFxFileTypeFactory.isFxml(file)) return; if (!FileModificationService.getInstance().prepareFileForWrite(file)) return; ImportOptimizer optimizer = new JavaFxImportsOptimizer(); final Runnable runnable = optimizer.processFile(file); new WriteCommandAction.Simple(project, getFamilyName(), file) { @Override protected void run() throws Throwable { runnable.run(); } }.execute(); }
private void retrieveAndStoreNotificationInfo(@NotNull Runnable runnable) { if (runnable instanceof ImportOptimizer.CollectingInfoRunnable) { String optimizerMessage = ((ImportOptimizer.CollectingInfoRunnable)runnable).getUserNotificationInfo(); myOptimizerNotifications.add(optimizerMessage != null ? new NotificationInfo(optimizerMessage) : NOTHING_CHANGED_NOTIFICATION); } else if (runnable == EmptyRunnable.getInstance()) { myOptimizerNotifications.add(NOTHING_CHANGED_NOTIFICATION); } else { myOptimizerNotifications.add(SOMETHING_CHANGED_WITHOUT_MESSAGE_NOTIFICATION); } }
private void optimizeImports(final Project project, final PsiFile file) { ImportOptimizer optimizer = new PyImportOptimizer(); final Runnable runnable = optimizer.processFile(file); new WriteCommandAction.Simple(project, getFamilyName(), file) { @Override protected void run() throws Throwable { runnable.run(); } }.execute(); }
private void optimizeImports(final Project project, final SchemaFile file) { ImportOptimizer optimizer = new SchemaImportOptimizer(); final Runnable runnable = optimizer.processFile(file); new WriteCommandAction.Simple(project, getFamilyName(), file) { @Override protected void run() throws Throwable { runnable.run(); } }.execute(); }
public void invoke(@NotNull final Project project, PsiFile file) { ImportOptimizer optimizer = new HaxeImportOptimizer(); final Runnable runnable = optimizer.processFile(file); ApplicationManager.getApplication().runWriteAction(new Runnable() { public void run() { CommandProcessor.getInstance().executeCommand(project, runnable, getFamilyName(), this); } }); }
public void invoke(@NotNull final Project project, PsiFile file) { ImportOptimizer optimizer = new HaxeImportOptimizer(); final Runnable runnable = optimizer.processFile(file); ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { CommandProcessor.getInstance().executeCommand(project, runnable, getFamilyName(), this); } }); }
@Override public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { final PsiElement psiElement = descriptor.getPsiElement(); if(psiElement == null) { return; } final PsiFile file = psiElement.getContainingFile(); if(file == null || !JavaFxFileTypeFactory.isFxml(file)) { return; } if(!FileModificationService.getInstance().prepareFileForWrite(file)) { return; } ImportOptimizer optimizer = new JavaFxImportsOptimizer(); final Runnable runnable = optimizer.processFile(file); new WriteCommandAction.Simple(project, getFamilyName(), file) { @Override protected void run() throws Throwable { runnable.run(); } }.execute(); }
private void retrieveAndStoreNotificationInfo(@Nonnull Runnable runnable) { if (runnable instanceof ImportOptimizer.CollectingInfoRunnable) { String optimizerMessage = ((ImportOptimizer.CollectingInfoRunnable)runnable).getUserNotificationInfo(); myOptimizerNotifications.add(optimizerMessage != null ? new NotificationInfo(optimizerMessage) : NOTHING_CHANGED_NOTIFICATION); } else if (runnable == EmptyRunnable.getInstance()) { myOptimizerNotifications.add(NOTHING_CHANGED_NOTIFICATION); } else { myOptimizerNotifications.add(SOMETHING_CHANGED_WITHOUT_MESSAGE_NOTIFICATION); } }