int oldNegativeThreshold = config.getNegativeThreshold();
Color oldPositiveColor = config.getPositiveColor();
Color oldNegativeColor = config.getNegativeColor();
// Open dialog
MainFrame mainFrame = GlobalController.SINGLETON.getMainFrame();
SettingsDialog dialog = new SettingsDialog(mainFrame, config);
dialog.open();
// If not cancelled, see what has changed and recalculate if necessary
if (!dialog.hasBeenCanceled() && SentimentsFeature.isAvailable())
{
GlobalModel.touchPreferences();
String newPositive = config.getPositiveExpressions();
String newNegative = config.getNegativeExpressions();
boolean expressionsChanged =
!StringUtils.equals(oldPositive, newPositive) ||
!StringUtils.equals(oldNegative, newNegative);
boolean thresholdsChanged =
oldPositiveThreshold != config.getPositiveThreshold() ||
oldNegativeThreshold != config.getNegativeThreshold();
if (expressionsChanged || thresholdsChanged)
{
RecalculateAction.perform(!expressionsChanged);
} else if (!oldPositiveColor.equals(config.getPositiveColor()) ||
!oldNegativeColor.equals(config.getNegativeColor()))
{
IFeedDisplay feedDisplay = mainFrame.getArticlesListPanel().getFeedView();
feedDisplay.repaintSentimentsColorCodes();
}
}
}