Created
July 5, 2013 05:05
-
-
Save vexus2/5931909 to your computer and use it in GitHub Desktop.
Show Dialog and catch handlers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void syncWithSonar(Project project) { | |
Collection<Rule> sonarRules = this.sonarRulesByRuleKey.values(); | |
int oldSize = sonarRules.size(); | |
clearState(); | |
Collection<SonarSettingsBean> allSonarSettingsBeans = SonarSettingsComponent.getSonarSettingsBeans(project); | |
SonarService sonarService = ServiceManager.getService(SonarService.class); | |
if (null != allSonarSettingsBeans) { | |
for (Rule rule : sonarService.getAllRules(allSonarSettingsBeans)) { | |
this.sonarRulesByRuleKey.put(rule.getKey(), rule); | |
} | |
int newSize = sonarRulesByRuleKey.values().size(); | |
if (oldSize != newSize) { | |
// show restart ide dialog | |
final int ret = Messages.showOkCancelDialog("Detected new sonar rules. You have to restart IDE to reload the settings. Restart?", | |
IdeBundle.message("title.restart.needed"), Messages.getQuestionIcon()); | |
if (ret == 0) { | |
if (ApplicationManager.getApplication().isRestartCapable()) { | |
ApplicationManager.getApplication().restart(); | |
} else { | |
ApplicationManager.getApplication().exit(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment