java/src/jmri/jmrit/display/Editor.java

Summary

Maintainability
F
3 wks
Test Coverage
F
46%

File Editor.java has 2778 lines of code (exceeds 300 allowed). Consider refactoring.
Open

package jmri.jmrit.display;

import java.awt.*;
import java.awt.datatransfer.DataFlavor;
import java.awt.event.*;
Severity: Major
Found in java/src/jmri/jmrit/display/Editor.java - About 1 wk to fix

    Editor has 207 methods (exceeds 20 allowed). Consider refactoring.
    Open

    abstract public class Editor extends JmriJFrame implements JmriMouseListener, JmriMouseMotionListener,
            ActionListener, KeyListener, VetoableChangeListener {
    
        final public static int BKG = 1;
        final public static int TEMP = 2;
    Severity: Major
    Found in java/src/jmri/jmrit/display/Editor.java - About 4 days to fix

      Method setShowAlignmentMenu has 152 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public boolean setShowAlignmentMenu(Positionable p, JPopupMenu popup) {
              if (showAlignPopup(p)) {
                  JMenu edit = new JMenu(Bundle.getMessage("EditAlignment"));
                  edit.add(new AbstractAction(Bundle.getMessage("AlignX")) {
                      int _x;
      Severity: Major
      Found in java/src/jmri/jmrit/display/Editor.java - About 6 hrs to fix

        Method addToPopUpMenu has a Cognitive Complexity of 46 (exceeds 20 allowed). Consider refactoring.
        Open

            public void addToPopUpMenu(NamedBean nb, JMenuItem item, int menu) {
                if (nb == null || item == null) {
                    return;
                }
                for (Positionable pos : _contents) {
        Severity: Minor
        Found in java/src/jmri/jmrit/display/Editor.java - About 4 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method makeAddIconFrame has 102 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected JFrameItem makeAddIconFrame(String name, boolean add, boolean table, IconAdder editor) {
                log.debug("makeAddIconFrame for {}, add= {}, table= {}", name, add, table);
                String txt;
                String BundleName;
                JFrameItem frame = new JFrameItem(name, editor);
        Severity: Major
        Found in java/src/jmri/jmrit/display/Editor.java - About 4 hrs to fix

          Method addToPopUpMenu has 66 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public void addToPopUpMenu(NamedBean nb, JMenuItem item, int menu) {
                  if (nb == null || item == null) {
                      return;
                  }
                  for (Positionable pos : _contents) {
          Severity: Major
          Found in java/src/jmri/jmrit/display/Editor.java - About 2 hrs to fix

            Method getUsageReport has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public List<NamedBeanUsageReport> getUsageReport(NamedBean bean) {
                    List<NamedBeanUsageReport> report = new ArrayList<>();
                    if (bean != null) {
                        getContents().forEach((pos) -> {
                            String data = getUsageData(pos);
            Severity: Major
            Found in java/src/jmri/jmrit/display/Editor.java - About 2 hrs to fix

              Method paint has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      @Override
                      public void paint(Graphics g) {
                          Graphics2D g2d = null;
                          if (g instanceof Graphics2D) {
                              g2d = (Graphics2D) g;
              Severity: Minor
              Found in java/src/jmri/jmrit/display/Editor.java - About 2 hrs to fix

                Method getIconFrame has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public JFrameItem getIconFrame(String name) {
                        JFrameItem frame = _iconEditorFrame.get(name);
                        if (frame == null) {
                            if ("Sensor".equals(name)) {
                                addSensorEditor();
                Severity: Minor
                Found in java/src/jmri/jmrit/display/Editor.java - About 1 hr to fix

                  Method addSlip has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      @SuppressFBWarnings(value="BC_UNCONFIRMED_CAST_OF_RETURN_VALUE", justification="iconEditor requested as exact type")
                      SlipTurnoutIcon addSlip() {
                          SlipTurnoutIcon result = new SlipTurnoutIcon(this);
                          SlipIconAdder editor = (SlipIconAdder) getIconEditor("SlipTOEditor");
                          result.setSingleSlipRoute(editor.getSingleSlipRoute());
                  Severity: Minor
                  Found in java/src/jmri/jmrit/display/Editor.java - About 1 hr to fix

                    Method setLogixNGPositionableMenu has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public void setLogixNGPositionableMenu(Positionable p, JPopupMenu popup) {
                            if (p.getDisplayLevel() == BKG) {
                                return;
                            }
                    
                    
                    Severity: Minor
                    Found in java/src/jmri/jmrit/display/Editor.java - About 1 hr to fix

                      Method setAttributes has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public void setAttributes(PositionablePopupUtil newUtil, Positionable p) {
                              p.setPopupUtility(newUtil.clone(p, p.getTextComponent()));
                              int mar = newUtil.getMargin();
                              int bor = newUtil.getBorderSize();
                              Border outlineBorder;
                      Severity: Minor
                      Found in java/src/jmri/jmrit/display/Editor.java - About 1 hr to fix

                        Method setShowToolTipMenu has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public void setShowToolTipMenu(Positionable p, JPopupMenu popup) {
                                if (p.getDisplayLevel() == BKG) {
                                    return;
                                }
                        
                        
                        Severity: Minor
                        Found in java/src/jmri/jmrit/display/Editor.java - About 1 hr to fix

                          Method getSelectedItems has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected List<Positionable> getSelectedItems(JmriMouseEvent event) {
                                  Rectangle rect = new Rectangle();
                                  ArrayList<Positionable> selections = new ArrayList<>();
                                  for (Positionable p : _contents) {
                                      double x = event.getX();
                          Severity: Minor
                          Found in java/src/jmri/jmrit/display/Editor.java - About 1 hr to fix

                            Method makeAddIconFrame has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
                            Open

                                protected JFrameItem makeAddIconFrame(String name, boolean add, boolean table, IconAdder editor) {
                                    log.debug("makeAddIconFrame for {}, add= {}, table= {}", name, add, table);
                                    String txt;
                                    String BundleName;
                                    JFrameItem frame = new JFrameItem(name, editor);
                            Severity: Minor
                            Found in java/src/jmri/jmrit/display/Editor.java - About 1 hr to fix

                            Cognitive Complexity

                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                            A method's cognitive complexity is based on a few simple rules:

                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                            • Code is considered more complex for each "break in the linear flow of the code"
                            • Code is considered more complex when "flow breaking structures are nested"

                            Further reading

                            Method addMemoryEditor has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                protected void addMemoryEditor() {
                                    IconAdder editor = new IconAdder("Memory") {
                                        final JButton bSpin = new JButton(Bundle.getMessage("AddSpinner"));
                                        final JButton bBox = new JButton(Bundle.getMessage("AddInputBox"));
                                        final JSpinner spinner = new JSpinner(_spinCols);
                            Severity: Minor
                            Found in java/src/jmri/jmrit/display/Editor.java - About 1 hr to fix

                              Method addGlobalVariableEditor has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected void addGlobalVariableEditor() {
                                      IconAdder editor = new IconAdder("GlobalVariable") {
                                          final JButton bSpin = new JButton(Bundle.getMessage("AddSpinner"));
                                          final JButton bBox = new JButton(Bundle.getMessage("AddInputBox"));
                                          final JSpinner spinner = new JSpinner(_spinCols);
                              Severity: Minor
                              Found in java/src/jmri/jmrit/display/Editor.java - About 1 hr to fix

                                Method locoMarkerFromInput has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    protected void locoMarkerFromInput() {
                                        final JmriJFrame locoFrame = new JmriJFrame();
                                        locoFrame.getContentPane().setLayout(new FlowLayout());
                                        locoFrame.setTitle(Bundle.getMessage("EnterLocoMarker"));
                                
                                
                                Severity: Minor
                                Found in java/src/jmri/jmrit/display/Editor.java - About 1 hr to fix

                                  Method changeView has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      protected Editor changeView(String className) {
                                          JFrame frame = getTargetFrame();
                                  
                                          try {
                                              Editor ed = (Editor) Class.forName(className).getDeclaredConstructor().newInstance();
                                  Severity: Minor
                                  Found in java/src/jmri/jmrit/display/Editor.java - About 1 hr to fix

                                    Method vetoableChange has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        @Override
                                        public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException {
                                            NamedBean nb = (NamedBean) evt.getOldValue();
                                            if ("CanDelete".equals(evt.getPropertyName())) { // NOI18N
                                                StringBuilder message = new StringBuilder();
                                    Severity: Minor
                                    Found in java/src/jmri/jmrit/display/Editor.java - About 1 hr to fix

                                      Method keyPressed has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          @Override
                                          public void keyPressed(KeyEvent e) {
                                              if (_selectionGroup == null) {
                                                  return;
                                              }
                                      Severity: Minor
                                      Found in java/src/jmri/jmrit/display/Editor.java - About 1 hr to fix

                                        Method setTargetPanel has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            protected void setTargetPanel(JLayeredPane targetPanel, JmriJFrame frame) {
                                                if (targetPanel == null) {
                                                    _targetPanel = new TargetPane();
                                                } else {
                                                    _targetPanel = targetPanel;
                                        Severity: Minor
                                        Found in java/src/jmri/jmrit/display/Editor.java - About 1 hr to fix

                                          Method paint has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
                                          Open

                                                  @Override
                                                  public void paint(Graphics g) {
                                                      Graphics2D g2d = null;
                                                      if (g instanceof Graphics2D) {
                                                          g2d = (Graphics2D) g;
                                          Severity: Minor
                                          Found in java/src/jmri/jmrit/display/Editor.java - About 1 hr to fix

                                          Cognitive Complexity

                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                          A method's cognitive complexity is based on a few simple rules:

                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                          • Code is considered more complex for each "break in the linear flow of the code"
                                          • Code is considered more complex when "flow breaking structures are nested"

                                          Further reading

                                          Method makeDoneButtonPanel has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                                  protected JPanel makeDoneButtonPanel() {
                                                      JPanel result = new JPanel();
                                                      result.setLayout(new FlowLayout());
                                                      JButton doneButton = new JButton(Bundle.getMessage("ButtonContinue"));
                                                      doneButton.addActionListener(a -> {
                                          Severity: Minor
                                          Found in java/src/jmri/jmrit/display/Editor.java - About 1 hr to fix

                                            Method makeSelectionGroup has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                protected void makeSelectionGroup(JmriMouseEvent event) {
                                                    if (!event.isControlDown() || _selectionGroup == null) {
                                                        _selectionGroup = new ArrayList<>();
                                                    }
                                                    Rectangle test = new Rectangle();
                                            Severity: Minor
                                            Found in java/src/jmri/jmrit/display/Editor.java - About 1 hr to fix

                                              Method getIconFrame has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                                              Open

                                                  public JFrameItem getIconFrame(String name) {
                                                      JFrameItem frame = _iconEditorFrame.get(name);
                                                      if (frame == null) {
                                                          if ("Sensor".equals(name)) {
                                                              addSensorEditor();
                                              Severity: Minor
                                              Found in java/src/jmri/jmrit/display/Editor.java - About 35 mins to fix

                                              Cognitive Complexity

                                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                              A method's cognitive complexity is based on a few simple rules:

                                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                              • Code is considered more complex for each "break in the linear flow of the code"
                                              • Code is considered more complex when "flow breaking structures are nested"

                                              Further reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                  protected void addMemoryEditor() {
                                                      IconAdder editor = new IconAdder("Memory") {
                                                          final JButton bSpin = new JButton(Bundle.getMessage("AddSpinner"));
                                                          final JButton bBox = new JButton(Bundle.getMessage("AddInputBox"));
                                                          final JSpinner spinner = new JSpinner(_spinCols);
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 4 hrs to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 2153..2192

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 293.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                  protected void addGlobalVariableEditor() {
                                                      IconAdder editor = new IconAdder("GlobalVariable") {
                                                          final JButton bSpin = new JButton(Bundle.getMessage("AddSpinner"));
                                                          final JButton bBox = new JButton(Bundle.getMessage("AddInputBox"));
                                                          final JSpinner spinner = new JSpinner(_spinCols);
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 4 hrs to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 2112..2151

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 293.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 4 locations. Consider refactoring.
                                              Open

                                                  protected void addSensorEditor() {
                                                      IconAdder editor = new IconAdder("Sensor");
                                                      editor.setIcon(3, "SensorStateActive",
                                                              "resources/icons/smallschematics/tracksegments/circuit-occupied.gif");
                                                      editor.setIcon(2, "SensorStateInactive",
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 3 other locations - About 2 hrs to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 1971..1990
                                              java/src/jmri/jmrit/display/Editor.java on lines 1992..2011
                                              java/src/jmri/jmrit/display/Editor.java on lines 2216..2235

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 141.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 4 locations. Consider refactoring.
                                              Open

                                                  protected void addLightEditor() {
                                                      IconAdder editor = new IconAdder("Light");
                                                      editor.setIcon(3, "StateOff",
                                                              "resources/icons/smallschematics/lights/cross-on.png");
                                                      editor.setIcon(2, "StateOn",
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 3 other locations - About 2 hrs to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 1971..1990
                                              java/src/jmri/jmrit/display/Editor.java on lines 1992..2011
                                              java/src/jmri/jmrit/display/Editor.java on lines 2038..2057

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 141.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 4 locations. Consider refactoring.
                                              Open

                                                  protected void addRightTOEditor() {
                                                      IconAdder editor = new IconAdder("RightTurnout");
                                                      editor.setIcon(3, "TurnoutStateClosed",
                                                              "resources/icons/smallschematics/tracksegments/os-righthand-west-closed.gif");
                                                      editor.setIcon(2, "TurnoutStateThrown",
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 3 other locations - About 2 hrs to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 1992..2011
                                              java/src/jmri/jmrit/display/Editor.java on lines 2038..2057
                                              java/src/jmri/jmrit/display/Editor.java on lines 2216..2235

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 141.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 4 locations. Consider refactoring.
                                              Open

                                                  protected void addLeftTOEditor() {
                                                      IconAdder editor = new IconAdder("LeftTurnout");
                                                      editor.setIcon(3, "TurnoutStateClosed",
                                                              "resources/icons/smallschematics/tracksegments/os-lefthand-east-closed.gif");
                                                      editor.setIcon(2, "TurnoutStateThrown",
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 3 other locations - About 2 hrs to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 1971..1990
                                              java/src/jmri/jmrit/display/Editor.java on lines 2038..2057
                                              java/src/jmri/jmrit/display/Editor.java on lines 2216..2235

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 141.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                  protected Positionable putLogixNG() {
                                                      IconAdder iconEditor = getIconEditor("LogixNG");
                                                      String url = iconEditor.getIcon("plainIcon").getURL();
                                                      NamedIcon icon = NamedIcon.getIconByName(url);
                                                      if (log.isDebugEnabled()) {
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 2 hrs to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 2657..2676

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 131.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                  protected Positionable putIcon() {
                                                      IconAdder iconEditor = getIconEditor("Icon");
                                                      String url = iconEditor.getIcon("plainIcon").getURL();
                                                      NamedIcon icon = NamedIcon.getIconByName(url);
                                                      if (log.isDebugEnabled()) {
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 2 hrs to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 2713..2732

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 131.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 3 locations. Consider refactoring.
                                              Open

                                                  protected GlobalVariableIcon putGlobalVariable() {
                                                      GlobalVariableIcon result = new GlobalVariableIcon(new NamedIcon("resources/icons/misc/X-red.gif",
                                                              "resources/icons/misc/X-red.gif"), this);
                                                      IconAdder globalVariableIconEditor = getIconEditor("GlobalVariable");
                                                      result.setGlobalVariable(globalVariableIconEditor.getTableSelection().getDisplayName());
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 2 other locations - About 1 hr to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 2486..2501
                                              java/src/jmri/jmrit/display/Editor.java on lines 2584..2599

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 101.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 3 locations. Consider refactoring.
                                              Open

                                                  protected MemoryIcon putMemory() {
                                                      MemoryIcon result = new MemoryIcon(new NamedIcon("resources/icons/misc/X-red.gif",
                                                              "resources/icons/misc/X-red.gif"), this);
                                                      IconAdder memoryIconEditor = getIconEditor("Memory");
                                                      result.setMemory(memoryIconEditor.getTableSelection().getDisplayName());
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 2 other locations - About 1 hr to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 2535..2550
                                              java/src/jmri/jmrit/display/Editor.java on lines 2584..2599

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 101.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 3 locations. Consider refactoring.
                                              Open

                                                  protected BlockContentsIcon putBlockContents() {
                                                      BlockContentsIcon result = new BlockContentsIcon(new NamedIcon("resources/icons/misc/X-red.gif",
                                                              "resources/icons/misc/X-red.gif"), this);
                                                      IconAdder blockIconEditor = getIconEditor("BlockLabel");
                                                      result.setBlock(blockIconEditor.getTableSelection().getDisplayName());
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 2 other locations - About 1 hr to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 2486..2501
                                              java/src/jmri/jmrit/display/Editor.java on lines 2535..2550

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 101.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                  protected MemoryInputIcon addMemoryInputBox() {
                                                      MemoryInputIcon result = new MemoryInputIcon(_spinCols.getNumber().intValue(), this);
                                                      IconAdder memoryIconEditor = getIconEditor("Memory");
                                                      result.setMemory(memoryIconEditor.getTableSelection().getDisplayName());
                                                      result.setSize(result.getPreferredSize().width, result.getPreferredSize().height);
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 1 hr to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 2568..2582

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 101.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                  protected GlobalVariableInputIcon addGlobalVariableInputBox() {
                                                      GlobalVariableInputIcon result = new GlobalVariableInputIcon(_spinCols.getNumber().intValue(), this);
                                                      IconAdder globalVariableIconEditor = getIconEditor("GlobalVariable");
                                                      result.setGlobalVariable(globalVariableIconEditor.getTableSelection().getDisplayName());
                                                      result.setSize(result.getPreferredSize().width, result.getPreferredSize().height);
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 1 hr to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 2519..2533

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 101.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 3 locations. Consider refactoring.
                                              Open

                                                  protected void addIconEditor() {
                                                      IconAdder editor = new IconAdder("Icon");
                                                      editor.setIcon(0, "plainIcon", "resources/icons/smallschematics/tracksegments/block.gif");
                                                      JFrameItem frame = makeAddIconFrame("Icon", true, false, editor);
                                                      _iconEditorFrame.put("Icon", frame);
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 2 other locations - About 1 hr to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 2237..2248
                                              java/src/jmri/jmrit/display/Editor.java on lines 2302..2312

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 95.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 3 locations. Consider refactoring.
                                              Open

                                                  protected void addLogixNGEditor() {
                                                      IconAdder editor = new IconAdder("LogixNG");
                                                      editor.setIcon(0, "plainIcon", "resources/icons/logixng/logixng_icon.gif");
                                                      JFrameItem frame = makeAddIconFrame("LogixNG", true, false, editor);
                                                      _iconEditorFrame.put("LogixNG", frame);
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 2 other locations - About 1 hr to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 2237..2248
                                              java/src/jmri/jmrit/display/Editor.java on lines 2277..2287

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 95.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 3 locations. Consider refactoring.
                                              Open

                                                  protected void addBackgroundEditor() {
                                                      IconAdder editor = new IconAdder("Background");
                                                      editor.setIcon(0, "background", "resources/PanelPro.gif");
                                              
                                                      JFrameItem frame = makeAddIconFrame("Background", true, false, editor);
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 2 other locations - About 1 hr to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 2277..2287
                                              java/src/jmri/jmrit/display/Editor.java on lines 2302..2312

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 95.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                  protected MemorySpinnerIcon addMemorySpinner() {
                                                      MemorySpinnerIcon result = new MemorySpinnerIcon(this);
                                                      IconAdder memoryIconEditor = getIconEditor("Memory");
                                                      result.setMemory(memoryIconEditor.getTableSelection().getDisplayName());
                                                      result.setSize(result.getPreferredSize().width, result.getPreferredSize().height);
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 1 hr to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 2552..2566

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 95.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                  protected GlobalVariableSpinnerIcon addGlobalVariableSpinner() {
                                                      GlobalVariableSpinnerIcon result = new GlobalVariableSpinnerIcon(this);
                                                      IconAdder globalVariableIconEditor = getIconEditor("GlobalVariable");
                                                      result.setGlobalVariable(globalVariableIconEditor.getTableSelection().getDisplayName());
                                                      result.setSize(result.getPreferredSize().width, result.getPreferredSize().height);
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 1 hr to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 2503..2517

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 95.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                  protected void addReporterEditor() {
                                                      IconAdder editor = new IconAdder("Reporter");
                                                      ActionListener addIconAction = a -> addReporter();
                                                      JFrameItem frame = makeAddIconFrame("Reporter", true, true, editor);
                                                      _iconEditorFrame.put("Reporter", frame);
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 1 hr to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 2194..2203

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 93.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                  protected void addBlockContentsEditor() {
                                                      IconAdder editor = new IconAdder("Block Contents");
                                                      ActionListener addIconAction = a -> putBlockContents();
                                                      JFrameItem frame = makeAddIconFrame("BlockLabel", true, true, editor);
                                                      _iconEditorFrame.put("BlockLabel", frame);
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 1 hr to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 2205..2214

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 93.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                  protected int getItemX(Positionable p, int deltaX) {
                                                      if ((p instanceof MemoryOrGVIcon) && (p.getPopupUtility().getFixedWidth() == 0)) {
                                                          MemoryOrGVIcon pm = (MemoryOrGVIcon) p;
                                                          return pm.getOriginalX() + (int) Math.round(deltaX / getPaintScale());
                                                      } else {
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 1 hr to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 3041..3048

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 81.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                  protected int getItemY(Positionable p, int deltaY) {
                                                      if ((p instanceof MemoryOrGVIcon) && (p.getPopupUtility().getFixedWidth() == 0)) {
                                                          MemoryOrGVIcon pm = (MemoryOrGVIcon) p;
                                                          return pm.getOriginalY() + (int) Math.round(deltaY / getPaintScale());
                                                      } else {
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 1 hr to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 3032..3039

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 81.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                      lockItem.addActionListener(new ActionListener() {
                                                          Positionable comp;
                                                          JCheckBoxMenuItem checkBox;
                                              
                                                          @Override
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 1 hr to fix
                                              java/src/jmri/jmrit/display/panelEditor/PanelEditor.java on lines 1247..1262

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 75.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                  private void deleteLogixNG(LogixNG logixNG) {
                                                      DeleteBean<LogixNG> deleteBean = new DeleteBean<>(
                                                              InstanceManager.getDefault(LogixNG_Manager.class));
                                              
                                                      boolean hasChildren = logixNG.getNumConditionalNGs() > 0;
                                              Severity: Minor
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 1 hr to fix
                                              java/src/jmri/jmrit/display/layoutEditor/LayoutTrackView.java on lines 586..595

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 68.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Identical blocks of code found in 3 locations. Consider refactoring.
                                              Open

                                                          if (pos.getNamedBean() == nb && pos.getPopupUtility() != null) {
                                                              switch (menu) {
                                                                  case VIEWPOPUPONLY:
                                                                      pos.getPopupUtility().addViewPopUpMenu(item);
                                                                      break;
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 2 other locations - About 50 mins to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 3107..3120
                                              java/src/jmri/jmrit/display/Editor.java on lines 3079..3092

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 62.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Identical blocks of code found in 3 locations. Consider refactoring.
                                              Open

                                                                  if (match) {
                                                                      switch (menu) {
                                                                          case VIEWPOPUPONLY:
                                                                              pos.getPopupUtility().addViewPopUpMenu(item);
                                                                              break;
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 2 other locations - About 50 mins to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 3079..3092
                                              java/src/jmri/jmrit/display/Editor.java on lines 3062..3075

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 62.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Identical blocks of code found in 3 locations. Consider refactoring.
                                              Open

                                                                          || sti.getTurnout(SlipTurnoutIcon.LOWEREAST) == nb || sti.getTurnout(SlipTurnoutIcon.LOWERWEST) == nb) {
                                                                      switch (menu) {
                                                                          case VIEWPOPUPONLY:
                                                                              pos.getPopupUtility().addViewPopUpMenu(item);
                                                                              break;
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 2 other locations - About 50 mins to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 3107..3120
                                              java/src/jmri/jmrit/display/Editor.java on lines 3062..3075

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 62.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                          hideEmptyItem.addActionListener(new ActionListener() {
                                                              Positionable comp;
                                                              JCheckBoxMenuItem checkBox;
                                              
                                                              @Override
                                              Severity: Minor
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 50 mins to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 1582..1596

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 61.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                      showToolTipItem.addActionListener(new ActionListener() {
                                                          Positionable comp;
                                                          JCheckBoxMenuItem checkBox;
                                              
                                                          @Override
                                              Severity: Minor
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 50 mins to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 1370..1384

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 61.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                  private void deleteLogixNG_Internal(LogixNG logixNG) {
                                                      logixNG.setEnabled(false);
                                                      try {
                                                          InstanceManager.getDefault(LogixNG_Manager.class).deleteBean(logixNG, "DoDelete");
                                                          logixNG.getInlineLogixNG().setLogixNG(null);
                                              Severity: Minor
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 45 mins to fix
                                              java/src/jmri/jmrit/display/layoutEditor/LayoutTrackView.java on lines 597..606

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 56.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                          case SlipTurnoutIcon.THREEWAY:
                                                              result.setLowerWestToUpperEastIcon(editor.getIcon("Upper"));
                                                              result.setUpperWestToLowerEastIcon(editor.getIcon("Middle"));
                                                              result.setLowerWestToLowerEastIcon(editor.getIcon("Lower"));
                                                              result.setSingleSlipRoute(editor.getSingleSlipRoute());
                                              Severity: Minor
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 45 mins to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 2397..2402

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 54.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                          case SlipTurnoutIcon.SINGLESLIP:
                                                              result.setLowerWestToUpperEastIcon(editor.getIcon("LowerWestToUpperEast"));
                                                              result.setUpperWestToLowerEastIcon(editor.getIcon("UpperWestToLowerEast"));
                                                              result.setLowerWestToLowerEastIcon(editor.getIcon("Slip"));
                                                              result.setSingleSlipRoute(editor.getSingleSlipRoute());
                                              Severity: Minor
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 45 mins to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 2403..2408

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 54.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                      } else {
                                                          for (Positionable comp : list) {
                                                              if (_selectRect.contains(comp.getBounds(test))
                                                                      && (event.isControlDown() || comp.getDisplayLevel() > BKG)) {
                                                                  _selectionGroup.add(comp);
                                              Severity: Minor
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 40 mins to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 3216..3224

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 52.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                      if (event.isShiftDown()) {
                                                          for (Positionable comp : list) {
                                                              if (_selectRect.intersects(comp.getBounds(test))
                                                                      && (event.isControlDown() || comp.getDisplayLevel() > BKG)) {
                                                                  _selectionGroup.add(comp);
                                              Severity: Minor
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 40 mins to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 3224..3232

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 52.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                  public void showToolTip(Positionable selection, JmriMouseEvent event) {
                                                      ToolTip tip = selection.getToolTip();
                                                      tip.setLocation(selection.getX() + selection.getWidth() / 2, selection.getY() + selection.getHeight());
                                                      setToolTip(tip);
                                                  }
                                              Severity: Minor
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 40 mins to fix
                                              java/src/jmri/jmrit/display/layoutEditor/LayoutEditor.java on lines 8513..8520

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 51.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 3 locations. Consider refactoring.
                                              Open

                                                  protected void setSelectionsRotation(int k, Positionable p) {
                                                      if (_selectionGroup != null && _selectionGroup.contains(p)) {
                                                          for (Positionable comp : _selectionGroup) {
                                                              comp.rotate(k);
                                                          }
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 2 other locations - About 40 mins to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 3361..3369
                                              java/src/jmri/jmrit/display/Editor.java on lines 3381..3389

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 51.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 3 locations. Consider refactoring.
                                              Open

                                                  protected void setSelectionsDisplayLevel(int k, Positionable p) {
                                                      if (_selectionGroup != null && _selectionGroup.contains(p)) {
                                                          for (Positionable comp : _selectionGroup) {
                                                              comp.setDisplayLevel(k);
                                                          }
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 2 other locations - About 40 mins to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 3361..3369
                                              java/src/jmri/jmrit/display/Editor.java on lines 3371..3379

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 51.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 3 locations. Consider refactoring.
                                              Open

                                                  protected void setSelectionsScale(double s, Positionable p) {
                                                      if (_selectionGroup != null && _selectionGroup.contains(p)) {
                                                          for (Positionable comp : _selectionGroup) {
                                                              comp.setScale(s);
                                                          }
                                              Severity: Major
                                              Found in java/src/jmri/jmrit/display/Editor.java and 2 other locations - About 40 mins to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 3371..3379
                                              java/src/jmri/jmrit/display/Editor.java on lines 3381..3389

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 51.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                          switch (whichOption) {
                                                              case OPTION_POSITION:
                                                                  return _positionable;
                                                              case OPTION_CONTROLS:
                                                                  return _controlLayout;
                                              Severity: Minor
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 40 mins to fix
                                              java/src/jmri/jmrit/beantable/LRouteTableAction.java on lines 1967..1979

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 50.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                  private boolean checkEditConditionalNG() {
                                                      if (_inEditInlineLogixNGMode) {
                                                          // Already editing a LogixNG, ask for completion of that edit
                                                          JmriJOptionPane.showMessageDialog(null,
                                                                  Bundle.getMessage("Error_InlineLogixNGInEditMode"), // NOI18N
                                              Severity: Minor
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 35 mins to fix
                                              java/src/jmri/jmrit/display/layoutEditor/LayoutTrackView.java on lines 525..536

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 47.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                                  if (slip3Scissor.getNamedTurnout(SlipTurnoutIcon.LOWERWEST) != null) {
                                                                      if (bean.equals(slip3Scissor.getTurnout(SlipTurnoutIcon.LOWERWEST))) {
                                                                          report.add(new NamedBeanUsageReport("PositionalIcon", data));
                                                                      }
                                                                  }
                                              Severity: Minor
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 35 mins to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 3618..3622

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 44.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                                  if (slip3Scissor.getNamedTurnout(SlipTurnoutIcon.LOWEREAST) != null) {
                                                                      if (bean.equals(slip3Scissor.getTurnout(SlipTurnoutIcon.LOWEREAST))) {
                                                                          report.add(new NamedBeanUsageReport("PositionalIcon", data));
                                                                      }
                                                                  }
                                              Severity: Minor
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 35 mins to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 3623..3627

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 44.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                      if (bor == 0) {
                                                          outlineBorder = BorderFactory.createEmptyBorder(0, 0, 0, 0);
                                                      } else {
                                                          outlineBorder = new LineBorder(newUtil.getBorderColor(), bor);
                                                      }
                                              Severity: Minor
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 35 mins to fix
                                              java/src/jmri/jmrit/display/palette/TextItemPanel.java on lines 702..707

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 44.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                      if (p instanceof PositionableIcon) {
                                                          NamedBean bean = p.getNamedBean();
                                                          if (bean != null) {
                                                              ((PositionableIcon) p).displayState(bean.getState());
                                                          }
                                              Severity: Minor
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 30 mins to fix
                                              java/src/jmri/jmrit/display/controlPanelEditor/ControlPanelEditor.java on lines 1477..1482

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 42.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 3 locations. Consider refactoring.
                                              Open

                                                      if (newUtil.hasBackground()) {
                                                          borderMargin = new LineBorder(p.getBackground(), mar);
                                                      } else {
                                                          borderMargin = BorderFactory.createEmptyBorder(mar, mar, mar, mar);
                                                      }
                                              Severity: Minor
                                              Found in java/src/jmri/jmrit/display/Editor.java and 2 other locations - About 30 mins to fix
                                              java/src/jmri/jmrit/display/PositionablePropertiesUtil.java on lines 525..529
                                              java/src/jmri/jmrit/display/palette/TextItemPanel.java on lines 697..701

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 42.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                              } else {
                                                                  txt = MessageFormat.format(Bundle.getMessage("IconSelect"), Bundle.getMessage(BundleName),
                                                                          (add ? Bundle.getMessage("ButtonAddIcon") : Bundle.getMessage("ButtonUpdateIcon")));
                                                              }
                                              Severity: Minor
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 30 mins to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 2880..2883

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 42.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                          if (table) {
                                                              txt = MessageFormat.format(Bundle.getMessage("TableSelect"), Bundle.getMessage(BundleName),
                                                                      (add ? Bundle.getMessage("ButtonAddIcon") : Bundle.getMessage("ButtonUpdateIcon")));
                                                          } else {
                                              Severity: Minor
                                              Found in java/src/jmri/jmrit/display/Editor.java and 1 other location - About 30 mins to fix
                                              java/src/jmri/jmrit/display/Editor.java on lines 2887..2890

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 42.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              There are no issues that match your filters.

                                              Category
                                              Status