Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2018-06-29 04:57:52 -0400
committerLars Vogel2018-07-02 04:34:18 -0400
commitb5e853afd0ac59307d969a48dafaa9675f62e8c8 (patch)
tree0e7c3e353bc9032673e3f80156d4b42896f0d029
parentf1852ed8ac4c01fefb2037ad5a32debfb038a308 (diff)
downloadeclipse.platform.team-b5e853afd0ac59307d969a48dafaa9675f62e8c8.tar.gz
eclipse.platform.team-b5e853afd0ac59307d969a48dafaa9675f62e8c8.tar.xz
eclipse.platform.team-b5e853afd0ac59307d969a48dafaa9675f62e8c8.zip
Cleanup Sonar warnings in ComparePreferencePage
change to retrieger Change-Id: I63d84731e30ad94954697a37d58c2ff53789ae50 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java49
1 files changed, 21 insertions, 28 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java
index f192ad980..228701036 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java
@@ -54,7 +54,7 @@ import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
public class ComparePreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
- class FakeInput implements ITypedElement, IEncodedStreamContentAccessor {
+ private static class FakeInput implements ITypedElement, IEncodedStreamContentAccessor {
static final String UTF_16= "UTF-16"; //$NON-NLS-1$
String fContent;
@@ -81,6 +81,21 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
public String getCharset() {
return UTF_16;
}
+
+ private String loadPreviewContentFromFile(String key) {
+
+ String preview= Utilities.getString(key);
+ String separator= System.getProperty("line.separator"); //$NON-NLS-1$
+ StringBuilder buffer= new StringBuilder();
+ for (int i= 0; i < preview.length(); i++) {
+ char c= preview.charAt(i);
+ if (c == '\n')
+ buffer.append(separator);
+ else
+ buffer.append(c);
+ }
+ return buffer.toString();
+ }
}
private static final String PREFIX= CompareUIPlugin.PLUGIN_ID + "."; //$NON-NLS-1$
@@ -103,7 +118,6 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
public static final String SWAPPED = PREFIX + "Swapped"; //$NON-NLS-1$
- private TextMergeViewer fPreviewViewer;
private IPropertyChangeListener fPreferenceChangeListener;
private CompareConfiguration fCompareConfiguration;
private OverlayPreferenceStore fOverlayStore;
@@ -149,10 +163,8 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
store.setDefault(PREF_SAVE_ALL_EDITORS, false);
store.setDefault(ADDED_LINES_REGEX, ""); //$NON-NLS-1$
store.setDefault(REMOVED_LINES_REGEX, ""); //$NON-NLS-1$
- //store.setDefault(USE_SPLINES, false);
store.setDefault(USE_SINGLE_LINE, true);
store.setDefault(HIGHLIGHT_TOKEN_CHANGES, true);
- //store.setDefault(USE_RESOLVE_UI, false);
store.setDefault(CAPPING_DISABLED, false);
store.setDefault(PATH_FILTER, ""); //$NON-NLS-1$
store.setDefault(ICompareUIConstants.PREF_NAVIGATION_END_ACTION, ICompareUIConstants.PREF_VALUE_PROMPT);
@@ -162,8 +174,6 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
public ComparePreferencePage() {
- //setDescription(Utilities.getString("ComparePreferencePage.description")); //$NON-NLS-1$
-
setPreferenceStore(CompareUIPlugin.getDefault().getPreferenceStore());
fOverlayStore= new OverlayPreferenceStore(getPreferenceStore(), fKeys);
@@ -189,7 +199,7 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
fOverlayStore.setValue(ADDED_LINES_REGEX, addedLinesRegex.getText());
fOverlayStore.setValue(REMOVED_LINES_REGEX, removedLinesRegex.getText());
- editors.forEach(editor -> editor.store());
+ editors.forEach(FieldEditor::store);
fOverlayStore.propagate();
ComparePlugin.getDefault().setCappingDisabled(
@@ -222,12 +232,12 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
super.dispose();
}
- static public boolean getSaveAllEditors() {
+ public static boolean getSaveAllEditors() {
IPreferenceStore store= CompareUIPlugin.getDefault().getPreferenceStore();
return store.getBoolean(PREF_SAVE_ALL_EDITORS);
}
- static public void setSaveAllEditors(boolean value) {
+ public static void setSaveAllEditors(boolean value) {
IPreferenceStore store= CompareUIPlugin.getDefault().getPreferenceStore();
store.setValue(PREF_SAVE_ALL_EDITORS, value);
}
@@ -246,12 +256,10 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
TabItem item= new TabItem(folder, SWT.NONE);
item.setText(Utilities.getString("ComparePreferencePage.generalTab.label")); //$NON-NLS-1$
- //item.setImage(JavaPluginImages.get(JavaPluginImages.IMG_OBJS_CFILE));
item.setControl(createGeneralPage(folder));
item= new TabItem(folder, SWT.NONE);
item.setText(Utilities.getString("ComparePreferencePage.textCompareTab.label")); //$NON-NLS-1$
- //item.setImage(JavaPluginImages.get(JavaPluginImages.IMG_OBJS_CFILE));
item.setControl(createTextComparePage(folder));
fTextCompareTab = item;
@@ -399,7 +407,7 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
fCompareConfiguration.setRightLabel(Utilities.getString("ComparePreferencePage.right.label")); //$NON-NLS-1$
fCompareConfiguration.setRightEditable(false);
- fPreviewViewer= new TextMergeViewer(parent, SWT.BORDER, fCompareConfiguration);
+ TextMergeViewer fPreviewViewer= new TextMergeViewer(parent, SWT.BORDER, fCompareConfiguration);
fPreviewViewer.setInput(
new DiffNode(Differencer.CONFLICTING,
@@ -434,7 +442,7 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
if (removedLinesRegex != null)
removedLinesRegex.setText(fOverlayStore.getString(REMOVED_LINES_REGEX));
- editors.forEach(editor -> editor.load());
+ editors.forEach(FieldEditor::load);
}
// overlay stuff
@@ -466,21 +474,6 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
return checkBox;
}
- private String loadPreviewContentFromFile(String key) {
-
- String preview= Utilities.getString(key);
- String separator= System.getProperty("line.separator"); //$NON-NLS-1$
- StringBuilder buffer= new StringBuilder();
- for (int i= 0; i < preview.length(); i++) {
- char c= preview.charAt(i);
- if (c == '\n')
- buffer.append(separator);
- else
- buffer.append(c);
- }
- return buffer.toString();
- }
-
@Override
public void applyData(Object data) {
if (ComparePreferencePage.CAPPING_DISABLED.equals(data)) {

Back to the top