Use StructuredSelection directly.

Change-Id: I06329456bf20b9973abcabfc303e1b6f93baa9b2
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/preferences/ScriptStepFilterPreferencePage.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/preferences/ScriptStepFilterPreferencePage.java
index e99eb8c..587621f 100644
--- a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/preferences/ScriptStepFilterPreferencePage.java
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/preferences/ScriptStepFilterPreferencePage.java
@@ -43,7 +43,6 @@
 import org.eclipse.jface.viewers.CheckboxTableViewer;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.KeyAdapter;
@@ -392,8 +391,7 @@
 	 * Removes the currently selected filters.
 	 */
 	protected void removeFilters() {
-		fTableViewer.remove(
-				((IStructuredSelection) fTableViewer.getSelection()).toArray());
+		fTableViewer.remove(fTableViewer.getStructuredSelection().toArray());
 	}
 
 	@Override
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/AbstractInterpreterEnvironmentVariablesBlock.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/AbstractInterpreterEnvironmentVariablesBlock.java
index efc096a..a111308 100644
--- a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/AbstractInterpreterEnvironmentVariablesBlock.java
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/AbstractInterpreterEnvironmentVariablesBlock.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -91,7 +91,7 @@
 	 * Creates and returns the source lookup control.
 	 *
 	 * @param parent
-	 *            the parent widget of this control
+	 *                   the parent widget of this control
 	 */
 	public Control createControl(Composite parent) {
 		Composite comp = new Composite(parent, SWT.NONE);
@@ -167,9 +167,9 @@
 	 * Creates and returns a button
 	 *
 	 * @param parent
-	 *            parent widget
+	 *                   parent widget
 	 * @param label
-	 *            label
+	 *                   label
 	 * @return Button
 	 */
 	protected Button createPushButton(Composite parent, String label) {
@@ -291,26 +291,27 @@
 		Object source = e.getSource();
 		/*
 		 * if (source == fUpButton) { fEnvironmentVariablesContentProvider
-		 * .up((IStructuredSelection) fLibraryViewer.getSelection()); } else if
-		 * (source == fDownButton) { fEnvironmentVariablesContentProvider
-		 * .down((IStructuredSelection) fLibraryViewer.getSelection()); } else
-		 */if (source == fRemoveButton) {
+		 * .up(fLibraryViewer.getStructuredSelection()); } else if (source ==
+		 * fDownButton) { fEnvironmentVariablesContentProvider
+		 * .down(fLibraryViewer.getStructuredSelection()); } else
+		 */
+		if (source == fRemoveButton) {
 			EnvironmentVariable[] old = this.fEnvironmentVariablesContentProvider
 					.getVariables();
-			fEnvironmentVariablesContentProvider.remove(
-					(IStructuredSelection) fVariablesViewer.getSelection());
+			fEnvironmentVariablesContentProvider
+					.remove(fVariablesViewer.getStructuredSelection());
 			fDialog.updateLibraries(
 					this.fEnvironmentVariablesContentProvider.getVariables(),
 					old);
 			fDialog.updateValidateInterpreterLocation();
 		} else if (source == fAddExistedButton) {
-			addExisted((IStructuredSelection) fVariablesViewer.getSelection());
+			addExisted(fVariablesViewer.getStructuredSelection());
 		} else if (source == fAddButton) {
 			handleAdd();
 		} else if (source == fEditButton) {
 			EnvironmentVariable[] old = this.fEnvironmentVariablesContentProvider
 					.getVariables();
-			if (edit((IStructuredSelection) fVariablesViewer.getSelection())) {
+			if (edit(fVariablesViewer.getStructuredSelection())) {
 				fDialog.updateLibraries(
 						this.fEnvironmentVariablesContentProvider
 								.getVariables(),
@@ -487,8 +488,8 @@
 	 * Refresh the enable/disable state for the buttons.
 	 */
 	private void updateButtons() {
-		IStructuredSelection selection = (IStructuredSelection) fVariablesViewer
-				.getSelection();
+		IStructuredSelection selection = fVariablesViewer
+				.getStructuredSelection();
 		fRemoveButton.setEnabled(!selection.isEmpty());
 		fEditButton.setEnabled(selection.size() == 1);
 		@SuppressWarnings("unused")
@@ -522,9 +523,9 @@
 	 * install and type.
 	 *
 	 * @param interpreter
-	 *            Interpreter or <code>null</code> if none
+	 *                        Interpreter or <code>null</code> if none
 	 * @param type
-	 *            type of Interpreter install
+	 *                        type of Interpreter install
 	 */
 	public void initializeFrom(IInterpreterInstall interpreter,
 			IInterpreterInstallType type) {
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/AbstractInterpreterLibraryBlock.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/AbstractInterpreterLibraryBlock.java
index f346e5a..216f645 100644
--- a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/AbstractInterpreterLibraryBlock.java
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/AbstractInterpreterLibraryBlock.java
@@ -130,8 +130,8 @@
 					InterpretersMessages.AbstractInterpreterLibraryBlock_setPathVisibleToDltk);
 			fEnabledButton.addSelectionListener(this);
 			this.fLibraryViewer.addDoubleClickListener(event -> {
-				if (fLibraryContentProvider.canEnable(
-						(IStructuredSelection) fLibraryViewer.getSelection())) {
+				if (fLibraryContentProvider
+						.canEnable(fLibraryViewer.getStructuredSelection())) {
 					fLibraryContentProvider.changeEnabled();
 					updateButtons();
 				}
@@ -365,28 +365,20 @@
 		return fInterpreterInstallType;
 	}
 
-	/*
-	 * (non-Javadoc)
-	 *
-	 * @see
-	 * org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt
-	 * .events.SelectionEvent)
-	 */
 	@Override
 	public void widgetSelected(SelectionEvent e) {
 		Object source = e.getSource();
 		if (source == fUpButton) {
-			fLibraryContentProvider
-					.up((IStructuredSelection) fLibraryViewer.getSelection());
+			fLibraryContentProvider.up(fLibraryViewer.getStructuredSelection());
 		} else if (source == fDownButton) {
 			fLibraryContentProvider
-					.down((IStructuredSelection) fLibraryViewer.getSelection());
+					.down(fLibraryViewer.getStructuredSelection());
 		} else if (source == fRemoveButton) {
-			fLibraryContentProvider.remove(
-					(IStructuredSelection) fLibraryViewer.getSelection());
+			fLibraryContentProvider
+					.remove(fLibraryViewer.getStructuredSelection());
 			this.fDialog.updateValidateInterpreterLocation();
 		} else if (source == fAddButton) {
-			add((IStructuredSelection) fLibraryViewer.getSelection());
+			add(fLibraryViewer.getStructuredSelection());
 		} else if (source == fDefaultButton) {
 			restoreDefaultLibraries();
 			this.fDialog.updateValidateInterpreterLocation();
@@ -398,12 +390,6 @@
 		update();
 	}
 
-	/*
-	 * (non-Javadoc)
-	 *
-	 * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.
-	 * eclipse .swt.events.SelectionEvent)
-	 */
 	@Override
 	public void widgetDefaultSelected(SelectionEvent e) {
 	}
@@ -420,13 +406,6 @@
 		this.fDialog.updateValidateInterpreterLocation();
 	}
 
-	/*
-	 * (non-Javadoc)
-	 *
-	 * @see
-	 * org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(
-	 * org.eclipse.jface.viewers.SelectionChangedEvent)
-	 */
 	@Override
 	public void selectionChanged(SelectionChangedEvent event) {
 		updateButtons();
@@ -436,8 +415,8 @@
 	 * Refresh the enable/disable state for the buttons.
 	 */
 	private void updateButtons() {
-		IStructuredSelection selection = (IStructuredSelection) fLibraryViewer
-				.getSelection();
+		IStructuredSelection selection = fLibraryViewer
+				.getStructuredSelection();
 		fRemoveButton.setEnabled(fLibraryContentProvider.canRemove(selection));
 		boolean enableUp = true, enableDown = true;
 		Object[] libraries = fLibraryContentProvider.getElements(null);
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/InterpretersBlock.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/InterpretersBlock.java
index 438a90d..eddd07e 100644
--- a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/InterpretersBlock.java
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/InterpretersBlock.java
@@ -1042,8 +1042,8 @@
 	}
 
 	protected void editInterpreter() {
-		IStructuredSelection selection = (IStructuredSelection) fInterpreterList
-				.getSelection();
+		IStructuredSelection selection = fInterpreterList
+				.getStructuredSelection();
 		IInterpreterInstall install = (IInterpreterInstall) selection
 				.getFirstElement();
 
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/log/ScriptDebugLogView.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/log/ScriptDebugLogView.java
index 30e9c4f..630b6bc 100644
--- a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/log/ScriptDebugLogView.java
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/log/ScriptDebugLogView.java
@@ -83,8 +83,8 @@
 		});
 		viewer.addSelectionChangedListener(event -> {
 			if (event.getSelection() instanceof IStructuredSelection) {
-				final Object first = ((IStructuredSelection) event
-						.getSelection()).getFirstElement();
+				final Object first = event.getStructuredSelection()
+						.getFirstElement();
 				if (first instanceof ScriptDebugLogItem) {
 					textDocument.set(((ScriptDebugLogItem) first).getMessage());
 					return;
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/TestViewer.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/TestViewer.java
index 2accb11..ffc2801 100755
--- a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/TestViewer.java
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/TestViewer.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -621,8 +621,8 @@
 	}
 
 	public void selectFailure(boolean showNext) {
-		IStructuredSelection selection = (IStructuredSelection) getActiveViewer()
-				.getSelection();
+		IStructuredSelection selection = getActiveViewer()
+				.getStructuredSelection();
 		TestElement selected = (TestElement) selection.getFirstElement();
 		TestElement next;
 
diff --git a/core/plugins/org.eclipse.dltk.ui/.settings/org.eclipse.jdt.core.prefs b/core/plugins/org.eclipse.dltk.ui/.settings/org.eclipse.jdt.core.prefs
index 630f45f..3cc361a 100644
--- a/core/plugins/org.eclipse.dltk.ui/.settings/org.eclipse.jdt.core.prefs
+++ b/core/plugins/org.eclipse.dltk.ui/.settings/org.eclipse.jdt.core.prefs
@@ -16,6 +16,7 @@
 org.eclipse.jdt.core.compiler.debug.lineNumber=generate
 org.eclipse.jdt.core.compiler.debug.localVariable=generate
 org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.APILeak=warning
 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
 org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
@@ -77,6 +78,7 @@
 org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
 org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
 org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
 org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
 org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
 org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
@@ -86,8 +88,8 @@
 org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
 org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
 org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
 org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
 org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
 org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/NewWizardsActionGroup.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/NewWizardsActionGroup.java
index 49d482c..b4d364e 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/NewWizardsActionGroup.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/NewWizardsActionGroup.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -19,8 +19,6 @@
 import org.eclipse.ui.actions.ActionGroup;
 import org.eclipse.ui.actions.NewWizardMenu;
 
-
-
 /**
  * Action group that adds the 'new' menu to a context menu.
  * <p>
@@ -34,28 +32,29 @@
 	private IWorkbenchSite fSite;
 
 	/**
-	 * Creates a new <code>NewWizardsActionGroup</code>. The group requires
-	 * that the selection provided by the part's selection provider is of type <code>
+	 * Creates a new <code>NewWizardsActionGroup</code>. The group requires that
+	 * the selection provided by the part's selection provider is of type <code>
 	 * org.eclipse.jface.viewers.IStructuredSelection</code>.
 	 *
-	 * @param site the view part that owns this action group
+	 * @param site
+	 *                 the view part that owns this action group
 	 */
 	public NewWizardsActionGroup(IWorkbenchSite site) {
-		fSite= site;
+		fSite = site;
 	}
 
-
 	@Override
 	public void fillContextMenu(IMenuManager menu) {
 		super.fillContextMenu(menu);
 
-		ISelection selection= getContext().getSelection();
+		ISelection selection = getContext().getSelection();
 		if (selection instanceof IStructuredSelection) {
-			IStructuredSelection sel= (IStructuredSelection) selection;
+			IStructuredSelection sel = (IStructuredSelection) selection;
 			if (sel.size() <= 1 && isNewTarget(sel.getFirstElement())) {
-		        MenuManager newMenu = new MenuManager(ActionMessages.NewWizardsActionGroup_new);
-		        menu.appendToGroup(IContextMenuConstants.GROUP_NEW, newMenu);
-		        newMenu.add(new NewWizardMenu(fSite.getWorkbenchWindow()));
+				MenuManager newMenu = new MenuManager(
+						ActionMessages.NewWizardsActionGroup_new);
+				menu.appendToGroup(IContextMenuConstants.GROUP_NEW, newMenu);
+				newMenu.add(new NewWizardMenu(fSite.getWorkbenchWindow()));
 			}
 		}
 
@@ -68,12 +67,12 @@
 			return true;
 		}
 		if (element instanceof IModelElement) {
-			int type= ((IModelElement)element).getElementType();
-			return type == IModelElement.SCRIPT_PROJECT ||
-				type == IModelElement.PROJECT_FRAGMENT ||
-				type == IModelElement.SCRIPT_FOLDER ||
-				type == IModelElement.SOURCE_MODULE ||
-				type == IModelElement.TYPE;
+			int type = ((IModelElement) element).getElementType();
+			return type == IModelElement.SCRIPT_PROJECT
+					|| type == IModelElement.PROJECT_FRAGMENT
+					|| type == IModelElement.SCRIPT_FOLDER
+					|| type == IModelElement.SOURCE_MODULE
+					|| type == IModelElement.TYPE;
 		}
 		return false;
 	}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dialogs/TableTextCellEditor.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dialogs/TableTextCellEditor.java
index 130462d..4a07915 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dialogs/TableTextCellEditor.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dialogs/TableTextCellEditor.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2017 IBM Corporation and others.
+ * Copyright (c) 2005, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -36,8 +36,8 @@
  * following changes:
  *
  * <ul>
- * <li> modify events are sent out as the text is changed, and not only after
- * editing is done </li>
+ * <li>modify events are sent out as the text is changed, and not only after
+ * editing is done</li>
  *
  * <li>a content assistant is supported</li>
  *
@@ -53,27 +53,27 @@
 	private final int fColumn;
 	private final String fProperty;
 	/**
-	 * The editor's value on activation. This value is reset to the
-	 * cell when the editor is left via ESC key.
+	 * The editor's value on activation. This value is reset to the cell when
+	 * the editor is left via ESC key.
 	 */
 	String fOriginalValue;
 	SubjectControlContentAssistant fContentAssistant;
 	private IActivationListener fActivationListener;
 
-    protected Text text;
+	protected Text text;
 
-    private boolean isSelection = false;
-    private boolean isDeleteable = false;
-    private boolean isSelectable = false;
+	private boolean isSelection = false;
+	private boolean isDeleteable = false;
+	private boolean isSelectable = false;
 
-    private static final int defaultStyle = SWT.SINGLE;
+	private static final int defaultStyle = SWT.SINGLE;
 	private ModifyListener fModifyListener;
 
 	public TableTextCellEditor(TableViewer tableViewer, int column) {
 		super(tableViewer.getTable(), defaultStyle);
-		fTableViewer= tableViewer;
-		fColumn= column;
-		fProperty= (String) tableViewer.getColumnProperties()[column];
+		fTableViewer = tableViewer;
+		fColumn = column;
+		fProperty = (String) tableViewer.getColumnProperties()[column];
 	}
 
 	@Override
@@ -81,18 +81,19 @@
 		super.activate();
 		if (fActivationListener != null)
 			fActivationListener.activate();
-		fOriginalValue= text.getText();
+		fOriginalValue = text.getText();
 	}
 
 	private void fireModifyEvent(Object newValue) {
 		fTableViewer.getCellModifier().modify(
-				((IStructuredSelection) fTableViewer.getSelection()).getFirstElement(),
+				fTableViewer.getStructuredSelection().getFirstElement(),
 				fProperty, newValue);
 	}
 
 	@Override
 	protected void focusLost() {
-		if (fContentAssistant != null && fContentAssistant.hasProposalPopupFocus()) {
+		if (fContentAssistant != null
+				&& fContentAssistant.hasProposalPopupFocus()) {
 			// skip focus lost if it went to the content assist popup
 		} else {
 			super.focusLost();
@@ -100,67 +101,68 @@
 	}
 
 	public void setContentAssistant(SubjectControlContentAssistant assistant) {
-		fContentAssistant= assistant;
+		fContentAssistant = assistant;
 	}
 
 	public void setActivationListener(IActivationListener listener) {
-		fActivationListener= listener;
+		fActivationListener = listener;
 	}
 
 	public Text getText() {
 		return text;
 	}
 
-    protected void checkDeleteable() {
-        boolean oldIsDeleteable = isDeleteable;
-        isDeleteable = isDeleteEnabled();
-        if (oldIsDeleteable != isDeleteable) {
-            fireEnablementChanged(DELETE);
-        }
-    }
+	protected void checkDeleteable() {
+		boolean oldIsDeleteable = isDeleteable;
+		isDeleteable = isDeleteEnabled();
+		if (oldIsDeleteable != isDeleteable) {
+			fireEnablementChanged(DELETE);
+		}
+	}
 
-    protected void checkSelectable() {
-        boolean oldIsSelectable = isSelectable;
-        isSelectable = isSelectAllEnabled();
-        if (oldIsSelectable != isSelectable) {
-            fireEnablementChanged(SELECT_ALL);
-        }
-    }
+	protected void checkSelectable() {
+		boolean oldIsSelectable = isSelectable;
+		isSelectable = isSelectAllEnabled();
+		if (oldIsSelectable != isSelectable) {
+			fireEnablementChanged(SELECT_ALL);
+		}
+	}
 
-    protected void checkSelection() {
-        boolean oldIsSelection = isSelection;
-        isSelection = text.getSelectionCount() > 0;
-        if (oldIsSelection != isSelection) {
-            fireEnablementChanged(COPY);
-            fireEnablementChanged(CUT);
-        }
-    }
+	protected void checkSelection() {
+		boolean oldIsSelection = isSelection;
+		isSelection = text.getSelectionCount() > 0;
+		if (oldIsSelection != isSelection) {
+			fireEnablementChanged(COPY);
+			fireEnablementChanged(CUT);
+		}
+	}
 
 	private ModifyListener getModifyListener() {
-	    if (fModifyListener == null) {
+		if (fModifyListener == null) {
 			fModifyListener = e -> editOccured(e);
-	    }
-	    return fModifyListener;
+		}
+		return fModifyListener;
 	}
 
 	@Override
 	protected Control createControl(Composite parent) {
-        text= new Text(parent, getStyle());
-        text.addSelectionListener(new SelectionAdapter() {
+		text = new Text(parent, getStyle());
+		text.addSelectionListener(new SelectionAdapter() {
 			@Override
 			public void widgetDefaultSelected(SelectionEvent e) {
-                handleDefaultSelection(e);
-            }
-        });
+				handleDefaultSelection(e);
+			}
+		});
 		text.addKeyListener(new KeyAdapter() {
 			@Override
 			public void keyPressed(KeyEvent e) {
 				// support switching rows while editing:
 				if (e.stateMask == SWT.MOD1 || e.stateMask == SWT.MOD2) {
-					if (e.keyCode == SWT.ARROW_UP || e.keyCode == SWT.ARROW_DOWN) {
-					    // allow starting multi-selection even if in edit mode
+					if (e.keyCode == SWT.ARROW_UP
+							|| e.keyCode == SWT.ARROW_DOWN) {
+						// allow starting multi-selection even if in edit mode
 						deactivate();
-						e.doit= false;
+						e.doit = false;
 						return;
 					}
 				}
@@ -169,24 +171,26 @@
 					return;
 
 				switch (e.keyCode) {
-				case SWT.ARROW_DOWN :
-					e.doit= false;
-					int nextRow= fTableViewer.getTable().getSelectionIndex() + 1;
+				case SWT.ARROW_DOWN:
+					e.doit = false;
+					int nextRow = fTableViewer.getTable().getSelectionIndex()
+							+ 1;
 					if (nextRow >= fTableViewer.getTable().getItemCount())
 						break;
 					editRow(nextRow);
 					break;
 
-				case SWT.ARROW_UP :
-					e.doit= false;
-					int prevRow= fTableViewer.getTable().getSelectionIndex() - 1;
+				case SWT.ARROW_UP:
+					e.doit = false;
+					int prevRow = fTableViewer.getTable().getSelectionIndex()
+							- 1;
 					if (prevRow < 0)
 						break;
 					editRow(prevRow);
 					break;
 
-				case SWT.F2 :
-					e.doit= false;
+				case SWT.F2:
+					e.doit = false;
 					deactivate();
 					break;
 				}
@@ -194,238 +198,246 @@
 
 			private void editRow(int row) {
 				fTableViewer.getTable().setSelection(row);
-				IStructuredSelection newSelection= (IStructuredSelection) fTableViewer.getSelection();
+				IStructuredSelection newSelection = fTableViewer
+						.getStructuredSelection();
 				if (newSelection.size() == 1)
-					fTableViewer.editElement(newSelection.getFirstElement(), fColumn);
+					fTableViewer.editElement(newSelection.getFirstElement(),
+							fColumn);
 			}
 		});
-        text.addKeyListener(new KeyAdapter() {
-            // hook key pressed - see PR 14201
+		text.addKeyListener(new KeyAdapter() {
+			// hook key pressed - see PR 14201
 			@Override
 			public void keyPressed(KeyEvent e) {
-                keyReleaseOccured(e);
+				keyReleaseOccured(e);
 
-                // as a result of processing the above call, clients may have
-                // disposed this cell editor
-                if ((getControl() == null) || getControl().isDisposed())
-                    return;
-                checkSelection(); // see explaination below
-                checkDeleteable();
-                checkSelectable();
-            }
-        });
+				// as a result of processing the above call, clients may have
+				// disposed this cell editor
+				if ((getControl() == null) || getControl().isDisposed())
+					return;
+				checkSelection(); // see explaination below
+				checkDeleteable();
+				checkSelectable();
+			}
+		});
 		text.addTraverseListener(e -> {
 			if (e.detail == SWT.TRAVERSE_ESCAPE
 					|| e.detail == SWT.TRAVERSE_RETURN) {
 				e.doit = false;
 			}
 		});
-        // We really want a selection listener but it is not supported so we
-        // use a key listener and a mouse listener to know when selection changes
-        // may have occurred
-        text.addMouseListener(new MouseAdapter() {
+		// We really want a selection listener but it is not supported so we
+		// use a key listener and a mouse listener to know when selection
+		// changes
+		// may have occurred
+		text.addMouseListener(new MouseAdapter() {
 			@Override
 			public void mouseUp(MouseEvent e) {
-                checkSelection();
-                checkDeleteable();
-                checkSelectable();
-            }
-        });
-        text.addFocusListener(new FocusAdapter() {
+				checkSelection();
+				checkDeleteable();
+				checkSelectable();
+			}
+		});
+		text.addFocusListener(new FocusAdapter() {
 			@Override
 			public void focusLost(FocusEvent e) {
 				e.display.asyncExec(() -> TableTextCellEditor.this.focusLost());
-            }
-        });
-        text.setFont(parent.getFont());
-        text.setBackground(parent.getBackground());
-        text.setText("");//$NON-NLS-1$
-        text.addModifyListener(getModifyListener());
+			}
+		});
+		text.setFont(parent.getFont());
+		text.setBackground(parent.getBackground());
+		text.setText("");//$NON-NLS-1$
+		text.addModifyListener(getModifyListener());
 
 		return text;
-    }
+	}
 
 	@Override
 	protected void fireCancelEditor() {
-		/* bug 58540: change signature refactoring interaction: validate as you type [refactoring] */
-    	text.setText(fOriginalValue);
+		/*
+		 * bug 58540: change signature refactoring interaction: validate as you
+		 * type [refactoring]
+		 */
+		text.setText(fOriginalValue);
 		super.fireApplyEditorValue();
-    }
+	}
 
-    /**
-     * The <code>TextCellEditor</code> implementation of
-     * this <code>CellEditor</code> framework method returns
-     * the text string.
-     *
-     * @return the text string
-     */
+	/**
+	 * The <code>TextCellEditor</code> implementation of this
+	 * <code>CellEditor</code> framework method returns the text string.
+	 *
+	 * @return the text string
+	 */
 	@Override
 	protected Object doGetValue() {
-        return text.getText();
-    }
+		return text.getText();
+	}
 
 	@Override
 	protected void doSetFocus() {
-        if (text != null) {
-            text.selectAll();
-            text.setFocus();
-            checkSelection();
-            checkDeleteable();
-            checkSelectable();
-        }
-    }
+		if (text != null) {
+			text.selectAll();
+			text.setFocus();
+			checkSelection();
+			checkDeleteable();
+			checkSelectable();
+		}
+	}
 
-    /**
-     * The <code>TextCellEditor2</code> implementation of
-     * this <code>CellEditor</code> framework method accepts
-     * a text string (type <code>String</code>).
-     *
-     * @param value a text string (type <code>String</code>)
-     */
+	/**
+	 * The <code>TextCellEditor2</code> implementation of this
+	 * <code>CellEditor</code> framework method accepts a text string (type
+	 * <code>String</code>).
+	 *
+	 * @param value
+	 *                  a text string (type <code>String</code>)
+	 */
 	@Override
 	protected void doSetValue(Object value) {
-        Assert.isTrue(text != null && (value instanceof String));
-        text.removeModifyListener(getModifyListener());
-        text.setText((String) value);
-        text.addModifyListener(getModifyListener());
-    }
+		Assert.isTrue(text != null && (value instanceof String));
+		text.removeModifyListener(getModifyListener());
+		text.setText((String) value);
+		text.addModifyListener(getModifyListener());
+	}
 
-    /**
-     * Processes a modify event that occurred in this text cell editor.
-     * This framework method performs validation and sets the error message
-     * accordingly, and then reports a change via <code>fireEditorValueChanged</code>.
-     * Subclasses should call this method at appropriate times. Subclasses
-     * may extend or reimplement.
-     *
-     * @param e the SWT modify event
-     */
-    protected void editOccured(ModifyEvent e) {
-        String value = text.getText();
-        boolean oldValidState = isValueValid();
-        boolean newValidState = isCorrect(value);
-        if (!newValidState) {
-            // try to insert the current value into the error message.
-            setErrorMessage(Messages.format(getErrorMessage(),
-                    new Object[] { value }));
-        }
-        valueChanged(oldValidState, newValidState);
+	/**
+	 * Processes a modify event that occurred in this text cell editor. This
+	 * framework method performs validation and sets the error message
+	 * accordingly, and then reports a change via
+	 * <code>fireEditorValueChanged</code>. Subclasses should call this method
+	 * at appropriate times. Subclasses may extend or reimplement.
+	 *
+	 * @param e
+	 *              the SWT modify event
+	 */
+	protected void editOccured(ModifyEvent e) {
+		String value = text.getText();
+		boolean oldValidState = isValueValid();
+		boolean newValidState = isCorrect(value);
+		if (!newValidState) {
+			// try to insert the current value into the error message.
+			setErrorMessage(
+					Messages.format(getErrorMessage(), new Object[] { value }));
+		}
+		valueChanged(oldValidState, newValidState);
 		fireModifyEvent(text.getText()); // update model on-the-fly
-    }
+	}
 
 	@Override
 	public LayoutData getLayoutData() {
-        return new LayoutData();
-    }
+		return new LayoutData();
+	}
 
-    protected void handleDefaultSelection(SelectionEvent event) {
-        // same with enter-key handling code in keyReleaseOccured(e);
-        fireApplyEditorValue();
-        deactivate();
-    }
+	protected void handleDefaultSelection(SelectionEvent event) {
+		// same with enter-key handling code in keyReleaseOccured(e);
+		fireApplyEditorValue();
+		deactivate();
+	}
 
 	@Override
 	public boolean isCopyEnabled() {
-        if (text == null || text.isDisposed())
-            return false;
-        return text.getSelectionCount() > 0;
-    }
+		if (text == null || text.isDisposed())
+			return false;
+		return text.getSelectionCount() > 0;
+	}
 
 	@Override
 	public boolean isCutEnabled() {
-        if (text == null || text.isDisposed())
-            return false;
-        return text.getSelectionCount() > 0;
-    }
+		if (text == null || text.isDisposed())
+			return false;
+		return text.getSelectionCount() > 0;
+	}
 
 	@Override
 	public boolean isDeleteEnabled() {
-        if (text == null || text.isDisposed())
-            return false;
-        return text.getSelectionCount() > 0
-                || text.getCaretPosition() < text.getCharCount();
-    }
+		if (text == null || text.isDisposed())
+			return false;
+		return text.getSelectionCount() > 0
+				|| text.getCaretPosition() < text.getCharCount();
+	}
 
 	@Override
 	public boolean isPasteEnabled() {
-        if (text == null || text.isDisposed())
-            return false;
-        return true;
-    }
+		if (text == null || text.isDisposed())
+			return false;
+		return true;
+	}
 
 	@Override
 	public boolean isSelectAllEnabled() {
-        if (text == null || text.isDisposed())
-            return false;
-        return text.getCharCount() > 0;
-    }
+		if (text == null || text.isDisposed())
+			return false;
+		return text.getCharCount() > 0;
+	}
 
 	@Override
 	protected void keyReleaseOccured(KeyEvent keyEvent) {
-        if (keyEvent.character == '\r') { // Return key
-            // Enter is handled in handleDefaultSelection.
-            // Do not apply the editor value in response to an Enter key event
-            // since this can be received from the IME when the intent is -not-
-            // to apply the value.
-            // See bug 39074 [CellEditors] [DBCS] canna input mode fires bogus event from Text Control
-            //
-            // An exception is made for Ctrl+Enter for multi-line texts, since
-            // a default selection event is not sent in this case.
-            if (text != null && !text.isDisposed()
-                    && (text.getStyle() & SWT.MULTI) != 0) {
-                if ((keyEvent.stateMask & SWT.CTRL) != 0) {
-                    super.keyReleaseOccured(keyEvent);
-                }
-            }
-            return;
-        }
-        super.keyReleaseOccured(keyEvent);
-    }
+		if (keyEvent.character == '\r') { // Return key
+			// Enter is handled in handleDefaultSelection.
+			// Do not apply the editor value in response to an Enter key event
+			// since this can be received from the IME when the intent is -not-
+			// to apply the value.
+			// See bug 39074 [CellEditors] [DBCS] canna input mode fires bogus
+			// event from Text Control
+			//
+			// An exception is made for Ctrl+Enter for multi-line texts, since
+			// a default selection event is not sent in this case.
+			if (text != null && !text.isDisposed()
+					&& (text.getStyle() & SWT.MULTI) != 0) {
+				if ((keyEvent.stateMask & SWT.CTRL) != 0) {
+					super.keyReleaseOccured(keyEvent);
+				}
+			}
+			return;
+		}
+		super.keyReleaseOccured(keyEvent);
+	}
 
 	@Override
 	public void performCopy() {
-        text.copy();
-    }
+		text.copy();
+	}
 
 	@Override
 	public void performCut() {
-        text.cut();
-        checkSelection();
-        checkDeleteable();
-        checkSelectable();
-    }
+		text.cut();
+		checkSelection();
+		checkDeleteable();
+		checkSelectable();
+	}
 
 	@Override
 	public void performDelete() {
-        if (text.getSelectionCount() > 0)
-            // remove the contents of the current selection
-            text.insert(""); //$NON-NLS-1$
-        else {
-            // remove the next character
-            int pos = text.getCaretPosition();
-            if (pos < text.getCharCount()) {
-                text.setSelection(pos, pos + 1);
-                text.insert(""); //$NON-NLS-1$
-            }
-        }
-        checkSelection();
-        checkDeleteable();
-        checkSelectable();
-    }
+		if (text.getSelectionCount() > 0)
+			// remove the contents of the current selection
+			text.insert(""); //$NON-NLS-1$
+		else {
+			// remove the next character
+			int pos = text.getCaretPosition();
+			if (pos < text.getCharCount()) {
+				text.setSelection(pos, pos + 1);
+				text.insert(""); //$NON-NLS-1$
+			}
+		}
+		checkSelection();
+		checkDeleteable();
+		checkSelectable();
+	}
 
 	@Override
 	public void performPaste() {
-        text.paste();
-        checkSelection();
-        checkDeleteable();
-        checkSelectable();
-    }
+		text.paste();
+		checkSelection();
+		checkDeleteable();
+		checkSelectable();
+	}
 
 	@Override
 	public void performSelectAll() {
-        text.selectAll();
-        checkSelection();
-        checkDeleteable();
-    }
+		text.selectAll();
+		checkSelection();
+		checkDeleteable();
+	}
 
 	@Override
 	protected boolean dependsOnExternalFocusListener() {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dnd/DLTKViewerDragAdapter.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dnd/DLTKViewerDragAdapter.java
index 99a946d..1b4490e 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dnd/DLTKViewerDragAdapter.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dnd/DLTKViewerDragAdapter.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -19,14 +19,14 @@
 
 	public DLTKViewerDragAdapter(StructuredViewer viewer) {
 		super();
-		fViewer= viewer;
+		fViewer = viewer;
 	}
 
 	@Override
 	public void dragStart(DragSourceEvent event) {
-		IStructuredSelection selection= (IStructuredSelection)fViewer.getSelection();
+		IStructuredSelection selection = fViewer.getStructuredSelection();
 		if (selection.isEmpty()) {
-			event.doit= false;
+			event.doit = false;
 			return;
 		}
 		super.dragStart(event);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptEditor.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptEditor.java
index 46723db..ded861f 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptEditor.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptEditor.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2017 IBM Corporation and others.
+ * Copyright (c) 2005, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -301,7 +301,7 @@
 		 * Creates a new updater for the given <code>category</code>.
 		 *
 		 * @param category
-		 *            the new category.
+		 *                     the new category.
 		 */
 		public ExclusivePositionUpdater(String category) {
 			fCategory = category;
@@ -611,7 +611,7 @@
 		 * provider.
 		 *
 		 * @param selectionProvider
-		 *            the selection provider
+		 *                              the selection provider
 		 */
 		public void uninstall(ISelectionProvider selectionProvider) {
 			if (selectionProvider == null)
@@ -763,7 +763,8 @@
 	 * input.
 	 *
 	 * @param input
-	 *            The editor input for which to create the preference store
+	 *                  The editor input for which to create the preference
+	 *                  store
 	 * @return the preference store for this editor
 	 */
 	private IPreferenceStore createCombinedPreferenceStore(IEditorInput input) {
@@ -1312,8 +1313,8 @@
 
 	protected void doSelectionChanged(SelectionChangedEvent event) {
 		ISourceReference reference = null;
-		ISelection selection = event.getSelection();
-		Iterator<?> iter = ((IStructuredSelection) selection).iterator();
+		IStructuredSelection selection = event.getStructuredSelection();
+		Iterator<?> iter = selection.iterator();
 		while (iter.hasNext()) {
 			Object o = iter.next();
 			if (o instanceof ISourceReference) {
@@ -1454,7 +1455,7 @@
 	 * the editor.
 	 *
 	 * @param element
-	 *            thescriptelement to select
+	 *                    thescriptelement to select
 	 */
 	protected void synchronizeOutlinePage(ISourceReference element) {
 		synchronizeOutlinePage(element, true);
@@ -1465,10 +1466,10 @@
 	 * the editor.
 	 *
 	 * @param element
-	 *            thescriptelement to select
+	 *                                     thescriptelement to select
 	 * @param checkIfOutlinePageActive
-	 *            <code>true</code> if check for active outline page needs to be
-	 *            done
+	 *                                     <code>true</code> if check for active
+	 *                                     outline page needs to be done
 	 * @since 2.0
 	 */
 	@Override
@@ -1503,14 +1504,14 @@
 	 * </p>
 	 *
 	 * @param offset
-	 *            the region offset
+	 *                               the region offset
 	 * @param length
-	 *            the region length
+	 *                               the region length
 	 * @param forward
-	 *            <code>true</code> for forwards, <code>false</code> for
-	 *            backward
+	 *                               <code>true</code> for forwards,
+	 *                               <code>false</code> for backward
 	 * @param annotationPosition
-	 *            the position of the found annotation
+	 *                               the position of the found annotation
 	 * @return the found annotation
 	 */
 	@Override
@@ -1606,9 +1607,9 @@
 	 * <code>null</code>.
 	 *
 	 * @param offset
-	 *            the region offset
+	 *                   the region offset
 	 * @param length
-	 *            the region length
+	 *                   the region length
 	 * @return the found annotation or <code>null</code>
 	 * @since 3.0
 	 */
@@ -1774,7 +1775,7 @@
 	 * given IModelElement.
 	 *
 	 * @param element
-	 *            thescriptelement
+	 *                    thescriptelement
 	 * @return the corresponding model element
 	 */
 	protected IModelElement getCorrespondingElement(IModelElement element) {
@@ -1785,7 +1786,7 @@
 	 * Returns the most narrow model element including the given offset.
 	 *
 	 * @param offset
-	 *            the offset inside of the requested element
+	 *                   the offset inside of the requested element
 	 * @return the most narrow model element
 	 */
 	@Override
@@ -1801,9 +1802,10 @@
 	 * reconciled.
 	 *
 	 * @param offset
-	 *            the offset included by the retrieved element
+	 *                      the offset included by the retrieved element
 	 * @param reconcile
-	 *            <code>true</code> if working copy should be reconciled
+	 *                      <code>true</code> if working copy should be
+	 *                      reconciled
 	 * @return the most narrow element which includes the given offset
 	 */
 	public IModelElement getElementAt(int offset, boolean reconcile) {
@@ -2178,8 +2180,8 @@
 		 * Creates a new next sub-word action.
 		 *
 		 * @param code
-		 *            Action code for the default operation. Must be an action
-		 *            code from
+		 *                 Action code for the default operation. Must be an
+		 *                 action code from
 		 * @see org.eclipse.swt.custom.ST.
 		 */
 		protected NextSubWordAction(int code) {
@@ -2219,7 +2221,7 @@
 		 * Finds the next position after the given position.
 		 *
 		 * @param position
-		 *            the current position
+		 *                     the current position
 		 * @return the next position
 		 */
 		protected int findNextPosition(int position) {
@@ -2239,7 +2241,7 @@
 		 * <code>position</code>.
 		 *
 		 * @param position
-		 *            Position where the action should move the caret
+		 *                     Position where the action should move the caret
 		 */
 		protected abstract void setCaretPosition(int position);
 	}
@@ -2352,8 +2354,8 @@
 		 * Creates a new previous sub-word action.
 		 *
 		 * @param code
-		 *            Action code for the default operation. Must be an action
-		 *            code from
+		 *                 Action code for the default operation. Must be an
+		 *                 action code from
 		 * @see org.eclipse.swt.custom.ST.
 		 */
 		protected PreviousSubWordAction(final int code) {
@@ -2393,7 +2395,7 @@
 		 * Finds the previous position before the given position.
 		 *
 		 * @param position
-		 *            the current position
+		 *                     the current position
 		 * @return the previous position
 		 */
 		protected int findPreviousPosition(int position) {
@@ -2413,7 +2415,7 @@
 		 * <code>position</code>.
 		 *
 		 * @param position
-		 *            Position where the action should move the caret
+		 *                     Position where the action should move the caret
 		 */
 		protected abstract void setCaretPosition(int position);
 	}
@@ -2834,7 +2836,7 @@
 	 * </p>
 	 *
 	 * @param sourceViewer
-	 *            the source viewer
+	 *                         the source viewer
 	 * @return a region denoting the current signed selection, for a resulting
 	 *         RtoL selections length is < 0
 	 */
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/filters/CustomFiltersDialog.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/filters/CustomFiltersDialog.java
index 816effb..aad9836 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/filters/CustomFiltersDialog.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/filters/CustomFiltersDialog.java
@@ -23,7 +23,6 @@
 import org.eclipse.jface.viewers.ArrayContentProvider;
 import org.eclipse.jface.viewers.CheckboxTableViewer;
 import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.swt.SWT;
@@ -62,15 +61,16 @@
 	 * Creates a dialog to customize script element filters.
 	 *
 	 * @param shell
-	 *            the parent shell
+	 *                             the parent shell
 	 * @param viewId
-	 *            the id of the view
+	 *                             the id of the view
 	 * @param enablePatterns
-	 *            <code>true</code> if pattern filters are enabled
+	 *                             <code>true</code> if pattern filters are
+	 *                             enabled
 	 * @param patterns
-	 *            the filter patterns
+	 *                             the filter patterns
 	 * @param enabledFilterIds
-	 *            the Ids of the enabled filters
+	 *                             the Ids of the enabled filters
 	 */
 	public CustomFiltersDialog(Shell shell, String viewId,
 			boolean enablePatterns, String[] patterns,
@@ -198,14 +198,11 @@
 		data.heightHint = convertHeightInCharsToPixels(3);
 		description.setLayoutData(data);
 		fCheckBoxList.addSelectionChangedListener(event -> {
-			ISelection selection = event.getSelection();
-			if (selection instanceof IStructuredSelection) {
-				Object selectedElement = ((IStructuredSelection) selection)
-						.getFirstElement();
-				if (selectedElement instanceof FilterDescriptor)
-					description.setText(((FilterDescriptor) selectedElement)
-							.getDescription());
-			}
+			IStructuredSelection selection = event.getStructuredSelection();
+			Object selectedElement = selection.getFirstElement();
+			if (selectedElement instanceof FilterDescriptor)
+				description.setText(
+						((FilterDescriptor) selectedElement).getDescription());
 		});
 		fCheckBoxList.addCheckStateListener(event -> {
 			Object element = event.getElement();
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 bd36b03..b16f636 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
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -221,19 +221,6 @@
 		}
 	};
 
-	// 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
 		// explorer]
@@ -794,15 +781,14 @@
 					return DLTKUIPlugin.getDefault().getPreferenceStore();
 				}
 			};
-		} else {
-			return new WorkingSetAwareContentProvider(showCUChildren,
-					fWorkingSetModel) {
-				@Override
-				protected IPreferenceStore getPreferenceStore() {
-					return DLTKUIPlugin.getDefault().getPreferenceStore();
-				}
-			};
 		}
+		return new WorkingSetAwareContentProvider(showCUChildren,
+				fWorkingSetModel) {
+			@Override
+			protected IPreferenceStore getPreferenceStore() {
+				return DLTKUIPlugin.getDefault().getPreferenceStore();
+			}
+		};
 	}
 
 	protected ScriptExplorerLabelProvider createLabelProvider() {
@@ -819,9 +805,8 @@
 	private IElementComparer createElementComparer() {
 		if (getRootMode() == ScriptExplorerPart.PROJECTS_AS_ROOTS) {
 			return null;
-		} else {
-			return WorkingSetModel.COMPARER;
 		}
+		return WorkingSetModel.COMPARER;
 	}
 
 	private void fillActionBars() {
@@ -832,23 +817,22 @@
 	private Object findInputElement() {
 		if (getRootMode() == ScriptExplorerPart.WORKING_SETS_AS_ROOTS) {
 			return fWorkingSetModel;
-		} else {
-			Object input = getSite().getPage().getInput();
-			if (input instanceof IWorkspace) {
-				return DLTKCore.create(((IWorkspace) input).getRoot());
-			} else if (input instanceof IContainer) {
-				IModelElement element = DLTKCore.create((IContainer) input);
-				if (element != null && element.exists()) {
-					return element;
-				}
-				return input;
-			}
-			// 1GERPRT: ITPJUI:ALL - Packages View is empty when shown in Type
-			// Hierarchy Perspective
-			// we can't handle the input
-			// fall back to show the workspace
-			return DLTKCore.create(DLTKUIPlugin.getWorkspace().getRoot());
 		}
+		Object input = getSite().getPage().getInput();
+		if (input instanceof IWorkspace) {
+			return DLTKCore.create(((IWorkspace) input).getRoot());
+		} else if (input instanceof IContainer) {
+			IModelElement element = DLTKCore.create((IContainer) input);
+			if (element != null && element.exists()) {
+				return element;
+			}
+			return input;
+		}
+		// 1GERPRT: ITPJUI:ALL - Packages View is empty when shown in Type
+		// Hierarchy Perspective
+		// we can't handle the input
+		// fall back to show the workspace
+		return DLTKCore.create(DLTKUIPlugin.getWorkspace().getRoot());
 	}
 
 	@SuppressWarnings("unchecked")
@@ -912,36 +896,33 @@
 			}
 			return Messages.format(ScriptMessages.PackageExplorer_toolTip2,
 					new String[] { result, fWorkingSetLabel });
-		} else { // Working set mode. During initialization element and
-			// action set can be null.
-			if (element != null && !(element instanceof IWorkingSet)
-					&& !(element instanceof WorkingSetModel)
-					&& fActionSet != null) {
-				FrameList frameList = fActionSet.getFrameList();
-				int index = frameList.getCurrentIndex();
-				IWorkingSet ws = null;
-				while (index >= 0) {
-					Frame frame = frameList.getFrame(index);
-					if (frame instanceof TreeFrame) {
-						Object input = ((TreeFrame) frame).getInput();
-						if (input instanceof IWorkingSet) {
-							ws = (IWorkingSet) input;
-							break;
-						}
-					}
-					index--;
-				}
-				if (ws != null) {
-					return Messages.format(
-							ScriptMessages.PackageExplorer_toolTip3,
-							new String[] { ws.getLabel(), result });
-				} else {
-					return result;
-				}
-			} else {
-				return result;
-			}
 		}
+		// Working set mode. During initialization element and
+		// action set can be null.
+		if (element != null && !(element instanceof IWorkingSet)
+				&& !(element instanceof WorkingSetModel)
+				&& fActionSet != null) {
+			FrameList frameList = fActionSet.getFrameList();
+			int index = frameList.getCurrentIndex();
+			IWorkingSet ws = null;
+			while (index >= 0) {
+				Frame frame = frameList.getFrame(index);
+				if (frame instanceof TreeFrame) {
+					Object input = ((TreeFrame) frame).getInput();
+					if (input instanceof IWorkingSet) {
+						ws = (IWorkingSet) input;
+						break;
+					}
+				}
+				index--;
+			}
+			if (ws != null) {
+				return Messages.format(ScriptMessages.PackageExplorer_toolTip3,
+						new String[] { ws.getLabel(), result });
+			}
+			return result;
+		}
+		return result;
 	}
 
 	@Override
@@ -1071,9 +1052,8 @@
 		}
 		if (changed) {
 			return new StructuredSelection(elements);
-		} else {
-			return s;
 		}
+		return s;
 	}
 
 	private Object convertElement(Object original) {
@@ -1137,7 +1117,7 @@
 	 * Links to editor (if option enabled)
 	 *
 	 * @param selection
-	 *            the selection
+	 *                      the selection
 	 */
 	private void linkToEditor(IStructuredSelection selection) {
 		// ignore selection changes if the package explorer is not the active
@@ -1244,7 +1224,7 @@
 	 * to be the editor's input, if linking is enabled.
 	 *
 	 * @param editor
-	 *            the activated editor
+	 *                   the activated editor
 	 */
 	protected void editorActivated(IEditorPart editor) {
 		IEditorInput editorInput = editor.getEditorInput();
@@ -1288,8 +1268,7 @@
 	}
 
 	protected boolean inputIsSelected(IEditorInput input) {
-		IStructuredSelection selection = (IStructuredSelection) fViewer
-				.getSelection();
+		IStructuredSelection selection = fViewer.getStructuredSelection();
 		if (selection.size() != 1) {
 			return false;
 		}
@@ -1711,7 +1690,7 @@
 			}
 		}
 		IStructuredSelection selection = new StructuredSelection(
-				((IStructuredSelection) fViewer.getSelection()).toArray());
+				(fViewer.getStructuredSelection()).toArray());
 		Object input = fViewer.getInput();
 		boolean isRootInputChange = DLTKCore
 				.create(ResourcesPlugin.getWorkspace().getRoot()).equals(input)
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/AbstractInformationControl.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/AbstractInformationControl.java
index b8e2b8c..a9cae86 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/AbstractInformationControl.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/AbstractInformationControl.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -27,7 +27,6 @@
 import org.eclipse.jface.text.IInformationControlExtension;
 import org.eclipse.jface.text.IInformationControlExtension2;
 import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TreeViewer;
@@ -151,17 +150,17 @@
 	 * given styles are applied to the shell and the tree widget.
 	 *
 	 * @param parent
-	 *            the parent shell
+	 *                              the parent shell
 	 * @param shellStyle
-	 *            the additional styles for the shell
+	 *                              the additional styles for the shell
 	 * @param treeStyle
-	 *            the additional styles for the tree widget
+	 *                              the additional styles for the tree widget
 	 * @param invokingCommandId
-	 *            the id of the command that invoked this control or
-	 *            <code>null</code>
+	 *                              the id of the command that invoked this
+	 *                              control or <code>null</code>
 	 * @param showStatusField
-	 *            <code>true</code> iff the control has a status field at the
-	 *            bottom
+	 *                              <code>true</code> iff the control has a
+	 *                              status field at the bottom
 	 */
 	public AbstractInformationControl(Shell parent, int shellStyle,
 			int treeStyle, String invokingCommandId, boolean showStatusField) {
@@ -207,7 +206,7 @@
 	 * Create the main content for this information control.
 	 *
 	 * @param parent
-	 *            The parent composite
+	 *                   The parent composite
 	 * @return The control representing the main content.
 	 *
 	 */
@@ -298,11 +297,11 @@
 	 * given styles are applied to the shell and the tree widget.
 	 *
 	 * @param parent
-	 *            the parent shell
+	 *                       the parent shell
 	 * @param shellStyle
-	 *            the additional styles for the shell
+	 *                       the additional styles for the shell
 	 * @param treeStyle
-	 *            the additional styles for the tree widget
+	 *                       the additional styles for the tree widget
 	 */
 	public AbstractInformationControl(Shell parent, int shellStyle,
 			int treeStyle) {
@@ -428,9 +427,9 @@
 	 * </p>
 	 *
 	 * @param pattern
-	 *            the pattern
+	 *                    the pattern
 	 * @param update
-	 *            <code>true</code> if the viewer should be updated
+	 *                    <code>true</code> if the viewer should be updated
 	 */
 	protected void setMatcherString(String pattern, boolean update) {
 		if (pattern.length() == 0) {
@@ -457,8 +456,7 @@
 		if (fTreeViewer == null)
 			return null;
 
-		return ((IStructuredSelection) fTreeViewer.getSelection())
-				.getFirstElement();
+		return fTreeViewer.getStructuredSelection().getFirstElement();
 	}
 
 	private void gotoSelectedElement() {
@@ -519,7 +517,7 @@
 	 * Fills the view menu. Clients can extend or override.
 	 *
 	 * @param viewMenu
-	 *            the menu manager that manages the menu
+	 *                     the menu manager that manages the menu
 	 *
 	 */
 	protected void fillViewMenu(IMenuManager viewMenu) {
@@ -567,10 +565,10 @@
 	 * {@inheritDoc}
 	 *
 	 * @param event
-	 *            can be null
-	 *            <p>
-	 *            Subclasses may extend.
-	 *            </p>
+	 *                  can be null
+	 *                  <p>
+	 *                  Subclasses may extend.
+	 *                  </p>
 	 */
 	@Override
 	public void widgetDisposed(DisposeEvent event) {
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 46ea82f..2cdf207 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, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -333,7 +333,7 @@
 	 * list.
 	 *
 	 * @param entry
-	 *            The new entry
+	 *                  The new entry
 	 */
 	private void addHistoryEntry(IModelElement entry) {
 		if (fInputHistory.contains(entry)) {
@@ -358,7 +358,7 @@
 	 * entries.
 	 *
 	 * @param entry
-	 *            The entry to open
+	 *                  The entry to open
 	 */
 	public void gotoHistoryEntry(IModelElement entry) {
 		if (fInputHistory.contains(entry)) {
@@ -382,7 +382,7 @@
 	 * Sets the history entries
 	 *
 	 * @param elems
-	 *            The history elements to set
+	 *                  The history elements to set
 	 */
 	public void setHistoryEntries(IModelElement[] elems) {
 		fInputHistory.clear();
@@ -396,7 +396,7 @@
 	 * Selects an member in the methods list or in the current hierarchy.
 	 *
 	 * @param member
-	 *            The member to select
+	 *                   The member to select
 	 */
 	public void selectMember(IMember member) {
 		fSelectInEditor = false;
@@ -438,7 +438,7 @@
 	 * Sets the input to a new type
 	 *
 	 * @param type
-	 *            The new input type
+	 *                 The new input type
 	 * @deprecated
 	 */
 	@Override
@@ -462,7 +462,7 @@
 	 * Sets the input to a new element.
 	 *
 	 * @param element
-	 *            the input element
+	 *                    the input element
 	 */
 	@Override
 	public void setInputElement(IModelElement element) {
@@ -1003,8 +1003,9 @@
 	 * called from ToggleOrientationAction.
 	 *
 	 * @param orientation
-	 *            VIEW_ORIENTATION_SINGLE, VIEW_ORIENTATION_HORIZONTAL or
-	 *            VIEW_ORIENTATION_VERTICAL
+	 *                        VIEW_ORIENTATION_SINGLE,
+	 *                        VIEW_ORIENTATION_HORIZONTAL or
+	 *                        VIEW_ORIENTATION_VERTICAL
 	 */
 	public void setOrientation(int orientation) {
 		if (fCurrentOrientation != orientation) {
@@ -1408,7 +1409,7 @@
 	 * the view part.
 	 *
 	 * @param on
-	 *            <code>true</code> to turn the member filter on
+	 *               <code>true</code> to turn the member filter on
 	 */
 	public void enableMemberFilter(boolean on) {
 		if (on != fIsEnableMemberFilter) {
@@ -1441,7 +1442,7 @@
 	 * of the view part.
 	 *
 	 * @param on
-	 *            <code>true</code> to enable qualified type names
+	 *               <code>true</code> to enable qualified type names
 	 */
 	public void showQualifiedTypeNames(boolean on) {
 		if (fAllViewers == null) {
@@ -1461,10 +1462,11 @@
 	 * thread
 	 *
 	 * @param typeHierarchy
-	 *            Hierarchy that has changed
+	 *                          Hierarchy that has changed
 	 * @param changedTypes
-	 *            Types in the hierarchy that have change or <code>null</code>
-	 *            if the full hierarchy has changed
+	 *                          Types in the hierarchy that have change or
+	 *                          <code>null</code> if the full hierarchy has
+	 *                          changed
 	 */
 	protected void doTypeHierarchyChanged(
 			final TypeHierarchyLifeCycle typeHierarchy,
@@ -1573,8 +1575,7 @@
 		memento.putInteger(TAG_VERTICAL_SCROLL, position);
 
 		IModelElement selection = toModelElement(
-				((IStructuredSelection) getCurrentViewer().getSelection())
-						.getFirstElement());
+				getCurrentViewer().getStructuredSelection().getFirstElement());
 		if (selection != null) {
 			memento.putString(TAG_SELECTION, selection.getHandleIdentifier());
 		}
@@ -1725,7 +1726,7 @@
 	 * Link selection to active editor.
 	 *
 	 * @param editor
-	 *            The activated editor
+	 *                   The activated editor
 	 */
 	protected void editorActivated(IEditorPart editor) {
 		if (!isLinkingEnabled()) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/FolderSelectionDialog.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/FolderSelectionDialog.java
index 020f6de..52abddd 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/FolderSelectionDialog.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/FolderSelectionDialog.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -30,19 +30,21 @@
 import org.eclipse.ui.dialogs.NewFolderDialog;
 import org.eclipse.ui.views.navigator.ResourceComparator;
 
-public class FolderSelectionDialog extends ElementTreeSelectionDialog implements ISelectionChangedListener {
+public class FolderSelectionDialog extends ElementTreeSelectionDialog
+		implements ISelectionChangedListener {
 
 	private Button fNewFolderButton;
 	private IContainer fSelectedContainer;
 
-	public FolderSelectionDialog(Shell parent, ILabelProvider labelProvider, ITreeContentProvider contentProvider) {
+	public FolderSelectionDialog(Shell parent, ILabelProvider labelProvider,
+			ITreeContentProvider contentProvider) {
 		super(parent, labelProvider, contentProvider);
 		setComparator(new ResourceComparator(ResourceComparator.NAME));
 	}
 
 	@Override
 	protected Control createDialogArea(Composite parent) {
-		Composite result= (Composite)super.createDialogArea(parent);
+		Composite result = (Composite) super.createDialogArea(parent);
 
 		getTreeViewer().addSelectionChangedListener(this);
 
@@ -55,7 +57,7 @@
 			}
 		});
 		button.setFont(parent.getFont());
-		fNewFolderButton= button;
+		fNewFolderButton = button;
 
 		applyDialogFont(result);
 		if (DLTKCore.DEBUG) {
@@ -67,32 +69,36 @@
 	}
 
 	private void updateNewFolderButtonState() {
-		IStructuredSelection selection= (IStructuredSelection) getTreeViewer().getSelection();
-		fSelectedContainer= null;
+		IStructuredSelection selection = getTreeViewer()
+				.getStructuredSelection();
+		fSelectedContainer = null;
 		if (selection.size() == 1) {
-			Object first= selection.getFirstElement();
+			Object first = selection.getFirstElement();
 			if (first instanceof IContainer) {
-				fSelectedContainer= (IContainer) first;
+				fSelectedContainer = (IContainer) first;
 			}
 		}
 		fNewFolderButton.setEnabled(fSelectedContainer != null);
 	}
 
 	protected void newFolderButtonPressed() {
-		NewFolderDialog dialog= new NewFolderDialog(getShell(), fSelectedContainer) {
+		NewFolderDialog dialog = new NewFolderDialog(getShell(),
+				fSelectedContainer) {
 			@Override
 			protected Control createContents(Composite parent) {
-				//PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IDLTKHelpContextIds.BP_CREATE_NEW_FOLDER);
+				// PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
+				// IDLTKHelpContextIds.BP_CREATE_NEW_FOLDER);
 				if (DLTKCore.DEBUG) {
-					System.err.println("FolderSelectionDialog: Add help support"); //$NON-NLS-1$
+					System.err
+							.println("FolderSelectionDialog: Add help support"); //$NON-NLS-1$
 				}
 				return super.createContents(parent);
 			}
 		};
 		if (dialog.open() == Window.OK) {
-			TreeViewer treeViewer= getTreeViewer();
+			TreeViewer treeViewer = getTreeViewer();
 			treeViewer.refresh(fSelectedContainer);
-			Object createdFolder= dialog.getResult()[0];
+			Object createdFolder = dialog.getResult()[0];
 			treeViewer.reveal(createdFolder);
 			treeViewer.setSelection(new StructuredSelection(createdFolder));
 		}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/MultipleFolderSelectionDialog.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/MultipleFolderSelectionDialog.java
index 1482869..ad85624 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/MultipleFolderSelectionDialog.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/MultipleFolderSelectionDialog.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2087 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
@@ -42,10 +42,10 @@
 import org.eclipse.ui.dialogs.SelectionStatusDialog;
 import org.eclipse.ui.views.navigator.ResourceComparator;
 
-
 /**
   */
-public class MultipleFolderSelectionDialog extends SelectionStatusDialog implements ISelectionChangedListener {
+public class MultipleFolderSelectionDialog extends SelectionStatusDialog
+		implements ISelectionChangedListener {
 
 	private CheckboxTreeViewer fViewer;
 
@@ -59,10 +59,12 @@
 	private Set fExisting;
 	private Object fFocusElement;
 
-	public MultipleFolderSelectionDialog(Shell parent, ILabelProvider labelProvider, ITreeContentProvider contentProvider) {
+	public MultipleFolderSelectionDialog(Shell parent,
+			ILabelProvider labelProvider,
+			ITreeContentProvider contentProvider) {
 		super(parent);
-		fLabelProvider= labelProvider;
-		fContentProvider= contentProvider;
+		fLabelProvider = labelProvider;
+		fContentProvider = contentProvider;
 
 		setSelectionResult(null);
 		setStatusLineAboveButtons(true);
@@ -70,21 +72,23 @@
 		int shellStyle = getShellStyle();
 		setShellStyle(shellStyle | SWT.MAX | SWT.RESIZE);
 
-		fExisting= null;
-		fFocusElement= null;
-		fFilters= null;
+		fExisting = null;
+		fFocusElement = null;
+		fFilters = null;
 	}
 
 	public void setExisting(Object[] existing) {
-		fExisting= new HashSet();
-		for (int i= 0; i < existing.length; i++) {
+		fExisting = new HashSet();
+		for (int i = 0; i < existing.length; i++) {
 			fExisting.add(existing[i]);
 		}
 	}
 
 	/**
 	 * Sets the tree input.
-	 * @param input the tree input.
+	 *
+	 * @param input
+	 *                  the tree input.
 	 */
 	public void setInput(Object input) {
 		fInput = input;
@@ -92,7 +96,9 @@
 
 	/**
 	 * Adds a filter to the tree viewer.
-	 * @param filter a filter.
+	 *
+	 * @param filter
+	 *                   a filter.
 	 */
 	public void addFilter(ViewerFilter filter) {
 		if (fFilters == null)
@@ -112,23 +118,23 @@
 
 	@Override
 	protected void computeResult() {
-		Object[] checked= fViewer.getCheckedElements();
+		Object[] checked = fViewer.getCheckedElements();
 		if (fExisting == null) {
 			if (checked.length == 0) {
-				checked= null;
+				checked = null;
 			}
 		} else {
-			ArrayList res= new ArrayList();
-			for (int i= 0; i < checked.length; i++) {
-				Object elem= checked[i];
+			ArrayList res = new ArrayList();
+			for (int i = 0; i < checked.length; i++) {
+				Object elem = checked[i];
 				if (!fExisting.contains(elem)) {
 					res.add(elem);
 				}
 			}
 			if (!res.isEmpty()) {
-				checked= res.toArray();
+				checked = res.toArray();
 			} else {
-				checked= null;
+				checked = null;
 			}
 		}
 		setSelectionResult(checked);
@@ -138,9 +144,6 @@
 		super.create();
 	}
 
-	/*
-	 * @see Window#create()
-	 */
 	@Override
 	public void create() {
 
@@ -164,7 +167,8 @@
 	/**
 	 * Creates the tree viewer.
 	 *
-	 * @param parent the parent composite
+	 * @param parent
+	 *                   the parent composite
 	 * @return the tree viewer
 	 */
 	protected CheckboxTreeViewer createTreeViewer(Composite parent) {
@@ -185,8 +189,6 @@
 		return fViewer;
 	}
 
-
-
 	/**
 	 *
 	 */
@@ -199,9 +201,6 @@
 		}
 	}
 
-	/* (non-Javadoc)
-	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
-	 */
 	@Override
 	protected Control createDialogArea(Composite parent) {
 		Composite composite = (Composite) super.createDialogArea(parent);
@@ -227,16 +226,17 @@
 		});
 		button.setFont(composite.getFont());
 
-		fNewFolderButton= button;
+		fNewFolderButton = button;
 
 		treeViewer.addSelectionChangedListener(this);
 		if (fExisting != null) {
-			Object[] existing= fExisting.toArray();
+			Object[] existing = fExisting.toArray();
 			treeViewer.setGrayedElements(existing);
 			setInitialSelections(existing);
 		}
 		if (fFocusElement != null) {
-			treeViewer.setSelection(new StructuredSelection(fFocusElement), true);
+			treeViewer.setSelection(new StructuredSelection(fFocusElement),
+					true);
 		}
 		treeViewer.addCheckStateListener(event -> forceExistingChecked(event));
 
@@ -246,7 +246,7 @@
 
 	protected void forceExistingChecked(CheckStateChangedEvent event) {
 		if (fExisting != null) {
-			Object elem= event.getElement();
+			Object elem = event.getElement();
 			if (fExisting.contains(elem)) {
 				fViewer.setChecked(elem, true);
 			}
@@ -254,21 +254,21 @@
 	}
 
 	private void updateNewFolderButtonState() {
-		IStructuredSelection selection= (IStructuredSelection) fViewer.getSelection();
-		fSelectedContainer= null;
+		IStructuredSelection selection = fViewer.getStructuredSelection();
+		fSelectedContainer = null;
 		if (selection.size() == 1) {
-			Object first= selection.getFirstElement();
+			Object first = selection.getFirstElement();
 			if (first instanceof IContainer) {
-				fSelectedContainer= (IContainer) first;
+				fSelectedContainer = (IContainer) first;
 			}
 		}
 		fNewFolderButton.setEnabled(fSelectedContainer != null);
 	}
 
 	protected void newFolderButtonPressed() {
-		Object createdFolder= createFolder(fSelectedContainer);
+		Object createdFolder = createFolder(fSelectedContainer);
 		if (createdFolder != null) {
-			CheckboxTreeViewer treeViewer= fViewer;
+			CheckboxTreeViewer treeViewer = fViewer;
 			treeViewer.refresh(fSelectedContainer);
 			treeViewer.reveal(createdFolder);
 			treeViewer.setChecked(createdFolder, true);
@@ -278,25 +278,20 @@
 	}
 
 	protected Object createFolder(IContainer container) {
-		NewFolderDialog dialog= new NewFolderDialog(getShell(), container);
+		NewFolderDialog dialog = new NewFolderDialog(getShell(), container);
 		if (dialog.open() == Window.OK) {
 			return dialog.getResult()[0];
 		}
 		return null;
 	}
 
-	/* (non-Javadoc)
-	 * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
-	 */
 	@Override
 	public void selectionChanged(SelectionChangedEvent event) {
 		updateNewFolderButtonState();
 	}
 
 	public void setInitialFocus(Object focusElement) {
-		fFocusElement= focusElement;
+		fFocusElement = focusElement;
 	}
 
-
-
 }
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/DialogPackageExplorer.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/DialogPackageExplorer.java
index d39b98f..0b67674 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/DialogPackageExplorer.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/DialogPackageExplorer.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -76,8 +76,9 @@
 		 * Get the elements of the current project
 		 *
 		 * @param element
-		 *            the element to get the children from, will not be used,
-		 *            instead the project childrens are returned directly
+		 *                    the element to get the children from, will not be
+		 *                    used, instead the project childrens are returned
+		 *                    directly
 		 * @return returns the children of the project
 		 */
 		@Override
@@ -322,7 +323,7 @@
 	 * Should only be called once.
 	 *
 	 * @param actionGroup
-	 *            the action group to be used for the context menu.
+	 *                        the action group to be used for the context menu.
 	 */
 	public void setActionGroup(
 			final DialogPackageExplorerActionGroup actionGroup) {
@@ -368,7 +369,7 @@
 	 * Set the input for the package explorer.
 	 *
 	 * @param project
-	 *            the project to be displayed
+	 *                    the project to be displayed
 	 */
 	public void setInput(IScriptProject project) {
 		fCurrJProject = project;
@@ -388,7 +389,7 @@
 	 * Set the selection and focus to the list of elements
 	 *
 	 * @param elements
-	 *            the object to be selected and displayed
+	 *                     the object to be selected and displayed
 	 */
 	public void setSelection(final List<?> elements) {
 		if (elements == null || elements.size() == 0)
@@ -442,7 +443,7 @@
 	 */
 	@Override
 	public void selectionChanged(SelectionChangedEvent event) {
-		fCurrentSelection = (IStructuredSelection) event.getSelection();
+		fCurrentSelection = event.getStructuredSelection();
 		try {
 			if (fActionGroup != null)
 				fActionGroup.setContext(new DialogExplorerActionContext(
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/WorkingSetConfigurationDialog.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/WorkingSetConfigurationDialog.java
index 454045f..b80bf41 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/WorkingSetConfigurationDialog.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/WorkingSetConfigurationDialog.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -172,7 +172,7 @@
 	 * Sets the initial selection
 	 *
 	 * @param workingSets
-	 *            the initial selection
+	 *                        the initial selection
 	 */
 	public void setSelection(IWorkingSet[] workingSets) {
 		fResult = workingSets;
@@ -307,8 +307,7 @@
 		fUpButton.addSelectionListener(new SelectionAdapter() {
 			@Override
 			public void widgetSelected(SelectionEvent e) {
-				moveUp(((IStructuredSelection) fTableViewer.getSelection())
-						.toList());
+				moveUp(fTableViewer.getStructuredSelection().toList());
 			}
 		});
 
@@ -320,8 +319,7 @@
 		fDownButton.addSelectionListener(new SelectionAdapter() {
 			@Override
 			public void widgetSelected(SelectionEvent e) {
-				moveDown(((IStructuredSelection) fTableViewer.getSelection())
-						.toList());
+				moveDown(fTableViewer.getStructuredSelection().toList());
 			}
 		});
 
@@ -550,8 +548,7 @@
 	 * Updates the modify buttons' enabled state based on the current seleciton.
 	 */
 	private void updateButtonAvailability() {
-		IStructuredSelection selection = (IStructuredSelection) fTableViewer
-				.getSelection();
+		IStructuredSelection selection = fTableViewer.getStructuredSelection();
 		boolean hasSelection = !selection.isEmpty();
 		boolean hasSingleSelection = selection.size() == 1;
 
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/ScriptBrowsingPart.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/ScriptBrowsingPart.java
index 39556a2..865fe64 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/ScriptBrowsingPart.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/ScriptBrowsingPart.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -236,8 +236,7 @@
 	}
 
 	private void saveSelectionState(IMemento memento) {
-		Object elements[] = ((IStructuredSelection) fViewer.getSelection())
-				.toArray();
+		Object elements[] = fViewer.getStructuredSelection().toArray();
 		if (elements.length > 0) {
 			IMemento selectionMem = memento.createChild(TAG_SELECTED_ELEMENTS);
 			for (int i = 0; i < elements.length; i++) {
@@ -566,19 +565,11 @@
 	protected void fillToolBar(IToolBarManager tbm) {
 	}
 
-	/*
-	 * (non-Javadoc)
-	 *
-	 * @see
-	 * org.eclipse.jface.action.IMenuListener#menuAboutToShow(org.eclipse.jface
-	 * .action.IMenuManager)
-	 */
 	@Override
 	public void menuAboutToShow(IMenuManager menu) {
 		DLTKUIPlugin.createStandardGroups(menu);
 
-		IStructuredSelection selection = (IStructuredSelection) fViewer
-				.getSelection();
+		IStructuredSelection selection = fViewer.getStructuredSelection();
 		int size = selection.size();
 		Object element = selection.getFirstElement();
 
@@ -676,7 +667,7 @@
 	 * Answers if the given <code>element</code> is a valid input for this part.
 	 *
 	 * @param element
-	 *            the object to test
+	 *                    the object to test
 	 * @return <code>true</code> if the given element is a valid input
 	 */
 	abstract protected boolean isValidInput(Object element);
@@ -686,7 +677,7 @@
 	 * part.
 	 *
 	 * @param element
-	 *            the object to test
+	 *                    the object to test
 	 * @return <code>true</code> if the given element is a valid element
 	 */
 	protected boolean isValidElement(Object element) {
@@ -880,7 +871,7 @@
 	 * Returns the tool tip text for the given element.
 	 *
 	 * @param element
-	 *            the element
+	 *                    the element
 	 * @return the tooltip for the element
 	 */
 	String getToolTipText(Object element) {
@@ -957,7 +948,7 @@
 	 * Creates the viewer of this part.
 	 *
 	 * @param parent
-	 *            the parent for the viewer
+	 *                   the parent for the viewer
 	 * @return the created viewer
 	 */
 	protected StructuredViewer createViewer(Composite parent) {
@@ -1078,7 +1069,7 @@
 
 			if (page.equals(DLTKUIPlugin.getActivePage())
 					&& ScriptBrowsingPart.this.equals(page.getActivePart())) {
-				linkToEditor((IStructuredSelection) event.getSelection());
+				linkToEditor(event.getStructuredSelection());
 			}
 		});
 
@@ -1133,11 +1124,11 @@
 	 * Compute if a new input must be set.
 	 *
 	 * @param elementToSelect
-	 *            the element to select
+	 *                            the element to select
 	 * @param oldInput
-	 *            old input
+	 *                            old input
 	 * @param newInput
-	 *            new input
+	 *                            new input
 	 * @return <code>true</code> if the input has to be set
 	 * @since 3.0
 	 */
@@ -1157,7 +1148,7 @@
 	 * and has the given Java element as child
 	 *
 	 * @param je
-	 *            the Java element for which to search the closest input
+	 *               the Java element for which to search the closest input
 	 * @return the closest Java element used as input for this part
 	 */
 	protected IModelElement findInputForJavaElement(IModelElement je) {
@@ -1181,7 +1172,7 @@
 	 * Finds the element which has to be selected in this part.
 	 *
 	 * @param je
-	 *            the Java element which has the focus
+	 *               the Java element which has the focus
 	 * @return returns the element to select
 	 */
 	abstract protected IModelElement findElementToSelect(IModelElement je);
@@ -1246,7 +1237,7 @@
 	 * Links to editor (if option enabled)
 	 *
 	 * @param selection
-	 *            the selection
+	 *                      the selection
 	 */
 	private void linkToEditor(IStructuredSelection selection) {
 		Object obj = selection.getFirstElement();
@@ -1319,7 +1310,7 @@
 	 * Returns the element contained in the EditorInput
 	 *
 	 * @param input
-	 *            the editor input
+	 *                  the editor input
 	 * @return the input element
 	 */
 	Object getElementOfInput(IEditorInput input) {
@@ -1340,9 +1331,9 @@
 
 	/**
 	 * @param input
-	 *            the editor input
+	 *                   the editor input
 	 * @param offset
-	 *            the offset in the file
+	 *                   the offset in the file
 	 * @return the element at the given offset
 	 */
 	protected IModelElement getElementAt(IEditorInput input, int offset) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/dialogs/ProjectSelectionDialog.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/dialogs/ProjectSelectionDialog.java
index b08a8ef..6665ca9 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/dialogs/ProjectSelectionDialog.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/dialogs/ProjectSelectionDialog.java
@@ -14,7 +14,6 @@
 import org.eclipse.dltk.ui.preferences.PreferencesMessages;
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.jface.viewers.ViewerFilter;
@@ -44,7 +43,8 @@
 
 	private ViewerFilter fFilter;
 
-	public ProjectSelectionDialog(Shell parentShell, Set projectsWithSpecifics) {
+	public ProjectSelectionDialog(Shell parentShell,
+			Set projectsWithSpecifics) {
 		this(parentShell, projectsWithSpecifics, null);
 	}
 
@@ -75,11 +75,10 @@
 
 		createMessageArea(composite);
 
-		fTableViewer = new TableViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL
-				| SWT.BORDER);
-		fTableViewer
-				.addSelectionChangedListener(event -> doSelectionChanged(((IStructuredSelection) event
-						.getSelection()).toArray()));
+		fTableViewer = new TableViewer(composite,
+				SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+		fTableViewer.addSelectionChangedListener(event -> doSelectionChanged(
+				event.getStructuredSelection().toArray()));
 		fTableViewer.addDoubleClickListener(event -> okPressed());
 		GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
 		data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
@@ -98,8 +97,8 @@
 						Object element) {
 					if (element instanceof IScriptProject) {
 						IScriptProject project = (IScriptProject) element;
-						return natureId.equals(project.getLanguageToolkit()
-								.getNatureId());
+						return natureId.equals(
+								project.getLanguageToolkit().getNatureId());
 					}
 					return true;
 				}
@@ -108,8 +107,8 @@
 
 		Button checkbox = new Button(composite, SWT.CHECK);
 		checkbox.setText(PreferencesMessages.ProjectSelectionDialog_filter);
-		checkbox.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true,
-				false));
+		checkbox.setLayoutData(
+				new GridData(SWT.BEGINNING, SWT.CENTER, true, false));
 		checkbox.addSelectionListener(new SelectionListener() {
 			@Override
 			public void widgetSelected(SelectionEvent e) {
@@ -128,8 +127,8 @@
 		checkbox.setSelection(doFilter);
 		updateFilter(doFilter);
 
-		IScriptModel input = DLTKCore.create(ResourcesPlugin.getWorkspace()
-				.getRoot());
+		IScriptModel input = DLTKCore
+				.create(ResourcesPlugin.getWorkspace().getRoot());
 		fTableViewer.setInput(input);
 
 		doSelectionChanged(new Object[0]);
@@ -143,8 +142,8 @@
 		} else {
 			fTableViewer.removeFilter(fFilter);
 		}
-		DLTKUIPlugin.getDefault().getDialogSettings().put(
-				DIALOG_SETTINGS_SHOW_ALL, !selected);
+		DLTKUIPlugin.getDefault().getDialogSettings()
+				.put(DIALOG_SETTINGS_SHOW_ALL, !selected);
 	}
 
 	private void doSelectionChanged(Object[] objects) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/environment/EnvironmentPathBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/environment/EnvironmentPathBlock.java
index b8113cb..ceebba3 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/environment/EnvironmentPathBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/environment/EnvironmentPathBlock.java
@@ -289,7 +289,7 @@
 	}
 
 	public IStructuredSelection getSelection() {
-		return (IStructuredSelection) pathViewer.getSelection();
+		return pathViewer.getStructuredSelection();
 	}
 
 	public void setPaths(Map<IEnvironment, String> paths) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/AbstractScriptEditorColoringConfigurationBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/AbstractScriptEditorColoringConfigurationBlock.java
index df8eb1e..6482372 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/AbstractScriptEditorColoringConfigurationBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/AbstractScriptEditorColoringConfigurationBlock.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -116,17 +116,17 @@
 		 * Initialize the item with the given values.
 		 *
 		 * @param displayName
-		 *            the display name
+		 *                             the display name
 		 * @param colorKey
-		 *            the color preference key
+		 *                             the color preference key
 		 * @param boldKey
-		 *            the bold preference key
+		 *                             the bold preference key
 		 * @param italicKey
-		 *            the italic preference key
+		 *                             the italic preference key
 		 * @param strikethroughKey
-		 *            the strikethrough preference key
+		 *                             the strikethrough preference key
 		 * @param underlineKey
-		 *            the underline preference key
+		 *                             the underline preference key
 		 */
 		public HighlightingColorListItem(String displayName, String colorKey,
 				String boldKey, String italicKey, String strikethroughKey,
@@ -210,19 +210,19 @@
 		 * Initialize the item with the given values.
 		 *
 		 * @param displayName
-		 *            the display name
+		 *                             the display name
 		 * @param colorKey
-		 *            the color preference key
+		 *                             the color preference key
 		 * @param boldKey
-		 *            the bold preference key
+		 *                             the bold preference key
 		 * @param italicKey
-		 *            the italic preference key
+		 *                             the italic preference key
 		 * @param strikethroughKey
-		 *            the strikethroughKey preference key
+		 *                             the strikethroughKey preference key
 		 * @param underlineKey
-		 *            the underlineKey preference key
+		 *                             the underlineKey preference key
 		 * @param enableKey
-		 *            the enable preference key
+		 *                             the enable preference key
 		 */
 		public SemanticHighlightingColorListItem(String displayName,
 				String colorKey, String boldKey, String italicKey,
@@ -511,7 +511,7 @@
 	 * Creates page for hover preferences.
 	 *
 	 * @param parent
-	 *            the parent composite
+	 *                   the parent composite
 	 * @return the control for the preference page
 	 */
 	@Override
@@ -971,8 +971,7 @@
 	 *
 	 */
 	private HighlightingColorListItem getHighlightingColorListItem() {
-		IStructuredSelection selection = (IStructuredSelection) fListViewer
-				.getSelection();
+		IStructuredSelection selection = fListViewer.getStructuredSelection();
 		Object element = selection.getFirstElement();
 		if (element instanceof String)
 			return null;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/ComboViewerBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/ComboViewerBlock.java
index 6dd788f..8e9f1c2 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/ComboViewerBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/ComboViewerBlock.java
@@ -22,14 +22,15 @@
 			}
 		});
 
-		viewer.addSelectionChangedListener(event -> selectedObjectChanged(getSelectedObject()));
+		viewer.addSelectionChangedListener(
+				event -> selectedObjectChanged(getSelectedObject()));
 	}
 
 	/**
 	 * Initializes the ComboViewer
 	 *
 	 * @param elements
-	 *            viewer elements
+	 *                     viewer elements
 	 */
 	public void initialize(Object[] elements) {
 		viewer.add(elements);
@@ -65,7 +66,7 @@
 	 * </p>
 	 *
 	 * @param element
-	 *            newly selected element
+	 *                    newly selected element
 	 */
 	protected abstract void selectedObjectChanged(Object element);
 
@@ -91,8 +92,7 @@
 	protected abstract Object getObjectById(String id);
 
 	public Object getSelectedObject() {
-		IStructuredSelection selection = (IStructuredSelection) viewer
-				.getSelection();
+		IStructuredSelection selection = viewer.getStructuredSelection();
 		if (selection != null) {
 			return selection.getFirstElement();
 		}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/templates/ScriptTemplatePreferencePage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/templates/ScriptTemplatePreferencePage.java
index 5b869ea..4216f37 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/templates/ScriptTemplatePreferencePage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/templates/ScriptTemplatePreferencePage.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2017 IBM Corporation and others.
+ * Copyright (c) 2005, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -30,8 +30,8 @@
 import org.eclipse.ui.IWorkbenchPreferencePage;
 import org.eclipse.ui.texteditor.templates.TemplatePreferencePage;
 
-public abstract class ScriptTemplatePreferencePage extends
-		TemplatePreferencePage implements IWorkbenchPreferencePage {
+public abstract class ScriptTemplatePreferencePage
+		extends TemplatePreferencePage implements IWorkbenchPreferencePage {
 	protected class ScriptEditTemplateDialog extends EditTemplateDialog {
 		public ScriptEditTemplateDialog(Shell parent, Template template,
 				boolean edit, boolean isNameModifiable,
@@ -48,7 +48,7 @@
 		 * override.
 		 *
 		 * @param parent
-		 *            the parent composite of the viewer
+		 *                   the parent composite of the viewer
 		 * @return a configured <code>SourceViewer</code>
 		 */
 		@Override
@@ -108,8 +108,8 @@
 		viewer.setDocument(document);
 
 		Control control = viewer.getControl();
-		control.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
-				| GridData.FILL_VERTICAL));
+		control.setLayoutData(new GridData(
+				GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL));
 
 		// Font font = JFaceResources
 		// .getFont(TPreferenceConstants.EDITOR_TEXT_FONT);
@@ -122,12 +122,12 @@
 
 	@Override
 	protected void updateViewerInput() {
-		IStructuredSelection selection = (IStructuredSelection) getTableViewer()
-				.getSelection();
+		IStructuredSelection selection = getTableViewer()
+				.getStructuredSelection();
 		SourceViewer viewer = getViewer();
 
-		if (selection.size() == 1
-				&& selection.getFirstElement() instanceof TemplatePersistenceData) {
+		if (selection.size() == 1 && selection
+				.getFirstElement() instanceof TemplatePersistenceData) {
 			final TemplatePersistenceData data = (TemplatePersistenceData) selection
 					.getFirstElement();
 			final Template template = data.getTemplate();
@@ -167,8 +167,8 @@
 	 * so template content is colored like inside "javadoc", but prefix and
 	 * suffix strings are invisible.
 	 */
-	protected static class ViewerInputDecorations implements
-			IViewerInputUpdater {
+	protected static class ViewerInputDecorations
+			implements IViewerInputUpdater {
 		private final String prefix;
 		private final String suffix;
 
@@ -197,8 +197,8 @@
 			}
 			final IDocument doc = viewer.getDocument();
 			doc.set(sb.toString());
-			viewer.setDocument(doc, offset, doc.getLength() - offset
-					- endOffset);
+			viewer.setDocument(doc, offset,
+					doc.getLength() - offset - endOffset);
 		}
 
 	}
diff --git a/core/plugins/org.eclipse.dltk.validators.externalchecker/src/org/eclipse/dltk/validators/internal/externalchecker/ui/ExternalCheckerConfigurationPage.java b/core/plugins/org.eclipse.dltk.validators.externalchecker/src/org/eclipse/dltk/validators/internal/externalchecker/ui/ExternalCheckerConfigurationPage.java
index a5226ac..dec7b2a 100644
--- a/core/plugins/org.eclipse.dltk.validators.externalchecker/src/org/eclipse/dltk/validators/internal/externalchecker/ui/ExternalCheckerConfigurationPage.java
+++ b/core/plugins/org.eclipse.dltk.validators.externalchecker/src/org/eclipse/dltk/validators/internal/externalchecker/ui/ExternalCheckerConfigurationPage.java
@@ -21,7 +21,6 @@
 import org.eclipse.jface.viewers.CellEditor;
 import org.eclipse.jface.viewers.ComboBoxCellEditor;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.jface.viewers.TextCellEditor;
 import org.eclipse.jface.viewers.Viewer;
@@ -98,8 +97,7 @@
 
 			if ("".equals(txtPath)) { //$NON-NLS-1$
 				/*
-				 * setMessage(env,
-				 * ValidatorMessages.ValidatorMessages_path_isempty,
+				 * setMessage(env, ValidatorMessages.ValidatorMessages_path_isempty,
 				 * IStatus.INFO);
 				 */
 				continue;
@@ -244,7 +242,7 @@
 		delRule.addSelectionListener(new SelectionAdapter() {
 			@Override
 			public void widgetSelected(SelectionEvent ev) {
-				Rule rule = (Rule) ((IStructuredSelection) tableViewer.getSelection()).getFirstElement();
+				Rule rule = (Rule) tableViewer.getStructuredSelection().getFirstElement();
 				if (rule != null)
 					rulesList.removeRule(rule);
 			}
diff --git a/core/plugins/org.eclipse.dltk.validators.externalchecker/src/org/eclipse/dltk/validators/internal/externalchecker/ui/ExternalCheckerRulesBlock.java b/core/plugins/org.eclipse.dltk.validators.externalchecker/src/org/eclipse/dltk/validators/internal/externalchecker/ui/ExternalCheckerRulesBlock.java
index f143c48..f9a4827 100644
--- a/core/plugins/org.eclipse.dltk.validators.externalchecker/src/org/eclipse/dltk/validators/internal/externalchecker/ui/ExternalCheckerRulesBlock.java
+++ b/core/plugins/org.eclipse.dltk.validators.externalchecker/src/org/eclipse/dltk/validators/internal/externalchecker/ui/ExternalCheckerRulesBlock.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -18,7 +18,6 @@
 import org.eclipse.dltk.validators.internal.externalchecker.core.ExternalCheckerWildcardManager;
 import org.eclipse.jface.viewers.CellEditor;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.jface.viewers.TextCellEditor;
 import org.eclipse.jface.viewers.Viewer;
@@ -150,8 +149,7 @@
 		removeWCard.addSelectionListener(new SelectionAdapter() {
 			@Override
 			public void widgetSelected(SelectionEvent ev) {
-				CustomWildcard rule = (CustomWildcard) ((IStructuredSelection) tViewer.getSelection())
-						.getFirstElement();
+				CustomWildcard rule = (CustomWildcard) tViewer.getStructuredSelection().getFirstElement();
 				if (rule != null)
 					wlist.removeWcard(rule);
 			}
diff --git a/core/plugins/org.eclipse.dltk.validators.ui/META-INF/MANIFEST.MF b/core/plugins/org.eclipse.dltk.validators.ui/META-INF/MANIFEST.MF
index f4ba3af..bc10cfc 100644
--- a/core/plugins/org.eclipse.dltk.validators.ui/META-INF/MANIFEST.MF
+++ b/core/plugins/org.eclipse.dltk.validators.ui/META-INF/MANIFEST.MF
@@ -21,3 +21,4 @@
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Import-Package: com.ibm.icu.text
 Bundle-ActivationPolicy: lazy
+Automatic-Module-Name: org.eclipse.dltk.validators.ui
diff --git a/core/plugins/org.eclipse.dltk.validators.ui/src/org/eclipse/dltk/validators/internal/ui/ValidatorBlock.java b/core/plugins/org.eclipse.dltk.validators.ui/src/org/eclipse/dltk/validators/internal/ui/ValidatorBlock.java
index 96455bc..0c80004 100644
--- a/core/plugins/org.eclipse.dltk.validators.ui/src/org/eclipse/dltk/validators/internal/ui/ValidatorBlock.java
+++ b/core/plugins/org.eclipse.dltk.validators.ui/src/org/eclipse/dltk/validators/internal/ui/ValidatorBlock.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -157,12 +157,14 @@
 	 * Creates this block's control in the given control.
 	 *
 	 * @param ancestor
-	 *            containing control
+	 *                            containing control
 	 * @param useManageButton
-	 *            whether to present a single 'manage...' button to the user
-	 *            that opens the installed InterpreterEnvironments pref page for
-	 *            InterpreterEnvironment management, or to provide 'add, remove,
-	 *            edit, and search' buttons.
+	 *                            whether to present a single 'manage...' button
+	 *                            to the user that opens the installed
+	 *                            InterpreterEnvironments pref page for
+	 *                            InterpreterEnvironment management, or to
+	 *                            provide 'add, remove, edit, and search'
+	 *                            buttons.
 	 */
 	public void createControl(Composite ancestor) {
 
@@ -352,8 +354,8 @@
 	}
 
 	private void enableButtons() {
-		IStructuredSelection selection = (IStructuredSelection) fValidatorList
-				.getSelection();
+		IStructuredSelection selection = fValidatorList
+				.getStructuredSelection();
 		int selectionCount = selection.size();
 
 		boolean addEnabled = ValidatorRuntime
@@ -363,7 +365,7 @@
 		boolean copyEnabled = false && selectionCount > 0;// not implemented
 
 		if (selectionCount > 0) {
-			Iterator iterator = selection.iterator();
+			Iterator<?> iterator = selection.iterator();
 			while (iterator.hasNext()) {
 				IValidator install = (IValidator) iterator.next();
 				if (isContributed(install)) {
@@ -401,7 +403,7 @@
 	 * Sets the InterpreterEnvironments to be displayed in this block
 	 *
 	 * @param validators
-	 *            InterpreterEnvironments to be displayed
+	 *                       InterpreterEnvironments to be displayed
 	 */
 	protected void setValidators(IValidator[] validators) {
 		fValidators.clear();
@@ -446,11 +448,11 @@
 	}
 
 	private void removeValidator() {
-		IStructuredSelection selection = (IStructuredSelection) fValidatorList
-				.getSelection();
+		IStructuredSelection selection = fValidatorList
+				.getStructuredSelection();
 		IValidator[] validators = new IValidator[selection.size()];
 		int i = 0;
-		for (Iterator iter = selection.iterator(); iter.hasNext();) {
+		for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
 			validators[i++] = (IValidator) iter.next();
 		}
 		removeValidators(validators);
@@ -477,9 +479,9 @@
 	 * given key.
 	 *
 	 * @param settings
-	 *            dialog store
+	 *                      dialog store
 	 * @param qualifier
-	 *            key qualifier
+	 *                      key qualifier
 	 */
 	public void saveColumnSettings(IDialogSettings settings, String qualifier) {
 		int columnCount = fTable.getColumnCount();
@@ -494,9 +496,9 @@
 	 * Restore table settings from the given dialog store using the given key.
 	 *
 	 * @param settings
-	 *            dialog settings store
+	 *                      dialog settings store
 	 * @param qualifier
-	 *            key to restore settings from
+	 *                      key to restore settings from
 	 */
 	public void restoreColumnSettings(IDialogSettings settings,
 			String qualifier) {
@@ -592,7 +594,7 @@
 	 * numerical suffix to ensure that it is unique.
 	 *
 	 * @param name
-	 *            the name with which to ensure uniqueness
+	 *                 the name with which to ensure uniqueness
 	 * @return the unique version of the given name
 	 *
 	 */
@@ -658,8 +660,8 @@
 	}
 
 	protected void editValidator() {
-		IStructuredSelection selection = (IStructuredSelection) fValidatorList
-				.getSelection();
+		IStructuredSelection selection = fValidatorList
+				.getStructuredSelection();
 		IValidator validator = (IValidator) selection.getFirstElement();
 		if (validator == null) {
 			return;