本文整理汇总了Java中com.intellij.lang.ImportOptimizer类的典型用法代码示例。如果您正苦于以下问题:Java ImportOptimizer类的具体用法?Java ImportOptimizer怎么用?Java ImportOptimizer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ImportOptimizer类属于com.intellij.lang包,在下文中一共展示了ImportOptimizer类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyFix
import com.intellij.lang.ImportOptimizer; //导入依赖的package包/类
@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();
}
示例2: retrieveAndStoreNotificationInfo
import com.intellij.lang.ImportOptimizer; //导入依赖的package包/类
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);
}
}
示例3: optimizeImports
import com.intellij.lang.ImportOptimizer; //导入依赖的package包/类
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();
}
示例4: optimizeImports
import com.intellij.lang.ImportOptimizer; //导入依赖的package包/类
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();
}
示例5: invoke
import com.intellij.lang.ImportOptimizer; //导入依赖的package包/类
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);
}
});
}
示例6: invoke
import com.intellij.lang.ImportOptimizer; //导入依赖的package包/类
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);
}
});
}
示例7: applyFix
import com.intellij.lang.ImportOptimizer; //导入依赖的package包/类
@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();
}
示例8: retrieveAndStoreNotificationInfo
import com.intellij.lang.ImportOptimizer; //导入依赖的package包/类
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);
}
}