null
.
*/
+ @SuppressWarnings("cast")
protected void executeCommand(Object data) {
// Get the command service from the workbench
ICommandService service = (ICommandService)PlatformUI.getWorkbench().getAdapter(ICommandService.class);
@@ -112,7 +113,7 @@ public abstract class AbstractAction extends AbstractTerminalAction {
// Apply the selection to the "activeMenuSelection" and "selection" variable too
context.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, selection);
context.addVariable(ISources.ACTIVE_MENU_SELECTION_NAME, selection);
- // Allow plugin activation
+ // Allow plug-in activation
context.setAllowPluginActivation(true);
// And execute the event
try {
diff --git a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/actions/ToggleCommandFieldAction.java b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/actions/ToggleCommandFieldAction.java
index f108f885931..9fe0aecc7c7 100644
--- a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/actions/ToggleCommandFieldAction.java
+++ b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/actions/ToggleCommandFieldAction.java
@@ -69,6 +69,7 @@ public class ToggleCommandFieldAction extends AbstractTerminalAction {
*
* @return The command input field handler or null
.
*/
+ @SuppressWarnings("cast")
protected TabCommandFieldHandler getCommandFieldHandler() {
TabCommandFieldHandler handler = null;
// Get the active tab item from the tab folder manager
diff --git a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/internal/PropertyTester.java b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/internal/PropertyTester.java
index 133b8594732..d6eb2f5802e 100644
--- a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/internal/PropertyTester.java
+++ b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/internal/PropertyTester.java
@@ -28,6 +28,7 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester
/* (non-Javadoc)
* @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
*/
+ @SuppressWarnings("cast")
@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if ("hasApplicableLauncherDelegates".equals(property)) { //$NON-NLS-1$
diff --git a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/internal/handler/AbstractTriggerCommandHandler.java b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/internal/handler/AbstractTriggerCommandHandler.java
index 03b5e7a93f9..07e36f031cf 100644
--- a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/internal/handler/AbstractTriggerCommandHandler.java
+++ b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/internal/handler/AbstractTriggerCommandHandler.java
@@ -37,6 +37,7 @@ public abstract class AbstractTriggerCommandHandler extends AbstractHandler {
* @param commandId The command id. Must not be null
.
* @param selection The selection to pass on to the command or null
.
*/
+ @SuppressWarnings("cast")
protected void triggerCommand(String commandId, ISelection selection) {
Assert.isNotNull(commandId);
diff --git a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/internal/handler/DisconnectTerminalCommandHandler.java b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/internal/handler/DisconnectTerminalCommandHandler.java
index 98c6635682a..142973bff65 100644
--- a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/internal/handler/DisconnectTerminalCommandHandler.java
+++ b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/internal/handler/DisconnectTerminalCommandHandler.java
@@ -28,6 +28,7 @@ public class DisconnectTerminalCommandHandler extends AbstractHandler {
/* (non-Javadoc)
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
+ @SuppressWarnings("cast")
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
CTabItem item = null;
diff --git a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/launcher/LauncherDelegateManager.java b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/launcher/LauncherDelegateManager.java
index 0e9d1886feb..2428eefabd6 100644
--- a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/launcher/LauncherDelegateManager.java
+++ b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/launcher/LauncherDelegateManager.java
@@ -284,6 +284,7 @@ public class LauncherDelegateManager {
* @param selection The selection or null
.
* @return The list of applicable terminal launcher delegates or an empty array.
*/
+ @SuppressWarnings("cast")
public ILauncherDelegate[] getApplicableLauncherDelegates(ISelection selection) {
Listnull
.
* @param flags The flags controlling how the console is opened or null
to use defaults.
*/
+ @SuppressWarnings("cast")
public CTabItem openConsole(String id, String secondaryId, String title, String encoding, ITerminalConnector connector, Object data, Mapnull
.
*/
+ @SuppressWarnings("cast")
public CTabItem findConsole(String id, String secondaryId, String title, ITerminalConnector connector, Object data) {
Assert.isNotNull(title);
Assert.isNotNull(connector);
@@ -520,6 +522,7 @@ public class ConsoleManager {
* @param control The terminal control. Must not be null
.
* @return The corresponding console tab item or null
.
*/
+ @SuppressWarnings("cast")
public CTabItem findConsole(ITerminalControl control) {
Assert.isNotNull(control);
@@ -562,6 +565,7 @@ public class ConsoleManager {
*
* @return The corresponding console tab item or null
.
*/
+ @SuppressWarnings("cast")
private CTabItem findConsoleForTerminalConnector(String id, String title, ITerminalConnector connector, Object data) {
Assert.isNotNull(title);
Assert.isNotNull(connector);
diff --git a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/tabs/TabCommandFieldHandler.java b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/tabs/TabCommandFieldHandler.java
index 9a85fee1112..1ebda75d59c 100644
--- a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/tabs/TabCommandFieldHandler.java
+++ b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/tabs/TabCommandFieldHandler.java
@@ -55,6 +55,7 @@ public class TabCommandFieldHandler implements IDisposable, IAdaptable {
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
+ @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public Object getAdapter(Class adapter) {
if (TabFolderManager.class.equals(adapter)) {
diff --git a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/tabs/TabFolderManager.java b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/tabs/TabFolderManager.java
index f9eff593b42..fcbd8e5cbc9 100644
--- a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/tabs/TabFolderManager.java
+++ b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/tabs/TabFolderManager.java
@@ -200,7 +200,8 @@ public class TabFolderManager extends PlatformObject implements ISelectionProvid
*
* @return The tab folder or null
.
*/
- protected final CTabFolder getTabFolder() {
+ @SuppressWarnings("cast")
+ protected final CTabFolder getTabFolder() {
return (CTabFolder) getParentView().getAdapter(CTabFolder.class);
}
@@ -237,7 +238,7 @@ public class TabFolderManager extends PlatformObject implements ISelectionProvid
*
* @return The created tab item or null
if failed.
*/
- @SuppressWarnings("unused")
+ @SuppressWarnings({ "unused", "cast" })
public CTabItem createTabItem(String title, String encoding, ITerminalConnector connector, Object data, Mapnull
.
* @return The new dropped tab item.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({ "unchecked", "cast" })
public CTabItem cloneTabItemAfterDrop(CTabItem oldItem) {
Assert.isNotNull(oldItem);
diff --git a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/tabs/TabFolderMenuHandler.java b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/tabs/TabFolderMenuHandler.java
index 784da0841e0..e406040a8b5 100644
--- a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/tabs/TabFolderMenuHandler.java
+++ b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/tabs/TabFolderMenuHandler.java
@@ -130,7 +130,8 @@ public class TabFolderMenuHandler extends PlatformObject {
*
* @return The tab folder or null
.
*/
- protected final CTabFolder getTabFolder() {
+ @SuppressWarnings("cast")
+ protected final CTabFolder getTabFolder() {
return (CTabFolder) getParentView().getAdapter(CTabFolder.class);
}
@@ -201,7 +202,8 @@ public class TabFolderMenuHandler extends PlatformObject {
/**
* Create the context menu actions.
*/
- protected void doCreateContextMenuActions() {
+ @SuppressWarnings("cast")
+ protected void doCreateContextMenuActions() {
// Create and add the copy action
add(new TerminalActionCopy() {
/* (non-Javadoc)
@@ -215,7 +217,7 @@ public class TabFolderMenuHandler extends PlatformObject {
// Create and add the paste action
add(new TerminalActionPaste() {
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({ "unchecked" })
@Override
public void run() {
// Determine if pasting to the active tab require backslash translation
@@ -309,7 +311,8 @@ public class TabFolderMenuHandler extends PlatformObject {
*
* @return The currently active terminal control or null
.
*/
- protected ITerminalViewControl getActiveTerminalViewControl() {
+ @SuppressWarnings("cast")
+ protected ITerminalViewControl getActiveTerminalViewControl() {
ITerminalViewControl terminal = null;
// Get the active tab item from the tab folder manager
@@ -366,6 +369,7 @@ public class TabFolderMenuHandler extends PlatformObject {
/* (non-Javadoc)
* @see org.eclipse.ui.part.WorkbenchPart#getAdapter(java.lang.Class)
*/
+ @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public Object getAdapter(Class adapter) {
if (MenuManager.class.isAssignableFrom(adapter)) {
diff --git a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/tabs/TabFolderToolbarHandler.java b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/tabs/TabFolderToolbarHandler.java
index 27cde5ba294..44bdcfe6d18 100644
--- a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/tabs/TabFolderToolbarHandler.java
+++ b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/tabs/TabFolderToolbarHandler.java
@@ -101,7 +101,8 @@ public class TabFolderToolbarHandler extends PlatformObject {
*
* @return The tab folder or null
.
*/
- protected final CTabFolder getTabFolder() {
+ @SuppressWarnings("cast")
+ protected final CTabFolder getTabFolder() {
return (CTabFolder) getParentView().getAdapter(CTabFolder.class);
}
@@ -110,7 +111,8 @@ public class TabFolderToolbarHandler extends PlatformObject {
*
* @return The currently active terminal control or null
.
*/
- public ITerminalViewControl getActiveTerminalViewControl() {
+ @SuppressWarnings("cast")
+ public ITerminalViewControl getActiveTerminalViewControl() {
ITerminalViewControl terminal = null;
// Get the active tab item from the tab folder manager
@@ -347,6 +349,7 @@ public class TabFolderToolbarHandler extends PlatformObject {
/* (non-Javadoc)
* @see org.eclipse.ui.part.WorkbenchPart#getAdapter(java.lang.Class)
*/
+ @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public Object getAdapter(Class adapter) {
if (IToolBarManager.class.isAssignableFrom(adapter)) {
diff --git a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/view/OldTerminalsViewHandler.java b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/view/OldTerminalsViewHandler.java
new file mode 100644
index 00000000000..7c7df67ad7a
--- /dev/null
+++ b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/view/OldTerminalsViewHandler.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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 http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.terminal.view.ui.view;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.tm.terminal.view.ui.interfaces.IUIConstants;
+import org.eclipse.ui.IPerspectiveDescriptor;
+import org.eclipse.ui.IStartup;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PerspectiveAdapter;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Old terminals view handler implementation.
+ *
+ * If invoked, the view implementation opens the new terminals view and
+ * closes itself afterwards.
+ */
+public class OldTerminalsViewHandler extends PerspectiveAdapter implements IStartup {
+ private final static String OLD_VIEW_ID = "org.eclipse.tcf.te.ui.terminals.TerminalsView"; //$NON-NLS-1$
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IStartup#earlyStartup()
+ */
+ @Override
+ public void earlyStartup() {
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ IWorkbenchPage page = window != null ? window.getActivePage() : null;
+
+ if (page != null) handleOldTerminalsView(page);
+
+ // Register ourself as perspective listener
+ window.addPerspectiveListener(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.PerspectiveAdapter#perspectiveActivated(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IPerspectiveDescriptor)
+ */
+ @Override
+ public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
+ super.perspectiveActivated(page, perspective);
+ }
+
+ /**
+ * Checks for the old terminals view ID and close any view with
+ * that ID. If found in the perspective, it attempts to open the
+ * new terminals view.
+ *
+ * @param page The active workbench page. Must not be null
.
+ */
+ protected void handleOldTerminalsView(IWorkbenchPage page) {
+ Assert.isNotNull(page);
+
+ boolean showNewView = false;
+
+ // Search all view references in the current workbench page
+ // matching the old terminals view ID
+ IViewPart oldView = page.findView(OLD_VIEW_ID);
+ while (oldView != null) {
+ page.hideView(oldView);
+ showNewView = true;
+ }
+
+ // Show the new terminals view if necessary
+ if (showNewView) {
+ try {
+ page.showView(IUIConstants.ID);
+ }
+ catch (PartInitException e) { /* ignored on purpose */ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/view/TerminalsView.java b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/view/TerminalsView.java
index 4db5b5b3520..b8ab57a43d9 100644
--- a/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/view/TerminalsView.java
+++ b/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/view/TerminalsView.java
@@ -607,7 +607,8 @@ public class TerminalsView extends ViewPart implements ITerminalsView, IShowInTa
/* (non-Javadoc)
* @see org.eclipse.ui.part.WorkbenchPart#getAdapter(java.lang.Class)
*/
- @Override
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
public Object getAdapter(Class adapter) {
if (CTabFolder.class.isAssignableFrom(adapter)) {
return tabFolderControl;
@@ -667,7 +668,8 @@ public class TerminalsView extends ViewPart implements ITerminalsView, IShowInTa
/* (non-Javadoc)
* @see org.eclipse.ui.part.IShowInTarget#show(org.eclipse.ui.part.ShowInContext)
*/
- @Override
+ @SuppressWarnings("cast")
+ @Override
public boolean show(ShowInContext context) {
if (context != null) {
// Get the selection from the context