Bug 118479 [api] Need a way to get a shared instance of JavaTextTools
JavaTextTools contains tools required to cofigure a java text viewer, and those tools can be shared via JavaTextTools. Currently, when clients want to use those tools, they need to first create a new instance of JavaTextTools and then share their instance of JavaTextTools in order to share the tools in JavaTextTools. This seems like it goes against the purpose of JavaTextTools. You should only really have 1 instance of JavaTextTools (at least per preferenceStore) Plus, you also need to make sure you dispose JavaTextTools, so by having only 1 instance, it'll be easier to keep track of to dispose. JDT is already kind of doing this by only creating one instance of JavaTextTools in JavaPlugin. I think this one instance should be shared amongst other clients instead of just the jdt plugin. A new method should be added to JavaUI, getJavaTextTools, which gets JavaTextTools from JavaPlugin.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/JavaUI.java
} else if (style == IJavaElementSearchConstants.CONSIDER_ANNOTATION_TYPES) {
			elementKinds= IJavaSearchConstants.ANNOTATION_TYPE;
		} else if (style == IJavaElementSearchConstants.CONSIDER_ENUMS) {
			elementKinds= IJavaSearchConstants.ENUM;
		} else if (style == IJavaElementSearchConstants.CONSIDER_CLASSES_AND_INTERFACES) {
			elementKinds= IJavaSearchConstants.CLASS_AND_INTERFACE;
		} else if (style == IJavaElementSearchConstants.CONSIDER_CLASSES_AND_ENUMS) {
			elementKinds= IJavaSearchConstants.CLASS_AND_ENUM;
		} else if (style == DEPRECATED_CONSIDER_TYPES) {
			elementKinds= IJavaSearchConstants.CLASS_AND_INTERFACE;
		} else {	
			throw new IllegalArgumentException("Invalid style constant."); 
		}
		TypeSelectionDialog2 dialog= new TypeSelectionDialog2(parent, multipleSelection, 
			context, scope, elementKinds, extension);
		dialog.setMessage(JavaUIMessages.JavaUI_defaultDialogMessage); 
		dialog.setFilter(filter);
		return dialog;
	}
	/**
	 * Creates a selection dialog that lists all types in the given scope containing 
	 * a standard <code>main</code> method.
	 * The caller is responsible for opening the dialog with <code>Window.open</code>,
	 * and subsequently extracting the selected type(s) (of type
	 * <code>IType</code>) via <code>SelectionDialog.getResult</code>.
	 * 
	 * @param parent the parent shell of the dialog to be created
	 * @param context the runnable context used to show progress when the dialog
	 *   is being populated
	 * @param scope the scope that limits which types are included