Generify and lambda conversion.

ScriptExplorer related classes.
Also change the save action to format whole class as only edited line
leaves inconsistent formatting.

Change-Id: I06724d596a3d2080c5bfbe9ff6eb2acab824397a
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/core/plugins/org.eclipse.dltk.ui/.settings/org.eclipse.jdt.ui.prefs b/core/plugins/org.eclipse.dltk.ui/.settings/org.eclipse.jdt.ui.prefs
index 6dd4da6..9f776e8 100644
--- a/core/plugins/org.eclipse.dltk.ui/.settings/org.eclipse.jdt.ui.prefs
+++ b/core/plugins/org.eclipse.dltk.ui/.settings/org.eclipse.jdt.ui.prefs
@@ -19,7 +19,7 @@
 sp_cleanup.convert_to_enhanced_for_loop=false
 sp_cleanup.correct_indentation=false
 sp_cleanup.format_source_code=true
-sp_cleanup.format_source_code_changes_only=true
+sp_cleanup.format_source_code_changes_only=false
 sp_cleanup.insert_inferred_type_arguments=false
 sp_cleanup.make_local_variable_final=false
 sp_cleanup.make_parameters_final=false
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptOutlinePage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptOutlinePage.java
index dcbeb20..e8b76df 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptOutlinePage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptOutlinePage.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -55,7 +55,6 @@
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.GroupMarker;
 import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
 import org.eclipse.jface.action.IMenuManager;
 import org.eclipse.jface.action.IStatusLineManager;
 import org.eclipse.jface.action.IToolBarManager;
@@ -109,12 +108,12 @@
  * IClassFiles. Publishes its context menu under
  * <code>JavaPlugin.getDefault().getPluginId() + ".outline"</code>.
  */
-public class ScriptOutlinePage extends Page implements IContentOutlinePage,
-		IAdaptable, IPostSelectionProvider {
+public class ScriptOutlinePage extends Page
+		implements IContentOutlinePage, IAdaptable, IPostSelectionProvider {
 
 	/**
 	 * Content provider for the children of an ICompilationUnit or an IClassFile
-	 * 
+	 *
 	 * @see ITreeContentProvider
 	 */
 	protected class ChildrenProvider implements ITreeContentProvider {
@@ -210,7 +209,8 @@
 		 * @see IContentProvider#inputChanged(Viewer, Object, Object)
 		 */
 		@Override
-		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+		public void inputChanged(Viewer viewer, Object oldInput,
+				Object newInput) {
 			boolean isCU = (newInput instanceof ISourceModule);
 
 			if (isCU && fListener == null) {
@@ -233,7 +233,7 @@
 
 	/**
 	 * The element change listener of the java outline viewer.
-	 * 
+	 *
 	 * @see IElementChangedListener
 	 */
 	protected class ElementChangedListener implements IElementChangedListener {
@@ -247,17 +247,13 @@
 
 			Display d = getControl().getDisplay();
 			if (d != null) {
-				d.asyncExec(new Runnable() {
-					@Override
-					public void run() {
-						ISourceModule cu = (ISourceModule) fInput;
-						IModelElement base = cu;
+				d.asyncExec(() -> {
+					ISourceModule cu = (ISourceModule) fInput;
+					IModelElement base = cu;
 
-						IModelElementDelta delta = findElement(base, e
-								.getDelta());
-						if (delta != null && fOutlineViewer != null) {
-							fOutlineViewer.reconcile(delta);
-						}
+					IModelElementDelta delta = findElement(base, e.getDelta());
+					if (delta != null && fOutlineViewer != null) {
+						fOutlineViewer.reconcile(delta);
 					}
 				});
 			}
@@ -306,17 +302,18 @@
 			if ((flags & IModelElementDelta.F_CHILDREN) != 0) {
 				return true;
 			}
-			return (flags & (IModelElementDelta.F_CONTENT | IModelElementDelta.F_FINE_GRAINED)) == IModelElementDelta.F_CONTENT;
+			return (flags & (IModelElementDelta.F_CONTENT
+					| IModelElementDelta.F_FINE_GRAINED)) == IModelElementDelta.F_CONTENT;
 		}
 	}
 
 	/**
 	 * Empty selection provider.
-	 * 
+	 *
 	 * @since 3.2
 	 */
-	private static final class EmptySelectionProvider implements
-			ISelectionProvider {
+	private static final class EmptySelectionProvider
+			implements ISelectionProvider {
 		@Override
 		public void addSelectionChangedListener(
 				ISelectionChangedListener listener) {
@@ -341,7 +338,7 @@
 
 	/**
 	 * The tree viewer used for displaying the outline.
-	 * 
+	 *
 	 * @see TreeViewer
 	 */
 	protected class ScriptOutlineViewer extends TreeViewer {
@@ -359,9 +356,9 @@
 				cu = cu.getPrimary();
 				return cu.getResource();
 			} /*
-			 * else if (input instanceof IClassFile) { return ((IClassFile)
-			 * input).getResource(); }
-			 */
+				 * else if (input instanceof IClassFile) { return ((IClassFile)
+				 * input).getResource(); }
+				 */
 			return null;
 		}
 
@@ -419,7 +416,7 @@
 		/**
 		 * Investigates the given element change event and if affected
 		 * incrementally updates the Java outline.
-		 * 
+		 *
 		 * @param delta
 		 *            the Java element delta used to reconcile the Java outline
 		 */
@@ -444,7 +441,8 @@
 			DLTKPluginImages.setLocalImageDescriptors(this,
 					"alphab_sort_co.png"); //$NON-NLS-1$
 			setToolTipText(DLTKEditorMessages.ScriptOutlinePage_Sort_tooltip);
-			setDescription(DLTKEditorMessages.ScriptOutlinePage_Sort_description);
+			setDescription(
+					DLTKEditorMessages.ScriptOutlinePage_Sort_description);
 
 			boolean checked = fStore
 					.getBoolean(LEXICAL_SORTING_ACTION_IS_CHECKED);
@@ -459,23 +457,19 @@
 		private void valueChanged(final boolean on, boolean store) {
 			setChecked(on);
 			BusyIndicator.showWhile(fOutlineViewer.getControl().getDisplay(),
-					new Runnable() {
-						@Override
-						public void run() {
-							if (on) {
-								fOutlineViewer.setComparator(fComparator);
-								fDropSupport.setFeedbackEnabled(false);
-							} else {
-								fOutlineViewer
-										.setComparator(fSourcePositonComparator);
-								fDropSupport.setFeedbackEnabled(true);
-							}
+					() -> {
+						if (on) {
+							fOutlineViewer.setComparator(fComparator);
+							fDropSupport.setFeedbackEnabled(false);
+						} else {
+							fOutlineViewer
+									.setComparator(fSourcePositonComparator);
+							fDropSupport.setFeedbackEnabled(true);
 						}
 					});
 
 			if (store) {
-				fStore.setValue(
-						LEXICAL_SORTING_ACTION_IS_CHECKED, on);
+				fStore.setValue(LEXICAL_SORTING_ACTION_IS_CHECKED, on);
 			}
 		}
 	}
@@ -483,7 +477,7 @@
 	/**
 	 * This action toggles whether this Java Outline page links its selection to
 	 * the active editor.
-	 * 
+	 *
 	 * @since 3.0
 	 */
 	public class ToggleLinkingAction extends AbstractToggleLinkingAction {
@@ -492,13 +486,13 @@
 
 		/**
 		 * Constructs a new action.
-		 * 
+		 *
 		 * @param outlinePage
 		 *            the Java outline page
 		 */
 		public ToggleLinkingAction(ScriptOutlinePage outlinePage) {
-			boolean isLinkingEnabled = fStore
-					.getBoolean(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE);
+			boolean isLinkingEnabled = fStore.getBoolean(
+					PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE);
 			setChecked(isLinkingEnabled);
 			fJavaOutlinePage = outlinePage;
 		}
@@ -512,8 +506,8 @@
 					PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE,
 					isChecked());
 			if (isChecked() && fEditor != null) {
-				fEditor.synchronizeOutlinePage(fEditor
-						.computeHighlightRangeSourceReference(), false);
+				fEditor.synchronizeOutlinePage(
+						fEditor.computeHighlightRangeSourceReference(), false);
 			}
 		}
 
@@ -546,7 +540,7 @@
 	private IPropertyChangeListener fPropertyChangeListener;
 	/**
 	 * Custom filter action group.
-	 * 
+	 *
 	 * @since 3.0
 	 */
 	private CustomFiltersActionGroup fCustomFiltersActionGroup;
@@ -575,19 +569,14 @@
 			fTogglePresentation.setEditor((ITextEditor) editor);
 		}
 
-		fPropertyChangeListener = new IPropertyChangeListener() {
-			@Override
-			public void propertyChange(PropertyChangeEvent event) {
-				doPropertyChange(event);
-			}
-		};
+		fPropertyChangeListener = event -> doPropertyChange(event);
 		fStore.addPropertyChangeListener(fPropertyChangeListener);
 	}
 
 	/**
 	 * Convenience method to add the action installed under the given actionID
 	 * to the specified group of the menu.
-	 * 
+	 *
 	 * @param menu
 	 *            the menu manager
 	 * @param group
@@ -614,8 +603,8 @@
 	}
 
 	/*
-	 * @see
-	 * org.eclipse.jface.text.IPostSelectionProvider#addPostSelectionChangedListener
+	 * @see org.eclipse.jface.text.IPostSelectionProvider#
+	 * addPostSelectionChangedListener
 	 * (org.eclipse.jface.viewers.ISelectionChangedListener)
 	 */
 	@Override
@@ -633,7 +622,8 @@
 	 * ISelectionProvider#addSelectionChangedListener(ISelectionChangedListener)
 	 */
 	@Override
-	public void addSelectionChangedListener(ISelectionChangedListener listener) {
+	public void addSelectionChangedListener(
+			ISelectionChangedListener listener) {
 		if (fOutlineViewer != null) {
 			fOutlineViewer.addSelectionChangedListener(listener);
 		} else {
@@ -689,51 +679,46 @@
 		fOutlineViewer = new ScriptOutlineViewer(tree);
 		initDragAndDrop();
 		fOutlineViewer.setContentProvider(new ChildrenProvider());
-		fOutlineViewer.setLabelProvider(new StyledDecoratingModelLabelProvider(
-				lprovider));
+		fOutlineViewer.setLabelProvider(
+				new StyledDecoratingModelLabelProvider(lprovider));
 
 		Object[] listeners = fSelectionChangedListeners.getListeners();
 		for (int i = 0; i < listeners.length; i++) {
 			fSelectionChangedListeners.remove(listeners[i]);
-			fOutlineViewer
-					.addSelectionChangedListener((ISelectionChangedListener) listeners[i]);
+			fOutlineViewer.addSelectionChangedListener(
+					(ISelectionChangedListener) listeners[i]);
 		}
 
 		listeners = fPostSelectionChangedListeners.getListeners();
 		for (int i = 0; i < listeners.length; i++) {
 			fPostSelectionChangedListeners.remove(listeners[i]);
-			fOutlineViewer
-					.addPostSelectionChangedListener((ISelectionChangedListener) listeners[i]);
+			fOutlineViewer.addPostSelectionChangedListener(
+					(ISelectionChangedListener) listeners[i]);
 		}
 
-		MenuManager manager = new MenuManager(DLTKUIPlugin.getPluginId()
-				+ ".outline", DLTKUIPlugin.getPluginId() + ".outline"); //$NON-NLS-1$ //$NON-NLS-2$
+		MenuManager manager = new MenuManager(
+				DLTKUIPlugin.getPluginId() + ".outline", //$NON-NLS-1$
+				DLTKUIPlugin.getPluginId() + ".outline"); //$NON-NLS-1$
 		manager.setRemoveAllWhenShown(true);
-		manager.addMenuListener(new IMenuListener() {
-			@Override
-			public void menuAboutToShow(IMenuManager m) {
-				contextMenuAboutToShow(m);
-			}
-		});
+		manager.addMenuListener(m -> contextMenuAboutToShow(m));
 		fMenu = manager.createContextMenu(tree);
 		tree.setMenu(fMenu);
 
 		IPageSite site = getSite();
-		site
-				.registerContextMenu(
-						DLTKUIPlugin.getPluginId() + ".outline", manager, fOutlineViewer); //$NON-NLS-1$
+		site.registerContextMenu(DLTKUIPlugin.getPluginId() + ".outline", //$NON-NLS-1$
+				manager, fOutlineViewer);
 
 		updateSelectionProvider(site);
 
 		IDLTKLanguageToolkit toolkit = fEditor.getLanguageToolkit();
 		// we must create the groups after we have set the selection provider to
 		// the site
-		fActionGroups = new CompositeActionGroup(new ActionGroup[] {
-				new OpenViewActionGroup(this),
-				// new CCPActionGroup(this),
-				/* new GenerateActionGroup(this), */
-				new RefactorActionGroup(this, toolkit),
-				new SearchActionGroup(this, toolkit) });
+		fActionGroups = new CompositeActionGroup(
+				new ActionGroup[] { new OpenViewActionGroup(this),
+						// new CCPActionGroup(this),
+						/* new GenerateActionGroup(this), */
+						new RefactorActionGroup(this, toolkit),
+						new SearchActionGroup(this, toolkit) });
 
 		// register global actions
 		IActionBars actionBars = site.getActionBars();
@@ -748,17 +733,15 @@
 		actionBars.setGlobalActionHandler(ITextEditorActionConstants.NEXT,
 				action);
 		action = fEditor.getAction(ITextEditorActionConstants.PREVIOUS);
-		actionBars
-				.setGlobalActionHandler(
-						ITextEditorActionDefinitionIds.GOTO_PREVIOUS_ANNOTATION,
-						action);
+		actionBars.setGlobalActionHandler(
+				ITextEditorActionDefinitionIds.GOTO_PREVIOUS_ANNOTATION,
+				action);
 		actionBars.setGlobalActionHandler(ITextEditorActionConstants.PREVIOUS,
 				action);
 		if (fTogglePresentation != null) {
-			actionBars
-					.setGlobalActionHandler(
-							ITextEditorActionDefinitionIds.TOGGLE_SHOW_SELECTED_ELEMENT_ONLY,
-							fTogglePresentation);
+			actionBars.setGlobalActionHandler(
+					ITextEditorActionDefinitionIds.TOGGLE_SHOW_SELECTED_ELEMENT_ONLY,
+					fTogglePresentation);
 		}
 
 		fActionGroups.fillActionBars(actionBars);
@@ -833,8 +816,8 @@
 
 	private void doPropertyChange(PropertyChangeEvent event) {
 		if (fOutlineViewer != null) {
-			if (MembersOrderPreferenceCache.isMemberOrderProperty(event
-					.getProperty())) {
+			if (MembersOrderPreferenceCache
+					.isMemberOrderProperty(event.getProperty())) {
 				fOutlineViewer.refresh(false);
 			}
 		}
@@ -852,13 +835,8 @@
 			return (T) getShowInSource();
 		}
 		if (key == IShowInTargetList.class) {
-			return (T) new IShowInTargetList() {
-				@Override
-				public String[] getShowInTargetIds() {
-					return new String[] { DLTKUIPlugin.ID_SCRIPT_EXPLORER };
-				}
-
-			};
+			return (T) (IShowInTargetList) () -> new String[] {
+					DLTKUIPlugin.ID_SCRIPT_EXPLORER };
 		}
 		if (key == IShowInTarget.class) {
 			return (T) getShowInTarget();
@@ -877,7 +855,7 @@
 
 	/**
 	 * Returns the <code>JavaOutlineViewer</code> of this view.
-	 * 
+	 *
 	 * @return the {@link ScriptOutlineViewer}
 	 * @since 3.3
 	 */
@@ -898,43 +876,35 @@
 
 	/**
 	 * Returns the <code>IShowInSource</code> for this view.
-	 * 
+	 *
 	 * @return the {@link IShowInSource}
 	 */
 	protected IShowInSource getShowInSource() {
-		return new IShowInSource() {
-			@Override
-			public ShowInContext getShowInContext() {
-				return new ShowInContext(null, getSite().getSelectionProvider()
-						.getSelection());
-			}
-		};
+		return () -> new ShowInContext(null,
+				getSite().getSelectionProvider().getSelection());
 	}
 
 	/**
 	 * Returns the <code>IShowInTarget</code> for this view.
-	 * 
+	 *
 	 * @return the {@link IShowInTarget}
 	 */
 	protected IShowInTarget getShowInTarget() {
-		return new IShowInTarget() {
-			@Override
-			public boolean show(ShowInContext context) {
-				ISelection sel = context.getSelection();
-				if (sel instanceof ITextSelection) {
-					ITextSelection tsel = (ITextSelection) sel;
-					int offset = tsel.getOffset();
-					IModelElement element = fEditor.getElementAt(offset);
-					if (element != null) {
-						setSelection(new StructuredSelection(element));
-						return true;
-					}
-				} else if (sel instanceof IStructuredSelection) {
-					setSelection(sel);
+		return context -> {
+			ISelection sel = context.getSelection();
+			if (sel instanceof ITextSelection) {
+				ITextSelection tsel = (ITextSelection) sel;
+				int offset = tsel.getOffset();
+				IModelElement element = fEditor.getElementAt(offset);
+				if (element != null) {
+					setSelection(new StructuredSelection(element));
 					return true;
 				}
-				return false;
+			} else if (sel instanceof IStructuredSelection) {
+				setSelection(sel);
+				return true;
 			}
+			return false;
 		};
 	}
 
@@ -956,7 +926,7 @@
 	/**
 	 * Answers if a given model element should be collapsed initially in the
 	 * Outline view.
-	 * 
+	 *
 	 * @param element
 	 *            the model element
 	 * @return <code>true</code> iff the given element should be initially
@@ -974,7 +944,8 @@
 		} else if (elementType == IModelElement.METHOD
 				|| elementType == IModelElement.FIELD) {
 			final IModelElement parent = element.getParent();
-			if (parent != null && parent.getElementType() == IModelElement.TYPE) {
+			if (parent != null
+					&& parent.getElementType() == IModelElement.TYPE) {
 				// collapse methods/fields of a type if no nested types
 				try {
 					if (!containsTypes((IMember) element)) {
@@ -992,7 +963,7 @@
 		for (IModelElement child : ((IParent) element).getChildren()) {
 			if (child.getElementType() == IModelElement.TYPE
 					|| child instanceof IMember
-					&& containsTypes((IMember) child)) {
+							&& containsTypes((IMember) child)) {
 				return true;
 			}
 		}
@@ -1045,9 +1016,8 @@
 	}
 
 	/*
-	 * @see
-	 * ISelectionProvider#removeSelectionChangedListener(ISelectionChangedListener
-	 * )
+	 * @see ISelectionProvider#removeSelectionChangedListener(
+	 * ISelectionChangedListener )
 	 */
 	@Override
 	public void removeSelectionChangedListener(
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/navigator/ProjectFragmentProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/navigator/ProjectFragmentProvider.java
index 2fad3c9..1277e7d 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/navigator/ProjectFragmentProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/navigator/ProjectFragmentProvider.java
@@ -33,10 +33,9 @@
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Display;
 
-
 /**
- * Content provider which provides package fragments for hierarchical
- * Package Explorer layout.
+ * Content provider which provides package fragments for hierarchical Package
+ * Explorer layout.
  *
  */
 public class ProjectFragmentProvider implements IPropertyChangeListener {
@@ -47,48 +46,52 @@
 
 	public ProjectFragmentProvider(IPreferenceStore store) {
 		fStore = store;
-		fFoldPackages= arePackagesFoldedInHierarchicalLayout();
+		fFoldPackages = arePackagesFoldedInHierarchicalLayout();
 		fStore.addPropertyChangeListener(this);
 	}
 
 	public Object[] getChildren(Object parentElement) {
 		try {
 			if (parentElement instanceof IFolder) {
-				IResource[] resources= ((IFolder) parentElement).members();
+				IResource[] resources = ((IFolder) parentElement).members();
 				return filter(getFolders(resources)).toArray();
 			} else if (parentElement instanceof IModelElement) {
-				IModelElement iModelElement= (IModelElement) parentElement;
-				int type= iModelElement.getElementType();
+				IModelElement iModelElement = (IModelElement) parentElement;
+				int type = iModelElement.getElementType();
 
 				switch (type) {
-					case IModelElement.SCRIPT_PROJECT: {
-						IScriptProject project= (IScriptProject) iModelElement;
+				case IModelElement.SCRIPT_PROJECT: {
+					IScriptProject project = (IScriptProject) iModelElement;
 
-						IProjectFragment root= project.findProjectFragment(project.getPath());
-						if (root != null) {
-							List children= getTopLevelChildren(root);
-							return filter(children).toArray();
-						}
-						break;
+					IProjectFragment root = project
+							.findProjectFragment(project.getPath());
+					if (root != null) {
+						List<IModelElement> children = getTopLevelChildren(
+								root);
+						return filter(children).toArray();
 					}
-					case IModelElement.PROJECT_FRAGMENT: {
-						IProjectFragment root= (IProjectFragment) parentElement;
-						if (root.exists()) {
-							return filter(getTopLevelChildren(root)).toArray();
-						}
-						break;
+					break;
+				}
+				case IModelElement.PROJECT_FRAGMENT: {
+					IProjectFragment root = (IProjectFragment) parentElement;
+					if (root.exists()) {
+						return filter(getTopLevelChildren(root)).toArray();
 					}
-					case IModelElement.SCRIPT_FOLDER: {
-						IScriptFolder scriptFolder = (IScriptFolder) parentElement;
-						if (!scriptFolder.isRootFolder()) {
-							IProjectFragment root= (IProjectFragment) scriptFolder.getParent();
-							List children = getPackageChildren(root, scriptFolder);
-							return filter(children).toArray();
-						}
-						break;
+					break;
+				}
+				case IModelElement.SCRIPT_FOLDER: {
+					IScriptFolder scriptFolder = (IScriptFolder) parentElement;
+					if (!scriptFolder.isRootFolder()) {
+						IProjectFragment root = (IProjectFragment) scriptFolder
+								.getParent();
+						List<IScriptFolder> children = getPackageChildren(root,
+								scriptFolder);
+						return filter(children).toArray();
 					}
-					default :
-						// do nothing
+					break;
+				}
+				default:
+					// do nothing
 				}
 			}
 		} catch (CoreException e) {
@@ -99,15 +102,16 @@
 
 	private List filter(List children) throws ModelException {
 		if (fFoldPackages) {
-			int size= children.size();
+			int size = children.size();
 			for (int i = 0; i < size; i++) {
-				Object curr= children.get(i);
+				Object curr = children.get(i);
 				if (curr instanceof IScriptFolder) {
 					IScriptFolder fragment = (IScriptFolder) curr;
 					if (!fragment.isRootFolder() && isEmpty(fragment)) {
-						IScriptFolder collapsed= getCollapsed(fragment);
+						IScriptFolder collapsed = getCollapsed(fragment);
 						if (collapsed != null) {
-							children.set(i, collapsed); // replace with collapsed
+							children.set(i, collapsed); // replace with
+														// collapsed
 						}
 					}
 				}
@@ -116,33 +120,40 @@
 		return children;
 	}
 
-	private IScriptFolder getCollapsed(IScriptFolder pack) throws ModelException {
-		IModelElement[] children= ((IProjectFragment) pack.getParent()).getChildren();
-		IScriptFolder child= getSinglePackageChild(pack, children);
+	private IScriptFolder getCollapsed(IScriptFolder pack)
+			throws ModelException {
+		IModelElement[] children = ((IProjectFragment) pack.getParent())
+				.getChildren();
+		IScriptFolder child = getSinglePackageChild(pack, children);
 		while (child != null && isEmpty(child)) {
-			IScriptFolder collapsed= getSinglePackageChild(child, children);
+			IScriptFolder collapsed = getSinglePackageChild(child, children);
 			if (collapsed == null) {
 				return child;
 			}
-			child= collapsed;
+			child = collapsed;
 		}
 		return child;
 	}
 
 	private boolean isEmpty(IScriptFolder fragment) throws ModelException {
-		return !fragment.containsScriptResources() && fragment.getForeignResources().length == 0;
+		return !fragment.containsScriptResources()
+				&& fragment.getForeignResources().length == 0;
 	}
 
-	private static IScriptFolder getSinglePackageChild(IScriptFolder fragment, IModelElement[] children) {
-		String prefix= fragment.getElementName() + IScriptFolder.PACKAGE_DELIMITER;
-		int prefixLen= prefix.length();
-		IScriptFolder found= null;
-		for (int i= 0; i < children.length; i++) {
-			IModelElement element= children[i];
-			String name= element.getElementName();
-			if (name.startsWith(prefix) && name.length() > prefixLen && name.indexOf(IScriptFolder.PACKAGE_DELIMITER, prefixLen) == -1) {
+	private static IScriptFolder getSinglePackageChild(IScriptFolder fragment,
+			IModelElement[] children) {
+		String prefix = fragment.getElementName()
+				+ IScriptFolder.PACKAGE_DELIMITER;
+		int prefixLen = prefix.length();
+		IScriptFolder found = null;
+		for (int i = 0; i < children.length; i++) {
+			IModelElement element = children[i];
+			String name = element.getElementName();
+			if (name.startsWith(prefix) && name.length() > prefixLen
+					&& name.indexOf(IScriptFolder.PACKAGE_DELIMITER,
+							prefixLen) == -1) {
 				if (found == null) {
-					found= (IScriptFolder) element;
+					found = (IScriptFolder) element;
 				} else {
 					return null;
 				}
@@ -151,36 +162,44 @@
 		return found;
 	}
 
-
-	private static List getPackageChildren(IProjectFragment parent, IScriptFolder fragment) throws ModelException {
-		IModelElement[] children= parent.getChildren();
-		ArrayList list= new ArrayList(children.length);
-		String prefix= fragment.getElementName() + IScriptFolder.PACKAGE_DELIMITER;
-		int prefixLen= prefix.length();
-		for (int i= 0; i < children.length; i++) {
-			IModelElement element= children[i];
+	private static List<IScriptFolder> getPackageChildren(
+			IProjectFragment parent, IScriptFolder fragment)
+			throws ModelException {
+		IModelElement[] children = parent.getChildren();
+		ArrayList<IScriptFolder> list = new ArrayList<>(children.length);
+		String prefix = fragment.getElementName()
+				+ IScriptFolder.PACKAGE_DELIMITER;
+		int prefixLen = prefix.length();
+		for (int i = 0; i < children.length; i++) {
+			IModelElement element = children[i];
 			if (element instanceof IScriptFolder) { // see bug 134256
-				String name= element.getElementName();
-				if (name.startsWith(prefix) && name.length() > prefixLen && name.indexOf(IScriptFolder.PACKAGE_DELIMETER_STR, prefixLen) == -1) {
-					list.add(element);
+				String name = element.getElementName();
+				if (name.startsWith(prefix) && name.length() > prefixLen
+						&& name.indexOf(IScriptFolder.PACKAGE_DELIMETER_STR,
+								prefixLen) == -1) {
+					list.add((IScriptFolder) element);
 				}
 			}
 		}
 		return list;
 	}
 
-	private static List getTopLevelChildren(IProjectFragment root) throws ModelException {
-		IModelElement[] elements= root.getChildren();
-		ArrayList topLevelElements= new ArrayList(elements.length);
-		for (int i= 0; i < elements.length; i++) {
-			IModelElement iModelElement= elements[i];
-			//if the name of the ScriptFolder is the top level package it will contain no "." separators
-			if (iModelElement instanceof IScriptFolder && iModelElement.getElementName().indexOf(IScriptFolder.PACKAGE_DELIMITER)==-1) {
+	private static List<IModelElement> getTopLevelChildren(
+			IProjectFragment root) throws ModelException {
+		IModelElement[] elements = root.getChildren();
+		ArrayList<IModelElement> topLevelElements = new ArrayList<>(
+				elements.length);
+		for (int i = 0; i < elements.length; i++) {
+			IModelElement iModelElement = elements[i];
+			// if the name of the ScriptFolder is the top level package it will
+			// contain no "." separators
+			if (iModelElement instanceof IScriptFolder
+					&& iModelElement.getElementName()
+							.indexOf(IScriptFolder.PACKAGE_DELIMITER) == -1) {
 				IScriptFolder folder = (IScriptFolder) iModelElement;
-				if( !folder.isRootFolder() ) {
+				if (!folder.isRootFolder()) {
 					topLevelElements.add(iModelElement);
-				}
-				else {
+				} else {
 					IModelElement[] children = folder.getChildren();
 					for (int j = 0; j < children.length; j++) {
 						topLevelElements.add(children[j]);
@@ -191,32 +210,32 @@
 		return topLevelElements;
 	}
 
-	private List getFolders(IResource[] resources) throws ModelException {
-		List list= new ArrayList(resources.length);
-		for (int i= 0; i < resources.length; i++) {
-			IResource resource= resources[i];
+	private List<IFolder> getFolders(IResource[] resources)
+			throws ModelException {
+		List<IFolder> list = new ArrayList<>(resources.length);
+		for (int i = 0; i < resources.length; i++) {
+			IResource resource = resources[i];
 			if (resource instanceof IFolder) {
 				IFolder folder = (IFolder) resource;
-//				IModelElement element= DLTKCore.create(folder);
-//				if (element instanceof IScriptFolder) {
-					IProject project = folder.getProject();
-					IScriptProject scriptProject= DLTKCore.create(project);
-					if (scriptProject != null) {
-						if (scriptProject.isOnBuildpath(folder))
-							list.add(folder);
-					}
-//				}
+				// IModelElement element= DLTKCore.create(folder);
+				// if (element instanceof IScriptFolder) {
+				IProject project = folder.getProject();
+				IScriptProject scriptProject = DLTKCore.create(project);
+				if (scriptProject != null) {
+					if (scriptProject.isOnBuildpath(folder))
+						list.add(folder);
+				}
+				// }
 			}
 		}
 		return list;
 	}
 
-
 	public Object getParent(Object element) {
 
 		if (element instanceof IScriptFolder) {
 			IScriptFolder frag = (IScriptFolder) element;
-			//@Changed: a fix, before: if(frag.exists() && isEmpty(frag))
+			// @Changed: a fix, before: if(frag.exists() && isEmpty(frag))
 
 			return filterParent(getActualParent(frag));
 		}
@@ -236,7 +255,8 @@
 					} else {
 
 						IResource resource = fragment.getUnderlyingResource();
-						if ((resource != null) && (resource instanceof IFolder)) {
+						if ((resource != null)
+								&& (resource instanceof IFolder)) {
 							IFolder folder = (IFolder) resource;
 							IResource res = folder.getParent();
 
@@ -259,7 +279,7 @@
 	}
 
 	private Object filterParent(Object parent) {
-		if (fFoldPackages && (parent!=null)) {
+		if (fFoldPackages && (parent != null)) {
 			try {
 				if (parent instanceof IScriptFolder) {
 					IScriptFolder fragment = (IScriptFolder) parent;
@@ -275,17 +295,17 @@
 	}
 
 	private boolean hasSingleChild(IScriptFolder fragment) {
-		return getChildren(fragment).length==1;
+		return getChildren(fragment).length == 1;
 	}
 
-
 	private Object findNextLevelParentByElementName(IScriptFolder child) {
-		String name= child.getElementName();
+		String name = child.getElementName();
 
-		int index= name.lastIndexOf(IScriptFolder.PACKAGE_DELIMITER);
+		int index = name.lastIndexOf(IScriptFolder.PACKAGE_DELIMITER);
 		if (index != -1) {
-			String realParentName= name.substring(0, index);
-			IScriptFolder element= ((IProjectFragment) child.getParent()).getScriptFolder(realParentName);
+			String realParentName = name.substring(0, index);
+			IScriptFolder element = ((IProjectFragment) child.getParent())
+					.getScriptFolder(realParentName);
 			if (element.exists()) {
 				return element;
 			}
@@ -293,22 +313,22 @@
 		return child.getParent();
 	}
 
-
 	/*
 	 * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(Object)
 	 */
 	public boolean hasChildren(Object element) {
 
 		if (element instanceof IScriptFolder) {
-			IScriptFolder fragment= (IScriptFolder) element;
-			if(fragment.isRootFolder())
+			IScriptFolder fragment = (IScriptFolder) element;
+			if (fragment.isRootFolder())
 				return false;
 		}
 		return getChildren(element).length > 0;
 	}
 
 	/*
-	 * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(Object)
+	 * @see
+	 * org.eclipse.jface.viewers.IStructuredContentProvider#getElements(Object)
 	 */
 	public Object[] getElements(Object inputElement) {
 		return getChildren(inputElement);
@@ -324,10 +344,11 @@
 	/**
 	 * Called when the view is closed and opened.
 	 *
-	 * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(Viewer, Object, Object)
+	 * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(Viewer,
+	 *      Object, Object)
 	 */
 	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-		fViewer= (TreeViewer)viewer;
+		fViewer = (TreeViewer) viewer;
 	}
 
 	public void elementChanged(ElementChangedEvent event) {
@@ -376,13 +397,13 @@
 	// XXX: needs to be revisited - might be a performance issue
 	private void refreshGrandParent(final IModelElement element) {
 		if (element instanceof IScriptFolder) {
-			Object gp= getGrandParent((IScriptFolder)element);
+			Object gp = getGrandParent((IScriptFolder) element);
 			if (gp instanceof IModelElement) {
 				IModelElement el = (IModelElement) gp;
-				if(el.exists())
+				if (el.exists())
 					fViewer.refresh(gp);
 			} else if (gp instanceof IFolder) {
-				IFolder folder= (IFolder)gp;
+				IFolder folder = (IFolder) gp;
 				if (folder.exists())
 					fViewer.refresh(folder);
 			}
@@ -391,16 +412,17 @@
 
 	private Object getGrandParent(IScriptFolder element) {
 
-		Object parent= findNextLevelParentByElementName(element);
+		Object parent = findNextLevelParentByElementName(element);
 		if (parent instanceof IProjectFragment) {
-			IProjectFragment root= (IProjectFragment) parent;
-			if(isRootProject(root))
+			IProjectFragment root = (IProjectFragment) parent;
+			if (isRootProject(root))
 				return root.getScriptProject();
-			else return root;
+			else
+				return root;
 		}
 
-		Object grandParent= getParent(parent);
-		if(grandParent==null){
+		Object grandParent = getParent(parent);
+		if (grandParent == null) {
 			return parent;
 		}
 		return grandParent;
@@ -413,11 +435,12 @@
 	}
 
 	private void postRunnable(final Runnable r) {
-		Control ctrl= fViewer.getControl();
+		Control ctrl = fViewer.getControl();
 		if (ctrl != null && !ctrl.isDisposed()) {
 
-			Display currentDisplay= Display.getCurrent();
-			if (currentDisplay != null && currentDisplay.equals(ctrl.getDisplay()))
+			Display currentDisplay = Display.getCurrent();
+			if (currentDisplay != null
+					&& currentDisplay.equals(ctrl.getDisplay()))
 				ctrl.getDisplay().syncExec(r);
 			else
 				ctrl.getDisplay().asyncExec(r);
@@ -425,15 +448,17 @@
 	}
 
 	/*
-	 * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+	 * @see
+	 * org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse
+	 * .jface.util.PropertyChangeEvent)
 	 */
 	@Override
 	public void propertyChange(PropertyChangeEvent event) {
-		if (arePackagesFoldedInHierarchicalLayout() != fFoldPackages){
-			fFoldPackages= arePackagesFoldedInHierarchicalLayout();
+		if (arePackagesFoldedInHierarchicalLayout() != fFoldPackages) {
+			fFoldPackages = arePackagesFoldedInHierarchicalLayout();
 			if (fViewer != null && !fViewer.getControl().isDisposed()) {
 				fViewer.getControl().setRedraw(false);
-				Object[] expandedObjects= fViewer.getExpandedElements();
+				Object[] expandedObjects = fViewer.getExpandedElements();
 				fViewer.refresh();
 				fViewer.setExpandedElements(expandedObjects);
 				fViewer.getControl().setRedraw(true);
@@ -441,7 +466,8 @@
 		}
 	}
 
-	private boolean arePackagesFoldedInHierarchicalLayout(){
-		return fStore.getBoolean(PreferenceConstants.APPEARANCE_FOLD_PACKAGES_IN_PACKAGE_EXPLORER);
+	private boolean arePackagesFoldedInHierarchicalLayout() {
+		return fStore.getBoolean(
+				PreferenceConstants.APPEARANCE_FOLD_PACKAGES_IN_PACKAGE_EXPLORER);
 	}
 }
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/navigator/ScriptExplorerContentProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/navigator/ScriptExplorerContentProvider.java
index e88f33c..0a46e0f 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/navigator/ScriptExplorerContentProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/navigator/ScriptExplorerContentProvider.java
@@ -958,14 +958,8 @@
 	 */
 	private void postUpdateIcon(final IModelElement element,
 			final Collection<Runnable> runnables) {
-		runnables.add(new Runnable() {
-			@Override
-			public void run() {
-				// 1GF87WR: ITPUI:ALL - SWTEx + NPE closing a workbench window.
-				fViewer.update(element,
-						new String[] { IBasicPropertyConstants.P_IMAGE });
-			}
-		});
+		runnables.add(() -> fViewer.update(element,
+				new String[] { IBasicPropertyConstants.P_IMAGE }));
 	}
 
 	/**
@@ -1100,59 +1094,45 @@
 
 	protected void postRefresh(final List<?> toRefresh,
 			final boolean updateLabels, final Collection<Runnable> runnables) {
-		runnables.add(new Runnable() {
-			@Override
-			public void run() {
-				for (Object item : toRefresh) {
-					fViewer.refresh(item, updateLabels);
-				}
+		runnables.add(() -> {
+			for (Object item : toRefresh) {
+				fViewer.refresh(item, updateLabels);
 			}
 		});
 	}
 
 	protected void postAdd(final Object parent, final Object element,
 			final Collection<Runnable> runnables) {
-		runnables.add(new Runnable() {
-			@Override
-			public void run() {
-				Widget[] items = fViewer.testFindItems(element);
-				for (int i = 0; i < items.length; i++) {
-					Widget item = items[i];
-					if (item instanceof TreeItem && !item.isDisposed()) {
-						TreeItem parentItem = ((TreeItem) item).getParentItem();
-						if (parentItem != null && !parentItem.isDisposed()
-								&& parent.equals(parentItem.getData())) {
-							return; // no add, element already added (most
-							// likely by a refresh)
-						}
+		runnables.add(() -> {
+			Widget[] items = fViewer.testFindItems(element);
+			for (int i = 0; i < items.length; i++) {
+				Widget item = items[i];
+				if (item instanceof TreeItem && !item.isDisposed()) {
+					TreeItem parentItem = ((TreeItem) item).getParentItem();
+					if (parentItem != null && !parentItem.isDisposed()
+							&& parent.equals(parentItem.getData())) {
+						return; // no add, element already added (most
+						// likely by a refresh)
 					}
 				}
-				fViewer.add(parent, element);
 			}
+			fViewer.add(parent, element);
 		});
 	}
 
 	protected void postRemove(final Object element,
 			final Collection<Runnable> runnables) {
-		runnables.add(new Runnable() {
-			@Override
-			public void run() {
-				fViewer.remove(element);
-			}
-		});
+		runnables.add(() -> fViewer.remove(element));
 	}
 
 	protected void postProjectStateChanged(final Object root,
 			final Collection<Runnable> runnables) {
-		runnables.add(new Runnable() {
-			@Override
-			public void run() {
-				fViewer.refresh(root, true);
-				// trigger a synthetic selection change so that action refresh
-				// their
-				// enable state.
-				fViewer.setSelection(fViewer.getSelection());
-			}
+		runnables.add(() -> {
+			fViewer.refresh(root, true);
+			// trigger a synthetic selection change so that action refresh
+			// their
+			// enable state.
+			fViewer.setSelection(fViewer.getSelection());
 		});
 	}
 
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/navigator/ScriptExplorerLabelProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/navigator/ScriptExplorerLabelProvider.java
index 3a108f3..4ec7c7a 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/navigator/ScriptExplorerLabelProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/navigator/ScriptExplorerLabelProvider.java
@@ -38,7 +38,7 @@
 public class ScriptExplorerLabelProvider extends AppearanceAwareLabelProvider {
 
 	protected ScriptExplorerContentProvider fContentProvider;
-	private Map fWorkingSetImages;
+	private Map<ImageDescriptor, Image> fWorkingSetImages;
 
 	private boolean fIsFlatLayout;
 	private ScriptExplorerProblemsDecorator fProblemDecorator;
@@ -47,8 +47,9 @@
 			IPreferenceStore store) {
 		super(DEFAULT_TEXTFLAGS | ScriptElementLabels.P_COMPRESSED
 				| ScriptElementLabels.REFERENCED_ARCHIVE_POST_QUALIFIED
-				| ScriptElementLabels.ALL_CATEGORY, DEFAULT_IMAGEFLAGS
-				| ScriptElementImageProvider.SMALL_ICONS, store);
+				| ScriptElementLabels.ALL_CATEGORY,
+				DEFAULT_IMAGEFLAGS | ScriptElementImageProvider.SMALL_ICONS,
+				store);
 
 		fProblemDecorator = new ScriptExplorerProblemsDecorator();
 		addLabelDecorator(fProblemDecorator);
@@ -89,8 +90,8 @@
 			String decorated = decorateText(text, element);
 			if (decorated != null) {
 				return StyledCellLabelProvider.styleDecoratedString(decorated,
-								StyledString.DECORATIONS_STYLER,
-								new StyledString(text));
+						StyledString.DECORATIONS_STYLER,
+						new StyledString(text));
 			}
 		}
 		return super.getStyledText(element);
@@ -111,7 +112,8 @@
 		IPath fullPath = fragment.getPath();
 		if (prefix.isPrefixOf(fullPath)) {
 			StringBuffer buf = new StringBuffer();
-			for (int i = prefix.segmentCount(); i < fullPath.segmentCount(); i++) {
+			for (int i = prefix.segmentCount(); i < fullPath
+					.segmentCount(); i++) {
 				if (buf.length() > 0)
 					buf.append(IScriptFolder.PACKAGE_DELIMITER);
 				buf.append(fullPath.segment(i));
@@ -127,10 +129,10 @@
 			ImageDescriptor image = ((IWorkingSet) element)
 					.getImageDescriptor();
 			if (fWorkingSetImages == null) {
-				fWorkingSetImages = new HashMap();
+				fWorkingSetImages = new HashMap<>();
 			}
 
-			Image result = (Image) fWorkingSetImages.get(image);
+			Image result = fWorkingSetImages.get(image);
 			if (result == null) {
 				result = image.createImage();
 				fWorkingSetImages.put(image, result);
@@ -148,9 +150,9 @@
 	@Override
 	public void dispose() {
 		if (fWorkingSetImages != null) {
-			for (Iterator iter = fWorkingSetImages.values().iterator(); iter
-					.hasNext();) {
-				((Image) iter.next()).dispose();
+			for (Iterator<Image> iter = fWorkingSetImages.values()
+					.iterator(); iter.hasNext();) {
+				iter.next().dispose();
 			}
 		}
 		super.dispose();
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/ScriptExplorerPart.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/ScriptExplorerPart.java
index 76df358..651db61 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/ScriptExplorerPart.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/ScriptExplorerPart.java
@@ -73,18 +73,14 @@
 import org.eclipse.jface.util.IPropertyChangeListener;
 import org.eclipse.jface.util.PropertyChangeEvent;
 import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.DoubleClickEvent;
 import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.IDoubleClickListener;
 import org.eclipse.jface.viewers.IElementComparer;
 import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.IOpenListener;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.ISelectionProvider;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.ITreeSelection;
-import org.eclipse.jface.viewers.OpenEvent;
 import org.eclipse.jface.viewers.SelectionChangedEvent;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TreePath;
@@ -140,10 +136,9 @@
  * view the corresponding editor is activated.
  */
 
-public class ScriptExplorerPart extends ViewPart implements
-		ISetSelectionTarget, IMenuListener, IShowInTarget,
-		IScriptExplorerViewPart, IPropertyChangeListener,
-		IViewPartInputProvider {
+public class ScriptExplorerPart extends ViewPart implements ISetSelectionTarget,
+		IMenuListener, IShowInTarget, IScriptExplorerViewPart,
+		IPropertyChangeListener, IViewPartInputProvider {
 
 	private static final String PERF_CREATE_PART_CONTROL = "org.eclipse.dltk.ui/perf/explorer/createPartControl"; //$NON-NLS-1$
 	private static final String PERF_MAKE_ACTIONS = "org.eclipse.dltk.ui/perf/explorer/makeActions"; //$NON-NLS-1$
@@ -230,17 +225,18 @@
 		}
 	};
 
-//	private ITreeViewerListener fExpansionListener = new ITreeViewerListener() {
-//		public void treeCollapsed(TreeExpansionEvent event) {
-//		}
-//
-//		public void treeExpanded(TreeExpansionEvent event) {
-//			Object element = event.getElement();
-//			if (element instanceof ISourceModule) {
-//				expandMainType(element);
-//			}
-//		}
-//	};
+	// private ITreeViewerListener fExpansionListener = new
+	// ITreeViewerListener() {
+	// public void treeCollapsed(TreeExpansionEvent event) {
+	// }
+	//
+	// public void treeExpanded(TreeExpansionEvent event) {
+	// Object element = event.getElement();
+	// if (element instanceof ISourceModule) {
+	// expandMainType(element);
+	// }
+	// }
+	// };
 
 	protected class PackageExplorerProblemTreeViewer extends ProblemTreeViewer {
 		// fix for 64372 Projects showing up in Package Explorer twice [package
@@ -262,7 +258,7 @@
 
 		/*
 		 * (non-Javadoc)
-		 * 
+		 *
 		 * @see
 		 * org.eclipse.jface.viewers.AbstractTreeViewer#internalRefresh(java
 		 * .lang.Object, boolean)
@@ -329,8 +325,8 @@
 			IStructuredSelection is = (IStructuredSelection) invalidSelection;
 			List ns = null;
 			if (newSelection instanceof IStructuredSelection) {
-				ns = new ArrayList(((IStructuredSelection) newSelection)
-						.toList());
+				ns = new ArrayList(
+						((IStructuredSelection) newSelection).toList());
 			} else {
 				ns = new ArrayList();
 			}
@@ -387,12 +383,14 @@
 		}
 
 		@Override
-		protected void setSelectionToWidget(ISelection selection, boolean reveal) {
+		protected void setSelectionToWidget(ISelection selection,
+				boolean reveal) {
 			if (true) {
 				super.setSelectionToWidget(selection, reveal);
 				return;
 			}
-			if (!fInPreserveSelection || !(selection instanceof ITreeSelection)) {
+			if (!fInPreserveSelection
+					|| !(selection instanceof ITreeSelection)) {
 				super.setSelectionToWidget(selection, reveal);
 				return;
 			}
@@ -407,8 +405,8 @@
 			for (Iterator iter = toRestore.iterator(); iter.hasNext();) {
 				Object element = iter.next();
 				TreePath[] pathsToRestore = toRestore.getPathsFor(element);
-				CustomHashtable currentParents = createRootAccessedMap(contentProvider
-						.getTreePaths(element));
+				CustomHashtable currentParents = createRootAccessedMap(
+						contentProvider.getTreePaths(element));
 				for (int i = 0; i < pathsToRestore.length; i++) {
 					TreePath path = pathsToRestore[i];
 					Object root = path.getFirstSegment();
@@ -438,9 +436,8 @@
 					}
 				}
 			}
-			getTree().setSelection(
-					(TreeItem[]) toSelect
-							.toArray(new TreeItem[toSelect.size()]));
+			getTree().setSelection((TreeItem[]) toSelect
+					.toArray(new TreeItem[toSelect.size()]));
 		}
 
 		private Widget internalFindChild(Widget parent, Object element) {
@@ -469,16 +466,11 @@
 	}
 
 	public ScriptExplorerPart() {
-		fPostSelectionListener = new ISelectionChangedListener() {
-			@Override
-			public void selectionChanged(SelectionChangedEvent event) {
-				handlePostSelectionChanged(event);
-			}
-		};
+		fPostSelectionListener = event -> handlePostSelectionChanged(event);
 
 		// exception: initialize from preference
-		fDialogSettings = DLTKUIPlugin.getDefault().getDialogSettingsSection(
-				getClass().getName());
+		fDialogSettings = DLTKUIPlugin.getDefault()
+				.getDialogSettingsSection(getClass().getName());
 
 		// on by default
 		fShowLibrariesNode = fDialogSettings
@@ -490,8 +482,8 @@
 				.getBoolean(ScriptExplorerPart.TAG_LINK_EDITOR);
 
 		try {
-			fIsCurrentLayoutFlat = fDialogSettings
-					.getInt(ScriptExplorerPart.TAG_LAYOUT) == ScriptExplorerPart.FLAT_LAYOUT;
+			fIsCurrentLayoutFlat = fDialogSettings.getInt(
+					ScriptExplorerPart.TAG_LAYOUT) == ScriptExplorerPart.FLAT_LAYOUT;
 		} catch (NumberFormatException e) {
 			fIsCurrentLayoutFlat = getDefaultPackageLayout() == FLAT_LAYOUT;
 		}
@@ -510,15 +502,16 @@
 	}
 
 	@Override
-	public void init(IViewSite site, IMemento memento) throws PartInitException {
+	public void init(IViewSite site, IMemento memento)
+			throws PartInitException {
 		super.init(site, memento);
 		if (memento == null) {
 			String persistedMemento = fDialogSettings
 					.get(ScriptExplorerPart.TAG_MEMENTO);
 			if (persistedMemento != null) {
 				try {
-					memento = XMLMemento.createReadRoot(new StringReader(
-							persistedMemento));
+					memento = XMLMemento
+							.createReadRoot(new StringReader(persistedMemento));
 				} catch (WorkbenchException e) {
 					// don't do anything. Simply don't restore the settings
 				}
@@ -548,7 +541,8 @@
 	private void restoreLayoutState(IMemento memento) {
 		Integer layoutState = memento.getInteger(ScriptExplorerPart.TAG_LAYOUT);
 		if (layoutState != null) {
-			fIsCurrentLayoutFlat = layoutState.intValue() == ScriptExplorerPart.FLAT_LAYOUT;
+			fIsCurrentLayoutFlat = layoutState
+					.intValue() == ScriptExplorerPart.FLAT_LAYOUT;
 		}
 
 		// on by default
@@ -581,8 +575,8 @@
 	 */
 	public static ScriptExplorerPart openInActivePerspective() {
 		try {
-			return (ScriptExplorerPart) DLTKUIPlugin.getActivePage().showView(
-					DLTKUIPlugin.ID_SCRIPT_EXPLORER);
+			return (ScriptExplorerPart) DLTKUIPlugin.getActivePage()
+					.showView(DLTKUIPlugin.ID_SCRIPT_EXPLORER);
 		} catch (PartInitException pe) {
 			return null;
 		}
@@ -602,8 +596,8 @@
 		StringWriter writer = new StringWriter();
 		try {
 			memento.save(writer);
-			fDialogSettings.put(ScriptExplorerPart.TAG_MEMENTO, writer
-					.getBuffer().toString());
+			fDialogSettings.put(ScriptExplorerPart.TAG_MEMENTO,
+					writer.getBuffer().toString());
 		} catch (IOException e) {
 			// don't do anything. Simply don't store the settings
 		}
@@ -622,16 +616,16 @@
 
 		DLTKUIPlugin.getDefault().getPreferenceStore()
 				.removePropertyChangeListener(this);
-//		if (fViewer != null) {
-//			fViewer.removeTreeListener(fExpansionListener);
-//		}
+		// if (fViewer != null) {
+		// fViewer.removeTreeListener(fExpansionListener);
+		// }
 
 		if (fActionSet != null) {
 			fActionSet.dispose();
 		}
 		if (fFilterUpdater != null) {
-			ResourcesPlugin.getWorkspace().removeResourceChangeListener(
-					fFilterUpdater);
+			ResourcesPlugin.getWorkspace()
+					.removeResourceChangeListener(fFilterUpdater);
 		}
 		if (fWorkingSetModel != null) {
 			fWorkingSetModel.dispose();
@@ -641,16 +635,15 @@
 
 	/*
 	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets
-	 * .Composite)
+	 *
+	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.
+	 * widgets .Composite)
 	 */
 	@Override
 	public void createPartControl(Composite parent) {
 
-		final PerformanceStats stats = PerformanceStats.getStats(
-				ScriptExplorerPart.PERF_CREATE_PART_CONTROL, this);
+		final PerformanceStats stats = PerformanceStats
+				.getStats(ScriptExplorerPart.PERF_CREATE_PART_CONTROL, this);
 		stats.startRun();
 
 		fViewer = createViewer(parent);
@@ -686,25 +679,18 @@
 
 		fViewer.addPostSelectionChangedListener(fPostSelectionListener);
 
-		fViewer.addDoubleClickListener(new IDoubleClickListener() {
-			@Override
-			public void doubleClick(DoubleClickEvent event) {
-				fActionSet.handleDoubleClick(event);
-			}
-		});
+		fViewer.addDoubleClickListener(
+				event -> fActionSet.handleDoubleClick(event));
 
-		fViewer.addOpenListener(new IOpenListener() {
-			@Override
-			public void open(OpenEvent event) {
-				fActionSet.handleOpen(event);
-				fLastOpenSelection = event.getSelection();
-			}
+		fViewer.addOpenListener(event -> {
+			fActionSet.handleOpen(event);
+			fLastOpenSelection = event.getSelection();
 		});
 
 		IStatusLineManager slManager = getViewSite().getActionBars()
 				.getStatusLineManager();
 		fViewer.addSelectionChangedListener(new StatusBarUpdater(slManager));
-//		fViewer.addTreeListener(fExpansionListener);
+		// fViewer.addTreeListener(fExpansionListener);
 
 		// ScriptUIHelp.setHelp(fViewer, IScriptHelpContextIds.PACKAGES_VIEW);
 
@@ -721,8 +707,8 @@
 		// set yet.
 		setLinkingEnabled(isLinkingEnabled());
 
-		IContextService ctxService = getSite().getService(
-				IContextService.class);
+		IContextService ctxService = getSite()
+				.getService(IContextService.class);
 		if (ctxService != null) {
 			fContextActivation = ctxService
 					.activateContext(DLTKUIPlugin.CONTEXT_VIEWS);
@@ -739,18 +725,18 @@
 	/**
 	 * This viewer ensures that non-leaves in the hierarchical layout are not
 	 * removed by any filters.
-	 * 
-	 * 
+	 *
+	 *
 	 */
 	protected ProblemTreeViewer createViewer(Composite composite) {
-		return new PackageExplorerProblemTreeViewer(composite, SWT.MULTI
-				| SWT.H_SCROLL | SWT.V_SCROLL);
+		return new PackageExplorerProblemTreeViewer(composite,
+				SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
 	}
 
 	/**
 	 * Answers whether this part shows the packages flat or hierarchical.
-	 * 
-	 * 
+	 *
+	 *
 	 */
 	public boolean isFlatLayout() {
 		return fIsCurrentLayoutFlat;
@@ -805,7 +791,7 @@
 
 	/**
 	 * This method should only be called inside this class and from test cases.
-	 * 
+	 *
 	 * @return the created content provider
 	 */
 	public ScriptExplorerContentProvider createContentProvider() {
@@ -886,13 +872,8 @@
 			return (T) getShowInSource();
 		}
 		if (key == IShowInTargetList.class) {
-			return (T) new IShowInTargetList() {
-				@Override
-				public String[] getShowInTargetIds() {
-					return new String[] { IPageLayout.ID_RES_NAV };
-				}
-
-			};
+			return (T) (IShowInTargetList) () -> new String[] {
+					IPageLayout.ID_RES_NAV };
 		}
 		// if (key == IContextProvider.class) {
 		// return ScriptUIHelp.getHelpContextProvider(this,
@@ -984,7 +965,7 @@
 
 	/*
 	 * (non-Javadoc)
-	 * 
+	 *
 	 * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
 	 */
 	@Override
@@ -1001,7 +982,7 @@
 
 	/*
 	 * (non-Javadoc)
-	 * 
+	 *
 	 * @see IMenuListener#menuAboutToShow(IMenuManager)
 	 */
 	@Override
@@ -1015,14 +996,14 @@
 
 	private void makeActions() {
 
-		final PerformanceStats stats = PerformanceStats.getStats(
-				ScriptExplorerPart.PERF_MAKE_ACTIONS, this);
+		final PerformanceStats stats = PerformanceStats
+				.getStats(ScriptExplorerPart.PERF_MAKE_ACTIONS, this);
 		stats.startRun();
 
 		fActionSet = getActionGroup();
 		if (fWorkingSetModel != null) {
-			fActionSet.getWorkingSetActionGroup().setWorkingSetModel(
-					fWorkingSetModel);
+			fActionSet.getWorkingSetActionGroup()
+					.setWorkingSetModel(fWorkingSetModel);
 		}
 
 		stats.endRun();
@@ -1055,7 +1036,7 @@
 
 	/**
 	 * Handles post selection changed in viewer.
-	 * 
+	 *
 	 * Links to editor (if option enabled).
 	 */
 	private void handlePostSelectionChanged(SelectionChangedEvent event) {
@@ -1070,7 +1051,7 @@
 
 	/*
 	 * (non-Javadoc)
-	 * 
+	 *
 	 * @see
 	 * org.eclipse.ui.part.ISetSelectionTarget#selectReveal(org.eclipse.jface
 	 * .viewers.ISelection)
@@ -1135,8 +1116,7 @@
 
 		} else if (original instanceof IAdaptable) {
 			IAdaptable adaptable = (IAdaptable) original;
-			IModelElement je2 = adaptable
-					.getAdapter(IModelElement.class);
+			IModelElement je2 = adaptable.getAdapter(IModelElement.class);
 			if (je2 != null && je2.exists()) {
 				return je2;
 			}
@@ -1166,7 +1146,7 @@
 
 	/**
 	 * Links to editor (if option enabled)
-	 * 
+	 *
 	 * @param selection
 	 *            the selection
 	 */
@@ -1234,8 +1214,8 @@
 				fShowLibrariesNode);
 		fDialogSettings.put(ScriptExplorerPart.TAG_LAYOUT, getLayoutAsInt());
 		fDialogSettings.put(ScriptExplorerPart.TAG_ROOT_MODE, fRootMode);
-		fDialogSettings
-				.put(ScriptExplorerPart.TAG_LINK_EDITOR, fLinkingEnabled);
+		fDialogSettings.put(ScriptExplorerPart.TAG_LINK_EDITOR,
+				fLinkingEnabled);
 	}
 
 	private int getLayoutAsInt() {
@@ -1273,7 +1253,7 @@
 	/**
 	 * An editor has been activated. Set the selection in this Packages Viewer
 	 * to be the editor's input, if linking is enabled.
-	 * 
+	 *
 	 * @param editor
 	 *            the activated editor
 	 */
@@ -1325,8 +1305,8 @@
 			return false;
 		}
 
-		IEditorInput selectionAsInput = EditorUtility.getEditorInput(selection
-				.getFirstElement());
+		IEditorInput selectionAsInput = EditorUtility
+				.getEditorInput(selection.getFirstElement());
 		return input.equals(selectionAsInput);
 	}
 
@@ -1347,11 +1327,12 @@
 				fViewer.reveal(element);
 			} else {
 				try {
-					fViewer
-							.removePostSelectionChangedListener(fPostSelectionListener);
+					fViewer.removePostSelectionChangedListener(
+							fPostSelectionListener);
 					fViewer.setSelection(newSelection, true);
 
-					while (element != null && fViewer.getSelection().isEmpty()) {
+					while (element != null
+							&& fViewer.getSelection().isEmpty()) {
 						// Try to select parent in case element is filtered
 						element = getParent(element);
 						if (element != null) {
@@ -1360,8 +1341,8 @@
 						}
 					}
 				} finally {
-					fViewer
-							.addPostSelectionChangedListener(fPostSelectionListener);
+					fViewer.addPostSelectionChangedListener(
+							fPostSelectionListener);
 				}
 			}
 			return true;
@@ -1376,7 +1357,7 @@
 
 	/**
 	 * Returns the element's parent.
-	 * 
+	 *
 	 * @return the parent or <code>null</code> if there's no parent
 	 */
 	private Object getParent(Object element) {
@@ -1391,38 +1372,6 @@
 		return null;
 	}
 
-	// /**
-	// * A compilation unit or class was expanded, expand the main type.
-	// */
-	// void expandMainType(Object element) {
-	// try {
-	// IType type = null;
-	// if (element instanceof ISourceModule) {
-	// ISourceModule cu = (ISourceModule) element;
-	// IType[] types = cu.getTypes();
-	// if (types.length > 0) {
-	// type = types[0];
-	// }
-	// }
-	// if (type != null) {
-	// final IType type2 = type;
-	// Control ctrl = fViewer.getControl();
-	// if (ctrl != null && !ctrl.isDisposed()) {
-	// ctrl.getDisplay().asyncExec(new Runnable() {
-	// public void run() {
-	// Control ctrl2 = fViewer.getControl();
-	// if (ctrl2 != null && !ctrl2.isDisposed()) {
-	// fViewer.expandToLevel(type2, 1);
-	// }
-	// }
-	// });
-	// }
-	// }
-	// } catch (ModelException e) {
-	// // no reveal
-	// }
-	// }
-
 	protected Object getElementOfInput(IEditorInput input) {
 		if (input instanceof IFileEditorInput)
 			return ((IFileEditorInput) input).getFile();
@@ -1482,7 +1431,7 @@
 
 	/**
 	 * Sets the decorator for the package explorer.
-	 * 
+	 *
 	 * @param decorator
 	 *            a label decorator or <code>null</code> for no decorations.
 	 * @deprecated To be removed
@@ -1502,8 +1451,8 @@
 
 		boolean refreshViewer = false;
 
-		if (PreferenceConstants.SHOW_SOURCE_MODULE_CHILDREN.equals(event
-				.getProperty())) {
+		if (PreferenceConstants.SHOW_SOURCE_MODULE_CHILDREN
+				.equals(event.getProperty())) {
 			fActionSet.updateActionBars(getViewSite().getActionBars());
 
 			boolean showCUChildren = DLTKUIPlugin.getDefault()
@@ -1515,8 +1464,8 @@
 			refreshViewer = true;
 		}
 		if (DLTKCore.DEBUG) {
-			System.err
-					.println("Add members order preference cach support here..."); //$NON-NLS-1$
+			System.err.println(
+					"Add members order preference cach support here..."); //$NON-NLS-1$
 		}
 		// } else if
 		// (MembersOrderPreferenceCache.isMemberOrderProperty(event.getProperty()
@@ -1532,7 +1481,7 @@
 
 	/*
 	 * (non-Javadoc)
-	 * 
+	 *
 	 * @see IViewPartInputProvider#getViewPartInput()
 	 */
 	@Override
@@ -1555,7 +1504,7 @@
 
 	/*
 	 * (non-Javadoc)
-	 * 
+	 *
 	 * @see
 	 * org.eclipse.ui.part.IShowInTarget#show(org.eclipse.ui.part.ShowInContext)
 	 */
@@ -1594,13 +1543,8 @@
 	 * Returns the <code>IShowInSource</code> for this view.
 	 */
 	protected IShowInSource getShowInSource() {
-		return new IShowInSource() {
-			@Override
-			public ShowInContext getShowInContext() {
-				return new ShowInContext(getTreeViewer().getInput(),
-						getTreeViewer().getSelection());
-			}
-		};
+		return () -> new ShowInContext(getTreeViewer().getInput(),
+				getTreeViewer().getSelection());
 	}
 
 	@Override
@@ -1644,7 +1588,8 @@
 				.getWorkingSetActionGroup().getFilterGroup();
 		if (workingSetGroup != null) {
 			IWorkingSet workingSet = workingSetGroup.getWorkingSet();
-			if (workingSetGroup.isFiltered(getVisibleParent(element), element)) {
+			if (workingSetGroup.isFiltered(getVisibleParent(element),
+					element)) {
 				String message;
 				if (element instanceof IModelElement) {
 					IDLTKUILanguageToolkit toolkit = DLTKUILanguageManager
@@ -1654,14 +1599,14 @@
 					String elementLabel = labels.getElementLabel(
 							(IModelElement) element,
 							ScriptElementLabels.ALL_DEFAULT);
-					message = Messages
-							.format(ScriptMessages.PackageExplorer_notFound,
-									new String[] { elementLabel,
-											workingSet.getLabel() });
+					message = Messages.format(
+							ScriptMessages.PackageExplorer_notFound,
+							new String[] { elementLabel,
+									workingSet.getLabel() });
 				} else {
 					message = Messages.format(
-							ScriptMessages.PackageExplorer_notFound, workingSet
-									.getLabel());
+							ScriptMessages.PackageExplorer_notFound,
+							workingSet.getLabel());
 				}
 				if (MessageDialog.openQuestion(getSite().getShell(),
 						ScriptMessages.PackageExplorer_filteredDialog_title,
@@ -1680,8 +1625,8 @@
 				.getCustomFilterActionGroup();
 		String[] currentFilters = filterGroup.internalGetEnabledFilterIds();
 		String[] newFilters = filterGroup.removeFiltersFor(
-				getVisibleParent(element), element, getTreeViewer()
-						.getContentProvider());
+				getVisibleParent(element), element,
+				getTreeViewer().getContentProvider());
 		if (currentFilters.length > newFilters.length) {
 			String message;
 			if (element instanceof IModelElement) {
@@ -1712,8 +1657,8 @@
 		while (action.getFrameList().getCurrentIndex() > 0) {
 			// only try to go up if there is a parent frame
 			// fix for bug# 63769 Endless loop after Show in Package Explorer
-			if (action.getFrameList().getSource().getFrame(
-					IFrameSource.PARENT_FRAME, 0) == null) {
+			if (action.getFrameList().getSource()
+					.getFrame(IFrameSource.PARENT_FRAME, 0) == null) {
 				break;
 			}
 			action.run();
@@ -1786,15 +1731,15 @@
 				&& fWorkingSetModel == null) {
 			createWorkingSetModel();
 			if (fActionSet != null) {
-				fActionSet.getWorkingSetActionGroup().setWorkingSetModel(
-						fWorkingSetModel);
+				fActionSet.getWorkingSetActionGroup()
+						.setWorkingSetModel(fWorkingSetModel);
 			}
 		}
 		IStructuredSelection selection = new StructuredSelection(
 				((IStructuredSelection) fViewer.getSelection()).toArray());
 		Object input = fViewer.getInput();
-		boolean isRootInputChange = DLTKCore.create(
-				ResourcesPlugin.getWorkspace().getRoot()).equals(input)
+		boolean isRootInputChange = DLTKCore
+				.create(ResourcesPlugin.getWorkspace().getRoot()).equals(input)
 				|| (fWorkingSetModel != null && fWorkingSetModel.equals(input))
 				|| input instanceof IWorkingSet;
 		try {
@@ -1866,7 +1811,7 @@
 	/**
 	 * Returns the root mode: Either {@link #PROJECTS_AS_ROOTS} or
 	 * {@link #WORKING_SETS_AS_ROOTS}.
-	 * 
+	 *
 	 * @return returns the root mode
 	 */
 	public int getRootMode() {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AbstractScriptEditorTextHover.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AbstractScriptEditorTextHover.java
index 88e7237..2ce866f 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AbstractScriptEditorTextHover.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AbstractScriptEditorTextHover.java
@@ -35,13 +35,11 @@
 import org.eclipse.jface.resource.JFaceResources;
 import org.eclipse.jface.text.BadLocationException;
 import org.eclipse.jface.text.DefaultInformationControl;
-import org.eclipse.jface.text.IInformationControl;
 import org.eclipse.jface.text.IInformationControlCreator;
 import org.eclipse.jface.text.IRegion;
 import org.eclipse.jface.text.ITextHoverExtension;
 import org.eclipse.jface.text.ITextViewer;
 import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.editors.text.EditorsUI;
@@ -50,8 +48,8 @@
 /**
  * Abstract class for providing hover information for Script elements.
  */
-public abstract class AbstractScriptEditorTextHover implements
-		IScriptEditorTextHover, ITextHoverExtension {
+public abstract class AbstractScriptEditorTextHover
+		implements IScriptEditorTextHover, ITextHoverExtension {
 
 	/**
 	 * The style sheet (css).
@@ -95,23 +93,6 @@
 
 	@Override
 	public IRegion getHoverRegion(final ITextViewer textViewer, int offset) {
-
-		// final IRegion[] result = new IRegion[] { ScriptWordFinder.findWord(
-		// textViewer.getDocument(), offset) };
-		//
-		// textViewer.getTextWidget().getDisplay().syncExec(new Runnable() {
-		// public void run() {
-		// Point selection = textViewer.getSelectedRange();
-		// int off = selection.x;
-		// int len = selection.y;
-		//
-		// if (len > 0) {
-		// result[0] = new Region(off, len);
-		// }
-		// }
-		// });
-		//
-		// return result[0];
 		return ScriptWordFinder.findWord(textViewer.getDocument(), offset);
 	}
 
@@ -165,17 +146,18 @@
 	}
 
 	@Deprecated
-	protected String getHoverInfo(String nature, IModelElement[] modelElements) {
+	protected String getHoverInfo(String nature,
+			IModelElement[] modelElements) {
 		return null;
 	}
 
 	/**
 	 * Provides hover information for the given elements.
-	 * 
+	 *
 	 * @param elements
 	 *            the Script elements for which to provide hover information
 	 * @return the hover information string
-	 * 
+	 *
 	 */
 	protected String getHoverInfo(String nature, Object[] elements) {
 		final List<IModelElement> modelElements = new ArrayList<IModelElement>();
@@ -190,7 +172,7 @@
 
 	/**
 	 * Provides hover information for the given elements.
-	 * 
+	 *
 	 * @param selection
 	 *            the Script elements for which to provide hover information
 	 * @return the hover information string
@@ -201,11 +183,11 @@
 
 	/**
 	 * Provides hover information for the keyword.
-	 * 
+	 *
 	 * @param content
 	 *            text of the keyword
 	 * @return the hover information string
-	 * 
+	 *
 	 */
 	protected String getHoverInfo(String nature, String content) {
 		return null;
@@ -213,21 +195,16 @@
 
 	@Override
 	public IInformationControlCreator getHoverControlCreator() {
-		return new IInformationControlCreator() {
-			@Override
-			public IInformationControl createInformationControl(Shell parent) {
-				return new DefaultInformationControl(parent,
-						EditorsUI.getTooltipAffordanceString());
-			}
-		};
+		return parent -> new DefaultInformationControl(parent,
+				EditorsUI.getTooltipAffordanceString());
 	}
 
 	/**
 	 * Returns the tool tip affordance string.
-	 * 
+	 *
 	 * @return the affordance string or <code>null</code> if disabled or no key
 	 *         binding is defined
-	 * 
+	 *
 	 */
 	// protected String getTooltipAffordanceString() {
 	// if (this.getPreferenceStore() == null) {
@@ -246,12 +223,12 @@
 	//
 	// return Messages.format(
 	// ScriptHoverMessages.ScriptTextHover_makeStickyHint,
-	//				keySequence == null ? "" : keySequence); //$NON-NLS-1$
+	// keySequence == null ? "" : keySequence); //$NON-NLS-1$
 	// }
 	/**
 	 * Returns the style sheet.
-	 * 
-	 * 
+	 *
+	 *
 	 */
 	protected static String getStyleSheet() {
 		if (fgCSSStyles == null) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/typehierarchy/TypeHierarchyViewPart.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/typehierarchy/TypeHierarchyViewPart.java
index 5923b1c..b6d9581 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/typehierarchy/TypeHierarchyViewPart.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/typehierarchy/TypeHierarchyViewPart.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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 @@
 import org.eclipse.dltk.ui.viewsupport.ScriptUILabelProvider;
 import org.eclipse.dltk.ui.viewsupport.SelectionProviderMediator;
 import org.eclipse.dltk.ui.viewsupport.StatusBarUpdater;
-import org.eclipse.jface.action.IMenuListener;
 import org.eclipse.jface.action.IMenuManager;
 import org.eclipse.jface.action.IStatusLineManager;
 import org.eclipse.jface.action.IToolBarManager;
@@ -110,8 +109,8 @@
 /**
  * view showing the super types/sub types of its input.
  */
-public class TypeHierarchyViewPart extends ViewPart implements
-		ITypeHierarchyViewPart, IViewPartInputProvider {
+public class TypeHierarchyViewPart extends ViewPart
+		implements ITypeHierarchyViewPart, IViewPartInputProvider {
 
 	public static final int VIEW_ID_TYPE = 2;
 	public static final int VIEW_ID_SUPER = 0;
@@ -213,21 +212,12 @@
 		fRestoreStateJob = null;
 
 		fHierarchyLifeCycle = new TypeHierarchyLifeCycle();
-		fTypeHierarchyLifeCycleListener = new ITypeHierarchyLifeCycleListener() {
-			@Override
-			public void typeHierarchyChanged(
-					TypeHierarchyLifeCycle typeHierarchy, IType[] changedTypes) {
-				doTypeHierarchyChanged(typeHierarchy, changedTypes);
-			}
-		};
+		fTypeHierarchyLifeCycleListener = (typeHierarchy,
+				changedTypes) -> doTypeHierarchyChanged(typeHierarchy,
+						changedTypes);
 		fHierarchyLifeCycle.addChangedListener(fTypeHierarchyLifeCycleListener);
 
-		fPropertyChangeListener = new IPropertyChangeListener() {
-			@Override
-			public void propertyChange(PropertyChangeEvent event) {
-				doPropertyChange(event);
-			}
-		};
+		fPropertyChangeListener = event -> doPropertyChange(event);
 		// getPreferenceStore().addPropertyChangeListener(fPropertyChangeListener
 		// );
 
@@ -312,27 +302,22 @@
 			}
 		};
 
-		fSelectionChangedListener = new ISelectionChangedListener() {
-			@Override
-			public void selectionChanged(SelectionChangedEvent event) {
-				doSelectionChanged(event);
-			}
-		};
+		fSelectionChangedListener = event -> doSelectionChanged(event);
 
-		fLinkingEnabled = getPreferenceStore().getBoolean(
-				PreferenceConstants.LINK_TYPEHIERARCHY_TO_EDITOR);
+		fLinkingEnabled = getPreferenceStore()
+				.getBoolean(PreferenceConstants.LINK_TYPEHIERARCHY_TO_EDITOR);
 	}
 
 	/**
 	 * Method doPropertyChange.
-	 * 
+	 *
 	 * @param event
 	 */
 	protected void doPropertyChange(PropertyChangeEvent event) {
 		String property = event.getProperty();
 		if (fMethodsViewer != null) {
-			if (MembersOrderPreferenceCache.isMemberOrderProperty(event
-					.getProperty())) {
+			if (MembersOrderPreferenceCache
+					.isMemberOrderProperty(event.getProperty())) {
 				fMethodsViewer.refresh();
 			}
 		}
@@ -346,7 +331,7 @@
 	/**
 	 * Adds the entry if new. Inserted at the beginning of the history entries
 	 * list.
-	 * 
+	 *
 	 * @param entry
 	 *            The new entry
 	 */
@@ -371,7 +356,7 @@
 	/**
 	 * Goes to the selected entry, without updating the order of history
 	 * entries.
-	 * 
+	 *
 	 * @param entry
 	 *            The entry to open
 	 */
@@ -383,7 +368,7 @@
 
 	/**
 	 * Gets all history entries.
-	 * 
+	 *
 	 * @return All history entries
 	 */
 	public IModelElement[] getHistoryEntries() {
@@ -395,7 +380,7 @@
 
 	/**
 	 * Sets the history entries
-	 * 
+	 *
 	 * @param elems
 	 *            The history elements to set
 	 */
@@ -409,7 +394,7 @@
 
 	/**
 	 * Selects an member in the methods list or in the current hierarchy.
-	 * 
+	 *
 	 * @param member
 	 *            The member to select
 	 */
@@ -429,8 +414,8 @@
 			}
 
 			if (!member.equals(fSelectedType)) {
-				getCurrentViewer().setSelection(
-						new StructuredSelection(member), true);
+				getCurrentViewer().setSelection(new StructuredSelection(member),
+						true);
 			}
 		}
 		fSelectInEditor = true;
@@ -451,7 +436,7 @@
 
 	/**
 	 * Sets the input to a new type
-	 * 
+	 *
 	 * @param type
 	 *            The new input type
 	 * @deprecated
@@ -465,7 +450,7 @@
 	/**
 	 * Returns the input element of the type hierarchy. Can be of type
 	 * <code>IType</code> or <code>IPackageFragment</code>
-	 * 
+	 *
 	 * @return the input element
 	 */
 	@Override
@@ -475,7 +460,7 @@
 
 	/**
 	 * Sets the input to a new element.
-	 * 
+	 *
 	 * @param element
 	 *            the input element
 	 */
@@ -490,11 +475,9 @@
 
 				}
 				if (element == null || !element.exists()) {
-					MessageDialog
-							.openError(
-									getSite().getShell(),
-									TypeHierarchyMessages.TypeHierarchyViewPart_error_title,
-									TypeHierarchyMessages.TypeHierarchyViewPart_error_message);
+					MessageDialog.openError(getSite().getShell(),
+							TypeHierarchyMessages.TypeHierarchyViewPart_error_title,
+							TypeHierarchyMessages.TypeHierarchyViewPart_error_message);
 					return;
 				}
 			} else {
@@ -502,8 +485,8 @@
 				if (kind != IModelElement.SCRIPT_PROJECT
 						&& kind != IModelElement.PROJECT_FRAGMENT) {
 					element = null;
-					DLTKUIPlugin
-							.logErrorMessage("Invalid type hierarchy input type.");//$NON-NLS-1$
+					DLTKUIPlugin.logErrorMessage(
+							"Invalid type hierarchy input type.");//$NON-NLS-1$
 				}
 			}
 		}
@@ -519,7 +502,7 @@
 
 	/*
 	 * Changes the input to a new type
-	 * 
+	 *
 	 * @param inputElement
 	 */
 	private void updateInput(IModelElement inputElement) {
@@ -553,11 +536,9 @@
 				// fHierarchyLifeCycle.ensureRefreshedTypeHierarchy(inputElement,
 				// getSite().getWorkbenchWindow());
 			} catch (InvocationTargetException e) {
-				ExceptionHandler
-						.handle(e,
-								getSite().getShell(),
-								TypeHierarchyMessages.TypeHierarchyViewPart_exception_title,
-								TypeHierarchyMessages.TypeHierarchyViewPart_exception_message);
+				ExceptionHandler.handle(e, getSite().getShell(),
+						TypeHierarchyMessages.TypeHierarchyViewPart_exception_title,
+						TypeHierarchyMessages.TypeHierarchyViewPart_exception_message);
 				clearInput();
 				return;
 			} catch (InterruptedException e) {
@@ -654,13 +635,8 @@
 			return (T) getShowInSource();
 		}
 		if (key == IShowInTargetList.class) {
-			return (T) new IShowInTargetList() {
-				@Override
-				public String[] getShowInTargetIds() {
-					return new String[] { DLTKUIPlugin.ID_SCRIPT_EXPLORER,
-							IPageLayout.ID_RES_NAV };
-				}
-			};
+			return (T) (IShowInTargetList) () -> new String[] {
+					DLTKUIPlugin.ID_SCRIPT_EXPLORER, IPageLayout.ID_RES_NAV };
 		}
 		// if (key == IContextProvider.class) {
 		// return JavaUIHelp.getHelpContextProvider(this,
@@ -705,8 +681,8 @@
 			currViewerIndex = VIEW_ID_TYPE;
 		}
 
-		fEmptyTypesViewer = new Label(fViewerbook, SWT.TOP | SWT.LEFT
-				| SWT.WRAP);
+		fEmptyTypesViewer = new Label(fViewerbook,
+				SWT.TOP | SWT.LEFT | SWT.WRAP);
 
 		for (int i = 0; i < fAllViewers.length; i++) {
 			fAllViewers[i].setInput(fAllViewers[i]);
@@ -743,27 +719,21 @@
 			KeyListener keyListener, String cotextHelpId) {
 		typesViewer.getControl().setVisible(false);
 		typesViewer.getControl().addKeyListener(keyListener);
-		typesViewer.initContextMenu(new IMenuListener() {
-			@Override
-			public void menuAboutToShow(IMenuManager menu) {
-				fillTypesViewerContextMenu(typesViewer, menu);
-			}
-		}, cotextHelpId, getSite());
+		typesViewer.initContextMenu(
+				menu -> fillTypesViewerContextMenu(typesViewer, menu),
+				cotextHelpId, getSite());
 		typesViewer.addPostSelectionChangedListener(fSelectionChangedListener);
 		typesViewer.setQualifiedTypeName(isShowQualifiedTypeNames());
-		typesViewer.setWorkingSetFilter(fWorkingSetActionGroup
-				.getWorkingSetFilter());
+		typesViewer.setWorkingSetFilter(
+				fWorkingSetActionGroup.getWorkingSetFilter());
 	}
 
 	private Control createMethodViewerControl(Composite parent) {
 		fMethodsViewer = new MethodsViewer(parent, fHierarchyLifeCycle, this,
 				getPreferenceStore());
-		fMethodsViewer.initContextMenu(new IMenuListener() {
-			@Override
-			public void menuAboutToShow(IMenuManager menu) {
-				fillMethodsViewerContextMenu(menu);
-			}
-		}, IContextMenuConstants.TARGET_ID_MEMBERS_VIEW, getSite());
+		fMethodsViewer.initContextMenu(
+				menu -> fillMethodsViewerContextMenu(menu),
+				IContextMenuConstants.TARGET_ID_MEMBERS_VIEW, getSite());
 		fMethodsViewer
 				.addPostSelectionChangedListener(fSelectionChangedListener);
 
@@ -832,7 +802,7 @@
 
 	/**
 	 * Returns the inner component in a workbench part.
-	 * 
+	 *
 	 * @see IWorkbenchPart#createPartControl(Composite)
 	 */
 	@Override
@@ -846,8 +816,8 @@
 
 		// page 1 of page book (no hierarchy label)
 
-		fNoHierarchyShownLabel = new Label(fPagebook, SWT.TOP + SWT.LEFT
-				+ SWT.WRAP);
+		fNoHierarchyShownLabel = new Label(fPagebook,
+				SWT.TOP + SWT.LEFT + SWT.WRAP);
 		fNoHierarchyShownLabel
 				.setText(TypeHierarchyMessages.TypeHierarchyViewPart_empty);
 
@@ -858,13 +828,15 @@
 
 		fTypeViewerViewForm = new ViewForm(fTypeMethodsSplitter, SWT.NONE);
 
-		Control typeViewerControl = createTypeViewerControl(fTypeViewerViewForm);
+		Control typeViewerControl = createTypeViewerControl(
+				fTypeViewerViewForm);
 		fTypeViewerViewForm.setContent(typeViewerControl);
 
 		fMethodViewerViewForm = new ViewForm(fTypeMethodsSplitter, SWT.NONE);
 		fTypeMethodsSplitter.setWeights(new int[] { 35, 65 });
 
-		Control methodViewerPart = createMethodViewerControl(fMethodViewerViewForm);
+		Control methodViewerPart = createMethodViewerControl(
+				fMethodViewerViewForm);
 		fMethodViewerViewForm.setContent(methodViewerPart);
 
 		fMethodViewerPaneLabel = new CLabel(fMethodViewerViewForm, SWT.NONE);
@@ -878,8 +850,8 @@
 
 		MenuManager menu = new MenuManager();
 		menu.add(fFocusOnTypeAction);
-		fNoHierarchyShownLabel.setMenu(menu
-				.createContextMenu(fNoHierarchyShownLabel));
+		fNoHierarchyShownLabel
+				.setMenu(menu.createContextMenu(fNoHierarchyShownLabel));
 
 		fPagebook.showPage(fNoHierarchyShownLabel);
 
@@ -934,7 +906,8 @@
 
 		// selection provider
 		int nHierarchyViewers = fAllViewers.length;
-		StructuredViewer[] trackedViewers = new StructuredViewer[nHierarchyViewers + 1];
+		StructuredViewer[] trackedViewers = new StructuredViewer[nHierarchyViewers
+				+ 1];
 		for (int i = 0; i < nHierarchyViewers; i++) {
 			trackedViewers[i] = fAllViewers[i];
 		}
@@ -962,24 +935,25 @@
 		// PlatformUI.getWorkbench().getHelpSystem().setHelp(fPagebook,
 		// IJavaHelpContextIds.TYPE_HIERARCHY_VIEW);
 
-		fActionGroups = new CompositeActionGroup(new ActionGroup[] {
-				new NewWizardsActionGroup(this.getSite()),
-				new OpenEditorActionGroup(this), new OpenViewActionGroup(this),
-				new CCPActionGroup(this),
-				// new GenerateActionGroup(this),
-				new RefactorActionGroup(this) /*
-											 * , new DLTKSearchActionGroup(this,
-											 * getLanguageToolkit())
-											 */
-		});
+		fActionGroups = new CompositeActionGroup(
+				new ActionGroup[] { new NewWizardsActionGroup(this.getSite()),
+						new OpenEditorActionGroup(this),
+						new OpenViewActionGroup(this), new CCPActionGroup(this),
+						// new GenerateActionGroup(this),
+						new RefactorActionGroup(
+								this) /*
+										 * , new DLTKSearchActionGroup(this,
+										 * getLanguageToolkit())
+										 */
+				});
 
 		fActionGroups.fillActionBars(actionBars);
 		fSelectAllAction = new SelectAllAction(fMethodsViewer);
 
 		actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(),
 				fSelectAllAction);
-		IContextService ctxService = getSite().getService(
-				IContextService.class);
+		IContextService ctxService = getSite()
+				.getService(IContextService.class);
 		if (ctxService != null) {
 			fContextActivation = ctxService
 					.activateContext(DLTKUIPlugin.CONTEXT_VIEWS);
@@ -1027,7 +1001,7 @@
 
 	/**
 	 * called from ToggleOrientationAction.
-	 * 
+	 *
 	 * @param orientation
 	 *            VIEW_ORIENTATION_SINGLE, VIEW_ORIENTATION_HORIZONTAL or
 	 *            VIEW_ORIENTATION_VERTICAL
@@ -1050,9 +1024,8 @@
 						methodViewerNeedsUpdate = true;
 					}
 					boolean horizontal = orientation == VIEW_ORIENTATION_HORIZONTAL;
-					fTypeMethodsSplitter
-							.setOrientation(horizontal ? SWT.HORIZONTAL
-									: SWT.VERTICAL);
+					fTypeMethodsSplitter.setOrientation(
+							horizontal ? SWT.HORIZONTAL : SWT.VERTICAL);
 				}
 				updateMainToolbar(orientation);
 				fTypeMethodsSplitter.layout();
@@ -1112,8 +1085,8 @@
 			IMenuManager menu) {
 		DLTKUIPlugin.createStandardGroups(menu);
 
-		menu.appendToGroup(IContextMenuConstants.GROUP_SHOW, new Separator(
-				GROUP_FOCUS));
+		menu.appendToGroup(IContextMenuConstants.GROUP_SHOW,
+				new Separator(GROUP_FOCUS));
 		// viewer entries
 		viewer.contributeToContextMenu(menu);
 
@@ -1121,8 +1094,8 @@
 			menu.appendToGroup(GROUP_FOCUS, fFocusOnSelectionAction);
 		menu.appendToGroup(GROUP_FOCUS, fFocusOnTypeAction);
 
-		fActionGroups.setContext(new ActionContext(getSite()
-				.getSelectionProvider().getSelection()));
+		fActionGroups.setContext(new ActionContext(
+				getSite().getSelectionProvider().getSelection()));
 		fActionGroups.fillContextMenu(menu);
 		fActionGroups.setContext(null);
 	}
@@ -1134,8 +1107,8 @@
 		DLTKUIPlugin.createStandardGroups(menu);
 		// viewer entries
 		fMethodsViewer.contributeToContextMenu(menu);
-		fActionGroups.setContext(new ActionContext(getSite()
-				.getSelectionProvider().getSelection()));
+		fActionGroups.setContext(new ActionContext(
+				getSite().getSelectionProvider().getSelection()));
 		fActionGroups.fillContextMenu(menu);
 		fActionGroups.setContext(null);
 	}
@@ -1189,18 +1162,15 @@
 			fPagebook.showPage(fNoHierarchyShownLabel);
 		} else {
 			if (getCurrentViewer().containsElements() != null) {
-				Runnable runnable = new Runnable() {
-					@Override
-					public void run() {
-						final TypeHierarchyViewer viewer = getCurrentViewer();
-						((TypeHierarchyContentProvider) viewer
-								.getContentProvider()).resetState();
-						viewer.updateContent(doExpand); // refresh
-					}
+				Runnable runnable = () -> {
+					final TypeHierarchyViewer viewer = getCurrentViewer();
+					((TypeHierarchyContentProvider) viewer.getContentProvider())
+							.resetState();
+					viewer.updateContent(doExpand); // refresh
 				};
 				BusyIndicator.showWhile(getDisplay(), runnable);
-				if (!isChildVisible(fViewerbook, getCurrentViewer()
-						.getControl())) {
+				if (!isChildVisible(fViewerbook,
+						getCurrentViewer().getControl())) {
 					setViewerVisibility(true);
 				}
 			} else {
@@ -1217,30 +1187,20 @@
 				&& fCurrentOrientation != VIEW_ORIENTATION_SINGLE) {
 			if (input == fMethodsViewer.getInput()) {
 				if (input != null) {
-					Runnable runnable = new Runnable() {
-						@Override
-						public void run() {
-							fMethodsViewer.refresh(); // refresh
-						}
-					};
+					Runnable runnable = () -> fMethodsViewer.refresh();
 					BusyIndicator.showWhile(getDisplay(), runnable);
 				}
 			} else {
 				if (input != null) {
-					fMethodViewerPaneLabel.setText(fPaneLabelProvider
-							.getText(input));
-					fMethodViewerPaneLabel.setImage(fPaneLabelProvider
-							.getImage(input));
+					fMethodViewerPaneLabel
+							.setText(fPaneLabelProvider.getText(input));
+					fMethodViewerPaneLabel
+							.setImage(fPaneLabelProvider.getImage(input));
 				} else {
 					fMethodViewerPaneLabel.setText(""); //$NON-NLS-1$
 					fMethodViewerPaneLabel.setImage(null);
 				}
-				Runnable runnable = new Runnable() {
-					@Override
-					public void run() {
-						fMethodsViewer.setInput(input); // refresh
-					}
-				};
+				Runnable runnable = () -> fMethodsViewer.setInput(input);
 				BusyIndicator.showWhile(getDisplay(), runnable);
 			}
 		}
@@ -1356,19 +1316,18 @@
 		if (fInputElement != null) {
 			IWorkingSet workingSet = fWorkingSetActionGroup.getWorkingSet();
 			if (workingSet == null) {
-				String[] args = new String[] {
-						viewerTitle,
+				String[] args = new String[] { viewerTitle,
 						ScriptElementLabels.getDefault().getElementLabel(
-								fInputElement, ScriptElementLabels.ALL_DEFAULT) };
-				title = Messages
-						.format(TypeHierarchyMessages.TypeHierarchyViewPart_title,
-								args);
+								fInputElement,
+								ScriptElementLabels.ALL_DEFAULT) };
+				title = Messages.format(
+						TypeHierarchyMessages.TypeHierarchyViewPart_title,
+						args);
 				tooltip = Messages.format(
 						TypeHierarchyMessages.TypeHierarchyViewPart_tooltip,
 						args);
 			} else {
-				String[] args = new String[] {
-						viewerTitle,
+				String[] args = new String[] { viewerTitle,
 						ScriptElementLabels.getDefault().getElementLabel(
 								fInputElement, ScriptElementLabels.ALL_DEFAULT),
 						workingSet.getLabel() };
@@ -1433,7 +1392,7 @@
 
 	/**
 	 * Gets the current active view index.
-	 * 
+	 *
 	 * @return The index of the current viewer
 	 */
 	public int getViewIndex() {
@@ -1447,7 +1406,7 @@
 	/**
 	 * called from EnableMemberFilterAction. Must be called after creation of
 	 * the view part.
-	 * 
+	 *
 	 * @param on
 	 *            <code>true</code> to turn the member filter on
 	 */
@@ -1460,8 +1419,8 @@
 				updateHierarchyViewer(true);
 				updateTitle();
 
-				if (methodViewerInput != null
-						&& getCurrentViewer().isElementShown(methodViewerInput)) {
+				if (methodViewerInput != null && getCurrentViewer()
+						.isElementShown(methodViewerInput)) {
 					// avoid that the method view changes content by selecting
 					// the previous input
 					internalSelectType(methodViewerInput, true);
@@ -1480,7 +1439,7 @@
 	/**
 	 * called from ShowQualifiedTypeNamesAction. Must be called after creation
 	 * of the view part.
-	 * 
+	 *
 	 * @param on
 	 *            <code>true</code> to enable qualified type names
 	 */
@@ -1500,7 +1459,7 @@
 	/**
 	 * Called from ITypeHierarchyLifeCycleListener. Can be called from any
 	 * thread
-	 * 
+	 *
 	 * @param typeHierarchy
 	 *            Hierarchy that has changed
 	 * @param changedTypes
@@ -1521,16 +1480,13 @@
 		Display display = getDisplay();
 		if (display != null) {
 			fIsRefreshRunnablePosted = true;
-			display.asyncExec(new Runnable() {
-				@Override
-				public void run() {
-					try {
-						if (fPagebook != null && !fPagebook.isDisposed()) {
-							doTypeHierarchyChangedOnViewers(changedTypes);
-						}
-					} finally {
-						fIsRefreshRunnablePosted = false;
+			display.asyncExec(() -> {
+				try {
+					if (fPagebook != null && !fPagebook.isDisposed()) {
+						doTypeHierarchyChangedOnViewers(changedTypes);
 					}
+				} finally {
+					fIsRefreshRunnablePosted = false;
 				}
 			});
 		}
@@ -1547,11 +1503,9 @@
 					fHierarchyLifeCycle.ensureRefreshedTypeHierarchy(
 							fInputElement, getSite().getWorkbenchWindow());
 				} catch (InvocationTargetException e) {
-					ExceptionHandler
-							.handle(e,
-									getSite().getShell(),
-									TypeHierarchyMessages.TypeHierarchyViewPart_exception_title,
-									TypeHierarchyMessages.TypeHierarchyViewPart_exception_message);
+					ExceptionHandler.handle(e, getSite().getShell(),
+							TypeHierarchyMessages.TypeHierarchyViewPart_exception_title,
+							TypeHierarchyMessages.TypeHierarchyViewPart_exception_message);
 					clearInput();
 					return;
 				} catch (InterruptedException e) {
@@ -1563,10 +1517,10 @@
 				// elements in hierarchy modified
 				Object methodViewerInput = fMethodsViewer.getInput();
 				fMethodsViewer.refresh();
-				fMethodViewerPaneLabel.setText(fPaneLabelProvider
-						.getText(methodViewerInput));
-				fMethodViewerPaneLabel.setImage(fPaneLabelProvider
-						.getImage(methodViewerInput));
+				fMethodViewerPaneLabel
+						.setText(fPaneLabelProvider.getText(methodViewerInput));
+				fMethodViewerPaneLabel.setImage(
+						fPaneLabelProvider.getImage(methodViewerInput));
 				if (getCurrentViewer().isMethodFiltering()) {
 					if (changedTypes.length == 1) {
 						getCurrentViewer().refresh(changedTypes[0]);
@@ -1574,8 +1528,7 @@
 						updateHierarchyViewer(false);
 					}
 				} else {
-					getCurrentViewer().update(
-							changedTypes,
+					getCurrentViewer().update(changedTypes,
 							new String[] { IBasicPropertyConstants.P_TEXT,
 									IBasicPropertyConstants.P_IMAGE });
 				}
@@ -1587,7 +1540,8 @@
 	 * @see IViewPart#init
 	 */
 	@Override
-	public void init(IViewSite site, IMemento memento) throws PartInitException {
+	public void init(IViewSite site, IMemento memento)
+			throws PartInitException {
 		super.init(site, memento);
 		fMemento = memento;
 	}
@@ -1618,8 +1572,9 @@
 		int position = bar != null ? bar.getSelection() : 0;
 		memento.putInteger(TAG_VERTICAL_SCROLL, position);
 
-		IModelElement selection = toModelElement(((IStructuredSelection) getCurrentViewer()
-				.getSelection()).getFirstElement());
+		IModelElement selection = toModelElement(
+				((IStructuredSelection) getCurrentViewer().getSelection())
+						.getFirstElement());
 		if (selection != null) {
 			memento.putString(TAG_SELECTION, selection.getHandleIdentifier());
 		}
@@ -1654,7 +1609,8 @@
 	/*
 	 * Restores the type hierarchy settings from a memento.
 	 */
-	private void restoreState(final IMemento memento, IModelElement defaultInput) {
+	private void restoreState(final IMemento memento,
+			IModelElement defaultInput) {
 		IModelElement input = defaultInput;
 		String elementId = memento.getString(TAG_INPUT);
 		if (elementId != null) {
@@ -1669,9 +1625,9 @@
 			final IModelElement hierarchyInput = input;
 
 			synchronized (this) {
-				String label = Messages
-						.format(TypeHierarchyMessages.TypeHierarchyViewPart_restoreinput,
-								hierarchyInput.getElementName());
+				String label = Messages.format(
+						TypeHierarchyMessages.TypeHierarchyViewPart_restoreinput,
+						hierarchyInput.getElementName());
 				fNoHierarchyShownLabel.setText(label);
 
 				fRestoreStateJob = new Job(label) {
@@ -1698,13 +1654,10 @@
 			throws ModelException {
 		fHierarchyLifeCycle.doHierarchyRefresh(hierarchyInput, monitor);
 		if (!monitor.isCanceled()) {
-			Display.getDefault().asyncExec(new Runnable() {
-				@Override
-				public void run() {
-					// running async: check first if view still exists
-					if (fPagebook != null && !fPagebook.isDisposed()) {
-						doRestoreState(memento, hierarchyInput);
-					}
+			Display.getDefault().asyncExec(() -> {
+				// running async: check first if view still exists
+				if (fPagebook != null && !fPagebook.isDisposed()) {
+					doRestoreState(memento, hierarchyInput);
 				}
 			});
 		}
@@ -1734,8 +1687,8 @@
 
 		Integer ratio = memento.getInteger(TAG_RATIO);
 		if (ratio != null) {
-			fTypeMethodsSplitter.setWeights(new int[] { ratio.intValue(),
-					1000 - ratio.intValue() });
+			fTypeMethodsSplitter.setWeights(
+					new int[] { ratio.intValue(), 1000 - ratio.intValue() });
 		}
 		ScrollBar bar = getCurrentViewer().getTree().getVerticalBar();
 		if (bar != null) {
@@ -1757,7 +1710,7 @@
 
 	/**
 	 * view part becomes visible
-	 * 
+	 *
 	 * @param isVisible
 	 */
 	protected void visibilityChanged(boolean isVisible) {
@@ -1770,7 +1723,7 @@
 
 	/**
 	 * Link selection to active editor.
-	 * 
+	 *
 	 * @param editor
 	 *            The activated editor
 	 */
@@ -1809,7 +1762,7 @@
 
 	/*
 	 * (non-Javadoc)
-	 * 
+	 *
 	 * @seeorg.eclipse.jdt.internal.ui.viewsupport.IViewPartInputProvider#
 	 * getViewPartInput()
 	 */
@@ -1822,13 +1775,8 @@
 	 * @return Returns the <code>IShowInSource</code> for this view.
 	 */
 	protected IShowInSource getShowInSource() {
-		return new IShowInSource() {
-			@Override
-			public ShowInContext getShowInContext() {
-				return new ShowInContext(null, getSite().getSelectionProvider()
-						.getSelection());
-			}
-		};
+		return () -> new ShowInContext(null,
+				getSite().getSelectionProvider().getSelection());
 	}
 
 	boolean isLinkingEnabled() {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/infoviews/AbstractInfoView.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/infoviews/AbstractInfoView.java
index 70234b3..61267b6 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/infoviews/AbstractInfoView.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/infoviews/AbstractInfoView.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -62,11 +62,10 @@
 
 /**
  * Abstract class for views which show information for a given element.
- * 
- * 
+ *
  */
-public abstract class AbstractInfoView extends ViewPart implements
-		ISelectionListener, IMenuListener, IPropertyChangeListener {
+public abstract class AbstractInfoView extends ViewPart
+		implements ISelectionListener, IMenuListener, IPropertyChangeListener {
 
 	/**
 	 * @since 2.0
@@ -172,15 +171,15 @@
 	private IContextActivation fContextActivation;
 	/**
 	 * Background color.
-	 * 
-	 * 
+	 *
+	 *
 	 */
 	private Color fBackgroundColor;
 	private RGB fBackgroundColorRGB;
 
 	/**
 	 * Set the input of this view.
-	 * 
+	 *
 	 * @param input
 	 *            the input object
 	 */
@@ -188,7 +187,7 @@
 
 	/**
 	 * Computes the input for this view based on the given element.
-	 * 
+	 *
 	 * @param element
 	 *            the element from which to compute the input
 	 * @return the input or <code>null</code> if the input was not computed
@@ -198,7 +197,7 @@
 
 	/**
 	 * Create the part control.
-	 * 
+	 *
 	 * @param parent
 	 *            the parent control
 	 * @see IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
@@ -207,7 +206,7 @@
 
 	/**
 	 * Set the view's foreground color.
-	 * 
+	 *
 	 * @param color
 	 *            the SWT color
 	 */
@@ -215,7 +214,7 @@
 
 	/**
 	 * Set the view's background color.
-	 * 
+	 *
 	 * @param color
 	 *            the SWT color
 	 */
@@ -223,16 +222,16 @@
 
 	/**
 	 * Returns the view's primary control.
-	 * 
+	 *
 	 * @return the primary control
 	 */
 	protected abstract Control getControl();
 
 	/**
 	 * Returns the context ID for the Help system
-	 * 
+	 *
 	 * @return the string used as ID for the Help context
-	 * 
+	 *
 	 */
 	abstract protected String getHelpContextId();
 
@@ -248,14 +247,14 @@
 		createActions();
 		createContextMenu();
 		fillActionBars(getViewSite().getActionBars());
-		IContextService ctxService = getSite().getService(
-				IContextService.class);
+		IContextService ctxService = getSite()
+				.getService(IContextService.class);
 		if (ctxService != null) {
 			fContextActivation = ctxService
 					.activateContext(DLTKUIPlugin.CONTEXT_VIEWS);
 		}
-		PlatformUI.getWorkbench().getHelpSystem()
-				.setHelp(getControl(), getHelpContextId());
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
+				getHelpContextId());
 	}
 
 	/**
@@ -307,7 +306,7 @@
 
 	/**
 	 * Returns the input of this view.
-	 * 
+	 *
 	 * @return input the input object or <code>null</code> if not input is set
 	 */
 	protected Object getInput() {
@@ -323,7 +322,7 @@
 	 * Fills the actions bars.
 	 * <p>
 	 * Subclasses may extend.
-	 * 
+	 *
 	 * @param actionBars
 	 *            the action bars
 	 */
@@ -346,7 +345,7 @@
 	 * <p>
 	 * Default is to do nothing.
 	 * </p>
-	 * 
+	 *
 	 * @param tbm
 	 *            the tool bar manager
 	 */
@@ -377,9 +376,9 @@
 
 	/**
 	 * The preference key for the background color.
-	 * 
+	 *
 	 * @return the background color key
-	 * 
+	 *
 	 */
 	abstract protected String getBackgroundColorKey();
 
@@ -413,7 +412,7 @@
 	/**
 	 * Tells whether the new input should be ignored if the current input is the
 	 * same.
-	 * 
+	 *
 	 * @param je
 	 *            the new input
 	 * @param selection
@@ -428,7 +427,7 @@
 
 	/**
 	 * Finds and returns the Script element selected in the given part.
-	 * 
+	 *
 	 * @param part
 	 *            the workbench part for which to find the selected Script
 	 *            element
@@ -442,8 +441,8 @@
 			if (isValidWorkbenchPart(part)
 					&& selection instanceof ITextSelection) {
 				final IEditorPart editor = (IEditorPart) part;
-				IModelElement[] elements = TextSelectionConverter.codeResolve(
-						editor, (ITextSelection) selection);
+				IModelElement[] elements = TextSelectionConverter
+						.codeResolve(editor, (ITextSelection) selection);
 				if (elements != null && elements.length > 0) {
 					return elements.length == 1 ? elements[0]
 							: (Object) new ModelElementArray(elements);
@@ -461,7 +460,7 @@
 	/**
 	 * Checks that specified {@link IWorkbenchPart} is an {@link ITextEditor}
 	 * and is suitable to retrieve selected {@link IModelElement}s
-	 * 
+	 *
 	 * @param part
 	 * @return
 	 */
@@ -471,7 +470,7 @@
 
 	/**
 	 * Tries to get a Script element out of the given element.
-	 * 
+	 *
 	 * @param element
 	 *            an object
 	 * @return the Script element represented by the given element or
@@ -479,8 +478,7 @@
 	 */
 	private IModelElement findModelElement(Object element) {
 		if (element != null && element instanceof IAdaptable) {
-			return ((IAdaptable) element)
-					.getAdapter(IModelElement.class);
+			return ((IAdaptable) element).getAdapter(IModelElement.class);
 		}
 		return null;
 	}
@@ -521,7 +519,7 @@
 	/**
 	 * Determines all necessary details and delegates the computation into a
 	 * background thread.
-	 * 
+	 *
 	 * @param part
 	 *            the workbench part
 	 */
@@ -552,8 +550,9 @@
 								((ITextSelection) selection).getOffset());
 						if (reg != null) {
 							try {
-								tmp = new KeywordInput(document.get(
-										reg.getOffset(), reg.getLength()),
+								tmp = new KeywordInput(
+										document.get(reg.getOffset(),
+												reg.getLength()),
 										EditorUtility
 												.getEditorInputModelElement(
 														edit, false));
@@ -579,15 +578,12 @@
 				Display display = shell.getDisplay();
 				if (display.isDisposed())
 					return;
-				display.asyncExec(new Runnable() {
-					@Override
-					public void run() {
-						if (fComputeCount != currentCount
-								|| getViewSite().getShell().isDisposed())
-							return;
-						fCurrentViewInput = src;
-						doSetInput(input);
-					}
+				display.asyncExec(() -> {
+					if (fComputeCount != currentCount
+							|| getViewSite().getShell().isDisposed())
+						return;
+					fCurrentViewInput = src;
+					doSetInput(input);
 				});
 
 			}
@@ -605,8 +601,8 @@
 			IModelElement me = (IModelElement) in;
 			setContentDescription(ScriptElementLabels.getDefault()
 					.getElementLabel(me, TITLE_FLAGS));
-			setTitleToolTip(ScriptElementLabels.getDefault().getElementLabel(
-					me, TOOLTIP_LABEL_FLAGS));
+			setTitleToolTip(ScriptElementLabels.getDefault().getElementLabel(me,
+					TOOLTIP_LABEL_FLAGS));
 		} else if (in instanceof ModelElementArray) {
 			final ModelElementArray array = (ModelElementArray) in;
 			setContentDescription(array.getContentDescription());