CPD Results

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

Duplications

File Line
io\github\tonywasher\joceanus\metis\ui\MetisPreferenceSetView.java 791
io\github\tonywasher\joceanus\metis\ui\MetisPreferenceSetView.java 886
FilePreferenceElement(final MetisStringPreference pItem) {
            /* Store parameters */
            theItem = pItem;
            theField = theGuiFactory.fieldFactory().newStringField();
            theField.setEditable(true);

            /* Create the button */
            theButton = theGuiFactory.buttonFactory().newButton();
            theButton.setTextOnly();
            theButton.setText(pItem.getDisplay());

            /* Add to the Grid Pane */
            theGrid.addCell(theButton);
            theGrid.addCell(theField);
            theGrid.setCellColumnSpan(theField, 2);
            theGrid.allowCellGrowth(theField);
            theGrid.newRow();

            /* Create listeners */
            theButton.getEventRegistrar().addEventListener(e -> handleDialog());
            theField.getEventRegistrar().addEventListener(e -> {
                pItem.setValue(theField.getValue());
                notifyChanges();
            });
        }

        @Override
        public void updateField() {
            /* Update the field */
            theField.setValue(theItem.getValue());

            /* Set changed indication */
            theField.setTheAttributeState(TethysUIFieldAttribute.CHANGED, theItem.isChanged());
            theField.adjustField();

            /* Handle hidden state */
            final boolean isEnabled = !theItem.isHidden();
            theField.setEnabled(isEnabled);
            theButton.setEnabled(isEnabled);
        }

        /**
         * Handle Dialog.
         */
        private void handleDialog() {
            ensureSelector();
            theSelector.setInitialFile(new File(theItem.getValue()));
File Line
io\github\tonywasher\joceanus\metis\help\MetisHelpWindow.java 153
io\github\tonywasher\joceanus\metis\viewer\MetisViewerWindow.java 359
theDialog.setTitle(MetisHelpResource.TITLE.getValue());

            /* Create the help panel */
            final TethysUIBorderPaneManager myPanel = theFactory.paneFactory().newBorderPane();
            myPanel.setCentre(theSplitTree);
            myPanel.setPreferredWidth(WINDOW_WIDTH);
            myPanel.setPreferredHeight(WINDOW_HEIGHT);
            theDialog.setContent(myPanel);

            /* Set listener */
            theDialog.getEventRegistrar().addEventListener(TethysUIEvent.WINDOWCLOSED, e -> {
                theTree.setVisible(false);
                fireEvent(TethysUIEvent.WINDOWCLOSED, null);
            });
        }

        /* If the dialog is not showing */
        if (!theDialog.isShowing()) {
            /* Make sure that the dialog is showing */
            theTree.setVisible(true);
            theDialog.showDialog();
        }
    }

    /**
     * Hide the dialog.
     */
    public void hideDialog() {
        /* If the dialog exists */
        if (theDialog != null
                && theDialog.isShowing()) {
            /* Make sure that the dialog is hidden */
            theDialog.hideDialog();