From 5f4099be630016a4c65dd5c24b7f4bee8f8ffdb0 Mon Sep 17 00:00:00 2001 From: Anna Bulenkova Date: Wed, 4 Feb 2015 11:27:49 +0100 Subject: [PATCH] [code] cleanup --- .../tutorials/project/model/LibrariesAction.java | 5 +++-- .../tutorials/project/model/ModificationAction.java | 5 +++-- .../project/model/ProjectFileIndexSampleAction.java | 5 +++-- .../tutorials/project/model/ProjectSdkAction.java | 11 ++++++----- .../project/model/ShowSourceRootsActions.java | 13 +++++++------ 5 files changed, 22 insertions(+), 17 deletions(-) diff --git a/code_samples/project_model/src/com/intellij/tutorials/project/model/LibrariesAction.java b/code_samples/project_model/src/com/intellij/tutorials/project/model/LibrariesAction.java index e09bdc7885a..dd53d59ddc0 100644 --- a/code_samples/project_model/src/com/intellij/tutorials/project/model/LibrariesAction.java +++ b/code_samples/project_model/src/com/intellij/tutorials/project/model/LibrariesAction.java @@ -11,13 +11,14 @@ import com.intellij.pom.Navigatable; import com.intellij.psi.PsiClass; import com.intellij.psi.PsiFile; +import org.jetbrains.annotations.NotNull; /** * @author Anna Bulenkova */ public class LibrariesAction extends AnAction { @Override - public void update(final AnActionEvent event) { + public void update(@NotNull final AnActionEvent event) { Project project = event.getProject(); if (project == null) return; Navigatable element = event.getData(CommonDataKeys.NAVIGATABLE); @@ -31,7 +32,7 @@ public void update(final AnActionEvent event) { } @Override - public void actionPerformed(AnActionEvent event) { + public void actionPerformed(@NotNull AnActionEvent event) { Project project = event.getProject(); if (project == null) return; Navigatable element = event.getData(CommonDataKeys.NAVIGATABLE); diff --git a/code_samples/project_model/src/com/intellij/tutorials/project/model/ModificationAction.java b/code_samples/project_model/src/com/intellij/tutorials/project/model/ModificationAction.java index 6171f67ad63..f3919faa613 100644 --- a/code_samples/project_model/src/com/intellij/tutorials/project/model/ModificationAction.java +++ b/code_samples/project_model/src/com/intellij/tutorials/project/model/ModificationAction.java @@ -13,13 +13,14 @@ import com.intellij.pom.Navigatable; import com.intellij.psi.PsiClass; import com.intellij.psi.PsiFile; +import org.jetbrains.annotations.NotNull; /** * @author Anna Bulenkova */ public class ModificationAction extends AnAction { @Override - public void actionPerformed(final AnActionEvent event) { + public void actionPerformed(@NotNull final AnActionEvent event) { Project project = event.getProject(); if (project == null) return; Navigatable element = event.getData(CommonDataKeys.NAVIGATABLE); @@ -39,7 +40,7 @@ public void actionPerformed(final AnActionEvent event) { } @Override - public void update(final AnActionEvent event) { + public void update(@NotNull final AnActionEvent event) { Project project = event.getProject(); Navigatable element = event.getData(CommonDataKeys.NAVIGATABLE); event.getPresentation().setEnabledAndVisible(project != null && element != null); diff --git a/code_samples/project_model/src/com/intellij/tutorials/project/model/ProjectFileIndexSampleAction.java b/code_samples/project_model/src/com/intellij/tutorials/project/model/ProjectFileIndexSampleAction.java index f13d77a61a5..efe8c1da328 100644 --- a/code_samples/project_model/src/com/intellij/tutorials/project/model/ProjectFileIndexSampleAction.java +++ b/code_samples/project_model/src/com/intellij/tutorials/project/model/ProjectFileIndexSampleAction.java @@ -12,13 +12,14 @@ import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.vfs.VirtualFile; +import org.jetbrains.annotations.NotNull; /** * @author Anna Bulenkova */ public class ProjectFileIndexSampleAction extends AnAction { @Override - public void update(final AnActionEvent event) { + public void update(@NotNull final AnActionEvent event) { Project project = event.getProject(); final Editor editor = event.getData(CommonDataKeys.EDITOR); boolean visibility = project != null && editor != null; @@ -26,7 +27,7 @@ public void update(final AnActionEvent event) { } @Override - public void actionPerformed(final AnActionEvent event) { + public void actionPerformed(@NotNull final AnActionEvent event) { Project project = event.getProject(); final Editor editor = event.getData(CommonDataKeys.EDITOR); if (project == null || editor == null) return; diff --git a/code_samples/project_model/src/com/intellij/tutorials/project/model/ProjectSdkAction.java b/code_samples/project_model/src/com/intellij/tutorials/project/model/ProjectSdkAction.java index 28b7960e9e2..b030992f27e 100644 --- a/code_samples/project_model/src/com/intellij/tutorials/project/model/ProjectSdkAction.java +++ b/code_samples/project_model/src/com/intellij/tutorials/project/model/ProjectSdkAction.java @@ -6,14 +6,15 @@ import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.ui.Messages; +import org.jetbrains.annotations.NotNull; /** * @author Anna Bulenkova */ public class ProjectSdkAction extends AnAction { @Override - public void actionPerformed(final AnActionEvent e) { - Project project = e.getProject(); + public void actionPerformed(@NotNull final AnActionEvent event) { + Project project = event.getProject(); if (project != null) { String projectSDKName = ProjectRootManager.getInstance(project).getProjectSdkName(); String newProjectSdkName = "New Sdk Name"; @@ -23,11 +24,11 @@ public void actionPerformed(final AnActionEvent e) { } @Override - public void update(final AnActionEvent e) { - Project project = e.getProject(); + public void update(@NotNull final AnActionEvent event) { + Project project = event.getProject(); if (project != null) { Sdk sdk = ProjectRootManager.getInstance(project).getProjectSdk(); - e.getPresentation().setEnabledAndVisible(sdk != null); + event.getPresentation().setEnabledAndVisible(sdk != null); } } } diff --git a/code_samples/project_model/src/com/intellij/tutorials/project/model/ShowSourceRootsActions.java b/code_samples/project_model/src/com/intellij/tutorials/project/model/ShowSourceRootsActions.java index c325cb41093..2a7d5e5278b 100644 --- a/code_samples/project_model/src/com/intellij/tutorials/project/model/ShowSourceRootsActions.java +++ b/code_samples/project_model/src/com/intellij/tutorials/project/model/ShowSourceRootsActions.java @@ -6,14 +6,15 @@ import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.vfs.VirtualFile; +import org.jetbrains.annotations.NotNull; /** * @author Anna Bulenkova */ public class ShowSourceRootsActions extends AnAction { @Override - public void actionPerformed(final AnActionEvent anActionEvent) { - Project project = anActionEvent.getProject(); + public void actionPerformed(@NotNull final AnActionEvent event) { + Project project = event.getProject(); if (project == null) return; String projectName = project.getName(); StringBuilder sourceRootsList = new StringBuilder(); @@ -25,9 +26,9 @@ public void actionPerformed(final AnActionEvent anActionEvent) { } @Override - public void update(final AnActionEvent e) { - boolean visibility = e.getProject() != null; - e.getPresentation().setEnabled(visibility); - e.getPresentation().setVisible(visibility); + public void update(@NotNull final AnActionEvent event) { + boolean visibility = event.getProject() != null; + event.getPresentation().setEnabled(visibility); + event.getPresentation().setVisible(visibility); } }