CPD Results

The following document contains the results of PMD's CPD 4.1.

Duplications

File Line
org/springframework/richclient/util/SeparatorUtils.java 82
org/springframework/richclient/util/SeparatorUtils.java 137
			if (menuComponent instanceof JSeparator) {
				menuComponent.setVisible(true);
			}

			// Separator should be invisible if
			// - previous visible item one is a separator
			// - it is the first one visible item (ie everything invisible
			// before)
			if (menuComponent instanceof JSeparator && everythingInvisibleSoFar) {
				menuComponent.setVisible(false);
			}
			else if (menuComponent instanceof JSeparator && previousVisibleComponent instanceof JSeparator) {
				previousVisibleComponent.setVisible(false);
			}

			if (menuComponent instanceof JSeparator) {
				previousVisibleComponent = menuComponent;
			}
			else if (menuComponent.isVisible()) {
				everythingInvisibleSoFar = false;
				previousVisibleComponent = menuComponent;
			}

			if (menuComponent instanceof JMenu) {
				consolidateSeparators((JMenu) menuComponent);
			}
		}

		// and if the last item on the menu is a separator -> make it invisible.
		if (previousVisibleComponent instanceof JSeparator) {
			previousVisibleComponent.setVisible(false);
		}
	}

	/**
	 * Consolidates separators in a menubar. This essentialy calls
	 * {@link #consolidateSeparators(JMenu)} for each menu in the menubar.
	 * @param menuBar the menu bar (cannot be null)
	 * @see #consolidateSeparators(JMenu)
	 */
	public static void consolidateSeparators(JMenuBar menuBar) {