Remove useless casts in o.e.dltk.ui.
Most are thanks to generification in Mars (the new targe platform).
Change-Id: Ieeb256bdef106a0832dd2768d6767bfc2baef6b4
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/base/DLTKChange.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/base/DLTKChange.java
index c16b9d4..dd28d16 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/base/DLTKChange.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/base/DLTKChange.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.corext.refactoring.base;
@@ -232,7 +231,7 @@
return ((IModelElement)element).getResource();
}
if (element instanceof IAdaptable) {
- return (IResource)((IAdaptable)element).getAdapter(IResource.class);
+ return ((IAdaptable) element).getAdapter(IResource.class);
}
return null;
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/buildpath/BuildpathModifier.java b/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/buildpath/BuildpathModifier.java
index 069100e..2f7d5e4 100644
--- a/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/buildpath/BuildpathModifier.java
+++ b/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/buildpath/BuildpathModifier.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
@@ -306,8 +306,8 @@
List result = new ArrayList(addedEntries.size());
for (int i = 0; i < addedEntries.size(); i++) {
- IBuildpathEntry entry = ((BPListElement) addedEntries
- .get(i)).getBuildpathEntry();
+ IBuildpathEntry entry = addedEntries.get(i)
+ .getBuildpathEntry();
IModelElement elem = project.findProjectFragment(entry
.getPath());
if (elem != null) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/DLTKElementContainmentAdapter.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/DLTKElementContainmentAdapter.java
index c13102e..a32ebb0 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/DLTKElementContainmentAdapter.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/DLTKElementContainmentAdapter.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui;
@@ -34,7 +33,7 @@
resource= jElement.getResource();
} else {
if (element instanceof IAdaptable) {
- resource= (IResource)((IAdaptable)element).getAdapter(IResource.class);
+ resource = ((IAdaptable) element).getAdapter(IResource.class);
if (resource != null) {
if (fModel.contains(resource)) {
jElement= DLTKCore.create(resource);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/DLTKWorkbenchAdapter.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/DLTKWorkbenchAdapter.java
index 4819dcf..7aee36e 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/DLTKWorkbenchAdapter.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/DLTKWorkbenchAdapter.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui;
@@ -68,7 +67,7 @@
if (element instanceof IModelElement)
return (IModelElement)element;
else if (element instanceof IAdaptable)
- return (IModelElement)((IAdaptable)element).getAdapter(IModelElement.class);
+ return ((IAdaptable) element).getAdapter(IModelElement.class);
return null;
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/IdBasedExtensionManager.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/IdBasedExtensionManager.java
index c71698c..27c69df 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/IdBasedExtensionManager.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/IdBasedExtensionManager.java
@@ -25,7 +25,7 @@
return ext.object;
}
- IConfigurationElement cfg = (IConfigurationElement) ext.getConfig();
+ IConfigurationElement cfg = ext.getConfig();
Object object = createObject(cfg);
ext.object = object;
return object;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/FoldingActionGroup.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/FoldingActionGroup.java
index 1509608..364fa10 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/FoldingActionGroup.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/FoldingActionGroup.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.actions;
@@ -119,7 +118,7 @@
}
public void update() {
- ITextOperationTarget target = (ITextOperationTarget) editor
+ ITextOperationTarget target = editor
.getAdapter(ITextOperationTarget.class);
boolean isEnabled = (target != null && target
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/OpenModelElementWithMenu.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/OpenModelElementWithMenu.java
index 90ce13f..10a6eeb 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/OpenModelElementWithMenu.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/OpenModelElementWithMenu.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.actions;
@@ -265,7 +264,7 @@
}
for (int i = 0; i < editors.length; i++) {
- IEditorDescriptor editor = (IEditorDescriptor) editors[i];
+ IEditorDescriptor editor = editors[i];
if (!alreadyMapped.contains(editor)) {
createMenuItem(menu, editor, preferredEditor);
if (defaultEditor != null
@@ -352,7 +351,7 @@
* Converts the IAdaptable file to IFile or null.
*/
private IFile getFileResource() {
- IResource resource = (IResource) this.element
+ IResource resource = this.element
.getAdapter(IResource.class);
if (resource instanceof IFile) {
return (IFile) resource;
@@ -389,7 +388,7 @@
String editorId = editorDescriptor == null ? IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID
: editorDescriptor.getId();
- ((IWorkbenchPage) page).openEditor(new FileEditorInput(file),
+ page.openEditor(new FileEditorInput(file),
editorId, true, MATCH_BOTH);
// only remember the default editor if the open succeeds
IDE.setDefaultEditor(file, editorId);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/OpenStorageWithMenu.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/OpenStorageWithMenu.java
index bad7fcc..774c50d 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/OpenStorageWithMenu.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/OpenStorageWithMenu.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.actions;
@@ -242,7 +241,7 @@
}
for (int i = 0; i < editors.length; i++) {
- IEditorDescriptor editor = (IEditorDescriptor) editors[i];
+ IEditorDescriptor editor = editors[i];
if (!alreadyMapped.contains(editor)) {
createMenuItem(menu, editor, preferredEditor);
if (defaultEditor != null
@@ -284,7 +283,7 @@
if (this.storage instanceof IStorage) {
return (IStorage) this.storage;
}
- return (IStorage) this.storage.getAdapter(IStorage.class);
+ return this.storage.getAdapter(IStorage.class);
}
/*
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/QuickMenuAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/QuickMenuAction.java
index e958469..5f05206 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/QuickMenuAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/QuickMenuAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
@@ -108,7 +108,7 @@
* @return the shortcut as a human readable string or <code>null</code>
*/
private String getShortcutString() {
- IBindingService bindingService = (IBindingService) PlatformUI
+ IBindingService bindingService = PlatformUI
.getWorkbench().getAdapter(IBindingService.class);
if (bindingService == null)
return null;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/RefreshAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/RefreshAction.java
index 1703b75..d4f7aca 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/RefreshAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/RefreshAction.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.actions;
@@ -92,7 +91,7 @@
if (curr instanceof IWorkingSet) {
IAdaptable[] members = ((IWorkingSet) curr).getElements();
for (int k = 0; k < members.length; k++) {
- IResource adapted = (IResource) members[k]
+ IResource adapted = members[k]
.getAdapter(IResource.class);
if (adapted != null) {
selectedResources.add(adapted);
@@ -162,7 +161,7 @@
if (element instanceof IWorkingSet) {
// don't inspect working sets any deeper.
} else if (element instanceof IAdaptable) {
- IResource resource = (IResource) ((IAdaptable) element)
+ IResource resource = ((IAdaptable) element)
.getAdapter(IResource.class);
if (resource == null)
return false;
@@ -203,7 +202,7 @@
} else if (curr instanceof IWorkingSet) {
IAdaptable[] members = ((IWorkingSet) curr).getElements();
for (int k = 0; k < members.length; k++) {
- IModelElement adapted = (IModelElement) members[k]
+ IModelElement adapted = members[k]
.getAdapter(IModelElement.class);
if (adapted instanceof ProjectFragmentContainer) {
modelElements.add(adapted);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/refactoring/RefactorActionGroup.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/refactoring/RefactorActionGroup.java
index 6157d32..2b29b5a 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/refactoring/RefactorActionGroup.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/refactoring/RefactorActionGroup.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.actions.refactoring;
@@ -191,7 +190,7 @@
public RefactorActionGroup(IViewPart part, IDLTKLanguageToolkit toolkit) {
this(part.getSite(), toolkit);
- IUndoContext workspaceContext = (IUndoContext) ResourcesPlugin
+ IUndoContext workspaceContext = ResourcesPlugin
.getWorkspace().getAdapter(IUndoContext.class);
fUndoRedoActionGroup = new UndoRedoActionGroup(part.getViewSite(),
workspaceContext, true);
@@ -495,7 +494,7 @@
}
private void installQuickAccessAction() {
- fHandlerService = (IHandlerService) fSite
+ fHandlerService = fSite
.getService(IHandlerService.class);
if (fHandlerService != null) {
final QuickMenuCreator creator = new QuickMenuCreator() {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/CallHierarchyViewPart.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/CallHierarchyViewPart.java
index 69bf4fc..62a28f7 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/CallHierarchyViewPart.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/CallHierarchyViewPart.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
@@ -420,7 +420,7 @@
}
restoreSplitterRatio();
addPartListener();
- IContextService ctxService = (IContextService) getSite().getService(
+ IContextService ctxService = getSite().getService(
IContextService.class);
if (ctxService != null) {
fContextActivation = ctxService
@@ -604,7 +604,7 @@
*/
public void dispose() {
if (fContextActivation != null) {
- IContextService ctxService = (IContextService) getSite()
+ IContextService ctxService = getSite()
.getService(IContextService.class);
if (ctxService != null) {
ctxService.deactivateContext(fContextActivation);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/OpenCallHierarchyAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/OpenCallHierarchyAction.java
index d593041..5f41298 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/OpenCallHierarchyAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/OpenCallHierarchyAction.java
@@ -203,7 +203,7 @@
return;
Object input= selection.getFirstElement();
if (!(input instanceof IModelElement))
- input = (IModelElement)((IAdaptable)input).getAdapter(IModelElement.class);
+ input = ((IAdaptable) input).getAdapter(IModelElement.class);
if (!(input instanceof IModelElement)) {
IStatus status= createStatus(CallHierarchyMessages.OpenCallHierarchyAction_messages_no_java_element);
openErrorDialog(status);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dialogs/TextFieldNavigationHandler.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dialogs/TextFieldNavigationHandler.java
index b3b6d8d..b7610a6 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dialogs/TextFieldNavigationHandler.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dialogs/TextFieldNavigationHandler.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.dialogs;
@@ -346,10 +345,18 @@
fSubmissions= new ArrayList();
- IContextService contextService= (IContextService) PlatformUI.getWorkbench().getAdapter(IContextService.class);
- ICommandService commandService= (ICommandService) PlatformUI.getWorkbench().getAdapter(ICommandService.class);
- IHandlerService handlerService= (IHandlerService) PlatformUI.getWorkbench().getAdapter(IHandlerService.class);
- IBindingService bindingService= (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class);
+ IContextService contextService = PlatformUI
+ .getWorkbench()
+ .getAdapter(IContextService.class);
+ ICommandService commandService = PlatformUI
+ .getWorkbench()
+ .getAdapter(ICommandService.class);
+ IHandlerService handlerService = PlatformUI
+ .getWorkbench()
+ .getAdapter(IHandlerService.class);
+ IBindingService bindingService = PlatformUI
+ .getWorkbench()
+ .getAdapter(IBindingService.class);
if (contextService == null || commandService == null || handlerService == null || bindingService == null)
return fSubmissions;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dnd/ResourceTransferDragAdapter.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dnd/ResourceTransferDragAdapter.java
index 8a56d26..3e9d5ea 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dnd/ResourceTransferDragAdapter.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dnd/ResourceTransferDragAdapter.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.dnd;
@@ -93,7 +92,7 @@
// don't use IAdaptable as for members only the top level type adapts
resource= ((IModelElement) element).getResource();
} else if (element instanceof IAdaptable) {
- resource= (IResource) ((IAdaptable) element).getAdapter(IResource.class);
+ resource = ((IAdaptable) element).getAdapter(IResource.class);
}
if (resource != null)
result.add(resource);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/EditorUtility.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/EditorUtility.java
index 580f294..57ab883 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/EditorUtility.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/EditorUtility.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.editor;
@@ -99,7 +98,7 @@
dProject = null;
}
} else if (input instanceof ExternalStorageEditorInput) {
- IModelElement element = (IModelElement) input
+ IModelElement element = input
.getAdapter(IModelElement.class);
if (element != null) {
IScriptProject project = element.getScriptProject();
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/OccurrencesFinder.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/OccurrencesFinder.java
index 929b98d..befb1d4 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/OccurrencesFinder.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/OccurrencesFinder.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.editor;
@@ -107,7 +106,7 @@
this.editor = editor;
final NatureExtensionManager<IOccurrencesFinder> occurrencesFinderManager = new NatureExtensionManager<IOccurrencesFinder>(
DLTKUIPlugin.PLUGIN_ID + ".search", IOccurrencesFinder.class);
- finders = (IOccurrencesFinder[]) occurrencesFinderManager
+ finders = occurrencesFinderManager
.getInstances(editor.getLanguageToolkit().getNatureId());
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptEditorErrorTickUpdater.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptEditorErrorTickUpdater.java
index 968a798..3d8647a 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptEditorErrorTickUpdater.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptEditorErrorTickUpdater.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.editor;
@@ -53,7 +52,7 @@
IEditorInput input= fScriptEditor.getEditorInput();
if (input != null) { // might run async, tests needed
- IModelElement jelement= (IModelElement) input.getAdapter(IModelElement.class);
+ IModelElement jelement = input.getAdapter(IModelElement.class);
if (jelement != null) {
IResource resource= jelement.getResource();
for (int i = 0; i < changedResources.length; i++) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptTemplatesPage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptTemplatesPage.java
index aa990df..ffe1b1b 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptTemplatesPage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptTemplatesPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Dakshinamurthy Karra, IBM Corporation and others.
+ * Copyright (c) 2007, 2016 Dakshinamurthy Karra, 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
@@ -329,7 +329,7 @@
Template template, final int offset, int length) {
final ScriptTemplateContextType contextType = (ScriptTemplateContextType) getContextTypeRegistry()
.getContextType(template.getContextTypeId());
- final ISourceModule module = (ISourceModule) EditorUtility
+ final ISourceModule module = EditorUtility
.getEditorInputModelElement(fScriptEditor, true);
return contextType.createContext(document, offset, length, module);
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/SourceModuleDocumentProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/SourceModuleDocumentProvider.java
index 82943d2..16c70ea 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/SourceModuleDocumentProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/SourceModuleDocumentProvider.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.editor;
@@ -1272,7 +1271,7 @@
original = createSourceModule(input.getFile());
}
if (original == null && element instanceof IAdaptable) {
- IModelElement modelE = (IModelElement) ((IAdaptable) element)
+ IModelElement modelE = ((IAdaptable) element)
.getAdapter(IModelElement.class);
if (modelE != null && modelE instanceof ISourceModule) {
original = (ISourceModule) modelE;
@@ -1564,7 +1563,7 @@
if (info == null) {
ISourceModule cu = null;
if (element instanceof IAdaptable) {
- IModelElement e = (IModelElement) ((IAdaptable) element)
+ IModelElement e = ((IAdaptable) element)
.getAdapter(IModelElement.class);
if (e != null && e instanceof ISourceModule) {
cu = (ISourceModule) e;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/SpecificContentAssistAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/SpecificContentAssistAction.java
index 060419c..a832cd0 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/SpecificContentAssistAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/SpecificContentAssistAction.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.editor;
@@ -94,7 +93,7 @@
private boolean computeEnablement(ITextEditor editor) {
if (editor == null)
return false;
- ITextOperationTarget target = (ITextOperationTarget) editor
+ ITextOperationTarget target = editor
.getAdapter(ITextOperationTarget.class);
boolean hasContentAssist = target != null
&& target.canDoOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/SpecificContentAssistExecutor.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/SpecificContentAssistExecutor.java
index 2f92e87..1876033 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/SpecificContentAssistExecutor.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/SpecificContentAssistExecutor.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.editor;
@@ -60,7 +59,8 @@
}
try {
- ITextOperationTarget target= (ITextOperationTarget) editor.getAdapter(ITextOperationTarget.class);
+ ITextOperationTarget target = editor
+ .getAdapter(ITextOperationTarget.class);
if (target != null && target.canDoOperation(ISourceViewer.CONTENTASSIST_PROPOSALS))
target.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
} finally {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ToggleCommentAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ToggleCommentAction.java
index be5f53b..4defd23 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ToggleCommentAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ToggleCommentAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
@@ -80,7 +80,8 @@
if (!validateEditorInputState())
return;
- ITextOperationTarget target = (ITextOperationTarget)editor.getAdapter(ITextOperationTarget.class);
+ ITextOperationTarget target = editor
+ .getAdapter(ITextOperationTarget.class);
if (target.canDoOperation(ProjectionViewer.EXPAND)) {
target.doOperation(ProjectionViewer.EXPAND);
}
@@ -275,7 +276,7 @@
ITextEditor editor= getTextEditor();
if (fOperationTarget == null && editor != null)
- fOperationTarget= (ITextOperationTarget) editor.getAdapter(ITextOperationTarget.class);
+ fOperationTarget = editor.getAdapter(ITextOperationTarget.class);
boolean isEnabled= (fOperationTarget != null && fOperationTarget.canDoOperation(ITextOperationTarget.PREFIX) && fOperationTarget.canDoOperation(ITextOperationTarget.STRIP_PREFIX));
setEnabled(isEnabled);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/filters/FilterDescriptor.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/filters/FilterDescriptor.java
index 58fdbce..01c8d7c 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/filters/FilterDescriptor.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/filters/FilterDescriptor.java
@@ -93,7 +93,7 @@
if (tid == null || tid.equals(targetId))
result.add(filterDescs[i]);
}
- return (FilterDescriptor[])result.toArray(new FilterDescriptor[result.size()]);
+ return result.toArray(new FilterDescriptor[result.size()]);
}
/**
@@ -266,7 +266,7 @@
}
}
}
- return (FilterDescriptor[])result.toArray(new FilterDescriptor[result.size()]);
+ return result.toArray(new FilterDescriptor[result.size()]);
}
public String getLocalId() {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/filters/NamePatternFilter.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/filters/NamePatternFilter.java
index 827eb25..04f0aba 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/filters/NamePatternFilter.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/filters/NamePatternFilter.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.filters;
@@ -55,14 +54,16 @@
String matchName= null;
if (element instanceof IModelElement) {
if( viewer instanceof IFilterElementNameProvider ) {
- matchName= ((IFilterElementNameProvider)viewer).getElementName((IModelElement)element);
+ matchName = ((IFilterElementNameProvider) viewer)
+ .getElementName(element);
}
else {
matchName= ((IModelElement) element).getElementName();
}
} else if (element instanceof IAdaptable) {
IAdaptable adaptable= (IAdaptable) element;
- IModelElement modelElement= (IModelElement)adaptable.getAdapter(IModelElement.class);
+ IModelElement modelElement = adaptable
+ .getAdapter(IModelElement.class);
if (modelElement != null)
if( viewer instanceof IFilterElementNameProvider ) {
matchName= ((IFilterElementNameProvider)viewer).getElementName(modelElement);
@@ -71,7 +72,7 @@
matchName= modelElement.getElementName();
}
else {
- IResource resource= (IResource)adaptable.getAdapter(IResource.class);
+ IResource resource = adaptable.getAdapter(IResource.class);
if (resource != null)
matchName= resource.getName();
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/FileTransferDragAdapter.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/FileTransferDragAdapter.java
index 0f06a05..86586f5 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/FileTransferDragAdapter.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/FileTransferDragAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
@@ -228,7 +228,7 @@
if (o instanceof IResource) {
r = (IResource) o;
} else if (o instanceof IAdaptable) {
- r = (IResource) ((IAdaptable) o).getAdapter(IResource.class);
+ r = ((IAdaptable) o).getAdapter(IResource.class);
}
// Only add resource for which we have a location
// in the local file system.
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 688baac..ae8a10e 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
@@ -572,7 +572,7 @@
public void dispose() {
if (fContextActivation != null) {
- IContextService ctxService = (IContextService) getSite()
+ IContextService ctxService = getSite()
.getService(IContextService.class);
if (ctxService != null) {
ctxService.deactivateContext(fContextActivation);
@@ -699,7 +699,7 @@
// set yet.
setLinkingEnabled(isLinkingEnabled());
- IContextService ctxService = (IContextService) getSite().getService(
+ IContextService ctxService = getSite().getService(
IContextService.class);
if (ctxService != null) {
fContextActivation = ctxService
@@ -1109,13 +1109,13 @@
} else if (original instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) original;
- IModelElement je2 = (IModelElement) adaptable
+ IModelElement je2 = adaptable
.getAdapter(IModelElement.class);
if (je2 != null && je2.exists()) {
return je2;
}
- IResource r = (IResource) adaptable.getAdapter(IResource.class);
+ IResource r = adaptable.getAdapter(IResource.class);
if (r != null) {
je2 = DLTKCore.create(r);
if (je2 != null && je2.exists()) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/WorkingSetAwareContentProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/WorkingSetAwareContentProvider.java
index a9c44a9..d76e71f 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/WorkingSetAwareContentProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/WorkingSetAwareContentProvider.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.scriptview;
@@ -107,7 +106,7 @@
if (isKnownWorkingSet) {
result.add(element);
} else {
- IProject project = (IProject) element
+ IProject project = element
.getAdapter(IProject.class);
if (project != null && project.exists()) {
IScriptProject jp = DLTKCore.create(project);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchEditorOpener.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchEditorOpener.java
index 61d3e1f..0534c7d 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchEditorOpener.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchEditorOpener.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.search;
@@ -121,11 +120,11 @@
IModelElement module = ((IModelElement) element)
.getAncestor(IModelElement.SOURCE_MODULE);
if (module instanceof IExternalSourceModule) {
- String editorID = getEditorID((IExternalSourceModule) module);
+ String editorID = getEditorID(module);
return showInEditor(wbPage, new ExternalStorageEditorInput(
(IExternalSourceModule) module), editorID);
} else if (module instanceof SourceModule) {
- String editorID = getEditorID((SourceModule) module);
+ String editorID = getEditorID(module);
IFile file = getFile(element);
return showInEditor(wbPage, new FileEditorInput(file), editorID);
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchResult.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchResult.java
index 49f3d57..b881609 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchResult.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchResult.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.search;
@@ -65,12 +64,12 @@
}
private Match[] computeContainedMatches(IAdaptable adaptable) {
- IModelElement modelElement= (IModelElement) adaptable.getAdapter(IModelElement.class);
+ IModelElement modelElement = adaptable.getAdapter(IModelElement.class);
Set<Match> matches= new HashSet<Match>();
if (modelElement != null) {
collectMatches(matches, modelElement);
}
- IFile file= (IFile) adaptable.getAdapter(IFile.class);
+ IFile file = adaptable.getAdapter(IFile.class);
if (file != null) {
collectMatches(matches, file);
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchScopeFactory.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchScopeFactory.java
index 97b4cd7..c8021f8 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchScopeFactory.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchScopeFactory.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.search;
@@ -298,12 +297,12 @@
IWorkingSet ws = (IWorkingSet) selectedElement;
addModelElements(result, ws);
} else if (selectedElement instanceof IAdaptable) {
- IResource resource = (IResource) ((IAdaptable) selectedElement)
+ IResource resource = ((IAdaptable) selectedElement)
.getAdapter(IResource.class);
if (resource != null)
addModelElements(result, resource);
- IModelElement modelElement = (IModelElement) ((IAdaptable) selectedElement)
+ IModelElement modelElement = ((IAdaptable) selectedElement)
.getAdapter(IModelElement.class);
if (modelElement != null)
addModelElements(result, modelElement);
@@ -346,7 +345,7 @@
}
private void addModelElements(Set modelElements, IResource resource) {
- IModelElement modelElement = (IModelElement) resource
+ IModelElement modelElement = resource
.getAdapter(IModelElement.class);
if (modelElement == null)
// not a Script resource
@@ -386,13 +385,13 @@
IAdaptable[] elements = workingSet.getElements();
for (int i = 0; i < elements.length; i++) {
- IModelElement modelElement = (IModelElement) elements[i]
+ IModelElement modelElement = elements[i]
.getAdapter(IModelElement.class);
if (modelElement != null) {
addModelElements(modelElements, modelElement);
continue;
}
- IResource resource = (IResource) elements[i]
+ IResource resource = elements[i]
.getAdapter(IResource.class);
if (resource != null) {
addModelElements(modelElements, resource);
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 99205e2..d0e3bf6 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
@@ -597,7 +597,7 @@
*/
public void dispose() {
if (fContextActivation != null) {
- IContextService ctxService = (IContextService) getSite()
+ IContextService ctxService = getSite()
.getService(IContextService.class);
if (ctxService != null) {
ctxService.deactivateContext(fContextActivation);
@@ -957,7 +957,7 @@
actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(),
fSelectAllAction);
- IContextService ctxService = (IContextService) getSite().getService(
+ IContextService ctxService = getSite().getService(
IContextService.class);
if (ctxService != null) {
fContextActivation = ctxService
@@ -1752,7 +1752,7 @@
return;
}
- IModelElement elem = (IModelElement) editor.getEditorInput()
+ IModelElement elem = editor.getEditorInput()
.getAdapter(IModelElement.class);
try {
IType type = null;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/viewsupport/ContextActivator.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/viewsupport/ContextActivator.java
index 0bbf4df..40b3b35 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/viewsupport/ContextActivator.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/viewsupport/ContextActivator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2016 Wind River Systems, Inc. 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
@@ -127,7 +127,8 @@
if (page instanceof ScriptOutlinePage) {
if (!fActivationPerOutline.containsKey(outline)){
// dltk outline activated for the first time
- IContextService ctxtService = (IContextService)outline.getViewSite().getService(IContextService.class);
+ IContextService ctxtService = outline.getViewSite()
+ .getService(IContextService.class);
IContextActivation activateContext = ctxtService
.activateContext(DLTKUIPlugin.CONTEXT_VIEWS);
fActivationPerOutline.put(outline,activateContext);
@@ -137,7 +138,8 @@
IContextActivation activation = fActivationPerOutline.remove(outline);
if (activation != null) {
// other outline page brought to front
- IContextService ctxtService = (IContextService)outline.getViewSite().getService(IContextService.class);
+ IContextService ctxtService = outline.getViewSite()
+ .getService(IContextService.class);
ctxtService.deactivateContext(activation);
}
}
@@ -150,7 +152,7 @@
public SelectionListener(IWorkbenchPartSite site) {
fSite= site;
- fCtxService= (IContextService)fSite.getService(IContextService.class);
+ fCtxService = fSite.getService(IContextService.class);
ISelectionProvider sp= site.getSelectionProvider();
if (sp != null && fCtxService != null) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/BuildpathDialogAccess.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/BuildpathDialogAccess.java
index 74b6312..c35d080 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/BuildpathDialogAccess.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/BuildpathDialogAccess.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.wizards;
@@ -323,7 +322,7 @@
// BuildPathDialogAccess_ExtZIPArchiveDialog_new_title);
// dialog.setFilterExtensions(ArchiveFileFilter.FILTER_EXTENSIONS);
// dialog.setFilterPath(lastUsedPath);
- IEnvironmentUI ui = (IEnvironmentUI) environment
+ IEnvironmentUI ui = environment
.getAdapter(IEnvironmentUI.class);
String res = ui.selectFile(shell, IEnvironmentUI.ARCHIVE);
if (res == null) {
@@ -436,7 +435,7 @@
// dialog.setText(NewWizardMessages.
// BuildPathDialogAccess_ExistingClassFolderDialog_new_title);
// dialog.setFilterPath(lastUsedPath);
- IEnvironmentUI ui = (IEnvironmentUI) environment
+ IEnvironmentUI ui = environment
.getAdapter(IEnvironmentUI.class);
String res = ui.selectFolder(shell);
if (res == null) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/AddArchiveToBuildpathAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/AddArchiveToBuildpathAction.java
index 63958fb..577a866 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/AddArchiveToBuildpathAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/AddArchiveToBuildpathAction.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.wizards.buildpath.newsourcepage;
@@ -205,7 +204,7 @@
if (part instanceof ISetSelectionTarget)
target= (ISetSelectionTarget) part;
else
- target= (ISetSelectionTarget) part.getAdapter(ISetSelectionTarget.class);
+ target = part.getAdapter(ISetSelectionTarget.class);
if (target != null) {
// select and reveal resource
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/AddFolderToBuildpathAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/AddFolderToBuildpathAction.java
index 964f88f..4ad3288 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/AddFolderToBuildpathAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/AddFolderToBuildpathAction.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.wizards.buildpath.newsourcepage;
@@ -299,7 +298,7 @@
if (part instanceof ISetSelectionTarget)
target = (ISetSelectionTarget) part;
else
- target = (ISetSelectionTarget) part
+ target = part
.getAdapter(ISetSelectionTarget.class);
if (target != null) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/AddLibraryToBuildpathAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/AddLibraryToBuildpathAction.java
index 21d150b..437f54f 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/AddLibraryToBuildpathAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/AddLibraryToBuildpathAction.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.wizards.buildpath.newsourcepage;
@@ -262,7 +261,7 @@
if (part instanceof ISetSelectionTarget)
target = (ISetSelectionTarget) part;
else
- target = (ISetSelectionTarget) part
+ target = part
.getAdapter(ISetSelectionTarget.class);
if (target != null) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/AddSelectedLibraryToBuildpathAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/AddSelectedLibraryToBuildpathAction.java
index 2b66142..0c61beb 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/AddSelectedLibraryToBuildpathAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/AddSelectedLibraryToBuildpathAction.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.wizards.buildpath.newsourcepage;
@@ -22,8 +21,8 @@
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.dltk.core.DLTKCore;
import org.eclipse.dltk.core.IBuildpathEntry;
-import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.IModelElement;
+import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.internal.corext.buildpath.BuildpathModifier;
import org.eclipse.dltk.internal.ui.wizards.NewWizardMessages;
import org.eclipse.dltk.internal.ui.wizards.buildpath.BPListElement;
@@ -208,7 +207,7 @@
if (part instanceof ISetSelectionTarget)
target= (ISetSelectionTarget) part;
else
- target= (ISetSelectionTarget) part.getAdapter(ISetSelectionTarget.class);
+ target = part.getAdapter(ISetSelectionTarget.class);
if (target != null) {
// select and reveal resource
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/ConfigureBuildPathAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/ConfigureBuildPathAction.java
index 4133c09..01df74b 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/ConfigureBuildPathAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/ConfigureBuildPathAction.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.wizards.buildpath.newsourcepage;
@@ -15,10 +14,10 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.dltk.core.ScriptModelUtil;
-import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.IModelElement;
import org.eclipse.dltk.core.IProjectFragment;
+import org.eclipse.dltk.core.IScriptProject;
+import org.eclipse.dltk.core.ScriptModelUtil;
import org.eclipse.dltk.internal.ui.scriptview.BuildPathContainer;
import org.eclipse.dltk.internal.ui.wizards.NewWizardMessages;
import org.eclipse.dltk.ui.DLTKPluginImages;
@@ -118,7 +117,7 @@
return ((BuildPathContainer) firstElement).getScriptProject()
.getProject();
} else if (firstElement instanceof IAdaptable) {
- IResource res = (IResource) ((IAdaptable) firstElement)
+ IResource res = ((IAdaptable) firstElement)
.getAdapter(IResource.class);
if (res != null) {
return res.getProject();
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/ExcludeFromBuildpathAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/ExcludeFromBuildpathAction.java
index a082bdd..f112084 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/ExcludeFromBuildpathAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/ExcludeFromBuildpathAction.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.wizards.buildpath.newsourcepage;
@@ -20,10 +19,10 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.IModelElement;
import org.eclipse.dltk.core.IProjectFragment;
import org.eclipse.dltk.core.IScriptFolder;
+import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.ISourceModule;
import org.eclipse.dltk.core.ModelException;
import org.eclipse.dltk.internal.corext.buildpath.BuildpathModifier;
@@ -199,7 +198,7 @@
if (part instanceof ISetSelectionTarget)
target = (ISetSelectionTarget) part;
else
- target = (ISetSelectionTarget) part.getAdapter(ISetSelectionTarget.class);
+ target = part.getAdapter(ISetSelectionTarget.class);
if (target != null) {
// select and reveal resource
final ISetSelectionTarget finalTarget = target;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/IncludeToBuildpathAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/IncludeToBuildpathAction.java
index 65647dd..d4d58c7 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/IncludeToBuildpathAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/IncludeToBuildpathAction.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.wizards.buildpath.newsourcepage;
@@ -192,7 +191,7 @@
if (part instanceof ISetSelectionTarget)
target= (ISetSelectionTarget) part;
else
- target= (ISetSelectionTarget) part.getAdapter(ISetSelectionTarget.class);
+ target = part.getAdapter(ISetSelectionTarget.class);
if (target != null) {
// select and reveal resource
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/RemoveFromBuildpathAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/RemoveFromBuildpathAction.java
index 0882c58..8b646d4 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/RemoveFromBuildpathAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/RemoveFromBuildpathAction.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.wizards.buildpath.newsourcepage;
@@ -264,7 +263,7 @@
if (part instanceof ISetSelectionTarget)
target = (ISetSelectionTarget) part;
else
- target = (ISetSelectionTarget) part.getAdapter(ISetSelectionTarget.class);
+ target = part.getAdapter(ISetSelectionTarget.class);
if (target != null) {
// select and reveal resource
final ISetSelectionTarget finalTarget = target;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/Mementos.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/Mementos.java
index 4b4eef0..35e4801 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/Mementos.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/Mementos.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.workingsets;
@@ -21,7 +20,8 @@
public static final String TAG_ITEM = "item"; //$NON-NLS-1$
public static void saveItem(IMemento memento, IAdaptable element) {
- IPersistableElement persistable= (IPersistableElement)element.getAdapter(IPersistableElement.class);
+ IPersistableElement persistable = element
+ .getAdapter(IPersistableElement.class);
if (persistable != null) {
memento.putString(
TAG_FACTORY_ID,
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/OthersWorkingSetUpdater.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/OthersWorkingSetUpdater.java
index 13c63de..1ef88f1 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/OthersWorkingSetUpdater.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/OthersWorkingSetUpdater.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.workingsets;
@@ -24,11 +23,11 @@
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.dltk.core.DLTKCore;
import org.eclipse.dltk.core.ElementChangedEvent;
-import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.IElementChangedListener;
import org.eclipse.dltk.core.IModelElement;
import org.eclipse.dltk.core.IModelElementDelta;
import org.eclipse.dltk.core.IScriptModel;
+import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.ModelException;
import org.eclipse.dltk.ui.DLTKUIPlugin;
import org.eclipse.jface.util.IPropertyChangeListener;
@@ -176,7 +175,7 @@
IAdaptable[] elements= activeWorkingSets[i].getElements();
for (int j= 0; j < elements.length; j++) {
IAdaptable element= elements[j];
- IResource resource= (IResource)element.getAdapter(IResource.class);
+ IResource resource = element.getAdapter(IResource.class);
if (resource != null && resource.getType() == IResource.PROJECT) {
projects.add(resource);
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ScriptWorkingSetPage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ScriptWorkingSetPage.java
index 77ee2fd..6783dba 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ScriptWorkingSetPage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ScriptWorkingSetPage.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.workingsets;
@@ -255,7 +254,7 @@
if (oldItems[i] instanceof IResource) {
oldResource= (IResource)oldItems[i];
} else {
- oldResource= (IResource)oldItems[i].getAdapter(IResource.class);
+ oldResource = oldItems[i].getAdapter(IResource.class);
}
if (oldResource != null && oldResource.isAccessible() == false) {
IProject project= oldResource.getProject();
@@ -344,7 +343,8 @@
private void setSubtreeChecked(Object parent, boolean state, boolean checkExpandedState) {
if (!(parent instanceof IAdaptable))
return;
- IContainer container= (IContainer)((IAdaptable)parent).getAdapter(IContainer.class);
+ IContainer container = ((IAdaptable) parent)
+ .getAdapter(IContainer.class);
if ((!fTree.getExpandedState(parent) && checkExpandedState) || (container != null && !container.isAccessible()))
return;
@@ -366,7 +366,8 @@
if (child == null)
return;
if (child instanceof IAdaptable) {
- IResource resource= (IResource)((IAdaptable)child).getAdapter(IResource.class);
+ IResource resource = ((IAdaptable) child)
+ .getAdapter(IResource.class);
if (resource != null && !resource.isAccessible())
return;
}
@@ -410,7 +411,8 @@
elements= SelectionConverter.getStructuredSelection(part).toArray();
for (int i= 0; i < elements.length; i++) {
if (elements[i] instanceof IResource) {
- IModelElement je= (IModelElement)((IResource)elements[i]).getAdapter(IModelElement.class);
+ IModelElement je = ((IResource) elements[i])
+ .getAdapter(IModelElement.class);
if (je != null && je.exists() && je.getScriptProject().isOnBuildpath((IResource)elements[i]))
elements[i]= je;
}
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 317db02..9907b2a 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, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
@@ -109,7 +109,7 @@
return false;
for (int i= 0; i < elements.length; i++) {
IAdaptable element= elements[i];
- IProject p= (IProject)element.getAdapter(IProject.class);
+ IProject p = element.getAdapter(IProject.class);
if (p == null || p.exists())
return true;
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/WorkingSetFilter.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/WorkingSetFilter.java
index ed310ca..de1bf27 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/WorkingSetFilter.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/WorkingSetFilter.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.workingsets;
@@ -14,9 +13,9 @@
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.IModelElement;
import org.eclipse.dltk.core.IProjectFragment;
+import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.ISourceModule;
import org.eclipse.dltk.internal.ui.scriptview.BuildPathContainer;
import org.eclipse.jface.viewers.Viewer;
@@ -69,11 +68,11 @@
if (element instanceof IAdaptable) {
IAdaptable adaptable= (IAdaptable)element;
- IModelElement je= (IModelElement)adaptable.getAdapter(IModelElement.class);
+ IModelElement je = adaptable.getAdapter(IModelElement.class);
if (je != null)
return isEnclosing(je);
- IResource resource= (IResource)adaptable.getAdapter(IResource.class);
+ IResource resource = adaptable.getAdapter(IResource.class);
if (resource != null)
return isEnclosing(resource.getFullPath());
}
@@ -132,7 +131,8 @@
int length= cachedWorkingSet.length;
for (int i= 0; i < length; i++) {
- IModelElement scopeElement= (IModelElement)cachedWorkingSet[i].getAdapter(IModelElement.class);
+ IModelElement scopeElement = cachedWorkingSet[i]
+ .getAdapter(IModelElement.class);
if (scopeElement != null) {
// compare Script elements
IModelElement searchedElement= element;
@@ -163,7 +163,8 @@
} else {
// compare resource paths
if (!isElementPathComputed) {
- IResource elementResource= (IResource)element.getAdapter(IResource.class);
+ IResource elementResource = element
+ .getAdapter(IResource.class);
if (elementResource != null)
elementPath= elementResource.getFullPath();
}
@@ -180,12 +181,13 @@
IPath elementPath= null;
- IResource elementResource= (IResource)element.getAdapter(IResource.class);
+ IResource elementResource = element.getAdapter(IResource.class);
if (elementResource != null)
elementPath= elementResource.getFullPath();
if (elementPath == null) {
- IModelElement ScriptElement= (IModelElement)element.getAdapter(IModelElement.class);
+ IModelElement ScriptElement = element
+ .getAdapter(IModelElement.class);
if (ScriptElement != null)
elementPath= ScriptElement.getPath();
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/WorkingSetModel.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/WorkingSetModel.java
index ecad3ee..f4e4380 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/WorkingSetModel.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/WorkingSetModel.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.workingsets;
@@ -174,7 +173,7 @@
private void addElement(IAdaptable element, IWorkingSet ws) {
addToMap(fElementToWorkingSet, element, ws);
- IResource resource = (IResource) element
+ IResource resource = element
.getAdapter(IResource.class);
if (resource != null) {
addToMap(fResourceToWorkingSet, resource, ws);
@@ -183,7 +182,7 @@
private void removeElement(IAdaptable element, IWorkingSet ws) {
removeFromMap(fElementToWorkingSet, element, ws);
- IResource resource = (IResource) element
+ IResource resource = element
.getAdapter(IResource.class);
if (resource != null) {
removeFromMap(fResourceToWorkingSet, resource, ws);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/DLTKUIPlugin.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/DLTKUIPlugin.java
index 9d1cbd8..9f2f0c1 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/DLTKUIPlugin.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/DLTKUIPlugin.java
@@ -436,7 +436,7 @@
return module;
}
}
- IModelElement me = (IModelElement) editorInput
+ IModelElement me = editorInput
.getAdapter(IModelElement.class);
if (me instanceof ISourceModule) {
return (ISourceModule) me;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/ModelElementSorter.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/ModelElementSorter.java
index fd94792..fbea761 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/ModelElementSorter.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/ModelElementSorter.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ui;
@@ -342,7 +341,7 @@
// available, use the viewers label provider
if (element instanceof IAdaptable) {
- IWorkbenchAdapter adapter = (IWorkbenchAdapter) ((IAdaptable) element)
+ IWorkbenchAdapter adapter = ((IAdaptable) element)
.getAdapter(IWorkbenchAdapter.class);
if (adapter != null) {
return adapter.getLabel(element);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/ScriptElementImageProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/ScriptElementImageProvider.java
index 5df9ecc..7b0dd96 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/ScriptElementImageProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/ScriptElementImageProvider.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ui;
@@ -176,7 +175,7 @@
public ImageDescriptor getWorkbenchImageDescriptor(IAdaptable adaptable,
int flags) {
- IWorkbenchAdapter wbAdapter = (IWorkbenchAdapter) adaptable
+ IWorkbenchAdapter wbAdapter = adaptable
.getAdapter(IWorkbenchAdapter.class);
if (wbAdapter == null) {
return null;
@@ -276,7 +275,7 @@
IScriptProject jp = (IScriptProject) element;
if (jp.getProject().isOpen()) {
IProject project = jp.getProject();
- IWorkbenchAdapter adapter = (IWorkbenchAdapter) project
+ IWorkbenchAdapter adapter = project
.getAdapter(IWorkbenchAdapter.class);
if (adapter != null) {
ImageDescriptor result = adapter
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/ScriptElementLabels.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/ScriptElementLabels.java
index 6cb6c7c..b39d164 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/ScriptElementLabels.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/ScriptElementLabels.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ui;
@@ -480,7 +479,7 @@
}
return getElementLabel((IModelElement) obj, flags);
} else if (obj instanceof IAdaptable) {
- IWorkbenchAdapter wbadapter = (IWorkbenchAdapter) ((IAdaptable) obj)
+ IWorkbenchAdapter wbadapter = ((IAdaptable) obj)
.getAdapter(IWorkbenchAdapter.class);
if (wbadapter != null) {
return wbadapter.getLabel(obj);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/FindAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/FindAction.java
index 2e683c8..06a48d3 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/FindAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/FindAction.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ui.actions;
@@ -152,7 +151,8 @@
if (firstElement instanceof IModelElement)
elem= (IModelElement) firstElement;
else if (firstElement instanceof IAdaptable)
- elem= (IModelElement) ((IAdaptable) firstElement).getAdapter(IModelElement.class);
+ elem = ((IAdaptable) firstElement)
+ .getAdapter(IModelElement.class);
if (elem != null) {
return getTypeIfPossible(elem, silent);
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/GenerateActionGroup.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/GenerateActionGroup.java
index a570564..4eae6ec 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/GenerateActionGroup.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/GenerateActionGroup.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
@@ -126,7 +126,7 @@
}
private void installQuickAccessAction() {
- fHandlerService = (IHandlerService) fSite
+ fHandlerService = fSite
.getService(IHandlerService.class);
if (fHandlerService != null) {
fQuickAccessAction = new SourceQuickAccessAction(fEditor);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/IndentAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/IndentAction.java
index 22de784..60da6fd 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/IndentAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/IndentAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 xored software, Inc.
+ * Copyright (c) 2010, 2016 xored software, Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -211,7 +211,7 @@
return false;
}
boolean changed = false;
- final IRewriteTarget target = (IRewriteTarget) getTextEditor()
+ final IRewriteTarget target = getTextEditor()
.getAdapter(IRewriteTarget.class);
if (target != null)
target.beginCompoundChange();
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/OpenAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/OpenAction.java
index fed4980..62c5b2e 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/OpenAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/OpenAction.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ui.actions;
@@ -178,7 +177,7 @@
if (elements == null || elements.length == 0) {
IEditorStatusLine statusLine = null;
if (fEditor != null)
- statusLine = (IEditorStatusLine) fEditor
+ statusLine = fEditor
.getAdapter(IEditorStatusLine.class);
if (statusLine != null)
statusLine.setMessage(true,
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/OpenEditorActionGroup.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/OpenEditorActionGroup.java
index 5cd4254..de89513 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/OpenEditorActionGroup.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/OpenEditorActionGroup.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ui.actions;
@@ -148,7 +147,8 @@
} else if ((element instanceof IModelElement) || (element.getAdapter(IModelElement.class) != null)) {
// Create a menu.
IMenuManager submenu = new MenuManager(ActionMessages.OpenWithMenu_label);
- submenu.add(new OpenModelElementWithMenu(fSite.getPage(), (IModelElement)element.getAdapter(IModelElement.class)));
+ submenu.add(new OpenModelElementWithMenu(fSite.getPage(),
+ element.getAdapter(IModelElement.class)));
// Add the submenu.
menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, submenu);
} else if ((resource instanceof IFile)) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/ScriptSelectAnnotationRulerAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/ScriptSelectAnnotationRulerAction.java
index cc61bb9..59ce4bf 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/ScriptSelectAnnotationRulerAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/ScriptSelectAnnotationRulerAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
@@ -101,7 +101,7 @@
// }
if (fHasCorrection) {
- ITextOperationTarget operation = (ITextOperationTarget) fTextEditor
+ ITextOperationTarget operation = fTextEditor
.getAdapter(ITextOperationTarget.class);
final int opCode = ISourceViewer.QUICK_ASSIST;
if (operation != null && operation.canDoOperation(opCode)) {
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 602adbe..a83d950 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
@@ -381,7 +381,7 @@
getViewSite().getPage().addPartListener(fPartListener);
fillActionBars(getViewSite().getActionBars());
- IContextService ctxService = (IContextService) getSite().getService(
+ IContextService ctxService = getSite().getService(
IContextService.class);
if (ctxService != null) {
fContextActivation = ctxService
@@ -513,7 +513,7 @@
public void dispose() {
if (fContextActivation != null) {
- IContextService ctxService = (IContextService) getSite()
+ IContextService ctxService = getSite()
.getService(IContextService.class);
if (ctxService != null) {
ctxService.deactivateContext(fContextActivation);
@@ -1199,7 +1199,7 @@
if (firstElement instanceof IMarker)
firstElement = ((IMarker) firstElement).getResource();
if (firstElement instanceof IAdaptable) {
- IModelElement je = (IModelElement) ((IAdaptable) firstElement)
+ IModelElement je = ((IAdaptable) firstElement)
.getAdapter(IModelElement.class);
if (je == null && firstElement instanceof IFile) {
IContainer parent = ((IFile) firstElement).getParent();
@@ -1299,13 +1299,13 @@
}
if (ei instanceof IFileEditorInput) {
IFile file = ((IFileEditorInput) ei).getFile();
- IModelElement je = (IModelElement) file
+ IModelElement je = file
.getAdapter(IModelElement.class);
if (je == null) {
IContainer container = ((IFileEditorInput) ei).getFile()
.getParent();
if (container != null)
- je = (IModelElement) container
+ je = container
.getAdapter(IModelElement.class);
}
if (je == null) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/ext/ColumnFormLayout.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/ext/ColumnFormLayout.java
index ade0c09..aa1698a 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/ext/ColumnFormLayout.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/ext/ColumnFormLayout.java
@@ -1,7 +1,5 @@
-package org.eclipse.dltk.ui.browsing.ext;
-
/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
@@ -10,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
+package org.eclipse.dltk.ui.browsing.ext;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
@@ -138,14 +137,14 @@
// composite.setSize(total, composite.getSize().y);
- int width = (int) (widths[0]);
+ int width = (widths[0]);
int x = area.x;
controls[0].setBounds(x, area.y, width, area.height);
x += width;
for (int i = 1; i < controls.length; i++) {
sashes[i - 1].setBounds(x, area.y, sashwidth, area.height);
x += sashwidth;
- width = (int) (widths[i]);
+ width = (widths[i]);
controls[i].setBounds(x, area.y, width, area.height);
x += width;
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/ext/ExtendedClassesView.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/ext/ExtendedClassesView.java
index c0c6575..2cabaf2 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/ext/ExtendedClassesView.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/ext/ExtendedClassesView.java
@@ -131,7 +131,7 @@
public void dispose() {
if (fContextActivation != null) {
- IContextService ctxService = (IContextService) getSite()
+ IContextService ctxService = getSite()
.getService(IContextService.class);
if (ctxService != null) {
ctxService.deactivateContext(fContextActivation);
@@ -227,7 +227,7 @@
getViewSite().getPage().addPartListener(fPartListener);
createActions();
- IContextService ctxService = (IContextService) getSite().getService(
+ IContextService ctxService = getSite().getService(
IContextService.class);
if (ctxService != null) {
fContextActivation = ctxService
@@ -271,7 +271,7 @@
StructuredSelection sel = (StructuredSelection) selection;
List list = sel.toList();
for (Iterator iterator = list.iterator(); iterator.hasNext();) {
- Object o = (Object) iterator.next();
+ Object o = iterator.next();
if (o instanceof MixedClass) {
List mixedElements = ((MixedClass) o).getElements();
result.addAll(mixedElements);
@@ -322,7 +322,7 @@
if (firstElement instanceof IMarker)
firstElement = ((IMarker) firstElement).getResource();
if (firstElement instanceof IAdaptable) {
- IModelElement je = (IModelElement) ((IAdaptable) firstElement)
+ IModelElement je = ((IAdaptable) firstElement)
.getAdapter(IModelElement.class);
if (je == null && firstElement instanceof IFile) {
IContainer parent = ((IFile) firstElement).getParent();
@@ -339,7 +339,7 @@
Object currentInput = browsingPane.getInput();
List elements = new ArrayList();
if (currentInput == null
- || !currentInput.equals((IModelElement) firstElement))
+ || !currentInput.equals(firstElement))
if (iter.hasNext() && selection instanceof StructuredSelection) {
// multi-selection and view is empty
return ((StructuredSelection) selection).toList();
@@ -352,7 +352,7 @@
Object element = iter.next();
if (!(element instanceof IModelElement))
return null;
- if (!currentInput.equals((IModelElement) element))
+ if (!currentInput.equals(element))
return null;
}
return firstElement;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/ext/MultiSelectionListViewer.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/ext/MultiSelectionListViewer.java
index b8b2eb7..42d5bbb 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/ext/MultiSelectionListViewer.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/ext/MultiSelectionListViewer.java
@@ -50,7 +50,7 @@
}
// we need to update all elements with bigger indexes.
for (int i = controlIndex + 1; i < viewers.size(); i++) {
- TreeViewer viewer = (TreeViewer) viewers.get(i);
+ TreeViewer viewer = viewers.get(i);
if (!viewer.getControl().isDisposed()) {
viewer.refresh(true);
}
@@ -80,7 +80,7 @@
}
// lets scroll for corrent position
- TreeViewer viewer = (TreeViewer) viewers.get(controlIndex);
+ TreeViewer viewer = viewers.get(controlIndex);
Tree tree = viewer.getTree();
if (!tree.isDisposed()) {
Rectangle bounds = tree.getBounds();
@@ -177,7 +177,7 @@
private void removePane() {
if (elements > 0 && !isDisposed()) {
elements -= 1;
- TreeViewer last = (TreeViewer) viewers.get(viewers.size() - 1);
+ TreeViewer last = viewers.get(viewers.size() - 1);
if (!last.getControl().isDisposed()) {
last.getControl().dispose();
}
@@ -211,7 +211,7 @@
private Object[] getElementsFrom(int controlIndex) {
if (controlIndex < this.viewers.size()) {
- TreeViewer prevViewer = (TreeViewer) viewers.get(controlIndex);
+ TreeViewer prevViewer = viewers.get(controlIndex);
ISelection selection = prevViewer.getSelection();
if (selection != null && selection instanceof IStructuredSelection) {
IStructuredSelection sel = (IStructuredSelection) selection;
@@ -228,7 +228,7 @@
public ISelection getSelection() {
if (this.viewers.size() > selectedView) {
- TreeViewer viewer = (TreeViewer) this.viewers.get(selectedView);
+ TreeViewer viewer = this.viewers.get(selectedView);
return viewer.getSelection();
}
return null;
@@ -243,7 +243,7 @@
public void refresh() {
for (int i = 0; i < viewers.size(); i++) {
- TreeViewer viewer = (TreeViewer) viewers.get(i);
+ TreeViewer viewer = viewers.get(i);
if (!viewer.getControl().isDisposed()) {
viewer.refresh(true);
}
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 5cfaddd..e96600f 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
@@ -266,7 +266,7 @@
if (selection instanceof IStructuredSelection) {
IStructuredSelection sel = (IStructuredSelection) selection;
IEnvironment environment = (IEnvironment) sel.getFirstElement();
- IEnvironmentUI ui = (IEnvironmentUI) environment
+ IEnvironmentUI ui = environment
.getAdapter(IEnvironmentUI.class);
String file = null;
if (!useFolders) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/infoviews/AbstractInfoView.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/infoviews/AbstractInfoView.java
index 651c584..70234b3 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/infoviews/AbstractInfoView.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/infoviews/AbstractInfoView.java
@@ -248,7 +248,7 @@
createActions();
createContextMenu();
fillActionBars(getViewSite().getActionBars());
- IContextService ctxService = (IContextService) getSite().getService(
+ IContextService ctxService = getSite().getService(
IContextService.class);
if (ctxService != null) {
fContextActivation = ctxService
@@ -479,7 +479,7 @@
*/
private IModelElement findModelElement(Object element) {
if (element != null && element instanceof IAdaptable) {
- return (IModelElement) ((IAdaptable) element)
+ return ((IAdaptable) element)
.getAdapter(IModelElement.class);
}
return null;
@@ -493,7 +493,7 @@
// cancel possible running computation
fComputeCount++;
if (fContextActivation != null) {
- IContextService ctxService = (IContextService) getSite()
+ IContextService ctxService = getSite()
.getService(IContextService.class);
if (ctxService != null) {
ctxService.deactivateContext(fContextActivation);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/AbstractConfigurationBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/AbstractConfigurationBlock.java
index 99b9e7b..9d065b5 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/AbstractConfigurationBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/AbstractConfigurationBlock.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ui.preferences;
@@ -558,7 +557,7 @@
Iterator iter = fCheckBoxes.keySet().iterator();
while (iter.hasNext()) {
Button b = (Button) iter.next();
- String key = (String) fCheckBoxes.get(b);
+ String key = fCheckBoxes.get(b);
b.setSelection(fStore.getBoolean(key));
}
@@ -588,7 +587,7 @@
iter = fTextFields.keySet().iterator();
while (iter.hasNext()) {
Text t = (Text) iter.next();
- String key = (String) fTextFields.get(t);
+ String key = fTextFields.get(t);
t.setText(fStore.getString(key));
}
@@ -624,7 +623,7 @@
if (validator == null) {
IStatus status = validatePositiveNumber(number);
if (!status.matches(IStatus.ERROR))
- fStore.setValue((String) fTextFields.get(textControl), number);
+ fStore.setValue(fTextFields.get(textControl), number);
updateStatus(status);
} else {
StatusInfo status = new StatusInfo();
@@ -632,7 +631,7 @@
if (res != null) {
status.setError(res);
} else
- fStore.setValue((String) fTextFields.get(textControl), number);
+ fStore.setValue(fTextFields.get(textControl), number);
updateStatus(status);
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/BuildpathContainerPreferencePage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/BuildpathContainerPreferencePage.java
index b574581..36122f6 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/BuildpathContainerPreferencePage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/BuildpathContainerPreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * Copyright (c) 2007, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -55,7 +55,7 @@
if (element instanceof BuildPathContainer) {
container = (BuildPathContainer) element;
} else {
- container = (BuildPathContainer) element
+ container = element
.getAdapter(BuildPathContainer.class);
}
fJavaProject = container.getScriptProject();
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/EditTemplateDialog.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/EditTemplateDialog.java
index 0b833eb..54a5f29 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/EditTemplateDialog.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/EditTemplateDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 xored software, Inc.
+ * Copyright (c) 2009, 2016 xored software, Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -505,7 +505,7 @@
private void initializeActions() {
final List<IHandlerActivation> handlerActivations = new ArrayList<IHandlerActivation>(
3);
- final IHandlerService handlerService = (IHandlerService) PlatformUI
+ final IHandlerService handlerService = PlatformUI
.getWorkbench().getAdapter(IHandlerService.class);
final Expression expression = new ActiveShellExpression(fPatternEditor
.getControl().getShell());
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/search/ScriptSearchPage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/search/ScriptSearchPage.java
index 2134cb2..6c210f2 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/search/ScriptSearchPage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/search/ScriptSearchPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
@@ -808,14 +808,14 @@
// lp.getElementName(), null, false);
// }
else if (o instanceof IAdaptable) {
- IModelElement element = (IModelElement) ((IAdaptable) o)
+ IModelElement element = ((IAdaptable) o)
.getAdapter(IModelElement.class);
if (element != null) {
res = determineInitValuesFrom(element);
}
}
if (res == null && o instanceof IAdaptable) {
- IWorkbenchAdapter adapter = (IWorkbenchAdapter) ((IAdaptable) o)
+ IWorkbenchAdapter adapter = ((IAdaptable) o)
.getAdapter(IWorkbenchAdapter.class);
if (adapter != null) {
return new SearchPatternData(TYPE, REFERENCES,
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ContentAssistProcessor.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ContentAssistProcessor.java
index bd8eaf5..09f5ec5 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ContentAssistProcessor.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ContentAssistProcessor.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ui.text.completion;
@@ -640,7 +639,7 @@
}
private KeySequence getIterationBinding() {
- final IBindingService bindingSvc = (IBindingService) PlatformUI
+ final IBindingService bindingSvc = PlatformUI
.getWorkbench().getAdapter(IBindingService.class);
TriggerSequence binding = bindingSvc
.getBestActiveBindingFor(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/AbstractASTFoldingStructureProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/AbstractASTFoldingStructureProvider.java
index 5db7a63..c574994 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/AbstractASTFoldingStructureProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/AbstractASTFoldingStructureProvider.java
@@ -1110,7 +1110,7 @@
}
private ProjectionAnnotationModel getModel() {
- return (ProjectionAnnotationModel) fEditor
+ return fEditor
.getAdapter(ProjectionAnnotationModel.class);
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/DelegatingFoldingStructureProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/DelegatingFoldingStructureProvider.java
index 6c1cf46..59b980e 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/DelegatingFoldingStructureProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/DelegatingFoldingStructureProvider.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * Copyright (c) 2006, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ui.text.folding;
@@ -897,7 +896,7 @@
}
private ProjectionAnnotationModel getModel() {
- return (ProjectionAnnotationModel) fEditor
+ return fEditor
.getAdapter(ProjectionAnnotationModel.class);
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/templates/TemplateVariableProcessor.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/templates/TemplateVariableProcessor.java
index 49fae45..b90356f 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/templates/TemplateVariableProcessor.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/templates/TemplateVariableProcessor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 xored software, Inc.
+ * Copyright (c) 2009, 2016 xored software, Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -97,7 +97,7 @@
for (@SuppressWarnings("unchecked")
Iterator<TemplateVariableResolver> iterator = fContextType.resolvers(); iterator
.hasNext();) {
- TemplateVariableResolver variable = (TemplateVariableResolver) iterator
+ TemplateVariableResolver variable = iterator
.next();
if (variable.getType().startsWith(prefix))
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/templates/TemplateVariableTextHover.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/templates/TemplateVariableTextHover.java
index 1a1fdc9..ed13fc5 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/templates/TemplateVariableTextHover.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/templates/TemplateVariableTextHover.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 xored software, Inc.
+ * Copyright (c) 2009, 2016 xored software, Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -49,7 +49,7 @@
Iterator<TemplateVariableResolver> iter = contextType
.resolvers();
while (iter.hasNext()) {
- TemplateVariableResolver var = (TemplateVariableResolver) iter
+ TemplateVariableResolver var = iter
.next();
if (varName.equals(var.getType())) {
return var.getDescription();
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/util/ElementValidator.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/util/ElementValidator.java
index c4c1fbb..e776a90 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/util/ElementValidator.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/util/ElementValidator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
@@ -224,7 +224,7 @@
}
resource = je.getResource();
} else {
- resource = (IResource) element.getAdapter(IResource.class);
+ resource = element.getAdapter(IResource.class);
}
if (resource != null)
result.add(resource);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ResourceToItemsMapper.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ResourceToItemsMapper.java
index 7870f16..33bd7c7 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ResourceToItemsMapper.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ResourceToItemsMapper.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ui.viewsupport;
@@ -180,12 +179,12 @@
return (IResource) element;
} else if (element instanceof IAdaptable) {
IResource res;
- IModelElement elem = (IModelElement) ((IAdaptable) element)
+ IModelElement elem = ((IAdaptable) element)
.getAdapter(IModelElement.class);
if (elem != null) {
return getCorrespondingResource(elem);
} else {
- res = ((IResource) ((IAdaptable) element)
+ res = (((IAdaptable) element)
.getAdapter(IResource.class));
}
return res;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/StatusBarUpdater.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/StatusBarUpdater.java
index 8550825..659e8d6 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/StatusBarUpdater.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/StatusBarUpdater.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ui.viewsupport;
@@ -75,7 +74,7 @@
+ ScriptElementLabels.CONCAT_STRING
+ container.getScriptProject().getElementName();
} else if (elem instanceof IAdaptable) {
- IWorkbenchAdapter wbadapter = (IWorkbenchAdapter) ((IAdaptable) elem)
+ IWorkbenchAdapter wbadapter = ((IAdaptable) elem)
.getAdapter(IWorkbenchAdapter.class);
if (wbadapter != null) {
return wbadapter.getLabel(elem);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/NewContainerWizardPage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/NewContainerWizardPage.java
index 669d8fd..2cc7e04 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/NewContainerWizardPage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/NewContainerWizardPage.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ui.wizards;
@@ -224,20 +223,20 @@
// Check for adapters
if (selectedElement instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) selectedElement;
- scriptElement = (IModelElement) adaptable
+ scriptElement = adaptable
.getAdapter(IModelElement.class);
if (scriptElement != null && scriptElement.isReadOnly()) {
scriptElement = scriptElement.getScriptProject();
}
if (scriptElement == null) {
- IResource resource = (IResource) adaptable
+ IResource resource = adaptable
.getAdapter(IResource.class);
if (resource != null
&& resource.getType() != IResource.ROOT) {
while (scriptElement == null
&& resource.getType() != IResource.PROJECT) {
resource = resource.getParent();
- scriptElement = (IModelElement) resource
+ scriptElement = resource
.getAdapter(IModelElement.class);
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/ProjectWizardFirstPage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/ProjectWizardFirstPage.java
index a29994e..284a453 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/ProjectWizardFirstPage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/ProjectWizardFirstPage.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ui.wizards;
@@ -379,7 +378,7 @@
public void changeControlPressed(DialogField field) {
final IEnvironment environment = getEnvironment();
- final IEnvironmentUI environmentUI = (IEnvironmentUI) environment
+ final IEnvironmentUI environmentUI = environment
.getAdapter(IEnvironmentUI.class);
if (environmentUI != null) {
String directoryName = fLocation.getText().trim();
diff --git a/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/RenameUserInterfaceStarter.java b/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/RenameUserInterfaceStarter.java
index 208a542..079a934 100644
--- a/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/RenameUserInterfaceStarter.java
+++ b/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/RenameUserInterfaceStarter.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.refactoring.reorg;
@@ -69,7 +68,7 @@
return;
ISetSelectionTarget target= null;
if (!(part instanceof ISetSelectionTarget)) {
- target= (ISetSelectionTarget)part.getAdapter(ISetSelectionTarget.class);
+ target = part.getAdapter(ISetSelectionTarget.class);
if (target == null)
return;
} else {