Modernize dltk.ui.actions package.

Generify, remove unused code and etc.

Change-Id: If4b3c9ddcd9bc67032f927bd69bc1d504ed83c2b
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/CustomFiltersActionGroup.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/CustomFiltersActionGroup.java
index 55eea88..3242235 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/CustomFiltersActionGroup.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/CustomFiltersActionGroup.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * 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
@@ -94,19 +94,13 @@
 		/**
 		 * Constructor for FilterActionMenuContributionItem.
 		 *
-		 * @param actionGroup
-		 *            the action group
-		 * @param filterId
-		 *            the id of the filter
-		 * @param filterName
-		 *            the name of the filter
-		 * @param state
-		 *            the initial state of the filter
-		 * @param itemNumber
-		 *            the menu item index
+		 * @param actionGroup the action group
+		 * @param filterId    the id of the filter
+		 * @param filterName  the name of the filter
+		 * @param state       the initial state of the filter
+		 * @param itemNumber  the menu item index
 		 */
-		public FilterActionMenuContributionItem(
-				CustomFiltersActionGroup actionGroup, String filterId,
+		public FilterActionMenuContributionItem(CustomFiltersActionGroup actionGroup, String filterId,
 				String filterName, boolean state, int itemNumber) {
 			super(filterId);
 			fActionGroup = actionGroup;
@@ -124,9 +118,9 @@
 			MenuItem mi = new MenuItem(menu, SWT.CHECK, index);
 			mi.setText("&" + fItemNumber + " " + fFilterName); //$NON-NLS-1$ //$NON-NLS-2$
 			/*
-			 * XXX: Don't set the image - would look bad because other menu
-			 * items don't provide image XXX: Get working set specific image
-			 * name from XML - would need to cache icons
+			 * XXX: Don't set the image - would look bad because other menu items don't
+			 * provide image XXX: Get working set specific image name from XML - would need
+			 * to cache icons
 			 */
 			// mi.setImage(DLTKPluginImages.get(DLTKPluginImages.IMG_OBJS_JAVA_WORKING_SET));
 			mi.setSelection(fState);
@@ -167,9 +161,9 @@
 	private StructuredViewer fViewer;
 
 	private NamePatternFilter fPatternFilter;
-	private Map fInstalledBuiltInFilters;
+	private Map<String, ViewerFilter> fInstalledBuiltInFilters;
 
-	private Map/* <String, Boolean> */ fEnabledFilterIds;
+	private Map<String, Boolean> fEnabledFilterIds;
 	private boolean fUserDefinedPatternsEnabled;
 	private String[] fUserDefinedPatterns;
 	private FilterDescriptor[] fCachedFilterDescriptors;
@@ -179,17 +173,15 @@
 	 *
 	 *
 	 */
-	private Stack fLRUFilterIdsStack;
+	private Stack<String> fLRUFilterIdsStack;
 	/**
-	 * Handle to menu manager to dynamically update the last recently used
-	 * filters.
+	 * Handle to menu manager to dynamically update the last recently used filters.
 	 *
 	 *
 	 */
 	private IMenuManager fMenuManager;
 	/**
-	 * The menu listener which dynamically updates the last recently used
-	 * filters.
+	 * The menu listener which dynamically updates the last recently used filters.
 	 *
 	 *
 	 */
@@ -206,10 +198,8 @@
 	/**
 	 * Creates a new <code>CustomFiltersActionGroup</code>.
 	 *
-	 * @param part
-	 *            the view part that owns this action group
-	 * @param viewer
-	 *            the viewer to be filtered
+	 * @param part   the view part that owns this action group
+	 * @param viewer the viewer to be filtered
 	 */
 	public CustomFiltersActionGroup(IViewPart part, StructuredViewer viewer) {
 		this(part.getViewSite().getId(), viewer);
@@ -218,16 +208,14 @@
 	/**
 	 * Creates a new <code>CustomFiltersActionGroup</code>.
 	 *
-	 * @param ownerId
-	 *            the id of this action group's owner
-	 * @param viewer
-	 *            the viewer to be filtered
+	 * @param ownerId the id of this action group's owner
+	 * @param viewer  the viewer to be filtered
 	 */
 	public CustomFiltersActionGroup(String ownerId, StructuredViewer viewer) {
 		fTargetId = ownerId;
 		fViewer = viewer;
 
-		fLRUFilterIdsStack = new Stack();
+		fLRUFilterIdsStack = new Stack<>();
 
 		initializeWithPluginContributions();
 		initializeWithViewDefaults();
@@ -245,8 +233,8 @@
 	}
 
 	/**
-	 * Returns a list of currently enabled filters. The filter is identified by
-	 * its id.
+	 * Returns a list of currently enabled filters. The filter is identified by its
+	 * id.
 	 * <p>
 	 * This method is for internal use only and should not be called by clients
 	 * outside of DLTK/UI.
@@ -258,11 +246,11 @@
 	 */
 	public String[] internalGetEnabledFilterIds() {
 		Set<String> enabledFilterIds = new HashSet<>(fEnabledFilterIds.size());
-		Iterator iter = fEnabledFilterIds.entrySet().iterator();
+		Iterator<Entry<String, Boolean>> iter = fEnabledFilterIds.entrySet().iterator();
 		while (iter.hasNext()) {
-			Map.Entry entry = (Map.Entry) iter.next();
-			String id = (String) entry.getKey();
-			boolean isEnabled = ((Boolean) entry.getValue()).booleanValue();
+			Entry<String, Boolean> entry = iter.next();
+			String id = entry.getKey();
+			boolean isEnabled = entry.getValue().booleanValue();
 			if (isEnabled)
 				enabledFilterIds.add(id);
 		}
@@ -272,24 +260,19 @@
 	/**
 	 * Removes filters for the given parent and element
 	 *
-	 * @param parent
-	 *            the parent of the element
-	 * @param element
-	 *            the element
-	 * @param contentProvider
-	 *            the content provider of the viewer from which the filters will
-	 *            be removed
+	 * @param parent          the parent of the element
+	 * @param element         the element
+	 * @param contentProvider the content provider of the viewer from which the
+	 *                        filters will be removed
 	 *
 	 * @return the array of new filter ids
 	 */
-	public String[] removeFiltersFor(Object parent, Object element,
-			IContentProvider contentProvider) {
+	public String[] removeFiltersFor(Object parent, Object element, IContentProvider contentProvider) {
 		String[] enabledFilters = internalGetEnabledFilterIds();
 		Set<String> newFilters = new HashSet<>();
 		for (int i = 0; i < enabledFilters.length; i++) {
 			String filterName = enabledFilters[i];
-			ViewerFilter filter = (ViewerFilter) fInstalledBuiltInFilters
-					.get(filterName);
+			ViewerFilter filter = fInstalledBuiltInFilters.get(filterName);
 			if (filter == null)
 				newFilters.add(filterName);
 			else if (isSelected(parent, element, contentProvider, filter))
@@ -303,16 +286,14 @@
 	/**
 	 * Sets the filters to the given array of new filters
 	 *
-	 * @param newFilters
-	 *            the new filters
+	 * @param newFilters the new filters
 	 */
 	public void setFilters(String[] newFilters) {
 		setEnabledFilterIds(newFilters);
 		updateViewerFilters(true);
 	}
 
-	private boolean isSelected(Object parent, Object element,
-			IContentProvider contentProvider, ViewerFilter filter) {
+	private boolean isSelected(Object parent, Object element, IContentProvider contentProvider, ViewerFilter filter) {
 		if (contentProvider instanceof ITreeContentProvider) {
 			// the element and all its parents have to be selected
 			ITreeContentProvider provider = (ITreeContentProvider) contentProvider;
@@ -329,10 +310,8 @@
 	/**
 	 * Sets the enable state of the given filter.
 	 *
-	 * @param filterId
-	 *            the id of the filter
-	 * @param state
-	 *            the filter state
+	 * @param filterId the id of the filter
+	 * @param state    the filter state
 	 */
 	private void setFilter(String filterId, boolean state) {
 		// Renew filter id in LRU stack
@@ -346,9 +325,9 @@
 	}
 
 	private void setEnabledFilterIds(String[] enabledIds) {
-		Iterator iter = fEnabledFilterIds.keySet().iterator();
+		Iterator<String> iter = fEnabledFilterIds.keySet().iterator();
 		while (iter.hasNext()) {
-			String id = (String) iter.next();
+			String id = iter.next();
 			fEnabledFilterIds.put(id, Boolean.FALSE);
 		}
 		for (int i = 0; i < enabledIds.length; i++)
@@ -363,23 +342,20 @@
 	/**
 	 * Sets the recently changed filters.
 	 *
-	 * @param changeHistory
-	 *            the change history
+	 * @param changeHistory the change history
 	 *
 	 */
-	private void setRecentlyChangedFilters(Stack changeHistory) {
-		Stack oldestFirstStack = new Stack();
+	private void setRecentlyChangedFilters(Stack<FilterDescriptor> changeHistory) {
+		Stack<String> oldestFirstStack = new Stack<>();
 
 		int length = Math.min(changeHistory.size(), MAX_FILTER_MENU_ENTRIES);
 		for (int i = 0; i < length; i++)
-			oldestFirstStack
-					.push(((FilterDescriptor) changeHistory.pop()).getId());
+			oldestFirstStack.push(changeHistory.pop().getId());
 
-		length = Math.min(fLRUFilterIdsStack.size(),
-				MAX_FILTER_MENU_ENTRIES - oldestFirstStack.size());
+		length = Math.min(fLRUFilterIdsStack.size(), MAX_FILTER_MENU_ENTRIES - oldestFirstStack.size());
 		int NEWEST = 0;
 		for (int i = 0; i < length; i++) {
-			Object filter = fLRUFilterIdsStack.remove(NEWEST);
+			String filter = fLRUFilterIdsStack.remove(NEWEST);
 			if (!oldestFirstStack.contains(filter))
 				oldestFirstStack.push(filter);
 		}
@@ -400,13 +376,12 @@
 	/**
 	 * Fills the given view menu with the entries managed by the group.
 	 *
-	 * @param viewMenu
-	 *            the menu to fill
+	 * @param viewMenu the menu to fill
 	 */
 	public void fillViewMenu(IMenuManager viewMenu) {
 		/*
-		 * Don't change the separator group name. Using this name ensures that
-		 * other filters get contributed to the same group.
+		 * Don't change the separator group name. Using this name ensures that other
+		 * filters get contributed to the same group.
 		 */
 		viewMenu.add(new Separator("filters")); //$NON-NLS-1$
 		viewMenu.add(new GroupMarker(RECENT_FILTERS_GROUP_NAME));
@@ -434,22 +409,18 @@
 			return;
 		}
 
-		SortedSet<String> sortedFilters = new TreeSet<String>(
-				fLRUFilterIdsStack);
-		String[] recentlyChangedFilterIds = sortedFilters
-				.toArray(new String[sortedFilters.size()]);
+		SortedSet<String> sortedFilters = new TreeSet<>(fLRUFilterIdsStack);
+		String[] recentlyChangedFilterIds = sortedFilters.toArray(new String[sortedFilters.size()]);
 
 		fFilterIdsUsedInLastViewMenu = new String[recentlyChangedFilterIds.length];
 		for (int i = 0; i < recentlyChangedFilterIds.length; i++) {
 			String id = recentlyChangedFilterIds[i];
 			fFilterIdsUsedInLastViewMenu[i] = id;
-			boolean state = fEnabledFilterIds.containsKey(id)
-					&& ((Boolean) fEnabledFilterIds.get(id)).booleanValue();
-			FilterDescriptor filterDesc = (FilterDescriptor) fFilterDescriptorMap
-					.get(id);
+			boolean state = fEnabledFilterIds.containsKey(id) && fEnabledFilterIds.get(id).booleanValue();
+			FilterDescriptor filterDesc = (FilterDescriptor) fFilterDescriptorMap.get(id);
 			if (filterDesc != null) {
-				IContributionItem item = new FilterActionMenuContributionItem(
-						this, id, filterDesc.getName(), state, i + 1);
+				IContributionItem item = new FilterActionMenuContributionItem(this, id, filterDesc.getName(), state,
+						i + 1);
 				mm.insertBefore(RECENT_FILTERS_GROUP_NAME, item);
 			}
 		}
@@ -468,8 +439,8 @@
 		fUserDefinedPatternsEnabled = false;
 
 		FilterDescriptor[] filterDescs = getCachedFilterDescriptors();
-		fFilterDescriptorMap = new HashMap(filterDescs.length);
-		fEnabledFilterIds = new HashMap(filterDescs.length);
+		fFilterDescriptorMap = new HashMap<>(filterDescs.length);
+		fEnabledFilterIds = new HashMap<>(filterDescs.length);
 		for (int i = 0; i < filterDescs.length; i++) {
 			String id = filterDescs[i].getId();
 			Boolean isEnabled = Boolean.valueOf(filterDescs[i].isEnabled());
@@ -487,7 +458,7 @@
 	// ---------- viewer filter handling ----------
 
 	private void installFilters() {
-		fInstalledBuiltInFilters = new HashMap(fEnabledFilterIds.size());
+		fInstalledBuiltInFilters = new HashMap<>(fEnabledFilterIds.size());
 		fPatternFilter = new NamePatternFilter();
 		fPatternFilter.setPatterns(getUserAndBuiltInPatterns());
 		fViewer.addFilter(fPatternFilter);
@@ -505,14 +476,14 @@
 	}
 
 	private void updateBuiltInFilters() {
-		Set installedFilters = fInstalledBuiltInFilters.keySet();
-		Set filtersToAdd = new HashSet(fEnabledFilterIds.size());
-		Set filtersToRemove = new HashSet(fEnabledFilterIds.size());
-		Iterator iter = fEnabledFilterIds.entrySet().iterator();
+		Set<String> installedFilters = fInstalledBuiltInFilters.keySet();
+		Set<String> filtersToAdd = new HashSet<>(fEnabledFilterIds.size());
+		Set<String> filtersToRemove = new HashSet<>(fEnabledFilterIds.size());
+		Iterator<Entry<String, Boolean>> iter = fEnabledFilterIds.entrySet().iterator();
 		while (iter.hasNext()) {
-			Map.Entry entry = (Map.Entry) iter.next();
-			String id = (String) entry.getKey();
-			boolean isEnabled = ((Boolean) entry.getValue()).booleanValue();
+			Map.Entry<String, Boolean> entry = iter.next();
+			String id = entry.getKey();
+			boolean isEnabled = entry.getValue().booleanValue();
 			if (isEnabled && !installedFilters.contains(id))
 				filtersToAdd.add(id);
 			else if (!isEnabled && installedFilters.contains(id))
@@ -534,8 +505,7 @@
 					}
 				}
 				if (filtersToRemove.contains(id)) {
-					fViewer.removeFilter(
-							(ViewerFilter) fInstalledBuiltInFilters.get(id));
+					fViewer.removeFilter(fInstalledBuiltInFilters.get(id));
 					fInstalledBuiltInFilters.remove(id);
 				}
 			}
@@ -551,8 +521,7 @@
 			String id = filterDescs[i].getId();
 			boolean isPatternFilter = filterDescs[i].isPatternFilter();
 			Object isEnabled = fEnabledFilterIds.get(id);
-			if (isEnabled != null && isPatternFilter
-					&& ((Boolean) isEnabled).booleanValue())
+			if (isEnabled != null && isPatternFilter && ((Boolean) isEnabled).booleanValue())
 				patterns.add(filterDescs[i].getPattern());
 		}
 		return patterns.toArray(new String[patterns.size()]);
@@ -568,31 +537,27 @@
 		if (!store.contains(getPreferenceKey(TAG_DUMMY_TO_TEST_EXISTENCE)))
 			return;
 
-		fUserDefinedPatternsEnabled = store.getBoolean(
-				getPreferenceKey(TAG_USER_DEFINED_PATTERNS_ENABLED));
-		setUserDefinedPatterns(CustomFiltersDialog.convertFromString(
-				store.getString(getPreferenceKey(TAG_USER_DEFINED_PATTERNS)),
-				SEPARATOR));
+		fUserDefinedPatternsEnabled = store.getBoolean(getPreferenceKey(TAG_USER_DEFINED_PATTERNS_ENABLED));
+		setUserDefinedPatterns(CustomFiltersDialog
+				.convertFromString(store.getString(getPreferenceKey(TAG_USER_DEFINED_PATTERNS)), SEPARATOR));
 
-		Iterator iter = fEnabledFilterIds.entrySet().iterator();
+		Iterator<Entry<String, Boolean>> iter = fEnabledFilterIds.entrySet().iterator();
 		while (iter.hasNext()) {
-			Entry entry = (Entry) iter.next();
-			String id = (String) entry.getKey();
+			Entry<String, Boolean> entry = iter.next();
+			String id = entry.getKey();
 			// set default to value from plugin contributions (fixes
 			// https://bugs.eclipse.org/bugs/show_bug.cgi?id=73991 ):
-			store.setDefault(id, ((Boolean) entry.getValue()).booleanValue());
+			store.setDefault(id, entry.getValue().booleanValue());
 			Boolean isEnabled = Boolean.valueOf(store.getBoolean(id));
 			fEnabledFilterIds.put(id, isEnabled);
 		}
 
 		fLRUFilterIdsStack.clear();
 		String lruFilterIds = store.getString(TAG_LRU_FILTERS);
-		StringTokenizer tokenizer = new StringTokenizer(lruFilterIds,
-				SEPARATOR);
+		StringTokenizer tokenizer = new StringTokenizer(lruFilterIds, SEPARATOR);
 		while (tokenizer.hasMoreTokens()) {
 			String id = tokenizer.nextToken();
-			if (fFilterDescriptorMap.containsKey(id)
-					&& !fLRUFilterIdsStack.contains(id))
+			if (fFilterDescriptorMap.containsKey(id) && !fLRUFilterIdsStack.contains(id))
 				fLRUFilterIdsStack.push(id);
 		}
 	}
@@ -602,27 +567,24 @@
 		IPreferenceStore store = DLTKUIPlugin.getDefault().getPreferenceStore();
 
 		// see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=22533
-		store.setValue(getPreferenceKey(TAG_DUMMY_TO_TEST_EXISTENCE),
-				"storedViewPreferences");//$NON-NLS-1$
+		store.setValue(getPreferenceKey(TAG_DUMMY_TO_TEST_EXISTENCE), "storedViewPreferences");//$NON-NLS-1$
 
-		store.setValue(getPreferenceKey(TAG_USER_DEFINED_PATTERNS_ENABLED),
-				fUserDefinedPatternsEnabled);
+		store.setValue(getPreferenceKey(TAG_USER_DEFINED_PATTERNS_ENABLED), fUserDefinedPatternsEnabled);
 		store.setValue(getPreferenceKey(TAG_USER_DEFINED_PATTERNS),
-				CustomFiltersDialog.convertToString(fUserDefinedPatterns,
-						SEPARATOR));
+				CustomFiltersDialog.convertToString(fUserDefinedPatterns, SEPARATOR));
 
-		Iterator iter = fEnabledFilterIds.entrySet().iterator();
+		Iterator<Entry<String, Boolean>> iter = fEnabledFilterIds.entrySet().iterator();
 		while (iter.hasNext()) {
-			Map.Entry entry = (Map.Entry) iter.next();
-			String id = (String) entry.getKey();
-			boolean isEnabled = ((Boolean) entry.getValue()).booleanValue();
+			Entry<String, Boolean> entry = iter.next();
+			String id = entry.getKey();
+			boolean isEnabled = entry.getValue().booleanValue();
 			store.setValue(id, isEnabled);
 		}
 
 		StringBuffer buf = new StringBuffer(fLRUFilterIdsStack.size() * 20);
-		iter = fLRUFilterIdsStack.iterator();
-		while (iter.hasNext()) {
-			buf.append((String) iter.next());
+		Iterator<String> iter2 = fLRUFilterIdsStack.iterator();
+		while (iter2.hasNext()) {
+			buf.append(iter2.next());
 			buf.append(SEPARATOR);
 		}
 		store.setValue(TAG_LRU_FILTERS, buf.toString());
@@ -637,13 +599,11 @@
 	/**
 	 * Saves the state of the custom filters in a memento.
 	 *
-	 * @param memento
-	 *            the memento into which the state is saved
+	 * @param memento the memento into which the state is saved
 	 */
 	public void saveState(IMemento memento) {
 		IMemento customFilters = memento.createChild(TAG_CUSTOM_FILTERS);
-		customFilters.putString(TAG_USER_DEFINED_PATTERNS_ENABLED,
-				Boolean.toString(fUserDefinedPatternsEnabled));
+		customFilters.putString(TAG_USER_DEFINED_PATTERNS_ENABLED, Boolean.toString(fUserDefinedPatternsEnabled));
 		saveUserDefinedPatterns(customFilters);
 		saveXmlDefinedFilters(customFilters);
 		saveLRUFilters(customFilters);
@@ -651,13 +611,12 @@
 
 	private void saveXmlDefinedFilters(IMemento memento) {
 		if (fEnabledFilterIds != null && !fEnabledFilterIds.isEmpty()) {
-			IMemento xmlDefinedFilters = memento
-					.createChild(TAG_XML_DEFINED_FILTERS);
-			Iterator iter = fEnabledFilterIds.entrySet().iterator();
+			IMemento xmlDefinedFilters = memento.createChild(TAG_XML_DEFINED_FILTERS);
+			Iterator<Entry<String, Boolean>> iter = fEnabledFilterIds.entrySet().iterator();
 			while (iter.hasNext()) {
-				Map.Entry entry = (Map.Entry) iter.next();
-				String id = (String) entry.getKey();
-				Boolean isEnabled = (Boolean) entry.getValue();
+				Entry<String, Boolean> entry = iter.next();
+				String id = entry.getKey();
+				Boolean isEnabled = entry.getValue();
 				IMemento child = xmlDefinedFilters.createChild(TAG_CHILD);
 				child.putString(TAG_FILTER_ID, id);
 				child.putString(TAG_IS_ENABLED, isEnabled.toString());
@@ -668,16 +627,15 @@
 	/**
 	 * Stores the last recently used filter Ids into the given memento
 	 *
-	 * @param memento
-	 *            the memento into which to store the LRU filter Ids
+	 * @param memento the memento into which to store the LRU filter Ids
 	 *
 	 */
 	private void saveLRUFilters(IMemento memento) {
 		if (fLRUFilterIdsStack != null && !fLRUFilterIdsStack.isEmpty()) {
 			IMemento lruFilters = memento.createChild(TAG_LRU_FILTERS);
-			Iterator iter = fLRUFilterIdsStack.iterator();
+			Iterator<String> iter = fLRUFilterIdsStack.iterator();
 			while (iter.hasNext()) {
-				String id = (String) iter.next();
+				String id = iter.next();
 				IMemento child = lruFilters.createChild(TAG_CHILD);
 				child.putString(TAG_FILTER_ID, id);
 			}
@@ -686,8 +644,7 @@
 
 	private void saveUserDefinedPatterns(IMemento memento) {
 		if (fUserDefinedPatterns != null && fUserDefinedPatterns.length > 0) {
-			IMemento userDefinedPatterns = memento
-					.createChild(TAG_USER_DEFINED_PATTERNS);
+			IMemento userDefinedPatterns = memento.createChild(TAG_USER_DEFINED_PATTERNS);
 			for (int i = 0; i < fUserDefinedPatterns.length; i++) {
 				IMemento child = userDefinedPatterns.createChild(TAG_CHILD);
 				child.putString(TAG_PATTERN, fUserDefinedPatterns[i]);
@@ -701,8 +658,7 @@
 	 * Note: This method does not refresh the viewer.
 	 * </p>
 	 *
-	 * @param memento
-	 *            the memento from which the state is restored
+	 * @param memento the memento from which the state is restored
 	 */
 	public void restoreState(IMemento memento) {
 		if (memento == null)
@@ -710,13 +666,11 @@
 		IMemento customFilters = memento.getChild(TAG_CUSTOM_FILTERS);
 		if (customFilters == null)
 			return;
-		String userDefinedPatternsEnabled = customFilters
-				.getString(TAG_USER_DEFINED_PATTERNS_ENABLED);
+		String userDefinedPatternsEnabled = customFilters.getString(TAG_USER_DEFINED_PATTERNS_ENABLED);
 		if (userDefinedPatternsEnabled == null)
 			return;
 
-		fUserDefinedPatternsEnabled = Boolean
-				.valueOf(userDefinedPatternsEnabled).booleanValue();
+		fUserDefinedPatternsEnabled = Boolean.valueOf(userDefinedPatternsEnabled).booleanValue();
 		restoreUserDefinedPatterns(customFilters);
 		restoreXmlDefinedFilters(customFilters);
 		restoreLRUFilters(customFilters);
@@ -725,8 +679,7 @@
 	}
 
 	private void restoreUserDefinedPatterns(IMemento memento) {
-		IMemento userDefinedPatterns = memento
-				.getChild(TAG_USER_DEFINED_PATTERNS);
+		IMemento userDefinedPatterns = memento.getChild(TAG_USER_DEFINED_PATTERNS);
 		if (userDefinedPatterns != null) {
 			IMemento children[] = userDefinedPatterns.getChildren(TAG_CHILD);
 			String[] patterns = new String[children.length];
@@ -744,8 +697,7 @@
 			IMemento[] children = xmlDefinedFilters.getChildren(TAG_CHILD);
 			for (int i = 0; i < children.length; i++) {
 				String id = children[i].getString(TAG_FILTER_ID);
-				Boolean isEnabled = Boolean
-						.valueOf(children[i].getString(TAG_IS_ENABLED));
+				Boolean isEnabled = Boolean.valueOf(children[i].getString(TAG_IS_ENABLED));
 				fEnabledFilterIds.put(id, isEnabled);
 			}
 		}
@@ -758,8 +710,7 @@
 			IMemento[] children = lruFilters.getChildren(TAG_CHILD);
 			for (int i = 0; i < children.length; i++) {
 				String id = children[i].getString(TAG_FILTER_ID);
-				if (fFilterDescriptorMap.containsKey(id)
-						&& !fLRUFilterIdsStack.contains(id))
+				if (fFilterDescriptorMap.containsKey(id) && !fLRUFilterIdsStack.contains(id))
 					fLRUFilterIdsStack.push(id);
 			}
 		}
@@ -768,8 +719,7 @@
 	private void cleanUpPatternDuplicates() {
 		if (!areUserDefinedPatternsEnabled())
 			return;
-		List<String> userDefinedPatterns = new ArrayList<>(
-				Arrays.asList(fUserDefinedPatterns));
+		List<String> userDefinedPatterns = new ArrayList<>(Arrays.asList(fUserDefinedPatterns));
 		FilterDescriptor[] filters = getCachedFilterDescriptors();
 
 		for (int i = 0; i < filters.length; i++) {
@@ -783,34 +733,27 @@
 				}
 			}
 		}
-		fUserDefinedPatterns = userDefinedPatterns
-				.toArray(new String[userDefinedPatterns.size()]);
-		setUserDefinedPatternsEnabled(
-				fUserDefinedPatternsEnabled && fUserDefinedPatterns.length > 0);
+		fUserDefinedPatterns = userDefinedPatterns.toArray(new String[userDefinedPatterns.size()]);
+		setUserDefinedPatternsEnabled(fUserDefinedPatternsEnabled && fUserDefinedPatterns.length > 0);
 	}
 
 	private FilterDescriptor[] getCachedFilterDescriptors() {
 		if (fCachedFilterDescriptors == null)
-			fCachedFilterDescriptors = FilterDescriptor
-					.getFilterDescriptors(fTargetId);
+			fCachedFilterDescriptors = FilterDescriptor.getFilterDescriptors(fTargetId);
 		return fCachedFilterDescriptors;
 	}
 
 	// ---------- dialog related code ----------
 
 	private void openDialog() {
-		CustomFiltersDialog dialog = new CustomFiltersDialog(
-				fViewer.getControl().getShell(), fTargetId,
-				areUserDefinedPatternsEnabled(), fUserDefinedPatterns,
-				internalGetEnabledFilterIds());
+		CustomFiltersDialog dialog = new CustomFiltersDialog(fViewer.getControl().getShell(), fTargetId,
+				areUserDefinedPatternsEnabled(), fUserDefinedPatterns, internalGetEnabledFilterIds());
 
 		if (dialog.open() == Window.OK) {
 			setEnabledFilterIds(dialog.getEnabledFilterIds());
-			setUserDefinedPatternsEnabled(
-					dialog.areUserDefinedPatternsEnabled());
+			setUserDefinedPatternsEnabled(dialog.areUserDefinedPatternsEnabled());
 			setUserDefinedPatterns(dialog.getUserDefinedPatterns());
-			setRecentlyChangedFilters(
-					dialog.getFilterDescriptorChangeHistory());
+			setRecentlyChangedFilters(dialog.getFilterDescriptorChangeHistory());
 
 			storeViewDefaults();
 
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/FindAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/FindAction.java
index 3489510..e53512e 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/FindAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/FindAction.java
@@ -59,10 +59,9 @@
 public abstract class FindAction extends SelectionDispatchAction {
 
 	// A dummy which can't be selected in the UI
-	private static final IModelElement RETURN_WITHOUT_BEEP = DLTKCore
-			.create(DLTKUIPlugin.getWorkspace().getRoot());
+	private static final IModelElement RETURN_WITHOUT_BEEP = DLTKCore.create(DLTKUIPlugin.getWorkspace().getRoot());
 
-	private Class[] fValidTypes;
+	private Class<?>[] fValidTypes;
 	private final IDLTKLanguageToolkit toolkit;
 	private AbstractDecoratedTextEditor fEditor;
 
@@ -84,36 +83,32 @@
 	 *
 	 * @since 5.3
 	 */
-	FindAction(IDLTKLanguageToolkit toolkit,
-			AbstractDecoratedTextEditor editor) {
+	FindAction(IDLTKLanguageToolkit toolkit, AbstractDecoratedTextEditor editor) {
 		this(toolkit, editor.getEditorSite());
 		fEditor = editor;
 		setEnabled(SelectionConverter.canOperateOn(fEditor));
 	}
 
 	/**
-	 * Called once by the constructors to initialize label, tooltip, image and
-	 * help support of the action. To be overridden by implementors of this
-	 * action.
+	 * Called once by the constructors to initialize label, tooltip, image and help
+	 * support of the action. To be overridden by implementors of this action.
 	 */
 	abstract void init();
 
 	/**
-	 * Called once by the constructors to get the list of the valid input types
-	 * of the action. To be overridden by implementors of this action.
+	 * Called once by the constructors to get the list of the valid input types of
+	 * the action. To be overridden by implementors of this action.
 	 *
 	 * @return the valid input types of the action
 	 */
-	abstract Class[] getValidTypes();
+	abstract Class<?>[] getValidTypes();
 
 	private boolean canOperateOn(IStructuredSelection sel) {
-		return sel != null && !sel.isEmpty()
-				&& canOperateOn(getModelElement(sel, true));
+		return sel != null && !sel.isEmpty() && canOperateOn(getModelElement(sel, true));
 	}
 
 	boolean canOperateOn(IModelElement element) {
-		if (element == null || fValidTypes == null || fValidTypes.length == 0
-				|| !ActionUtil.isOnBuildPath(element))
+		if (element == null || fValidTypes == null || fValidTypes.length == 0 || !ActionUtil.isOnBuildPath(element))
 			return false;
 
 		for (int i = 0; i < fValidTypes.length; i++) {
@@ -147,16 +142,14 @@
 		}
 	}
 
-	IModelElement getModelElement(IStructuredSelection selection,
-			boolean silent) {
+	IModelElement getModelElement(IStructuredSelection selection, boolean silent) {
 		if (selection.size() == 1) {
 			Object firstElement = selection.getFirstElement();
 			IModelElement elem = null;
 			if (firstElement instanceof IModelElement)
 				elem = (IModelElement) firstElement;
 			else if (firstElement instanceof IAdaptable)
-				elem = ((IAdaptable) firstElement)
-						.getAdapter(IModelElement.class);
+				elem = ((IAdaptable) firstElement).getAdapter(IModelElement.class);
 			if (elem != null) {
 				return getTypeIfPossible(elem, silent);
 			}
@@ -166,17 +159,13 @@
 	}
 
 	private void showOperationUnavailableDialog() {
-		MessageDialog.openInformation(getShell(),
-				SearchMessages.DLTKElementAction_operationUnavailable_title,
+		MessageDialog.openInformation(getShell(), SearchMessages.DLTKElementAction_operationUnavailable_title,
 				getOperationUnavailableMessage());
 	}
 
 	String getOperationUnavailableMessage() {
-		return NLS.bind(
-				SearchMessages.DLTKElementAction_operationUnavailable_generic,
-				(fEditor instanceof IScriptLanguageProvider
-						? ((IScriptLanguageProvider) fEditor)
-								.getLanguageToolkit()
+		return NLS.bind(SearchMessages.DLTKElementAction_operationUnavailable_generic,
+				(fEditor instanceof IScriptLanguageProvider ? ((IScriptLanguageProvider) fEditor).getLanguageToolkit()
 						: toolkit).getLanguageName());
 	}
 
@@ -186,8 +175,7 @@
 			types = cu.getTypes();
 		} catch (ModelException ex) {
 			if (ScriptModelUtil.isExceptionToBeLogged(ex))
-				ExceptionHandler.log(ex,
-						SearchMessages.DLTKElementAction_error_open_message);
+				ExceptionHandler.log(ex, SearchMessages.DLTKElementAction_error_open_message);
 			if (silent) {
 				return RETURN_WITHOUT_BEEP;
 			}
@@ -203,8 +191,8 @@
 		String message = SearchMessages.DLTKElementAction_typeSelectionDialog_message;
 		int flags = (ModelElementLabelProvider.SHOW_DEFAULT);
 
-		ElementListSelectionDialog dialog = new ElementListSelectionDialog(
-				getShell(), new ModelElementLabelProvider(flags));
+		ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(),
+				new ModelElementLabelProvider(flags));
 		dialog.setTitle(title);
 		dialog.setMessage(message);
 		dialog.setElements(types);
@@ -235,13 +223,11 @@
 			String title = SearchMessages.SearchElementSelectionDialog_title;
 			String message = SearchMessages.SearchElementSelectionDialog_message;
 
-			IModelElement[] elements = SelectionConverter
-					.codeResolveForked(fEditor, true);
+			IModelElement[] elements = SelectionConverter.codeResolveForked(fEditor, true);
 			if (elements.length > 0 && canOperateOn(elements[0])) {
 				IModelElement element = elements[0];
 				if (elements.length > 1)
-					element = OpenActionUtil.selectModelElement(elements,
-							getShell(), title, message);
+					element = OpenActionUtil.selectModelElement(elements, getShell(), title, message);
 				if (element != null)
 					run(element);
 			} else
@@ -267,8 +253,7 @@
 	/**
 	 * Executes this action for the givenscriptelement.
 	 *
-	 * @param element
-	 *                    Thescriptelement to be found.
+	 * @param element Thescriptelement to be found.
 	 */
 	public void run(IModelElement element) {
 
@@ -279,8 +264,7 @@
 		try {
 			performNewSearch(element);
 		} catch (ModelException ex) {
-			ExceptionHandler.handle(ex, getShell(),
-					SearchMessages.Search_Error_search_notsuccessful_title,
+			ExceptionHandler.handle(ex, getShell(), SearchMessages.Search_Error_search_notsuccessful_title,
 					SearchMessages.Search_Error_search_notsuccessful_message);
 		}
 	}
@@ -289,29 +273,23 @@
 		DLTKSearchQuery query = new DLTKSearchQuery(createQuery(element));
 		if (query.canRunInBackground()) {
 			/*
-			 * This indirection with Object as parameter is needed to prevent
-			 * the loading of the Search plug-in: the Interpreter verifies the
-			 * method call and hence loads the types used in the method
-			 * signature, eventually triggering the loading of a plug-in (in
-			 * this case ISearchQuery results in Search plug-in being loaded).
+			 * This indirection with Object as parameter is needed to prevent the loading of
+			 * the Search plug-in: the Interpreter verifies the method call and hence loads
+			 * the types used in the method signature, eventually triggering the loading of
+			 * a plug-in (in this case ISearchQuery results in Search plug-in being loaded).
 			 */
 			SearchUtil.runQueryInBackground(query);
 		} else {
-			IProgressService progressService = PlatformUI.getWorkbench()
-					.getProgressService();
+			IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
 			/*
-			 * This indirection with Object as parameter is needed to prevent
-			 * the loading of the Search plug-in: the Interpreter verifies the
-			 * method call and hence loads the types used in the method
-			 * signature, eventually triggering the loading of a plug-in (in
-			 * this case it would be ISearchQuery).
+			 * This indirection with Object as parameter is needed to prevent the loading of
+			 * the Search plug-in: the Interpreter verifies the method call and hence loads
+			 * the types used in the method signature, eventually triggering the loading of
+			 * a plug-in (in this case it would be ISearchQuery).
 			 */
-			IStatus status = SearchUtil.runQueryInForeground(progressService,
-					query);
-			if (status
-					.matches(IStatus.ERROR | IStatus.INFO | IStatus.WARNING)) {
-				ErrorDialog.openError(getShell(),
-						SearchMessages.Search_Error_search_title,
+			IStatus status = SearchUtil.runQueryInForeground(progressService, query);
+			if (status.matches(IStatus.ERROR | IStatus.INFO | IStatus.WARNING)) {
+				ErrorDialog.openError(getShell(), SearchMessages.Search_Error_search_title,
 						SearchMessages.Search_Error_search_message, status);
 			}
 		}
@@ -321,14 +299,11 @@
 		return toolkit;
 	}
 
-	QuerySpecification createQuery(IModelElement element)
-			throws ModelException {
+	QuerySpecification createQuery(IModelElement element) throws ModelException {
 		DLTKSearchScopeFactory factory = DLTKSearchScopeFactory.getInstance();
-		IDLTKSearchScope scope = factory.createWorkspaceScope(true,
-				getLanguageToolkit());
+		IDLTKSearchScope scope = factory.createWorkspaceScope(true, getLanguageToolkit());
 		String description = factory.getWorkspaceScopeDescription(true);
-		return new ElementQuerySpecification(element, getLimitTo(), scope,
-				description);
+		return new ElementQuerySpecification(element, getLimitTo(), scope, description);
 	}
 
 	abstract int getLimitTo();
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/FindDeclarationsAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/FindDeclarationsAction.java
index 768f453..fe66dfe 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/FindDeclarationsAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/FindDeclarationsAction.java
@@ -23,10 +23,9 @@
 import org.eclipse.ui.IWorkbenchSite;
 import org.eclipse.ui.texteditor.AbstractDecoratedTextEditor;
 
-
 /**
- * Finds declarations of the selected element in the workspace.
- * The action is applicable to selections representing a Script element.
+ * Finds declarations of the selected element in the workspace. The action is
+ * applicable to selections representing a Script element.
  *
  * <p>
  * This class may be instantiated; it is not intended to be subclassed.
@@ -35,38 +34,35 @@
 public class FindDeclarationsAction extends FindAction {
 
 	/**
-	 * Creates a new <code>FindDeclarationsAction</code>. The action requires
-	 * that the selection provided by the site's selection provider is of type <code>
+	 * Creates a new <code>FindDeclarationsAction</code>. The action requires that
+	 * the selection provided by the site's selection provider is of type <code>
 	 * org.eclipse.jface.viewers.IStructuredSelection</code>.
 	 *
 	 * @param site the site providing context information for this action
 	 */
-	public FindDeclarationsAction(IDLTKLanguageToolkit toolkit,
-			IWorkbenchSite site) {
+	public FindDeclarationsAction(IDLTKLanguageToolkit toolkit, IWorkbenchSite site) {
 		super(toolkit, site);
 	}
 
 	/**
-	 * Note: This constructor is for internal use only. Clients should not call
-	 * this constructor.
+	 * Note: This constructor is for internal use only. Clients should not call this
+	 * constructor.
 	 *
 	 * @param editor the Script editor
 	 * @since 5.3
 	 */
-	public FindDeclarationsAction(IDLTKLanguageToolkit toolkit,
-			ScriptEditor editor) {
+	public FindDeclarationsAction(IDLTKLanguageToolkit toolkit, ScriptEditor editor) {
 		super(toolkit, editor);
 	}
 
 	/**
-	 * Note: This constructor is for internal use only. Clients should not call
-	 * this constructor.
+	 * Note: This constructor is for internal use only. Clients should not call this
+	 * constructor.
 	 *
 	 * @param editor the Script editor
 	 * @since 5.3
 	 */
-	public FindDeclarationsAction(IDLTKLanguageToolkit toolkit,
-			AbstractDecoratedTextEditor editor) {
+	public FindDeclarationsAction(IDLTKLanguageToolkit toolkit, AbstractDecoratedTextEditor editor) {
 		super(toolkit, editor);
 	}
 
@@ -82,13 +78,15 @@
 	}
 
 	@Override
-	Class[] getValidTypes() {
-		return new Class[] { IField.class, IMethod.class, IType.class, ISourceModule.class, IPackageDeclaration.class, IScriptFolder.class};
+	Class<?>[] getValidTypes() {
+		return new Class[] { IField.class, IMethod.class, IType.class, ISourceModule.class, IPackageDeclaration.class,
+				IScriptFolder.class };
 	}
 
 	@Override
 	int getLimitTo() {
-		return IDLTKSearchConstants.DECLARATIONS | IDLTKSearchConstants.IGNORE_DECLARING_TYPE | IDLTKSearchConstants.IGNORE_RETURN_TYPE;
+		return IDLTKSearchConstants.DECLARATIONS | IDLTKSearchConstants.IGNORE_DECLARING_TYPE
+				| IDLTKSearchConstants.IGNORE_RETURN_TYPE;
 	}
 
 }
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/FindDeclarationsInHierarchyAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/FindDeclarationsInHierarchyAction.java
index 5b5a1a9..e6b54ea 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/FindDeclarationsInHierarchyAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/FindDeclarationsInHierarchyAction.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * 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
@@ -26,10 +26,9 @@
 import org.eclipse.ui.IWorkbenchSite;
 import org.eclipse.ui.texteditor.AbstractDecoratedTextEditor;
 
-
 /**
- * Finds declarations of the selected element in its hierarchy.
- * The action is applicable to selections representing a Script element.
+ * Finds declarations of the selected element in its hierarchy. The action is
+ * applicable to selections representing a Script element.
  *
  * <p>
  * This class may be instantiated; it is not intended to be subclassed.
@@ -39,41 +38,38 @@
 
 	/**
 	 * Creates a new <code>FindDeclarationsInHierarchyAction</code>. The action
-	 * requires that the selection provided by the site's selection provider is of type
-	 * <code>IStructuredSelection</code>.
+	 * requires that the selection provided by the site's selection provider is of
+	 * type <code>IStructuredSelection</code>.
 	 *
 	 * @param site the site providing context information for this action
 	 */
-	public FindDeclarationsInHierarchyAction(IDLTKLanguageToolkit toolkit,
-			IWorkbenchSite site) {
+	public FindDeclarationsInHierarchyAction(IDLTKLanguageToolkit toolkit, IWorkbenchSite site) {
 		super(toolkit, site);
 	}
 
 	/**
-	 * Note: This constructor is for internal use only. Clients should not call
-	 * this constructor.
+	 * Note: This constructor is for internal use only. Clients should not call this
+	 * constructor.
 	 *
 	 * @param editor the Script editor
 	 */
-	public FindDeclarationsInHierarchyAction(IDLTKLanguageToolkit toolkit,
-			ScriptEditor editor) {
+	public FindDeclarationsInHierarchyAction(IDLTKLanguageToolkit toolkit, ScriptEditor editor) {
 		super(toolkit, editor);
 	}
 
 	/**
-	 * Note: This constructor is for internal use only. Clients should not call
-	 * this constructor.
+	 * Note: This constructor is for internal use only. Clients should not call this
+	 * constructor.
 	 *
 	 * @param editor the Script editor
 	 * @since 5.3
 	 */
-	public FindDeclarationsInHierarchyAction(IDLTKLanguageToolkit toolkit,
-			AbstractDecoratedTextEditor editor) {
+	public FindDeclarationsInHierarchyAction(IDLTKLanguageToolkit toolkit, AbstractDecoratedTextEditor editor) {
 		super(toolkit, editor);
 	}
 
 	@Override
-	Class[] getValidTypes() {
+	Class<?>[] getValidTypes() {
 		return new Class[] { IField.class, IMethod.class };
 	}
 
@@ -90,14 +86,14 @@
 
 	@Override
 	QuerySpecification createQuery(IModelElement element) throws ModelException {
-		DLTKSearchScopeFactory factory= DLTKSearchScopeFactory.getInstance();
+		DLTKSearchScopeFactory factory = DLTKSearchScopeFactory.getInstance();
 
-		IType type= getType(element);
+		IType type = getType(element);
 		if (type == null) {
 			return super.createQuery(element);
 		}
-		IDLTKSearchScope scope= SearchEngine.createHierarchyScope(type);
-		String description= factory.getHierarchyScopeDescription(type);
+		IDLTKSearchScope scope = SearchEngine.createHierarchyScope(type);
+		String description = factory.getHierarchyScopeDescription(type);
 		return new ElementQuerySpecification(element, getLimitTo(), scope, description);
 	}
 }
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/FindReferencesInHierarchyAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/FindReferencesInHierarchyAction.java
index 1bcb0a2..93cd888 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/FindReferencesInHierarchyAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/FindReferencesInHierarchyAction.java
@@ -27,7 +27,6 @@
 import org.eclipse.ui.IWorkbenchSite;
 import org.eclipse.ui.texteditor.AbstractDecoratedTextEditor;
 
-
 /**
  * Finds references of the selected element in its hierarchy. The action is
  * applicable to selections representing a Script element.
@@ -40,42 +39,38 @@
 
 	/**
 	 * Creates a new <code>FindReferencesInHierarchyAction</code>. The action
-	 * requires that the selection provided by the site's selection provider is
-	 * of type <code>org.eclipse.jface.viewers.IStructuredSelection</code>.
+	 * requires that the selection provided by the site's selection provider is of
+	 * type <code>org.eclipse.jface.viewers.IStructuredSelection</code>.
 	 *
-	 * @param site
-	 *            the site providing context information for this action
+	 * @param site the site providing context information for this action
 	 */
-	public FindReferencesInHierarchyAction(IDLTKLanguageToolkit toolkit,
-			IWorkbenchSite site) {
+	public FindReferencesInHierarchyAction(IDLTKLanguageToolkit toolkit, IWorkbenchSite site) {
 		super(toolkit, site);
 	}
 
 	/**
-	 * Note: This constructor is for internal use only. Clients should not call
-	 * this constructor.
+	 * Note: This constructor is for internal use only. Clients should not call this
+	 * constructor.
 	 *
 	 * @param editor the Script editor
 	 */
-	public FindReferencesInHierarchyAction(IDLTKLanguageToolkit toolkit,
-			ScriptEditor editor) {
+	public FindReferencesInHierarchyAction(IDLTKLanguageToolkit toolkit, ScriptEditor editor) {
 		super(toolkit, editor);
 	}
 
 	/**
-	 * Note: This constructor is for internal use only. Clients should not call
-	 * this constructor.
+	 * Note: This constructor is for internal use only. Clients should not call this
+	 * constructor.
 	 *
 	 * @param editor the Script editor
 	 * @since 5.3
 	 */
-	public FindReferencesInHierarchyAction(IDLTKLanguageToolkit toolkit,
-			AbstractDecoratedTextEditor editor) {
+	public FindReferencesInHierarchyAction(IDLTKLanguageToolkit toolkit, AbstractDecoratedTextEditor editor) {
 		super(toolkit, editor);
 	}
 
 	@Override
-	Class[] getValidTypes() {
+	Class<?>[] getValidTypes() {
 		return new Class[] { ISourceModule.class, IType.class, IMethod.class, IField.class };
 	}
 
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/ScriptSelectAnnotationRulerAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/ScriptSelectAnnotationRulerAction.java
index 5f2d252..b1aabe4 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/ScriptSelectAnnotationRulerAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/ScriptSelectAnnotationRulerAction.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * 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
@@ -46,7 +46,6 @@
 
 	private ITextEditor fTextEditor;
 	private Position fPosition;
-	private Annotation fAnnotation;
 	private AnnotationPreferenceLookup fAnnotationPreferenceLookup;
 	private IPreferenceStore fStore;
 	private boolean fHasCorrection;
@@ -54,15 +53,13 @@
 
 	private String fNatureId;
 
-	public ScriptSelectAnnotationRulerAction(ITextEditor editor,
-			IVerticalRulerInfo ruler, IDLTKUILanguageToolkit toolkit) {
-		this(DLTKEditorMessages.getBundleForConstructedKeys(),
-				"SelectAnnotationRulerAction.", editor, ruler, toolkit);
+	public ScriptSelectAnnotationRulerAction(ITextEditor editor, IVerticalRulerInfo ruler,
+			IDLTKUILanguageToolkit toolkit) {
+		this(DLTKEditorMessages.getBundleForConstructedKeys(), "SelectAnnotationRulerAction.", editor, ruler, toolkit);
 	}
 
-	public ScriptSelectAnnotationRulerAction(ResourceBundle bundle,
-			String prefix, ITextEditor editor, IVerticalRulerInfo ruler,
-			IDLTKUILanguageToolkit toolkit) {
+	public ScriptSelectAnnotationRulerAction(ResourceBundle bundle, String prefix, ITextEditor editor,
+			IVerticalRulerInfo ruler, IDLTKUILanguageToolkit toolkit) {
 		super(bundle, prefix, editor, ruler);
 
 		fBundle = bundle;
@@ -88,8 +85,7 @@
 	}
 
 	/*
-	 * @see
-	 * org.eclipse.jface.action.IAction#runWithEvent(org.eclipse.swt.widgets
+	 * @see org.eclipse.jface.action.IAction#runWithEvent(org.eclipse.swt.widgets
 	 * .Event)
 	 *
 	 * @since 3.2
@@ -103,12 +99,10 @@
 		// }
 
 		if (fHasCorrection) {
-			ITextOperationTarget operation = fTextEditor
-					.getAdapter(ITextOperationTarget.class);
+			ITextOperationTarget operation = fTextEditor.getAdapter(ITextOperationTarget.class);
 			final int opCode = ISourceViewer.QUICK_ASSIST;
 			if (operation != null && operation.canDoOperation(opCode)) {
-				fTextEditor.selectAndReveal(fPosition.getOffset(),
-						fPosition.getLength());
+				fTextEditor.selectAndReveal(fPosition.getOffset(), fPosition.getLength());
 				operation.doOperation(opCode);
 			}
 			return;
@@ -144,7 +138,6 @@
 
 	private void findJavaAnnotation() {
 		fPosition = null;
-		fAnnotation = null;
 		fHasCorrection = false;
 
 		AbstractMarkerAnnotationModel model = getAnnotationModel();
@@ -154,9 +147,6 @@
 		if (model == null)
 			return;
 
-		boolean hasAssistLightbulb = false;
-		// fStore.getBoolean(TclPreferenceConstants.EDITOR_QUICKASSIST_LIGHTBULB);
-
 		Iterator<Annotation> iter = model.getAnnotationIterator();
 		int layer = Integer.MIN_VALUE;
 
@@ -177,17 +167,14 @@
 				continue;
 
 			boolean isReadOnly = fTextEditor instanceof ITextEditorExtension
-					&& ((ITextEditorExtension) fTextEditor)
-							.isEditorInputReadOnly();
+					&& ((ITextEditorExtension) fTextEditor).isEditorInputReadOnly();
 			if (!isReadOnly && hasCorrections(annotation)) {
 				fPosition = position;
-				fAnnotation = annotation;
 				fHasCorrection = true;
 				layer = annotationLayer;
 				continue;
 			}
-			AnnotationPreference preference = fAnnotationPreferenceLookup
-					.getAnnotationPreference(annotation);
+			AnnotationPreference preference = fAnnotationPreferenceLookup.getAnnotationPreference(annotation);
 			if (preference == null)
 				continue;
 
@@ -197,7 +184,6 @@
 
 			if (fStore.getBoolean(key)) {
 				fPosition = position;
-				fAnnotation = annotation;
 				fHasCorrection = false;
 				layer = annotationLayer;
 			}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/ScriptOutlineInformationControl.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/ScriptOutlineInformationControl.java
index fd2e99f..22c6f2c 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/ScriptOutlineInformationControl.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/ScriptOutlineInformationControl.java
@@ -66,8 +66,7 @@
 /**
  * Show outline in light-weight control.
  */
-public class ScriptOutlineInformationControl
-		extends AbstractInformationControl {
+public class ScriptOutlineInformationControl extends AbstractInformationControl {
 
 	private KeyAdapter fKeyAdapter;
 	private OutlineContentProvider fOutlineContentProvider;
@@ -78,7 +77,6 @@
 	private OutlineLabelProvider fInnerLabelProvider;
 	protected Color fForegroundColor;
 
-	private boolean fShowOnlyMainType;
 	private LexicalSortingAction fLexicalSortingAction;
 	private SortByDefiningTypeAction fSortByDefiningTypeAction;
 	// private ShowOnlyMainTypeAction fShowOnlyMainTypeAction;
@@ -100,12 +98,9 @@
 		private boolean fShowDefiningType;
 
 		private OutlineLabelProvider() {
-			super(AppearanceAwareLabelProvider.DEFAULT_TEXTFLAGS
-					| ScriptElementLabels.F_APP_TYPE_SIGNATURE
-					| ScriptElementLabels.M_APP_RETURNTYPE
-					| ScriptElementLabels.ALL_CATEGORY,
-					AppearanceAwareLabelProvider.DEFAULT_IMAGEFLAGS,
-					getPreferenceStore());
+			super(AppearanceAwareLabelProvider.DEFAULT_TEXTFLAGS | ScriptElementLabels.F_APP_TYPE_SIGNATURE
+					| ScriptElementLabels.M_APP_RETURNTYPE | ScriptElementLabels.ALL_CATEGORY,
+					AppearanceAwareLabelProvider.DEFAULT_IMAGEFLAGS, getPreferenceStore());
 		}
 
 		@Override
@@ -115,8 +110,7 @@
 				try {
 					IType type = getDefiningType(element);
 					if (type != null) {
-						StringBuffer buf = new StringBuffer(
-								super.getText(type));
+						StringBuffer buf = new StringBuffer(super.getText(type));
 						buf.append(ScriptElementLabels.CONCAT_STRING);
 						buf.append(text);
 						return buf.toString();
@@ -200,8 +194,7 @@
 				if (i.getData() instanceof IModelElement) {
 					IModelElement je = (IModelElement) i.getData();
 					if (je.getElementType() == IModelElement.IMPORT_CONTAINER
-							|| (je.getElementType() == ModelElement.METHOD
-									&& !expandMethodChildren((IMethod) je))
+							|| (je.getElementType() == ModelElement.METHOD && !expandMethodChildren((IMethod) je))
 							|| isInnerType(je)) {
 						setExpanded(i, false);
 						return;
@@ -226,17 +219,14 @@
 
 	}
 
-	private class OutlineContentProvider
-			extends StandardModelElementContentProvider {
+	private class OutlineContentProvider extends StandardModelElementContentProvider {
 
 		private boolean fShowInheritedMembers;
 
 		/**
 		 * Creates a new Outline content provider.
 		 *
-		 * @param showInheritedMembers
-		 *                                 <code>true</code> iff inherited
-		 *                                 members are shown
+		 * @param showInheritedMembers <code>true</code> iff inherited members are shown
 		 */
 		private OutlineContentProvider(boolean showInheritedMembers) {
 			super(true);
@@ -275,8 +265,7 @@
 						Collections.addAll(children, super.getChildren(type));
 						IType[] superClasses = th.getAllSupertypes(type);
 						for (int i = 0, scLength = superClasses.length; i < scLength; i++) {
-							Collections.addAll(children,
-									super.getChildren(superClasses[i]));
+							Collections.addAll(children, super.getChildren(superClasses[i]));
 						}
 						return children.toArray();
 					}
@@ -286,8 +275,7 @@
 		}
 
 		@Override
-		public void inputChanged(Viewer viewer, Object oldInput,
-				Object newInput) {
+		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
 			super.inputChanged(viewer, oldInput, newInput);
 			fTypeHierarchies.clear();
 		}
@@ -324,20 +312,15 @@
 		private TreeViewer fOutlineViewer;
 
 		private LexicalSortingAction(TreeViewer outlineViewer) {
-			super(TextMessages.ScriptOutlineInformationControl_LexicalSortingAction_label,
-					IAction.AS_CHECK_BOX);
-			setToolTipText(
-					TextMessages.ScriptOutlineInformationControl_LexicalSortingAction_tooltip);
-			setDescription(
-					TextMessages.ScriptOutlineInformationControl_LexicalSortingAction_description);
+			super(TextMessages.ScriptOutlineInformationControl_LexicalSortingAction_label, IAction.AS_CHECK_BOX);
+			setToolTipText(TextMessages.ScriptOutlineInformationControl_LexicalSortingAction_tooltip);
+			setDescription(TextMessages.ScriptOutlineInformationControl_LexicalSortingAction_description);
 
-			DLTKPluginImages.setLocalImageDescriptors(this,
-					"alphab_sort_co.png"); //$NON-NLS-1$
+			DLTKPluginImages.setLocalImageDescriptors(this, "alphab_sort_co.png"); //$NON-NLS-1$
 
 			fOutlineViewer = outlineViewer;
 
-			boolean checked = getDialogSettings()
-					.getBoolean(STORE_LEXICAL_SORTING_CHECKED);
+			boolean checked = getDialogSettings().getBoolean(STORE_LEXICAL_SORTING_CHECKED);
 			setChecked(checked);
 			// PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
 			// IJavaHelpContextIds.LEXICAL_SORTING_BROWSING_ACTION);
@@ -353,8 +336,7 @@
 
 		private void valueChanged(final boolean on, boolean store) {
 			setChecked(on);
-			BusyIndicator.showWhile(fOutlineViewer.getControl().getDisplay(),
-					() -> fOutlineViewer.refresh(false));
+			BusyIndicator.showWhile(fOutlineViewer.getControl().getDisplay(), () -> fOutlineViewer.refresh(false));
 
 			if (store)
 				getDialogSettings().put(STORE_LEXICAL_SORTING_CHECKED, on);
@@ -370,18 +352,14 @@
 		/**
 		 * Creates the action.
 		 *
-		 * @param outlineViewer
-		 *                          the outline viewer
+		 * @param outlineViewer the outline viewer
 		 */
 		private SortByDefiningTypeAction(TreeViewer outlineViewer) {
 			super(TextMessages.ScriptOutlineInformationControl_SortByDefiningTypeAction_label);
-			setDescription(
-					TextMessages.ScriptOutlineInformationControl_SortByDefiningTypeAction_description);
-			setToolTipText(
-					TextMessages.ScriptOutlineInformationControl_SortByDefiningTypeAction_tooltip);
+			setDescription(TextMessages.ScriptOutlineInformationControl_SortByDefiningTypeAction_description);
+			setToolTipText(TextMessages.ScriptOutlineInformationControl_SortByDefiningTypeAction_tooltip);
 
-			DLTKPluginImages.setLocalImageDescriptors(this,
-					"definingtype_sort_co.png"); //$NON-NLS-1$
+			DLTKPluginImages.setLocalImageDescriptors(this, "definingtype_sort_co.png"); //$NON-NLS-1$
 
 			fOutlineViewer = outlineViewer;
 
@@ -391,29 +369,25 @@
 				System.err.println("TODO: add help support here"); //$NON-NLS-1$
 			}
 
-			boolean state = getDialogSettings()
-					.getBoolean(STORE_SORT_BY_DEFINING_TYPE_CHECKED);
+			boolean state = getDialogSettings().getBoolean(STORE_SORT_BY_DEFINING_TYPE_CHECKED);
 			setChecked(state);
 			fInnerLabelProvider.setShowDefiningType(state);
 		}
 
 		@Override
 		public void run() {
-			BusyIndicator.showWhile(fOutlineViewer.getControl().getDisplay(),
-					() -> {
-						fInnerLabelProvider.setShowDefiningType(isChecked());
-						getDialogSettings().put(
-								STORE_SORT_BY_DEFINING_TYPE_CHECKED,
-								isChecked());
+			BusyIndicator.showWhile(fOutlineViewer.getControl().getDisplay(), () -> {
+				fInnerLabelProvider.setShowDefiningType(isChecked());
+				getDialogSettings().put(STORE_SORT_BY_DEFINING_TYPE_CHECKED, isChecked());
 
-						setMatcherString(fPattern, false);
-						fOutlineViewer.refresh(true);
+				setMatcherString(fPattern, false);
+				fOutlineViewer.refresh(true);
 
-						// reveal selection
-						Object selectedElement = getSelectedElement();
-						if (selectedElement != null)
-							fOutlineViewer.reveal(selectedElement);
-					});
+				// reveal selection
+				Object selectedElement = getSelectedElement();
+				if (selectedElement != null)
+					fOutlineViewer.reveal(selectedElement);
+			});
 		}
 	}
 
@@ -425,8 +399,7 @@
 		private StringMatcher fMatcher1;
 		private StringMatcher fMatcher2;
 
-		private OrStringMatcher(String pattern1, String pattern2,
-				boolean ignoreCase, boolean foo) {
+		private OrStringMatcher(String pattern1, String pattern2, boolean ignoreCase, boolean foo) {
 			super("", false, false); //$NON-NLS-1$
 			fMatcher1 = new StringMatcher(pattern1, ignoreCase, false);
 			fMatcher2 = new StringMatcher(pattern2, ignoreCase, false);
@@ -448,10 +421,8 @@
 	 * @param commandId
 	 */
 	@Deprecated
-	public ScriptOutlineInformationControl(Shell parent, int shellStyle,
-			int treeStyle, String commandId) {
-		this(parent, shellStyle, treeStyle, commandId,
-				DLTKUIPlugin.getDefault().getPreferenceStore());
+	public ScriptOutlineInformationControl(Shell parent, int shellStyle, int treeStyle, String commandId) {
+		this(parent, shellStyle, treeStyle, commandId, DLTKUIPlugin.getDefault().getPreferenceStore());
 	}
 
 	/**
@@ -464,8 +435,8 @@
 	 * @param preferenceStore
 	 * @since 2.0
 	 */
-	public ScriptOutlineInformationControl(Shell parent, int shellStyle,
-			int treeStyle, String commandId, IPreferenceStore preferenceStore) {
+	public ScriptOutlineInformationControl(Shell parent, int shellStyle, int treeStyle, String commandId,
+			IPreferenceStore preferenceStore) {
 		super(parent, shellStyle, treeStyle, commandId, true);
 		this.fPreferenceStore = preferenceStore;
 		create();
@@ -499,22 +470,19 @@
 		treeViewer.addFilter(new NamePatternFilter());
 		treeViewer.addFilter(new MemberFilter());
 
-		fForegroundColor = parent.getDisplay()
-				.getSystemColor(SWT.COLOR_DARK_GRAY);
+		fForegroundColor = parent.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY);
 
 		fInnerLabelProvider = new OutlineLabelProvider();
 		fInnerLabelProvider.addLabelDecorator(new ProblemsLabelDecorator(null));
 		// IDecoratorManager decoratorMgr=
 		// PlatformUI.getWorkbench().getDecoratorManager();
 		/*
-		 * if
-		 * (decoratorMgr.getEnabled("org.eclipse.dltk.ui.override.decorator"))
+		 * if (decoratorMgr.getEnabled("org.eclipse.dltk.ui.override.decorator"))
 		 * //$NON-NLS-1$ fInnerLabelProvider.addLabelDecorator(new
 		 * OverrideIndicatorLabelDecorator(null));
 		 */
 
-		treeViewer.setLabelProvider(
-				new StyledDecoratingModelLabelProvider(fInnerLabelProvider));
+		treeViewer.setLabelProvider(new StyledDecoratingModelLabelProvider(fInnerLabelProvider));
 
 		fLexicalSortingAction = new LexicalSortingAction(treeViewer);
 		fSortByDefiningTypeAction = new SortByDefiningTypeAction(treeViewer);
@@ -542,13 +510,10 @@
 		String keySequence = sequences[0].format();
 
 		if (fOutlineContentProvider.isShowingInheritedMembers()) {
-			return Messages.format(
-					TextMessages.ScriptOutlineInformationControl_pressToHideInheritedMembers,
+			return Messages.format(TextMessages.ScriptOutlineInformationControl_pressToHideInheritedMembers,
 					keySequence);
 		}
-		return Messages.format(
-				TextMessages.ScriptOutlineInformationControl_pressToShowInheritedMembers,
-				keySequence);
+		return Messages.format(TextMessages.ScriptOutlineInformationControl_pressToShowInheritedMembers, keySequence);
 	}
 
 	@Override
@@ -563,8 +528,7 @@
 			return;
 		}
 		IModelElement je = (IModelElement) information;
-		ISourceModule cu = (ISourceModule) je
-				.getAncestor(IModelElement.SOURCE_MODULE);
+		ISourceModule cu = (ISourceModule) je.getAncestor(IModelElement.SOURCE_MODULE);
 		if (cu != null)
 			fInput = cu;
 
@@ -578,11 +542,9 @@
 			fKeyAdapter = new KeyAdapter() {
 				@Override
 				public void keyPressed(KeyEvent e) {
-					int accelerator = SWTKeySupport
-							.convertEventToUnmodifiedAccelerator(e);
-					KeySequence keySequence = KeySequence.getInstance(
-							SWTKeySupport.convertAcceleratorToKeyStroke(
-									accelerator));
+					int accelerator = SWTKeySupport.convertEventToUnmodifiedAccelerator(e);
+					KeySequence keySequence = KeySequence
+							.getInstance(SWTKeySupport.convertAcceleratorToKeyStroke(accelerator));
 					KeySequence[] sequences = getInvokingCommandKeySequences();
 					if (sequences == null)
 						return;
@@ -637,8 +599,7 @@
 
 		boolean ignoreCase = pattern.toLowerCase().equals(pattern);
 		String pattern2 = "*" + ScriptElementLabels.CONCAT_STRING + pattern; //$NON-NLS-1$
-		fStringMatcher = new OrStringMatcher(pattern, pattern2, ignoreCase,
-				false);
+		fStringMatcher = new OrStringMatcher(pattern, pattern2, ignoreCase, false);
 
 		if (update)
 			stringMatcherUpdated();
@@ -649,8 +610,7 @@
 		ITypeHierarchy th = fTypeHierarchies.get(type);
 		if (th == null) {
 			try {
-				th = TypeHierarchyBuilders.getTypeHierarchy(type,
-						ITypeHierarchy.Mode.SUPERTYPE, getProgressMonitor());
+				th = TypeHierarchyBuilders.getTypeHierarchy(type, ITypeHierarchy.Mode.SUPERTYPE, getProgressMonitor());
 			} catch (OperationCanceledException e) {
 				return null;
 			}
@@ -668,8 +628,7 @@
 		if (editor == null)
 			return null;
 
-		return editor.getEditorSite().getActionBars().getStatusLineManager()
-				.getProgressMonitor();
+		return editor.getEditorSite().getActionBars().getStatusLineManager().getProgressMonitor();
 	}
 
 	protected boolean isInnerType(IModelElement element) {
@@ -678,10 +637,9 @@
 			// try {
 			return type.getDeclaringType() != null;
 			/*
-			 * } catch (ModelException e) { IModelElement parent=
-			 * type.getParent(); if (parent != null) { int parentElementType=
-			 * parent.getElementType(); return (parentElementType !=
-			 * IModelElement.SOURCE_MODULE); } }
+			 * } catch (ModelException e) { IModelElement parent= type.getParent(); if
+			 * (parent != null) { int parentElementType= parent.getElementType(); return
+			 * (parentElementType != IModelElement.SOURCE_MODULE); } }
 			 */
 		}
 		return false;