Skip to content

Commit

Permalink
[code] cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
boogiecat committed Feb 4, 2015
1 parent 003f516 commit 5f4099b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,22 @@
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;
event.getPresentation().setEnabledAndVisible(visibility);
}

@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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
}
}

0 comments on commit 5f4099b

Please sign in to comment.