<commit_before>/*******************************************************************************
 * Copyright (c) 2005-2010, <NAME> and Elexis
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    <NAME> - initial implementation
 *    
 *******************************************************************************/

package ch.elexis.core.ui.contacts.views;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.ISaveablePart2;
import org.eclipse.ui.part.ViewPart;

import ch.elexis.core.data.events.ElexisEventDispatcher;
import ch.elexis.core.ui.actions.GlobalActions;
import ch.elexis.core.ui.icons.Images;
import ch.elexis.core.ui.views.Messages;
import ch.elexis.data.Patient;

public class PatientDetailView2 extends ViewPart implements ISaveablePart2 {
	public static final String ID = "ch.elexis.PatDetail_v2"; //$NON-NLS-1$
	Patientenblatt2 pb;
	
	@Override
	public void createPartControl(Composite parent){
		setTitleImage(Images.IMG_VIEW_PATIENT_DETAIL.getImage());
		
		setPartName(Messages.PatientDetailView2_patientDetailViewName); //$NON-NLS-1$
		parent.setLayout(new FillLayout());
		pb = new Patientenblatt2(parent, getViewSite());
		
	}
	
	public void refresh(){
		pb.setPatient((Patient) ElexisEventDispatcher.getSelected(Patient.class));
		pb.refresh();
	}
	
	@Override
	public void setFocus(){
		// TODO Auto-generated method stub
		
	}
	
	/*
	 * ****** Die folgenden 6 Methoden implementieren das Interface ISaveablePart2 Wir benötigen das
	 * Interface nur, um das Schliessen einer View zu verhindern, wenn die Perspektive fixiert ist.<commit_msg>[4733] fixed patient detail selection and dispose<commit_after>/*******************************************************************************
 * Copyright (c) 2005-2010, <NAME> and Elexis
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    <NAME> - initial implementation
 *    
 *******************************************************************************/

package ch.elexis.core.ui.contacts.views;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.ISaveablePart2;
import org.eclipse.ui.part.ViewPart;

import ch.elexis.core.data.events.ElexisEventDispatcher;
import ch.elexis.core.ui.actions.GlobalActions;
import ch.elexis.core.ui.icons.Images;
import ch.elexis.core.ui.views.Messages;
import ch.elexis.data.Patient;

public class PatientDetailView2 extends ViewPart implements ISaveablePart2 {
	public static final String ID = "ch.elexis.PatDetail_v2"; //$NON-NLS-1$
	Patientenblatt2 pb;
	
	@Override
	public void createPartControl(Composite parent){
		setTitleImage(Images.IMG_VIEW_PATIENT_DETAIL.getImage());
		
		setPartName(Messages.PatientDetailView2_patientDetailViewName); //$NON-NLS-1$
		parent.setLayout(new FillLayout());
		pb = new Patientenblatt2(parent, getViewSite());
		
	}
	
	public void refresh(){
		pb.setPatient((Patient) ElexisEventDispatcher.getSelected(Patient.class));
		pb.refresh();
	}
	
	@Override
	public void setFocus(){
		if (pb != null && !pb.isDisposed()) {
			Patient selectedPatient = ElexisEventDispatcher.getSelectedPatient();
			if (selectedPatient != null && !selectedPatient.equals(pb.actPatient)) {
				pb.setPatient((Patient) ElexisEventDispatcher.getSelected(Patient.class));
				pb.refresh();
			}
		}
	}
	
	@Override
	public void dispose(){
		if (pb != null) {
			pb.dispose();
		}
		super.dispose();
	}
	
	/*
	 * ****** Die folgenden 6 Methoden implementieren das Interface ISaveablePart2 Wir benötigen das
	 * Interface nur, um das Schliessen einer View zu verhindern, wenn die Perspektive fixiert ist.
{'fraction_non_alphanumeric': 0.17763945415369883, 'fraction_numerical': 0.011970313622216903, 'mean_word_length': 5.117130307467057, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6545340', 'n_tokens_mistral': 1358, 'n_tokens_neox': 1227, 'n_words': 288}