1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-21 21:52:10 +02:00

Remove unnecessary SuppressWarning(cast) and casts.

Change-Id: I9248a3fd2481b590e8437bf7f880f936ba88ce6c
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
This commit is contained in:
Alexander Kurtakov 2020-02-14 22:24:09 +02:00
parent 757eab4307
commit fa092f2a4a
14 changed files with 10 additions and 31 deletions

View file

@ -49,8 +49,7 @@ public class FileContentProviderAdapter extends InternalFileContentProvider {
private FileContentProviderAdapter(AbstractCodeReaderFactory factory) { private FileContentProviderAdapter(AbstractCodeReaderFactory factory) {
fDelegate = factory; fDelegate = factory;
setIncludeResolutionHeuristics( setIncludeResolutionHeuristics(factory.getAdapter(IIncludeFileResolutionHeuristics.class));
(IIncludeFileResolutionHeuristics) factory.getAdapter(IIncludeFileResolutionHeuristics.class));
} }
/** /**

View file

@ -50,7 +50,7 @@ class EditActionAccelerators {
} }
private static IBindingService bindingService() { private static IBindingService bindingService() {
return (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class); return PlatformUI.getWorkbench().getAdapter(IBindingService.class);
} }
boolean isCopyAction(int accelerator) { boolean isCopyAction(int accelerator) {

View file

@ -842,7 +842,6 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
} }
@Override @Override
@SuppressWarnings("cast")
public void mouseEnter(MouseEvent e) { public void mouseEnter(MouseEvent e) {
// Disable all keyboard accelerators (e.g., Control-B) so the Terminal view // Disable all keyboard accelerators (e.g., Control-B) so the Terminal view
// can see every keystroke. Without this, Emacs, vi, and Bash are unusable // can see every keystroke. Without this, Emacs, vi, and Bash are unusable
@ -855,7 +854,6 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
} }
@Override @Override
@SuppressWarnings("cast")
public void mouseExit(MouseEvent e) { public void mouseExit(MouseEvent e) {
// Enable all keybindings. // Enable all keybindings.
captureKeyEvents(false); captureKeyEvents(false);
@ -866,7 +864,6 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
contextService.deactivateContext(editContextActivation); contextService.deactivateContext(editContextActivation);
} }
@SuppressWarnings("cast")
protected void captureKeyEvents(boolean capture) { protected void captureKeyEvents(boolean capture) {
IBindingService bindingService = PlatformUI.getWorkbench().getAdapter(IBindingService.class); IBindingService bindingService = PlatformUI.getWorkbench().getAdapter(IBindingService.class);
IContextService contextService = PlatformUI.getWorkbench().getAdapter(IContextService.class); IContextService contextService = PlatformUI.getWorkbench().getAdapter(IContextService.class);
@ -1179,7 +1176,6 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
/* /*
* Process given event as Eclipse key binding. * Process given event as Eclipse key binding.
*/ */
@SuppressWarnings("cast")
private void processKeyBinding(KeyEvent event, int accelerator) { private void processKeyBinding(KeyEvent event, int accelerator) {
IBindingService bindingService = PlatformUI.getWorkbench().getAdapter(IBindingService.class); IBindingService bindingService = PlatformUI.getWorkbench().getAdapter(IBindingService.class);
KeyStroke keyStroke = SWTKeySupport.convertAcceleratorToKeyStroke(accelerator); KeyStroke keyStroke = SWTKeySupport.convertAcceleratorToKeyStroke(accelerator);

View file

@ -72,7 +72,7 @@ public abstract class AbstractAction extends AbstractTerminalAction {
@Override @Override
public void run() { public void run() {
// Get the active tab item from the tab folder manager // Get the active tab item from the tab folder manager
TabFolderManager manager = (TabFolderManager) getParent().getAdapter(TabFolderManager.class); TabFolderManager manager = getParent().getAdapter(TabFolderManager.class);
if (manager != null) { if (manager != null) {
// If we have the active tab item, we can get the active terminal control // If we have the active tab item, we can get the active terminal control
CTabItem activeTabItem = manager.getActiveTabItem(); CTabItem activeTabItem = manager.getActiveTabItem();
@ -91,7 +91,6 @@ public abstract class AbstractAction extends AbstractTerminalAction {
* *
* @param data The terminal custom data node or <code>null</code>. * @param data The terminal custom data node or <code>null</code>.
*/ */
@SuppressWarnings("cast")
protected void executeCommand(Object data) { protected void executeCommand(Object data) {
// Get the command service from the workbench // Get the command service from the workbench
ICommandService service = PlatformUI.getWorkbench().getAdapter(ICommandService.class); ICommandService service = PlatformUI.getWorkbench().getAdapter(ICommandService.class);
@ -148,7 +147,7 @@ public abstract class AbstractAction extends AbstractTerminalAction {
// The action will be enabled if we can determine the VLM target object // The action will be enabled if we can determine the VLM target object
enabled = false; enabled = false;
// Get the active tab item from the tab folder manager // Get the active tab item from the tab folder manager
TabFolderManager manager = (TabFolderManager) getParent().getAdapter(TabFolderManager.class); TabFolderManager manager = getParent().getAdapter(TabFolderManager.class);
if (manager != null) { if (manager != null) {
// If we have the active tab item, we can get the active terminal control // If we have the active tab item, we can get the active terminal control
CTabItem activeTabItem = manager.getActiveTabItem(); CTabItem activeTabItem = manager.getActiveTabItem();

View file

@ -50,7 +50,6 @@ public class NewTerminalViewAction extends AbstractTerminalAction {
setEnabled(true); setEnabled(true);
} }
@SuppressWarnings("cast")
@Override @Override
public void run() { public void run() {
ICommandService service = PlatformUI.getWorkbench().getService(ICommandService.class); ICommandService service = PlatformUI.getWorkbench().getService(ICommandService.class);

View file

@ -67,7 +67,6 @@ public class ToggleCommandFieldAction extends AbstractTerminalAction {
* *
* @return The command input field handler or <code>null</code>. * @return The command input field handler or <code>null</code>.
*/ */
@SuppressWarnings("cast")
protected TabCommandFieldHandler getCommandFieldHandler() { protected TabCommandFieldHandler getCommandFieldHandler() {
TabCommandFieldHandler handler = null; TabCommandFieldHandler handler = null;
// Get the active tab item from the tab folder manager // Get the active tab item from the tab folder manager

View file

@ -133,7 +133,7 @@ public class UIPlugin extends AbstractUIPlugin {
final List<CTabItem> saveables = new ArrayList<>(); final List<CTabItem> saveables = new ArrayList<>();
// Get the tab folder // Get the tab folder
CTabFolder tabFolder = (CTabFolder) ((TerminalsView) part).getAdapter(CTabFolder.class); CTabFolder tabFolder = ((TerminalsView) part).getAdapter(CTabFolder.class);
if (tabFolder != null && !tabFolder.isDisposed()) { if (tabFolder != null && !tabFolder.isDisposed()) {
// Get the list of tab items // Get the list of tab items
CTabItem[] items = tabFolder.getItems(); CTabItem[] items = tabFolder.getItems();
@ -153,7 +153,7 @@ public class UIPlugin extends AbstractUIPlugin {
} }
// Push the determined saveable items to the memento handler // Push the determined saveable items to the memento handler
TerminalsViewMementoHandler mementoHandler = (TerminalsViewMementoHandler) ((TerminalsView) part) TerminalsViewMementoHandler mementoHandler = ((TerminalsView) part)
.getAdapter(TerminalsViewMementoHandler.class); .getAdapter(TerminalsViewMementoHandler.class);
if (mementoHandler != null) if (mementoHandler != null)
mementoHandler.setSaveables(saveables); mementoHandler.setSaveables(saveables);

View file

@ -25,7 +25,6 @@ import org.eclipse.tm.terminal.view.ui.tabs.TabFolderManager;
*/ */
public class PropertyTester extends org.eclipse.core.expressions.PropertyTester { public class PropertyTester extends org.eclipse.core.expressions.PropertyTester {
@SuppressWarnings("cast")
@Override @Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {

View file

@ -27,7 +27,6 @@ import org.eclipse.ui.handlers.HandlerUtil;
*/ */
public class DisconnectTerminalCommandHandler extends AbstractHandler { public class DisconnectTerminalCommandHandler extends AbstractHandler {
@SuppressWarnings("cast")
@Override @Override
public Object execute(ExecutionEvent event) throws ExecutionException { public Object execute(ExecutionEvent event) throws ExecutionException {
CTabItem item = null; CTabItem item = null;

View file

@ -281,7 +281,6 @@ public class LauncherDelegateManager {
* @param selection The selection or <code>null</code>. * @param selection The selection or <code>null</code>.
* @return The list of applicable terminal launcher delegates or an empty array. * @return The list of applicable terminal launcher delegates or an empty array.
*/ */
@SuppressWarnings("cast")
public ILauncherDelegate[] getApplicableLauncherDelegates(ISelection selection) { public ILauncherDelegate[] getApplicableLauncherDelegates(ISelection selection) {
List<ILauncherDelegate> applicable = new ArrayList<>(); List<ILauncherDelegate> applicable = new ArrayList<>();

View file

@ -49,7 +49,6 @@ public class WorkbenchPartListener implements IPartListener2 {
public void partHidden(IWorkbenchPartReference partRef) { public void partHidden(IWorkbenchPartReference partRef) {
} }
@SuppressWarnings("cast")
@Override @Override
public void partActivated(IWorkbenchPartReference partRef) { public void partActivated(IWorkbenchPartReference partRef) {
if ("org.eclipse.tm.terminal.view.ui.TerminalsView".equals(partRef.getId())) { //$NON-NLS-1$ if ("org.eclipse.tm.terminal.view.ui.TerminalsView".equals(partRef.getId())) { //$NON-NLS-1$
@ -68,7 +67,6 @@ public class WorkbenchPartListener implements IPartListener2 {
} }
} }
@SuppressWarnings("cast")
@Override @Override
public void partDeactivated(IWorkbenchPartReference partRef) { public void partDeactivated(IWorkbenchPartReference partRef) {
if ("org.eclipse.tm.terminal.view.ui.TerminalsView".equals(partRef.getId())) { //$NON-NLS-1$ if ("org.eclipse.tm.terminal.view.ui.TerminalsView".equals(partRef.getId())) { //$NON-NLS-1$

View file

@ -421,7 +421,6 @@ public class ConsoleManager {
* @param data The custom terminal data node or <code>null</code>. * @param data The custom terminal data node or <code>null</code>.
* @param flags The flags controlling how the console is opened or <code>null</code> to use defaults. * @param flags The flags controlling how the console is opened or <code>null</code> to use defaults.
*/ */
@SuppressWarnings("cast")
public CTabItem openConsole(String id, String secondaryId, String title, String encoding, public CTabItem openConsole(String id, String secondaryId, String title, String encoding,
ITerminalConnector connector, Object data, Map<String, Boolean> flags) { ITerminalConnector connector, Object data, Map<String, Boolean> flags) {
Assert.isNotNull(title); Assert.isNotNull(title);
@ -501,7 +500,6 @@ public class ConsoleManager {
* *
* @return The corresponding console tab item or <code>null</code>. * @return The corresponding console tab item or <code>null</code>.
*/ */
@SuppressWarnings("cast")
public CTabItem findConsole(String id, String secondaryId, String title, ITerminalConnector connector, public CTabItem findConsole(String id, String secondaryId, String title, ITerminalConnector connector,
Object data) { Object data) {
Assert.isNotNull(title); Assert.isNotNull(title);
@ -529,7 +527,6 @@ public class ConsoleManager {
* @param control The terminal control. Must not be <code>null</code>. * @param control The terminal control. Must not be <code>null</code>.
* @return The corresponding console tab item or <code>null</code>. * @return The corresponding console tab item or <code>null</code>.
*/ */
@SuppressWarnings("cast")
public CTabItem findConsole(ITerminalControl control) { public CTabItem findConsole(ITerminalControl control) {
Assert.isNotNull(control); Assert.isNotNull(control);
@ -572,7 +569,6 @@ public class ConsoleManager {
* *
* @return The corresponding console tab item or <code>null</code>. * @return The corresponding console tab item or <code>null</code>.
*/ */
@SuppressWarnings("cast")
private CTabItem findConsoleForTerminalConnector(String id, String title, ITerminalConnector connector, private CTabItem findConsoleForTerminalConnector(String id, String title, ITerminalConnector connector,
Object data) { Object data) {
Assert.isNotNull(title); Assert.isNotNull(title);

View file

@ -190,7 +190,6 @@ public class TabFolderManager extends PlatformObject implements ISelectionProvid
* *
* @return The tab folder or <code>null</code>. * @return The tab folder or <code>null</code>.
*/ */
@SuppressWarnings("cast")
protected final CTabFolder getTabFolder() { protected final CTabFolder getTabFolder() {
return getParentView().getAdapter(CTabFolder.class); return getParentView().getAdapter(CTabFolder.class);
} }
@ -229,7 +228,7 @@ public class TabFolderManager extends PlatformObject implements ISelectionProvid
* *
* @return The created tab item or <code>null</code> if failed. * @return The created tab item or <code>null</code> if failed.
*/ */
@SuppressWarnings({ "unused", "cast" }) @SuppressWarnings({ "unused" })
public CTabItem createTabItem(String title, String encoding, ITerminalConnector connector, Object data, public CTabItem createTabItem(String title, String encoding, ITerminalConnector connector, Object data,
Map<String, Boolean> flags) { Map<String, Boolean> flags) {
Assert.isNotNull(title); Assert.isNotNull(title);
@ -298,7 +297,7 @@ public class TabFolderManager extends PlatformObject implements ISelectionProvid
// Set the context menu // Set the context menu
TabFolderMenuHandler menuHandler = getParentView().getAdapter(TabFolderMenuHandler.class); TabFolderMenuHandler menuHandler = getParentView().getAdapter(TabFolderMenuHandler.class);
if (menuHandler != null) { if (menuHandler != null) {
Menu menu = (Menu) menuHandler.getAdapter(Menu.class); Menu menu = menuHandler.getAdapter(Menu.class);
if (menu != null) { if (menu != null) {
// One weird occurrence of IllegalArgumentException: Widget has wrong parent. // One weird occurrence of IllegalArgumentException: Widget has wrong parent.
// Inspecting the code, this seem extremely unlikely. The terminal is created // Inspecting the code, this seem extremely unlikely. The terminal is created
@ -341,7 +340,7 @@ public class TabFolderManager extends PlatformObject implements ISelectionProvid
* @param oldItem The old dragged tab item. Must not be <code>null</code>. * @param oldItem The old dragged tab item. Must not be <code>null</code>.
* @return The new dropped tab item. * @return The new dropped tab item.
*/ */
@SuppressWarnings({ "unchecked", "cast" }) @SuppressWarnings({ "unchecked" })
public CTabItem cloneTabItemAfterDrop(CTabItem oldItem) { public CTabItem cloneTabItemAfterDrop(CTabItem oldItem) {
Assert.isNotNull(oldItem); Assert.isNotNull(oldItem);
@ -413,7 +412,7 @@ public class TabFolderManager extends PlatformObject implements ISelectionProvid
// Set the context menu // Set the context menu
TabFolderMenuHandler menuHandler = getParentView().getAdapter(TabFolderMenuHandler.class); TabFolderMenuHandler menuHandler = getParentView().getAdapter(TabFolderMenuHandler.class);
if (menuHandler != null) { if (menuHandler != null) {
Menu menu = (Menu) menuHandler.getAdapter(Menu.class); Menu menu = menuHandler.getAdapter(Menu.class);
if (menu != null) { if (menu != null) {
// One weird occurrence of IllegalArgumentException: Widget has wrong parent. // One weird occurrence of IllegalArgumentException: Widget has wrong parent.
// Inspecting the code, this seem extremely unlikely. The terminal is created // Inspecting the code, this seem extremely unlikely. The terminal is created

View file

@ -125,7 +125,6 @@ public class TabFolderMenuHandler extends PlatformObject {
* *
* @return The tab folder or <code>null</code>. * @return The tab folder or <code>null</code>.
*/ */
@SuppressWarnings("cast")
protected final CTabFolder getTabFolder() { protected final CTabFolder getTabFolder() {
return getParentView().getAdapter(CTabFolder.class); return getParentView().getAdapter(CTabFolder.class);
} }
@ -209,7 +208,6 @@ public class TabFolderMenuHandler extends PlatformObject {
/** /**
* Create the context menu actions. * Create the context menu actions.
*/ */
@SuppressWarnings("cast")
protected void doCreateContextMenuActions() { protected void doCreateContextMenuActions() {
// Create and add the copy action // Create and add the copy action
add(new TerminalActionCopy() { add(new TerminalActionCopy() {
@ -303,7 +301,6 @@ public class TabFolderMenuHandler extends PlatformObject {
* *
* @return The currently active terminal control or <code>null</code>. * @return The currently active terminal control or <code>null</code>.
*/ */
@SuppressWarnings("cast")
protected ITerminalViewControl getActiveTerminalViewControl() { protected ITerminalViewControl getActiveTerminalViewControl() {
ITerminalViewControl terminal = null; ITerminalViewControl terminal = null;