Skip to content
Snippets Groups Projects
Commit 1c495d61 authored by Nils Christian Ehmke's avatar Nils Christian Ehmke
Browse files

Fixed some PMD, FB and CS issues

parent e80f67c2
No related branches found
No related tags found
No related merge requests found
......@@ -81,7 +81,6 @@
<module name="ArrayTypeStyle"/>
<module name="FinalParameters"/>
<module name="DescendantToken"/>
<module name="TrailingComment"/>
<module name="OuterTypeFilename"/>
<module name="ModifierOrder"/>
......
......@@ -4,5 +4,10 @@
<Class name="org.eclipse.wb.swt.SWTResourceManager" />
<Bug pattern="REC_CATCH_EXCEPTION" />
</Match>
<Match>
<Class name="kieker.diagnosis.subview.util.AbstractTraceTreeColumnSortListener$TraceComparator" />
<Bug pattern="SE_INNER_CLASS" />
</Match>
</FindBugsFilter>
\ No newline at end of file
......@@ -22,6 +22,7 @@
<rule ref="rulesets/java/coupling.xml">
<exclude name="LoosePackageCoupling"/>
<exclude name="LawOfDemeter"/>
<exclude name="ExcessiveImports"/>
</rule>
<rule ref="rulesets/java/design.xml">
<exclude name="ConfusingTernary"/>
......
......@@ -24,7 +24,13 @@ import java.util.prefs.Preferences;
public final class PropertiesModel extends Observable {
private final Logger logger = Logger.getGlobal();
private static final String KEY_TIMEUNIT = "timeunit";
private static final String KEY_OPERATIONS = "operations";
private static final String KEY_COMPONENTS = "components";
private static final String KEY_GRAPHVIZ_GENERATOR = "graphvizgenerator";
private static final String KEY_GRAPHVIZ_PATH = "graphvizpath";
private static final Logger LOGGER = Logger.getGlobal();
private boolean commit = true;
......@@ -41,26 +47,26 @@ public final class PropertiesModel extends Observable {
private void loadSettings() {
final Preferences preferences = Preferences.userNodeForPackage(PropertiesModel.class);
this.graphvizPath = preferences.get("graphvizpath", ".");
this.graphvizGenerator = GraphvizGenerator.valueOf(preferences.get("graphvizgenerator", GraphvizGenerator.DOT.name()));
this.timeunit = TimeUnit.valueOf(preferences.get("timeunit", TimeUnit.NANOSECONDS.name()));
this.componentNames = ComponentNames.valueOf(preferences.get("operations", ComponentNames.LONG.name()));
this.operationNames = OperationNames.valueOf(preferences.get("components", OperationNames.SHORT.name()));
this.graphvizPath = preferences.get(PropertiesModel.KEY_GRAPHVIZ_PATH, ".");
this.graphvizGenerator = GraphvizGenerator.valueOf(preferences.get(PropertiesModel.KEY_GRAPHVIZ_GENERATOR, GraphvizGenerator.DOT.name()));
this.timeunit = TimeUnit.valueOf(preferences.get(PropertiesModel.KEY_TIMEUNIT, TimeUnit.NANOSECONDS.name()));
this.componentNames = ComponentNames.valueOf(preferences.get(PropertiesModel.KEY_COMPONENTS, ComponentNames.LONG.name()));
this.operationNames = OperationNames.valueOf(preferences.get(PropertiesModel.KEY_OPERATIONS, OperationNames.SHORT.name()));
}
private void saveSettings() {
final Preferences preferences = Preferences.userNodeForPackage(PropertiesModel.class);
preferences.put("graphvizpath", this.graphvizPath);
preferences.put("graphvizgenerator", this.graphvizGenerator.name());
preferences.put("timeunit", this.timeunit.name());
preferences.put("operations", this.componentNames.name());
preferences.put("components", this.operationNames.name());
preferences.put(PropertiesModel.KEY_GRAPHVIZ_PATH, this.graphvizPath);
preferences.put(PropertiesModel.KEY_GRAPHVIZ_GENERATOR, this.graphvizGenerator.name());
preferences.put(PropertiesModel.KEY_TIMEUNIT, this.timeunit.name());
preferences.put(PropertiesModel.KEY_COMPONENTS, this.componentNames.name());
preferences.put(PropertiesModel.KEY_OPERATIONS, this.operationNames.name());
try {
preferences.flush();
} catch (final BackingStoreException e) {
this.logger.warning(e.getLocalizedMessage());
PropertiesModel.LOGGER.warning(e.getLocalizedMessage());
}
}
......
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***************************************************************************/
package kieker.diagnosis.dialog;
import java.util.concurrent.TimeUnit;
......@@ -38,9 +54,6 @@ public final class SettingsDialog extends Dialog {
private Combo comboBoxComponentNames;
private Combo comboBoxGraphvizGenerator;
private Button btnOkay;
private Button btnCancel;
public SettingsDialog(final Shell parent, final int style, final PropertiesModel model) {
super(parent, style);
......@@ -225,9 +238,9 @@ public final class SettingsDialog extends Dialog {
this.comboBoxGraphvizGenerator.select(0);
new Label(grpDependencyAndCall, SWT.NONE);
this.btnOkay = new Button(this.shlSettings, SWT.NONE);
fd_grpDependencyAndCall.bottom = new FormAttachment(this.btnOkay, -20);
this.btnOkay.addSelectionListener(new SelectionAdapter() {
final Button btnOkay = new Button(this.shlSettings, SWT.NONE);
fd_grpDependencyAndCall.bottom = new FormAttachment(btnOkay, -20);
btnOkay.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
SettingsDialog.this.result = SWT.OK;
......@@ -240,11 +253,11 @@ public final class SettingsDialog extends Dialog {
final FormData fd_btnOkay = new FormData();
fd_btnOkay.bottom = new FormAttachment(100, -10);
fd_btnOkay.left = new FormAttachment(0, 290);
this.btnOkay.setLayoutData(fd_btnOkay);
this.btnOkay.setText("OK");
btnOkay.setLayoutData(fd_btnOkay);
btnOkay.setText("OK");
this.btnCancel = new Button(this.shlSettings, SWT.NONE);
this.btnCancel.addSelectionListener(new SelectionAdapter() {
final Button btnCancel = new Button(this.shlSettings, SWT.NONE);
btnCancel.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
SettingsDialog.this.result = SWT.CANCEL;
......@@ -253,11 +266,11 @@ public final class SettingsDialog extends Dialog {
});
fd_btnOkay.right = new FormAttachment(100, -80);
final FormData fd_btnCancel = new FormData();
fd_btnCancel.top = new FormAttachment(this.btnOkay, 0, SWT.TOP);
fd_btnCancel.left = new FormAttachment(this.btnOkay, 6);
fd_btnCancel.top = new FormAttachment(btnOkay, 0, SWT.TOP);
fd_btnCancel.left = new FormAttachment(btnOkay, 6);
fd_btnCancel.right = new FormAttachment(100, -10);
this.btnCancel.setLayoutData(fd_btnCancel);
this.btnCancel.setText("Cancel");
btnCancel.setLayoutData(fd_btnCancel);
btnCancel.setText("Cancel");
}
}
......@@ -43,26 +43,24 @@ import org.eclipse.swt.widgets.Display;
*/
public final class Controller implements SelectionListener {
private final Logger logger = Logger.getGlobal();
private static final Logger LOGGER = Logger.getGlobal();
private final View mainView;
private final DataModel dataModel;
private final Model mainViewModel;
private final PropertiesModel propertiesModel;
public Controller() {
// Create the top models
this.dataModel = new DataModel();
this.propertiesModel = new PropertiesModel();
final PropertiesModel propertiesModel = new PropertiesModel();
// Create the sub-controllers
final ISubController subViewController1 = new kieker.diagnosis.subview.aggregatedtraces.Controller(Filter.NONE, this.dataModel, this.propertiesModel);
final ISubController subViewController2 = new kieker.diagnosis.subview.traces.Controller(Type.JUST_FAILED_TRACES, this.dataModel, this.propertiesModel);
final ISubController subViewController3 = new kieker.diagnosis.subview.traces.Controller(Type.NONE, this.dataModel, this.propertiesModel);
final ISubController subViewController4 = new kieker.diagnosis.subview.traces.Controller(Type.JUST_FAILURE_CONTAINING_TRACES, this.dataModel, this.propertiesModel);
final ISubController subViewController5 = new kieker.diagnosis.subview.aggregatedtraces.Controller(Filter.JUST_FAILED_TRACES, this.dataModel, this.propertiesModel);
final ISubController subViewController6 = new kieker.diagnosis.subview.aggregatedtraces.Controller(Filter.JUST_FAILURE_CONTAINING_TRACES, this.dataModel,
this.propertiesModel);
final ISubController subViewController1 = new kieker.diagnosis.subview.aggregatedtraces.Controller(Filter.NONE, this.dataModel, propertiesModel);
final ISubController subViewController2 = new kieker.diagnosis.subview.traces.Controller(Type.JUST_FAILED_TRACES, this.dataModel, propertiesModel);
final ISubController subViewController3 = new kieker.diagnosis.subview.traces.Controller(Type.NONE, this.dataModel, propertiesModel);
final ISubController subViewController4 = new kieker.diagnosis.subview.traces.Controller(Type.JUST_FAILURE_CONTAINING_TRACES, this.dataModel, propertiesModel);
final ISubController subViewController5 = new kieker.diagnosis.subview.aggregatedtraces.Controller(Filter.JUST_FAILED_TRACES, this.dataModel, propertiesModel);
final ISubController subViewController6 = new kieker.diagnosis.subview.aggregatedtraces.Controller(Filter.JUST_FAILURE_CONTAINING_TRACES, this.dataModel, propertiesModel);
// Get the sub-views from the controllers
final Map<String, ISubView> subViews = new HashMap<>();
......@@ -75,7 +73,7 @@ public final class Controller implements SelectionListener {
// Create the main model and the main view
this.mainViewModel = new Model();
this.mainView = new View(this.mainViewModel, this, subViews, this.propertiesModel);
this.mainView = new View(this.mainViewModel, this, subViews, propertiesModel);
}
public void showView() {
......@@ -105,7 +103,7 @@ public final class Controller implements SelectionListener {
try {
preferences.flush();
} catch (final BackingStoreException ex) {
this.logger.warning(ex.getLocalizedMessage());
Controller.LOGGER.warning(ex.getLocalizedMessage());
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment