Projects >> Weasis >>2974d94623f29884ff6e5f213555a271737557b4

Chunk
Conflicting content
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.TransferHandler;
<<<<<<< HEAD
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuListener;
=======
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuListener;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
>>>>>>> 652369a19ce9d32b8582c00547f72e9ff51e42d4

import org.noos.xing.mydoggy.Content;
import org.noos.xing.mydoggy.ContentManager;
Solution content
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.TransferHandler;
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuListener;

import org.noos.xing.mydoggy.Content;
import org.noos.xing.mydoggy.ContentManager;
File
WeasisWin.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
    private void buildMenuDisplay() {
        menuDisplay.removeAll();
<<<<<<< HEAD
=======
        final JMenu toolBarMenu = new JMenu("Toolbars");
        JPopupMenu menuImport = toolBarMenu.getPopupMenu();
        // #WEA-6 - workaround, PopupMenuListener doesn't work on Mac in the top bar with native look and feel
        if (AbstractProperties.isMacNativeLookAndFeel()) {
            toolBarMenu.addChangeListener(new ChangeListener() {
                @Override
                public void stateChanged(ChangeEvent e) {
                    if (toolBarMenu.isSelected()) {
                        buildToolBarSubMenu(toolBarMenu);
                    } else {
                        toolBarMenu.removeAll();
                    }
                }
            });
        } else {
            menuImport.addPopupMenuListener(new PopupMenuListener() {
>>>>>>> 652369a19ce9d32b8582c00547f72e9ff51e42d4

        DynamicMenu toolBarMenu = new DynamicMenu(Messages.getString("WeasisWin.toolbar")) {//$NON-NLS-1$
Solution content
    private void buildMenuDisplay() {
        menuDisplay.removeAll();

        DynamicMenu toolBarMenu = new DynamicMenu(Messages.getString("WeasisWin.toolbar")) {//$NON-NLS-1$
File
WeasisWin.java
Developer's decision
Version 1
Kind of conflict
Comment
If statement
Method invocation
Variable
Chunk
Conflicting content
    @Override
    public RenderedImage getRenderedImage(RenderedImage imageSource, ImageOperation imageOperation) {
        ImageElement imageElement = (imageOperation != null) ? imageOperation.getImage() : null;
<<<<<<< HEAD
=======

>>>>>>> 652369a19ce9d32b8582c00547f72e9ff51e42d4
        result = imageSource;

        if (imageElement == null || imageSource == null) {
Solution content
    @Override
    public RenderedImage getRenderedImage(RenderedImage imageSource, ImageOperation imageOperation) {
        ImageElement imageElement = (imageOperation != null) ? imageOperation.getImage() : null;
        result = imageSource;

        if (imageElement == null || imageSource == null) {
File
WindowLevelOperation.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
    }

    public static String formatDate(Date date) {
<<<<<<< HEAD
        if (date != null) {
            return DATE_FORMATTER.format(date);
        }
=======
        if (date != null)
            return formatDate.format(date);
>>>>>>> 652369a19ce9d32b8582c00547f72e9ff51e42d4
        return ""; //$NON-NLS-1$
    }
Solution content
    }

    public static String formatDate(Date date) {
        if (date != null) {
            return DATE_FORMATTER.format(date);
        }
        return ""; //$NON-NLS-1$
    }
File
TagW.java
Developer's decision
Version 1
Kind of conflict
If statement
Chunk
Conflicting content
    @Override
    public float getMaxValue() {
        return Math.max(pixel2rescale(minPixelValue), pixel2rescale(maxPixelValue)); // because slope can be inverted
<<<<<<< HEAD
=======
        // return pixel2rescale(maxValue);
>>>>>>> 652369a19ce9d32b8582c00547f72e9ff51e42d4
    }

    // cannot be used like this since modality LUT may be not linear
Solution content
    @Override
    public float getMaxValue() {
        return Math.max(pixel2rescale(minPixelValue), pixel2rescale(maxPixelValue)); // because slope can be inverted
    }

    // cannot be used like this since modality LUT may be not linear
File
DicomImageElement.java
Developer's decision
Version 1
Kind of conflict
Comment
Chunk
Conflicting content
        if (modalityLookup != null) {
            // In the case where the Modality LUT Sequence is used, the output range is from 0 to 2n-1 where n
            // is the third value of LUT Descriptor. This range is always unsigned.
<<<<<<< HEAD
=======

>>>>>>> 652369a19ce9d32b8582c00547f72e9ff51e42d4
            // String lutType = (String) getTagValue(TagW.ModalityLUTType);
            // String explanation = (String) getTagValue(TagW.ModalityLUTExplanation);
Solution content
        if (modalityLookup != null) {
            // In the case where the Modality LUT Sequence is used, the output range is from 0 to 2n-1 where n
            // is the third value of LUT Descriptor. This range is always unsigned.
            // String lutType = (String) getTagValue(TagW.ModalityLUTType);
            // String explanation = (String) getTagValue(TagW.ModalityLUTExplanation);
File
DicomImageElement.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
        // return pixelValue;

        LookupTableJAI lookup = getModalityLookup();
<<<<<<< HEAD

=======
>>>>>>> 652369a19ce9d32b8582c00547f72e9ff51e42d4
        // assert pixel value is inside bound array
        if (lookup != null) {
            int minValue = lookup.getOffset();
Solution content
        // return pixelValue;

        LookupTableJAI lookup = getModalityLookup();

        // assert pixel value is inside bound array
        if (lookup != null) {
            int minValue = lookup.getOffset();
File
DicomImageElement.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
import org.dcm4che2.imageioimpl.plugins.rle.RLEImageReaderSpi;
import org.dcm4che2.io.DicomInputStream;
import org.dcm4che2.io.DicomOutputStream;
<<<<<<< HEAD
=======
import org.dcm4che2.util.ByteUtils;
>>>>>>> 652369a19ce9d32b8582c00547f72e9ff51e42d4
import org.dcm4che2.util.TagUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Solution content
import org.dcm4che2.imageioimpl.plugins.rle.RLEImageReaderSpi;
import org.dcm4che2.io.DicomInputStream;
import org.dcm4che2.io.DicomOutputStream;
import org.dcm4che2.util.TagUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
File
DicomMediaIO.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
        return sb.toString();
    }

<<<<<<< HEAD
    public static String[] getStringArrayFromDicomElement(DicomObject dicom, int tag, String[] defaultValue) {
=======
    private static String[] getStringArrayFromDicomElement(DicomObject dicom, int tag, String[] defaultValue) {
>>>>>>> 652369a19ce9d32b8582c00547f72e9ff51e42d4
        DicomElement element = dicom.get(tag);
        if (element == null || element.isEmpty()) {
            return defaultValue;
Solution content
        return sb.toString();
    }

    public static String[] getStringArrayFromDicomElement(DicomObject dicom, int tag, String[] defaultValue) {
        DicomElement element = dicom.get(tag);
        if (element == null || element.isEmpty()) {
            return defaultValue;
File
DicomMediaIO.java
Developer's decision
Version 1
Kind of conflict
Method signature
Chunk
Conflicting content
=======
 ******************************************************************************/
package org.weasis.dicom.explorer;

<<<<<<< HEAD
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.FlowLayout;
>>>>>>> 652369a19ce9d32b8582c00547f72e9ff51e42d4
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
Solution content
 ******************************************************************************/
package org.weasis.dicom.explorer;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
File
DicomDirImport.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
import javax.swing.JTextField;
import java.awt.event.ActionListener;
import java.io.File;
import java.net.URI;
<<<<<<< HEAD
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JProgressBar;
import javax.swing.border.TitledBorder;
import javax.swing.filechooser.FileFilter;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.weasis.core.api.gui.util.AbstractItemDialogPage;
import org.weasis.core.api.gui.util.AbstractProperties;
import org.weasis.core.api.gui.util.JMVUtils;
import org.weasis.dicom.explorer.internal.Activator;
import org.weasis.dicom.explorer.wado.LoadSeries;
=======
import java.util.Properties;

import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
import javax.swing.JProgressBar;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.weasis.core.api.gui.util.AbstractItemDialogPage;
import org.weasis.core.api.util.FileUtil;
import org.weasis.dicom.explorer.internal.Activator;
>>>>>>> 652369a19ce9d32b8582c00547f72e9ff51e42d4

public class DicomDirImport extends AbstractItemDialogPage implements ImportDicom {
    private static final Logger LOGGER = LoggerFactory.getLogger(DicomDirImport.class);
Solution content
import java.awt.event.ActionListener;
import java.io.File;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JProgressBar;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
import javax.swing.filechooser.FileFilter;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.weasis.core.api.gui.util.AbstractItemDialogPage;
import org.weasis.core.api.gui.util.AbstractProperties;
import org.weasis.core.api.gui.util.JMVUtils;
import org.weasis.dicom.explorer.internal.Activator;
import org.weasis.dicom.explorer.wado.LoadSeries;

public class DicomDirImport extends AbstractItemDialogPage implements ImportDicom {
    private static final Logger LOGGER = LoggerFactory.getLogger(DicomDirImport.class);
File
DicomDirImport.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
public class DicomDirImport extends AbstractItemDialogPage implements ImportDicom {
    private static final Logger LOGGER = LoggerFactory.getLogger(DicomDirImport.class);

<<<<<<< HEAD
    private static final String lastDICOMDIR = "lastDicomDir";//$NON-NLS-1$

    private JCheckBox chckbxCache;
    private JLabel lblImportAFolder;
    private JTextField textField;
    private JButton btnSearch;
    private JButton btncdrom;

    public DicomDirImport() {
        setTitle("DICOMDIR (CD)");
=======
    private static final String lastDirKey = "lastOpenDir";//$NON-NLS-1$

    private JCheckBox chckbxSearch;
    private JTextField textField;
    private File files;
    private final Properties props;
    private JCheckBox chckbxNewCheckBox;
    private JButton btnOpen;

    public DicomDirImport() {
        setTitle(Messages.getString("LocalImport.local_dev")); //$NON-NLS-1$
        props = new Properties();
        FileUtil.readProperties(new File(Activator.PREFERENCES.getDataFolder(), "local-import.properties"), props);//$NON-NLS-1$
>>>>>>> 652369a19ce9d32b8582c00547f72e9ff51e42d4
        initGUI();
        initialize(true);
    }
Solution content
public class DicomDirImport extends AbstractItemDialogPage implements ImportDicom {
    private static final Logger LOGGER = LoggerFactory.getLogger(DicomDirImport.class);

    private static final String lastDICOMDIR = "lastDicomDir";//$NON-NLS-1$

    private JCheckBox chckbxCache;
    private JLabel lblImportAFolder;
    private JTextField textField;
    private JButton btnSearch;
    private JButton btncdrom;

    public DicomDirImport() {
        setTitle("DICOMDIR (CD)");
        initGUI();
        initialize(true);
    }
File
DicomDirImport.java
Developer's decision
Version 1
Kind of conflict
Attribute
Comment
Method invocation
Method signature
Chunk
Conflicting content
            }
        add(btnOpen);

    }

    public void initGUI() {
<<<<<<< HEAD
        GridBagLayout gridBagLayout = new GridBagLayout();
        setLayout(gridBagLayout);
        setBorder(new TitledBorder(null, "DICOMDIR", TitledBorder.LEADING, TitledBorder.TOP, null, null));

        lblImportAFolder = new JLabel("Path:");
        GridBagConstraints gbc_lblImportAFolder = new GridBagConstraints();
        gbc_lblImportAFolder.anchor = GridBagConstraints.WEST;
        gbc_lblImportAFolder.insets = new Insets(5, 5, 5, 5);
        gbc_lblImportAFolder.gridx = 0;
        gbc_lblImportAFolder.gridy = 0;
        add(lblImportAFolder, gbc_lblImportAFolder);

        textField = new JTextField();
        GridBagConstraints gbc_textField = new GridBagConstraints();
        gbc_textField.anchor = GridBagConstraints.WEST;
        gbc_textField.insets = new Insets(5, 2, 5, 5);
        gbc_textField.fill = GridBagConstraints.HORIZONTAL;
        gbc_textField.gridx = 1;
        gbc_textField.gridy = 0;
        JMVUtils.setPreferredWidth(textField, 375, 325);
        textField.setText(Activator.IMPORT_EXPORT_PERSISTENCE.getProperty(lastDICOMDIR, ""));//$NON-NLS-1$
        add(textField, gbc_textField);

        btnSearch = new JButton(" ... "); //$NON-NLS-1$
        btnSearch.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                browseImgFile();
        });
        GridBagConstraints gbc_button = new GridBagConstraints();
        gbc_button.anchor = GridBagConstraints.WEST;
        gbc_button.insets = new Insets(5, 5, 5, 0);
        gbc_button.gridx = 2;
        gbc_button.gridy = 0;
        add(btnSearch, gbc_button);

        btncdrom = new JButton("Detect CD-ROM", new ImageIcon(DicomDirImport.class.getResource("/icon/16x16/cd.png"))); //$NON-NLS-1$
        btncdrom.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                File dcmdir = getDcmDirFromMedia();
                if (dcmdir != null) {
                    String path = dcmdir.getPath();
                    textField.setText(path);
                    Activator.IMPORT_EXPORT_PERSISTENCE.setProperty(lastDICOMDIR, path);
                    // By default, copy images in cache for cdrom
                    chckbxCache.setSelected(true);
                }
            }
        });
        GridBagConstraints gbc_btnNewButton = new GridBagConstraints();
        gbc_btnNewButton.gridwidth = 2;
        gbc_btnNewButton.anchor = GridBagConstraints.WEST;
        gbc_btnNewButton.insets = new Insets(5, 5, 5, 5);
        gbc_btnNewButton.gridx = 0;
        gbc_btnNewButton.gridy = 1;
        add(btncdrom, gbc_btnNewButton);

        chckbxCache = new JCheckBox("Copy images in cache temporarily"); //$NON-NLS-1$
        GridBagConstraints gbc_chckbxSearch = new GridBagConstraints();
        gbc_chckbxSearch.gridwidth = 3;
        gbc_chckbxSearch.insets = new Insets(5, 5, 5, 0);
        gbc_chckbxSearch.anchor = GridBagConstraints.NORTHWEST;
        gbc_chckbxSearch.gridx = 0;
        gbc_chckbxSearch.gridy = 2;
        add(chckbxCache, gbc_chckbxSearch);

        final JLabel label = new JLabel();
        final GridBagConstraints gridBagConstraints_4 = new GridBagConstraints();
        gridBagConstraints_4.weighty = 1.0;
        gridBagConstraints_4.weightx = 1.0;
        gridBagConstraints_4.gridy = 5;
        gridBagConstraints_4.gridx = 2;
        add(label, gridBagConstraints_4);

    }

    protected void initialize(boolean afirst) {
        if (afirst) {

        }
    }

    public void browseImgFile() {
        String directory = getImportPath();
        if (directory == null) {
            directory = Activator.IMPORT_EXPORT_PERSISTENCE.getProperty(lastDICOMDIR, "");//$NON-NLS-1$
        }
        JFileChooser fileChooser = new JFileChooser(directory);
        fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
        fileChooser.setMultiSelectionEnabled(false);
        fileChooser.setFileFilter(new FileFilter() {

            @Override
            public String getDescription() {
                return "DICOMDIR";
            }

            @Override
            public boolean accept(File f) {
                if (f.isDirectory()) {
                    return true;
                }
                if (f.getName().equalsIgnoreCase("dicomdir") || f.getName().equalsIgnoreCase("dicomdir.")) {
                    return true;
                }
                return false;
            }
        });
        File selectedFile = null;
        if (fileChooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION
            || (selectedFile = fileChooser.getSelectedFile()) == null) {
            return;
        } else {
            String path = selectedFile.getPath();
            textField.setText(path);
            Activator.IMPORT_EXPORT_PERSISTENCE.setProperty(lastDICOMDIR, path);
        }
    }

    public void resetSettingsToDefault() {
        initialize(false);
    }

    public void applyChange() {

    }

    protected void updateChanges() {
    }

    @Override
    public void closeAdditionalWindow() {
        applyChange();

    }

    @Override
    public void resetoDefaultValues() {
    }

    private String getImportPath() {
        String path = textField.getText().trim();
        if (path != null && !path.trim().equals("")) { //$NON-NLS-1$ 
            return path;
        }
        return null;
    }

    @Override
    public void importDICOM(DicomModel dicomModel, JProgressBar info) {
        File file = null;
        String path = getImportPath();
        if (path != null) {
            File f = new File(path);
            if (f.canRead()) {
                file = f;
            } else {
                try {
                    f = new File(new URI(path));
                    if (f.canRead()) {
                        file = f;
                    }
                } catch (Exception e) {
                    LOGGER.error("Cannot read {}", path); //$NON-NLS-1$
                }
            }
        }
        loadDicomDir(file, dicomModel);
    }

    public static void loadDicomDir(File file, DicomModel dicomModel) {
        if (file != null) {
            ArrayList loadSeries = null;
            if (file.canRead()) {
                DicomDirLoader dirImport = new DicomDirLoader(file, dicomModel);
                loadSeries = dirImport.readDicomDir();
            }
            if (loadSeries != null && loadSeries.size() > 0) {
                DicomModel.loadingExecutor.execute(new LoadDicomDir(loadSeries, dicomModel));
            } else {
                LOGGER.error("Cannot import DICOM from {}", file);
            }
        }
    }

    public static File getDcmDirFromMedia() {
        String os = AbstractProperties.OPERATING_SYSTEM;
        File[] drives = null;
        if (os.startsWith("win")) {
            drives = File.listRoots();
        } else if (os.startsWith("mac")) {
            drives = new File("/Volumes").listFiles();
        } else {
            drives = new File("/media").listFiles();
=======
        FlowLayout flowLayout = (FlowLayout) getLayout();
        flowLayout.setAlignment(FlowLayout.LEFT);
        setBorder(new TitledBorder(null, "DICOMDIR", TitledBorder.LEADING, TitledBorder.TOP, null, null));

        btnOpen = new JButton("Open");
        btnOpen.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
            }
        });
        chckbxNewCheckBox = new JCheckBox("Store in temporary cache");
        add(chckbxNewCheckBox);

    }

    protected void initialize(boolean afirst) {
        if (afirst) {

        }
    }

    public void browseImgFile() {
        String directory = getImportPath();
        if (directory == null) {
            directory = props.getProperty(lastDirKey, "");//$NON-NLS-1$
        }
        JFileChooser fileChooser = new JFileChooser(directory);
        fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
        fileChooser.setMultiSelectionEnabled(true);
        // FileFormatFilter.setImageDecodeFilters(fileChooser);
        File[] selectedFiles = null;
        if (fileChooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION
            || (selectedFiles = fileChooser.getSelectedFiles()) == null || selectedFiles.length == 0) {
            return;
        } else {
            // files = selectedFiles;
            // String lastDir = null;
            // if (files.length == 1) {
            // lastDir = files[0].getPath();
            // textField.setText(lastDir);
            // } else {
            // lastDir = files[0].getParent();
            //                textField.setText(Messages.getString("LocalImport.multi_dir")); //$NON-NLS-1$
            // }
            // if (lastDir != null) {
            // props.setProperty(lastDirKey, lastDir);
            // }
        }
    }

    public void resetSettingsToDefault() {
        initialize(false);
    }

    public void applyChange() {
        FileUtil.storeProperties(
            new File(Activator.PREFERENCES.getDataFolder(), "local-import.properties"), props, null);//$NON-NLS-1$
    }

    protected void updateChanges() {
    }

    @Override
    public void closeAdditionalWindow() {
        applyChange();

    }

    @Override
    public void resetoDefaultValues() {
    }

    private String getImportPath() {
        String path = textField.getText().trim();
        if (path != null && !path.equals("") && !path.equals(Messages.getString("LocalImport.multi_dir"))) { //$NON-NLS-1$ //$NON-NLS-2$
            return path;
>>>>>>> 652369a19ce9d32b8582c00547f72e9ff51e42d4
        }
        List dvs = Arrays.asList(drives);
        Collections.reverse(dvs);
Solution content
    }

    public void initGUI() {
        GridBagLayout gridBagLayout = new GridBagLayout();
        setLayout(gridBagLayout);
        setBorder(new TitledBorder(null, "DICOMDIR", TitledBorder.LEADING, TitledBorder.TOP, null, null));

        lblImportAFolder = new JLabel("Path:");
        GridBagConstraints gbc_lblImportAFolder = new GridBagConstraints();
        gbc_lblImportAFolder.anchor = GridBagConstraints.WEST;
        gbc_lblImportAFolder.insets = new Insets(5, 5, 5, 5);
        gbc_lblImportAFolder.gridx = 0;
        gbc_lblImportAFolder.gridy = 0;
        add(lblImportAFolder, gbc_lblImportAFolder);

        textField = new JTextField();
        GridBagConstraints gbc_textField = new GridBagConstraints();
        gbc_textField.anchor = GridBagConstraints.WEST;
        gbc_textField.insets = new Insets(5, 2, 5, 5);
        gbc_textField.fill = GridBagConstraints.HORIZONTAL;
        gbc_textField.gridx = 1;
        gbc_textField.gridy = 0;
        JMVUtils.setPreferredWidth(textField, 375, 325);
        textField.setText(Activator.IMPORT_EXPORT_PERSISTENCE.getProperty(lastDICOMDIR, ""));//$NON-NLS-1$
        add(textField, gbc_textField);

        btnSearch = new JButton(" ... "); //$NON-NLS-1$
        btnSearch.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                browseImgFile();
            }
        });
        GridBagConstraints gbc_button = new GridBagConstraints();
        gbc_button.anchor = GridBagConstraints.WEST;
        gbc_button.insets = new Insets(5, 5, 5, 0);
        gbc_button.gridx = 2;
        gbc_button.gridy = 0;
        add(btnSearch, gbc_button);

        btncdrom = new JButton("Detect CD-ROM", new ImageIcon(DicomDirImport.class.getResource("/icon/16x16/cd.png"))); //$NON-NLS-1$
        btncdrom.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                File dcmdir = getDcmDirFromMedia();
                if (dcmdir != null) {
                    String path = dcmdir.getPath();
                    textField.setText(path);
                    Activator.IMPORT_EXPORT_PERSISTENCE.setProperty(lastDICOMDIR, path);
                    // By default, copy images in cache for cdrom
                    chckbxCache.setSelected(true);
                }
            }
        });
        GridBagConstraints gbc_btnNewButton = new GridBagConstraints();
        gbc_btnNewButton.gridwidth = 2;
        gbc_btnNewButton.anchor = GridBagConstraints.WEST;
        gbc_btnNewButton.insets = new Insets(5, 5, 5, 5);
        gbc_btnNewButton.gridx = 0;
        gbc_btnNewButton.gridy = 1;
        add(btncdrom, gbc_btnNewButton);

        chckbxCache = new JCheckBox("Copy images in cache temporarily"); //$NON-NLS-1$
        GridBagConstraints gbc_chckbxSearch = new GridBagConstraints();
        gbc_chckbxSearch.gridwidth = 3;
        gbc_chckbxSearch.insets = new Insets(5, 5, 5, 0);
        gbc_chckbxSearch.anchor = GridBagConstraints.NORTHWEST;
        gbc_chckbxSearch.gridx = 0;
        gbc_chckbxSearch.gridy = 2;
        add(chckbxCache, gbc_chckbxSearch);

        final JLabel label = new JLabel();
        final GridBagConstraints gridBagConstraints_4 = new GridBagConstraints();
        gridBagConstraints_4.weighty = 1.0;
        gridBagConstraints_4.weightx = 1.0;
        gridBagConstraints_4.gridy = 5;
        gridBagConstraints_4.gridx = 2;
        add(label, gridBagConstraints_4);

    }
    protected void initialize(boolean afirst) {
        if (afirst) {

        }
    }

    public void browseImgFile() {
        String directory = getImportPath();
        if (directory == null) {
            directory = Activator.IMPORT_EXPORT_PERSISTENCE.getProperty(lastDICOMDIR, "");//$NON-NLS-1$
        }
        JFileChooser fileChooser = new JFileChooser(directory);
        fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
        fileChooser.setMultiSelectionEnabled(false);
        fileChooser.setFileFilter(new FileFilter() {

            @Override
            public String getDescription() {
                return "DICOMDIR";
            }

            @Override
            public boolean accept(File f) {
                if (f.isDirectory()) {
                    return true;
                }
                if (f.getName().equalsIgnoreCase("dicomdir") || f.getName().equalsIgnoreCase("dicomdir.")) {
                    return true;
                }
                return false;
            }
        });
        File selectedFile = null;
        if (fileChooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION
            || (selectedFile = fileChooser.getSelectedFile()) == null) {
            return;
        } else {
            String path = selectedFile.getPath();
            textField.setText(path);
            Activator.IMPORT_EXPORT_PERSISTENCE.setProperty(lastDICOMDIR, path);
        }
    }

    public void resetSettingsToDefault() {
        initialize(false);
    }

    public void applyChange() {

    }

    protected void updateChanges() {
    }

    @Override
    public void closeAdditionalWindow() {
        applyChange();

    }

    @Override
    public void resetoDefaultValues() {
    }

    private String getImportPath() {
        String path = textField.getText().trim();
        if (path != null && !path.trim().equals("")) { //$NON-NLS-1$ 
            return path;
        }
        return null;
    }

    @Override
    public void importDICOM(DicomModel dicomModel, JProgressBar info) {
        File file = null;
        String path = getImportPath();
        if (path != null) {
            File f = new File(path);
            if (f.canRead()) {
                file = f;
            } else {
                try {
                    f = new File(new URI(path));
                    if (f.canRead()) {
                        file = f;
                    }
                } catch (Exception e) {
                    LOGGER.error("Cannot read {}", path); //$NON-NLS-1$
                }
            }
        }
        loadDicomDir(file, dicomModel);
    }

    public static void loadDicomDir(File file, DicomModel dicomModel) {
        if (file != null) {
            ArrayList loadSeries = null;
            if (file.canRead()) {
                DicomDirLoader dirImport = new DicomDirLoader(file, dicomModel);
                loadSeries = dirImport.readDicomDir();
            }
            if (loadSeries != null && loadSeries.size() > 0) {
                DicomModel.loadingExecutor.execute(new LoadDicomDir(loadSeries, dicomModel));
            } else {
                LOGGER.error("Cannot import DICOM from {}", file);
            }
        }
    }

    public static File getDcmDirFromMedia() {
        String os = AbstractProperties.OPERATING_SYSTEM;
        File[] drives = null;
        if (os.startsWith("win")) {
            drives = File.listRoots();
        } else if (os.startsWith("mac")) {
            drives = new File("/Volumes").listFiles();
        } else {
            drives = new File("/media").listFiles();
        }
        List dvs = Arrays.asList(drives);
        Collections.reverse(dvs);
File
DicomDirImport.java
Developer's decision
Version 1
Kind of conflict
Annotation
Attribute
Cast expression
Comment
If statement
Method declaration
Method invocation
Method signature
Return statement
Variable
Chunk
Conflicting content
                        }
        Collections.reverse(dvs);
        String[] dicomdir = { "DICOMDIR", "dicomdir", "DICOMDIR.", "dicomdir." };

<<<<<<< HEAD
        for (File drive : dvs) {
            // Detect read-only media
            if (drive.canRead() && !drive.canWrite() && !drive.isHidden()) {
                for (int j = 0; j < dicomdir.length; j++) {
                    File f = new File(drive, dicomdir[j]);
                    if (f.canRead()) {
                        return f;
                    }
                }
            }
        }
        return null;
=======
    @Override
    public void importDICOM(DicomModel dicomModel, JProgressBar info) {
        if (files == null) {
            String path = getImportPath();
            if (path != null) {
                File file = new File(path);
                if (file.canRead()) {
                    // files = new File[] { file };
                } else {
                    try {
                        file = new File(new URI(path));
                        if (file.canRead()) {
                            // files = new File[] { file };
                    } catch (Exception e) {
                        LOGGER.error("Cannot import DICOM from {}", path); //$NON-NLS-1$
                    }
                }
            }
        }
        if (files != null) {
            // LoadLocalDicom dicom = new LoadLocalDicom(files, chckbxSearch.isSelected(), dicomModel);
            // DicomModel.loadingExecutor.execute(dicom);
        }
>>>>>>> 652369a19ce9d32b8582c00547f72e9ff51e42d4
    }
}
Solution content
        Collections.reverse(dvs);
        String[] dicomdir = { "DICOMDIR", "dicomdir", "DICOMDIR.", "dicomdir." };

        for (File drive : dvs) {
            // Detect read-only media
            if (drive.canRead() && !drive.canWrite() && !drive.isHidden()) {
                for (int j = 0; j < dicomdir.length; j++) {
                    File f = new File(drive, dicomdir[j]);
                    if (f.canRead()) {
                        return f;
                    }
                }
            }
        }
        return null;
    }
}
File
DicomDirImport.java
Developer's decision
Version 1
Kind of conflict
Annotation
For statement
If statement
Method signature
Return statement
Chunk
Conflicting content
    public void browseImgFile() {
        String directory = getImportPath();
        if (directory == null) {
<<<<<<< HEAD
            directory = Activator.IMPORT_EXPORT_PERSISTENCE.getProperty(lastDirKey, "");//$NON-NLS-1$
=======
            directory = props.getProperty(lastDirKey, "");//$NON-NLS-1$
>>>>>>> 652369a19ce9d32b8582c00547f72e9ff51e42d4
        }
        JFileChooser fileChooser = new JFileChooser(directory);
        fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
Solution content
    public void browseImgFile() {
        String directory = getImportPath();
        if (directory == null) {
            directory = Activator.IMPORT_EXPORT_PERSISTENCE.getProperty(lastDirKey, "");//$NON-NLS-1$
        }
        JFileChooser fileChooser = new JFileChooser(directory);
        fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
File
LocalImport.java
Developer's decision
Version 1
Kind of conflict
Comment
Method invocation
Variable
Chunk
Conflicting content
                    windowAction.setValueWithoutTriggerAction(preset.getWindow().intValue());
                    levelAction.setValueWithoutTriggerAction(preset.getLevel().intValue());
                    lutShapeAction.setSelectedItemWithoutTriggerAction(preset.getLutShape());
<<<<<<< HEAD

                    // windowAction.getModel().removeChangeListener(this);
                    // levelAction.getModel().removeChangeListener(this);
                    // lutShapeAction.getModel().removeListDataListener(this);

                    // DicomImageElement img = null;
                    // if (selectedView2dContainer != null) {
                    // img = selectedView2dContainer.getSelectedImagePane().getImage();
                    // }
                    // if (img == null) {
                    // return;
                    // }

                    // windowAction.setValue(preset.getWindow().intValue());
                    // levelAction.setValue(preset.getLevel().intValue());
                    // lutShapeAction.setSelectedItem(preset.getLutShape());

                    // if (preset.equals(PresetWindowLevel.DEFAULT)) {
                    // windowAction.setValue((int) img.getDefaultWindow());
                    // levelAction.setValue((int) img.getDefaultLevel());
                    // } else if (preset.equals(PresetWindowLevel.AUTO)) {
                    // int min = (int) img.getMinValue();
                    // int max = (int) img.getMaxValue();
                    // windowAction.setValue(max - min);
                    // levelAction.setValue((max - min) / 2 + min);
                    // }

=======

                    // windowAction.getModel().removeChangeListener(this);
                    // levelAction.getModel().removeChangeListener(this);
                    // lutShapeAction.getModel().removeListDataListener(this);

                    // DicomImageElement img = null;
                    // if (selectedView2dContainer != null) {
                    // img = selectedView2dContainer.getSelectedImagePane().getImage();
                    // }
                    // if (img == null) {
                    // return;
                    // }

                    // windowAction.setValue(preset.getWindow().intValue());
                    // levelAction.setValue(preset.getLevel().intValue());
                    // lutShapeAction.setSelectedItem(preset.getLutShape());

                    // if (preset.equals(PresetWindowLevel.DEFAULT)) {
                    // windowAction.setValue((int) img.getDefaultWindow());
                    // levelAction.setValue((int) img.getDefaultLevel());
                    // } else if (preset.equals(PresetWindowLevel.AUTO)) {
                    // int min = (int) img.getMinValue();
                    // int max = (int) img.getMaxValue();
                    // windowAction.setValue(max - min);
                    // levelAction.setValue((max - min) / 2 + min);
                    // }

>>>>>>> 652369a19ce9d32b8582c00547f72e9ff51e42d4
                    // windowAction.getModel().addChangeListener(this);
                    // levelAction.getModel().addChangeListener(this);
                    // lutShapeAction.getModel().addListDataListener(this);
Solution content
                    windowAction.setValueWithoutTriggerAction(preset.getWindow().intValue());
                    levelAction.setValueWithoutTriggerAction(preset.getLevel().intValue());
                    lutShapeAction.setSelectedItemWithoutTriggerAction(preset.getLutShape());

                    // windowAction.getModel().removeChangeListener(this);
                    // levelAction.getModel().removeChangeListener(this);
                    // lutShapeAction.getModel().removeListDataListener(this);

                    // DicomImageElement img = null;
                    // if (selectedView2dContainer != null) {
                    // img = selectedView2dContainer.getSelectedImagePane().getImage();
                    // }
                    // if (img == null) {
                    // return;
                    // }

                    // windowAction.setValue(preset.getWindow().intValue());
                    // levelAction.setValue(preset.getLevel().intValue());
                    // lutShapeAction.setSelectedItem(preset.getLutShape());

                    // if (preset.equals(PresetWindowLevel.DEFAULT)) {
                    // windowAction.setValue((int) img.getDefaultWindow());
                    // levelAction.setValue((int) img.getDefaultLevel());
                    // } else if (preset.equals(PresetWindowLevel.AUTO)) {
                    // int min = (int) img.getMinValue();
                    // int max = (int) img.getMaxValue();
                    // windowAction.setValue(max - min);
                    // levelAction.setValue((max - min) / 2 + min);
                    // }

                    // windowAction.getModel().addChangeListener(this);
                    // levelAction.getModel().addChangeListener(this);
                    // lutShapeAction.getModel().addListDataListener(this);
File
EventManager.java
Developer's decision
Version 1
Kind of conflict
Comment
Chunk
Conflicting content
     */

    public static String setLookAndFeel(String look) {
<<<<<<< HEAD
=======
        // Workaround in substance 6.3 to work with JAVA 7
        UIManager.put("ColorChooserUI", BasicColorChooserUI.class.getName());
>>>>>>> 652369a19ce9d32b8582c00547f72e9ff51e42d4
        // Do not display metal LAF in bold, it is ugly
        UIManager.put("swing.boldMetal", Boolean.FALSE); //$NON-NLS-1$
        // Display slider value is set to false (already in all LAF by the panel title), used by GTK LAF
Solution content
     */

    public static String setLookAndFeel(String look) {
        // Do not display metal LAF in bold, it is ugly
        UIManager.put("swing.boldMetal", Boolean.FALSE); //$NON-NLS-1$
        // Display slider value is set to false (already in all LAF by the panel title), used by GTK LAF
File
WeasisLauncher.java
Developer's decision
Version 1
Kind of conflict
Comment
Method invocation