1 /******************************************************************************* 2 * Copyright (c) 2004, 2006 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.compare.internal; 12 13 import org.eclipse.compare.IStreamMerger; 14 import org.eclipse.core.runtime.CoreException; 15 import org.eclipse.core.runtime.IConfigurationElement; 16 17 /** 18 * A factory proxy for creating a StructureCreator. 19 */ 20 class StreamMergerDescriptor { 21 22 private final static String CLASS_ATTRIBUTE= "class"; //$NON-NLS-1$ 23 24 private IConfigurationElement fElement; 25 26 /* 27 * Creates a new sorter node with the given configuration element. 28 */ 29 public StreamMergerDescriptor(IConfigurationElement element) { 30 fElement= element; 31 } 32 33 /* 34 * Creates a new stream merger from this node. 35 */ 36 public IStreamMerger createStreamMerger() { 37 try { 38 return (IStreamMerger)fElement.createExecutableExtension(CLASS_ATTRIBUTE); 39 } catch (CoreException ex) { 40 //ExceptionHandler.handle(ex, SearchMessages.getString("Search.Error.createSorter.title"), SearchMessages.getString("Search.Error.createSorter.message")); //$NON-NLS-2$ //$NON-NLS-1$ 41 return null; 42 } catch (ClassCastException ex) { 43 //ExceptionHandler.displayMessageDialog(ex, SearchMessages.getString("Search.Error.createSorter.title"), SearchMessages.getString("Search.Error.createSorter.message")); //$NON-NLS-2$ //$NON-NLS-1$ 44 return null; 45 } 46 } 47 } 48