diff options
Diffstat (limited to 'terminal/org.eclipse.tm.terminal.view/src')
23 files changed, 0 insertions, 2022 deletions
diff --git a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/ActionMessages.java b/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/ActionMessages.java deleted file mode 100644 index 9105892da..000000000 --- a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/ActionMessages.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2006 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 - * - * Initial Contributors: - * The following Wind River employees contributed to the Terminal component - * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, - * Helmut Haigermoser and Ted Williams. - * - * Contributors: - * Michael Scharf (Wind River) - split into core, view and connector plugins - * Martin Oberhuber (Wind River) - fixed copyright headers and beautified - *******************************************************************************/ -package org.eclipse.tm.terminal.internal.actions; - -import org.eclipse.osgi.util.NLS; - -public class ActionMessages extends NLS { - static { - NLS.initializeMessages(ActionMessages.class.getName(), ActionMessages.class); - } - public static String NEW_TERMINAL; - public static String CONNECT; - public static String DISCONNECT; - public static String SETTINGS_ELLIPSE; - public static String COPY; - public static String CUT; - public static String PASTE; - public static String SELECTALL; - public static String CLEARALL; - public static String SETTINGS; - -} diff --git a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/ActionMessages.properties b/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/ActionMessages.properties deleted file mode 100644 index b475440f6..000000000 --- a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/ActionMessages.properties +++ /dev/null @@ -1,26 +0,0 @@ -############################################################################### -# Copyright (c) 2003, 2006 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 -# -# Initial Contributors: -# The following Wind River employees contributed to the Terminal component -# that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, -# Helmut Haigermoser and Ted Williams. -# -# Contributors: -# Michael Scharf (Wind River) - split into core, view and connector plugins -# Martin Oberhuber (Wind River) - fixed copyright headers and beautified -############################################################################### -NEW_TERMINAL = New Terminal -CONNECT = Connect -DISCONNECT = Disconnect -SETTINGS_ELLIPSE = Settings... -COPY = Copy -CUT = Cut -PASTE = Paste -SELECTALL = Select All -CLEARALL = Clear All -SETTINGS = Settings diff --git a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalAction.java b/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalAction.java deleted file mode 100644 index e3084958b..000000000 --- a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalAction.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 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 - * - * Initial Contributors: - * The following Wind River employees contributed to the Terminal component - * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, - * Helmut Haigermoser and Ted Williams. - * - * Contributors: - * Michael Scharf (Wind River) - split into core, view and connector plugins - * Martin Oberhuber (Wind River) - fixed copyright headers and beautified - *******************************************************************************/ -package org.eclipse.tm.terminal.internal.actions; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.tm.terminal.internal.view.ITerminalView; -import org.eclipse.tm.terminal.internal.view.TerminalViewPlugin; - -abstract public class TerminalAction extends Action { - protected final ITerminalView fTarget; - public TerminalAction(ITerminalView target, String strId) { - super(""); //$NON-NLS-1$ - - fTarget = target; - - setId(strId); - } - abstract public void run(); - protected void setupAction(String strText, String strToolTip, - String strImage, String strEnabledImage, String strDisabledImage, - boolean bEnabled) { - TerminalViewPlugin plugin; - ImageRegistry imageRegistry; - - plugin = TerminalViewPlugin.getDefault(); - imageRegistry = plugin.getImageRegistry(); - setupAction(strText, strToolTip, strImage, strEnabledImage, - strDisabledImage, bEnabled, imageRegistry); - } - protected void setupAction(String strText, String strToolTip, - String strImage, String strEnabledImage, String strDisabledImage, - boolean bEnabled, ImageRegistry imageRegistry) { - ImageDescriptor imageDescriptor; - - setText(strText); - setToolTipText(strToolTip); - setEnabled(bEnabled); - - imageDescriptor = imageRegistry.getDescriptor(strEnabledImage); - if (imageDescriptor != null) { - setImageDescriptor(imageDescriptor); - } - - imageDescriptor = imageRegistry.getDescriptor(strDisabledImage); - if (imageDescriptor != null) { - setDisabledImageDescriptor(imageDescriptor); - } - - imageDescriptor = imageRegistry.getDescriptor(strImage); - if (imageDescriptor != null) { - setHoverImageDescriptor(imageDescriptor); - } - } -} diff --git a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionClearAll.java b/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionClearAll.java deleted file mode 100644 index c86a95974..000000000 --- a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionClearAll.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 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 - * - * Initial Contributors: - * The following Wind River employees contributed to the Terminal component - * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, - * Helmut Haigermoser and Ted Williams. - * - * Contributors: - * Michael Scharf (Wind River) - split into core, view and connector plugins - * Martin Oberhuber (Wind River) - fixed copyright headers and beautified - *******************************************************************************/ -package org.eclipse.tm.terminal.internal.actions; - -import org.eclipse.tm.terminal.internal.view.ITerminalView; - -public class TerminalActionClearAll extends TerminalAction -{ - public TerminalActionClearAll(ITerminalView target) - { - super(target, - TerminalActionClearAll.class.getName()); - - setupAction(ActionMessages.CLEARALL, - ActionMessages.CLEARALL, - null, - null, - null, - false); - } - - public void run() { - fTarget.onEditClearAll(); - } -} - - diff --git a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionConnect.java b/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionConnect.java deleted file mode 100644 index cbd451045..000000000 --- a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionConnect.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 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 - * - * Initial Contributors: - * The following Wind River employees contributed to the Terminal component - * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, - * Helmut Haigermoser and Ted Williams. - * - * Contributors: - * Michael Scharf (Wind River) - split into core, view and connector plugins - * Martin Oberhuber (Wind River) - fixed copyright headers and beautified - *******************************************************************************/ -package org.eclipse.tm.terminal.internal.actions; - -import org.eclipse.tm.terminal.internal.view.ITerminalView; -import org.eclipse.tm.terminal.internal.view.ImageConsts; - -public class TerminalActionConnect extends TerminalAction -{ - public TerminalActionConnect(ITerminalView target) - { - super(target, - TerminalActionConnect.class.getName()); - - setupAction(ActionMessages.CONNECT, - ActionMessages.CONNECT, - ImageConsts.IMAGE_CLCL_CONNECT, - ImageConsts.IMAGE_ELCL_CONNECT, - ImageConsts.IMAGE_DLCL_CONNECT, - true); - } - public void run() { - fTarget.onTerminalConnect(); - } -} diff --git a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionCopy.java b/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionCopy.java deleted file mode 100644 index 496506724..000000000 --- a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionCopy.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 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 - * - * Initial Contributors: - * The following Wind River employees contributed to the Terminal component - * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, - * Helmut Haigermoser and Ted Williams. - * - * Contributors: - * Michael Scharf (Wind River) - split into core, view and connector plugins - * Martin Oberhuber (Wind River) - fixed copyright headers and beautified - *******************************************************************************/ -package org.eclipse.tm.terminal.internal.actions; - -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.tm.terminal.internal.view.ITerminalView; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.internal.WorkbenchImages; - -public class TerminalActionCopy extends TerminalAction -{ - public TerminalActionCopy(ITerminalView target) - { - super(target, - TerminalActionCopy.class.getName()); - - ImageRegistry imageRegistry; - - imageRegistry = WorkbenchImages.getImageRegistry(); - setupAction(ActionMessages.COPY, - ActionMessages.COPY, - ISharedImages.IMG_TOOL_COPY, - ISharedImages.IMG_TOOL_COPY, - ISharedImages.IMG_TOOL_COPY_DISABLED, - true, - imageRegistry); - } - public void run() { - fTarget.onEditCopy(); - } -} diff --git a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionCut.java b/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionCut.java deleted file mode 100644 index bb10424c0..000000000 --- a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionCut.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 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 - * - * Initial Contributors: - * The following Wind River employees contributed to the Terminal component - * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, - * Helmut Haigermoser and Ted Williams. - * - * Contributors: - * Michael Scharf (Wind River) - split into core, view and connector plugins - * Martin Oberhuber (Wind River) - fixed copyright headers and beautified - *******************************************************************************/ -package org.eclipse.tm.terminal.internal.actions; - -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.tm.terminal.internal.view.ITerminalView; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.internal.WorkbenchImages; - -public class TerminalActionCut extends TerminalAction -{ - public TerminalActionCut(ITerminalView target) - { - super(target, - TerminalActionCut.class.getName()); - - ImageRegistry imageRegistry; - - imageRegistry = WorkbenchImages.getImageRegistry(); - setupAction(ActionMessages.CUT, - ActionMessages.CUT, - ISharedImages.IMG_TOOL_CUT, - ISharedImages.IMG_TOOL_CUT, - ISharedImages.IMG_TOOL_CUT_DISABLED, - true, - imageRegistry); - } - public void run() { - fTarget.onEditCut(); - } -} diff --git a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionDisconnect.java b/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionDisconnect.java deleted file mode 100644 index 1a1417f78..000000000 --- a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionDisconnect.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 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 - * - * Initial Contributors: - * The following Wind River employees contributed to the Terminal component - * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, - * Helmut Haigermoser and Ted Williams. - * - * Contributors: - * Michael Scharf (Wind River) - split into core, view and connector plugins - * Martin Oberhuber (Wind River) - fixed copyright headers and beautified - *******************************************************************************/ -package org.eclipse.tm.terminal.internal.actions; - -import org.eclipse.tm.terminal.internal.view.ITerminalView; -import org.eclipse.tm.terminal.internal.view.ImageConsts; - -public class TerminalActionDisconnect extends TerminalAction -{ - /** - * - */ - public TerminalActionDisconnect(ITerminalView target) - { - super(target, - TerminalActionDisconnect.class.getName()); - - setupAction(ActionMessages.DISCONNECT, - ActionMessages.DISCONNECT, - ImageConsts.IMAGE_CLCL_DISCONNECT, - ImageConsts.IMAGE_ELCL_DISCONNECT, - ImageConsts.IMAGE_DLCL_DISCONNECT, - false); - } - public void run() { - fTarget.onTerminalDisconnect(); - } -} diff --git a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionNewTerminal.java b/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionNewTerminal.java deleted file mode 100644 index 9dd7aad57..000000000 --- a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionNewTerminal.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 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 - * - * Initial Contributors: - * The following Wind River employees contributed to the Terminal component - * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, - * Helmut Haigermoser and Ted Williams. - * - * Contributors: - * Michael Scharf (Wind River) - split into core, view and connector plugins - * Martin Oberhuber (Wind River) - fixed copyright headers and beautified - *******************************************************************************/ -package org.eclipse.tm.terminal.internal.actions; - -import org.eclipse.tm.terminal.internal.view.ITerminalView; -import org.eclipse.tm.terminal.internal.view.ImageConsts; - -/** - * UNDER CONSTRUCTION - * - * @author Fran Litterio <francis.litterio@windriver.com> - */ -public class TerminalActionNewTerminal extends TerminalAction -{ - /** - * UNDER CONSTRUCTION - */ - public TerminalActionNewTerminal(ITerminalView target) - { - super(target, TerminalActionNewTerminal.class.getName()); - - setupAction(ActionMessages.NEW_TERMINAL, - ActionMessages.NEW_TERMINAL, - ImageConsts.IMAGE_NEW_TERMINAL, - ImageConsts.IMAGE_NEW_TERMINAL, - ImageConsts.IMAGE_NEW_TERMINAL, - true); - } - public void run() { - fTarget.onTerminalNewTerminal(); - } -} diff --git a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionPaste.java b/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionPaste.java deleted file mode 100644 index 30ea59746..000000000 --- a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionPaste.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 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 - * - * Initial Contributors: - * The following Wind River employees contributed to the Terminal component - * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, - * Helmut Haigermoser and Ted Williams. - * - * Contributors: - * Michael Scharf (Wind River) - split into core, view and connector plugins - * Martin Oberhuber (Wind River) - fixed copyright headers and beautified - *******************************************************************************/ -package org.eclipse.tm.terminal.internal.actions; - -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.tm.terminal.internal.view.ITerminalView; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.internal.WorkbenchImages; - -public class TerminalActionPaste extends TerminalAction -{ - public TerminalActionPaste(ITerminalView target) - { - super(target, - TerminalActionPaste.class.getName()); - - ImageRegistry imageRegistry; - - imageRegistry = WorkbenchImages.getImageRegistry(); - setupAction(ActionMessages.PASTE, - ActionMessages.PASTE, - ISharedImages.IMG_TOOL_PASTE, - ISharedImages.IMG_TOOL_PASTE_DISABLED, - ISharedImages.IMG_TOOL_PASTE, - false, - imageRegistry); - } - public void run() { - fTarget.onEditPaste(); - } -} diff --git a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionSelectAll.java b/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionSelectAll.java deleted file mode 100644 index e32216b07..000000000 --- a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionSelectAll.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 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 - * - * Initial Contributors: - * The following Wind River employees contributed to the Terminal component - * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, - * Helmut Haigermoser and Ted Williams. - * - * Contributors: - * Michael Scharf (Wind River) - split into core, view and connector plugins - * Martin Oberhuber (Wind River) - fixed copyright headers and beautified - *******************************************************************************/ -package org.eclipse.tm.terminal.internal.actions; - -import org.eclipse.tm.terminal.internal.view.ITerminalView; - -public class TerminalActionSelectAll extends TerminalAction -{ - public TerminalActionSelectAll(ITerminalView target) - { - super(target, - TerminalActionSelectAll.class.getName()); - - setupAction(ActionMessages.SELECTALL, - ActionMessages.SELECTALL, - null, - null, - null, - false); - } - public void run() { - fTarget.onEditSelectAll(); - } -} diff --git a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionSettings.java b/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionSettings.java deleted file mode 100644 index 3471c4faa..000000000 --- a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/actions/TerminalActionSettings.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 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 - * - * Initial Contributors: - * The following Wind River employees contributed to the Terminal component - * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, - * Helmut Haigermoser and Ted Williams. - * - * Contributors: - * Michael Scharf (Wind River) - split into core, view and connector plugins - * Martin Oberhuber (Wind River) - fixed copyright headers and beautified - *******************************************************************************/ -package org.eclipse.tm.terminal.internal.actions; - -import org.eclipse.tm.terminal.internal.view.ITerminalView; -import org.eclipse.tm.terminal.internal.view.ImageConsts; - -public class TerminalActionSettings extends TerminalAction -{ - public TerminalActionSettings(ITerminalView target) - { - super(target, - TerminalActionSettings.class.getName()); - - setupAction(ActionMessages.SETTINGS_ELLIPSE, - ActionMessages.SETTINGS, - ImageConsts.IMAGE_CLCL_SETTINGS, - ImageConsts.IMAGE_ELCL_SETTINGS, - ImageConsts.IMAGE_DLCL_SETTINGS, - true); - } - public void run() { - fTarget.onTerminalSettings(); - } -} diff --git a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/ITerminalView.java b/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/ITerminalView.java deleted file mode 100644 index 2244f4536..000000000 --- a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/ITerminalView.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Michael Scharf (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.tm.terminal.internal.view; - -public interface ITerminalView { - - /** - * Display a new Terminal view. This method is called when the user clicks the New - * Terminal button in any Terminal view's toolbar. - */ - public void onTerminalNewTerminal(); - public void onTerminalConnect(); - public void onTerminalDisconnect(); - public void onTerminalSettings(); - public void onTerminalFontChanged(); - public void onEditCopy(); - public void onEditCut(); - public void onEditPaste(); - public void onEditClearAll(); - public void onEditSelectAll(); -} diff --git a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/ImageConsts.java b/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/ImageConsts.java deleted file mode 100644 index 9805efa61..000000000 --- a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/ImageConsts.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2006 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 - * - * Initial Contributors: - * The following Wind River employees contributed to the Terminal component - * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, - * Helmut Haigermoser and Ted Williams. - * - * Contributors: - * Michael Scharf (Wind River) - extracted from TerminalConsts - * Martin Oberhuber (Wind River) - fixed copyright headers and beautified - *******************************************************************************/ -package org.eclipse.tm.terminal.internal.view; - -public interface ImageConsts -{ - public final static String IMAGE_DIR_ROOT = "icons/"; //$NON-NLS-1$ - public final static String IMAGE_DIR_CTOOL = "ctool16/"; // basic colors - size 16x16 //$NON-NLS-1$ - public final static String IMAGE_DIR_LOCALTOOL = "clcl16/"; // basic colors - size 16x16 //$NON-NLS-1$ - public final static String IMAGE_DIR_DLCL = "dlcl16/"; // disabled - size 16x16 //$NON-NLS-1$ - public final static String IMAGE_DIR_ELCL = "elcl16/"; // enabled - size 16x16 //$NON-NLS-1$ - public final static String IMAGE_DIR_OBJECT = "obj16/"; // basic colors - size 16x16 //$NON-NLS-1$ - public final static String IMAGE_DIR_WIZBAN = "wizban/"; // basic colors - size 16x16 //$NON-NLS-1$ - public final static String IMAGE_DIR_OVR = "ovr16/"; // basic colors - size 7x8 //$NON-NLS-1$ - public final static String IMAGE_DIR_VIEW = "cview16/"; // views //$NON-NLS-1$ - public final static String IMAGE_DIR_EVIEW = "eview16/"; // views //$NON-NLS-1$ - - public static final String IMAGE_NEW_TERMINAL = "TerminalViewNewTerminal"; //$NON-NLS-1$ - public static final String IMAGE_CLCL_CONNECT = "ImageClclConnect"; //$NON-NLS-1$ - public static final String IMAGE_CLCL_DISCONNECT = "ImageClclDisconnect"; //$NON-NLS-1$ - public static final String IMAGE_CLCL_SETTINGS = "ImageClclSettings"; //$NON-NLS-1$ - - public static final String IMAGE_DLCL_CONNECT = "ImageDlclConnect"; //$NON-NLS-1$ - public static final String IMAGE_DLCL_DISCONNECT = "ImageDlclDisconnect"; //$NON-NLS-1$ - public static final String IMAGE_DLCL_SETTINGS = "ImageDlclSettings"; //$NON-NLS-1$ - - public static final String IMAGE_ELCL_CONNECT = "ImageElclConnect"; //$NON-NLS-1$ - public static final String IMAGE_ELCL_DISCONNECT = "ImageElclDisconnect"; //$NON-NLS-1$ - public static final String IMAGE_ELCL_SETTINGS = "ImageElclSettings"; //$NON-NLS-1$ - } diff --git a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/PageBook.java b/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/PageBook.java deleted file mode 100644 index 5a85f31ad..000000000 --- a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/PageBook.java +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 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 - * - * Contributors: - * IBM Corporation - initial API and implementation (org.eclipse.ui.part.PageBook) - * Michael Scharf (Wind River) - consider all children for layout and hiding - *******************************************************************************/ -package org.eclipse.tm.terminal.internal.view; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Layout; - -/** - * A pagebook is a composite control where only a single control is visible - * at a time. It is similar to a notebook, but without tabs. - * <p> - * This class may be instantiated; it is not intended to be subclassed. - * </p> - * - */ -public class PageBook extends Composite { - private Point minimumPageSize = new Point(0, 0); - - /** - * Layout for the page container. - * - */ - private class PageBookLayout extends Layout { - public Point computeSize(Composite composite, int wHint, int hHint, boolean force) { - if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT) - return new Point(wHint, hHint); - int x = minimumPageSize.x; - int y = minimumPageSize.y; - Control[] children = composite.getChildren(); - for (int i = 0; i < children.length; i++) { - Point size = children[i].computeSize(wHint, hHint, force); - x = Math.max(x, size.x); - y = Math.max(y, size.y); - } - - if (wHint != SWT.DEFAULT) { - x = wHint; - } - if (hHint != SWT.DEFAULT) { - y = hHint; - } - return new Point(x, y); - } - - public void layout(Composite composite, boolean force) { - Rectangle rect = composite.getClientArea(); - Control[] children = composite.getChildren(); - for (int i = 0; i < children.length; i++) { - children[i].setBounds(rect); - } - } - } - - /** - * The current control; <code>null</code> if none. - */ - private Control currentPage = null; - - /** - * Creates a new empty pagebook. - * - * @param parent the parent composite - * @param style the SWT style bits (use {@link SWT#NONE}) - */ - public PageBook(Composite parent, int style, int minWidth, int minHeight) { - super(parent, style); - minimumPageSize.x=minWidth; - minimumPageSize.y=minHeight; - setLayout(new PageBookLayout()); - } - - /** - * Shows the given page. This method has no effect if the given page is not - * contained in this pagebook. - * - * @param page the page to show - */ - public void showPage(Control page) { - - if (page == currentPage) { - return; - } - if (page==null || page.getParent() != this) { - return; - } - - currentPage = page; - - // show new page - if (!page.isDisposed()) { - page.setVisible(true); - layout(true); - // if (fRequestFocusOnShowPage) - // page.setFocus(); - } - - // hide old *after* new page has been made visible in order to avoid flashing - // we have to hide all other pages, because they might be visible - // by some other means... - Control[] pages=getChildren(); - for (int i = 0; i < pages.length; i++) { - if(pages[i]!=page && !pages[i].isDisposed()) { - pages[i].setVisible(false); - } - } - } -} diff --git a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/SettingStorePrefixDecorator.java b/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/SettingStorePrefixDecorator.java deleted file mode 100644 index 32db3749a..000000000 --- a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/SettingStorePrefixDecorator.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Michael Scharf (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.tm.terminal.internal.view; - -import org.eclipse.tm.terminal.ISettingsStore; - -public class SettingStorePrefixDecorator implements ISettingsStore { - private final String fPrefix; - private final ISettingsStore fStore; - SettingStorePrefixDecorator(ISettingsStore store,String prefix) { - fPrefix=prefix; - fStore=store; - } - - public String get(String key) { - return fStore.get(fPrefix+key); - } - - public String get(String key, String defaultValue) { - return fStore.get(fPrefix+key,defaultValue); - } - - public void put(String key, String value) { - fStore.put(fPrefix+key,value); - } - -} diff --git a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/SettingsStore.java b/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/SettingsStore.java deleted file mode 100644 index c00c9adef..000000000 --- a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/SettingsStore.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Michael Scharf (Wind River) - initial API and implementation - *******************************************************************************/ -package org.eclipse.tm.terminal.internal.view; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.tm.terminal.ISettingsStore; -import org.eclipse.ui.IMemento; - -/** - * A {@link IDialogSettings} based {@link ISettingsStore}. - * - * Setting Store dased on IMemento. IMemento documentations says only alpha numeric - * values mey be used as keys. Therefore the implementation converts dots (.) into - * child elements of the memento. - * - * @author Michael Scharf - */ -class SettingsStore implements ISettingsStore { - - private static final String KEYS = "_keys_"; - final private Map fMap=new HashMap(); - public SettingsStore(IMemento memento) { - if(memento==null) - return; - // load all keys ever used from the memento - String keys=memento.getString(KEYS); - if(keys!=null) { - String[] keyNames=keys.split(","); - for (int i = 0; i < keyNames.length; i++) { - String key=keyNames[i]; - if(!KEYS.equals(key)) { - // get the dot separated elements - String[] path=key.split("\\."); - IMemento m=memento; - // iterate over all but the last segment and get the children... - for(int iPath=0; m!=null && iPath+1<path.length; iPath++) { - m=m.getChild(path[iPath]); - } - if(m!=null) { - // cache the value in the map - fMap.put(key,m.getString(path[path.length-1])); - } - } - } - } - } - - public String get(String key) { - return get(key,null); - } - public String get(String key, String defaultValue) { - String value = (String) fMap.get(key); - if ((value == null) || (value.equals(""))) //$NON-NLS-1$ - return defaultValue; - - return value; - } - - public void put(String key, String value) { - if(!key.matches("^[\\w.]+$")) - throw new IllegalArgumentException("Key '"+key+"' is not alpha numeric or '.'!"); - // null values remove the key from the map - if ((value == null) || (value.equals(""))) //$NON-NLS-1$ - fMap.remove(key); - else - fMap.put(key, value); - } - /** - * Save the state into memento. - * @param memento - */ - public void saveState(IMemento memento) { - String[] keyNames=(String[]) fMap.keySet().toArray(new String[fMap.size()]); - Arrays.sort(keyNames); - StringBuffer buffer=new StringBuffer(); - for (int i = 0; i < keyNames.length; i++) { - String key=keyNames[i]; - String[] path=key.split("\\."); - IMemento m=memento; - // iterate over all but the last segment and get the children... - for(int iPath=0; iPath+1<path.length; iPath++) { - IMemento child=m.getChild(path[iPath]); - // if the child does not exist, create it - if(child==null) - child=m.createChild(path[iPath]); - m=child; - } - // use the last element in path as key of the child memento - m.putString(path[path.length-1], (String) fMap.get(key)); - // construct the string for the keys - if(i>0) - buffer.append(","); - buffer.append(key); - } - // save the keys we have used. - memento.putString(KEYS, buffer.toString()); - } -} diff --git a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/TerminalPreferencePage.java b/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/TerminalPreferencePage.java deleted file mode 100644 index 52e5762e1..000000000 --- a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/TerminalPreferencePage.java +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2006 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 - * - * Initial Contributors: - * The following Wind River employees contributed to the Terminal component - * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, - * Helmut Haigermoser and Ted Williams. - * - * Contributors: - * Michael Scharf (Wind River) - split into core, view and connector plugins - * Martin Oberhuber (Wind River) - fixed copyright headers and beautified - *******************************************************************************/ -package org.eclipse.tm.terminal.internal.view; - -import org.eclipse.jface.preference.BooleanFieldEditor; -import org.eclipse.jface.preference.FieldEditorPreferencePage; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.preference.IntegerFieldEditor; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; - -public class TerminalPreferencePage extends FieldEditorPreferencePage implements - IWorkbenchPreferencePage { - public static final String PREF_LIMITOUTPUT = "TerminalPrefLimitOutput"; //$NON-NLS-1$ - public static final String PREF_BUFFERLINES = "TerminalPrefBufferLines"; //$NON-NLS-1$ - public static final String PREF_TIMEOUT_SERIAL = "TerminalPrefTimeoutSerial"; //$NON-NLS-1$ - public static final String PREF_TIMEOUT_NETWORK = "TerminalPrefTimeoutNetwork"; //$NON-NLS-1$ - public static final boolean DEFAULT_LIMITOUTPUT = true; - public static final int DEFAULT_BUFFERLINES = 1000; - public static final int DEFAULT_TIMEOUT_SERIAL = 5; - public static final int DEFAULT_TIMEOUT_NETWORK = 5; - - - protected TerminalBooleanFieldEditor fEditorLimitOutput; - - protected IntegerFieldEditor fEditorBufferSize; - - protected IntegerFieldEditor fEditorSerialTimeout; - - protected IntegerFieldEditor fEditorNetworkTimeout; - public TerminalPreferencePage() { - super(GRID); - } - public void onLimitOutputSelected() { - Button ctlButton; - Text ctlText; - Label ctlLabel; - boolean bEnabled; - - ctlButton = fEditorLimitOutput.getChangeControl(getFieldEditorParent()); - ctlText = fEditorBufferSize.getTextControl(getFieldEditorParent()); - ctlLabel = fEditorBufferSize.getLabelControl(getFieldEditorParent()); - bEnabled = ctlButton.getSelection(); - - ctlText.setEnabled(bEnabled); - ctlLabel.setEnabled(bEnabled); - } - protected void createFieldEditors() { - setupPage(); - } - protected void initialize() { - super.initialize(); - - onLimitOutputSelected(); - } - protected void performDefaults() { - super.performDefaults(); - - onLimitOutputSelected(); - } - public void init(IWorkbench workbench) { - // do nothing - } - protected void setupPage() { - setupData(); - setupEditors(); - setupListeners(); - } - protected void setupData() { - TerminalViewPlugin plugin; - IPreferenceStore preferenceStore; - - plugin = TerminalViewPlugin.getDefault(); - preferenceStore = plugin.getPreferenceStore(); - setPreferenceStore(preferenceStore); - } - protected void setupEditors() { - fEditorLimitOutput = new TerminalBooleanFieldEditor( - PREF_LIMITOUTPUT, ViewMessages.LIMITOUTPUT, - getFieldEditorParent()); - fEditorBufferSize = new IntegerFieldEditor(PREF_BUFFERLINES, - ViewMessages.BUFFERLINES, getFieldEditorParent()); - fEditorSerialTimeout = new IntegerFieldEditor( - PREF_TIMEOUT_SERIAL, ViewMessages.SERIALTIMEOUT, - getFieldEditorParent()); - fEditorNetworkTimeout = new IntegerFieldEditor( - PREF_TIMEOUT_NETWORK, ViewMessages.NETWORKTIMEOUT, - getFieldEditorParent()); - - fEditorBufferSize.setValidRange(0, Integer.MAX_VALUE); - fEditorSerialTimeout.setValidRange(0, Integer.MAX_VALUE); - fEditorNetworkTimeout.setValidRange(0, Integer.MAX_VALUE); - - addField(fEditorLimitOutput); - addField(fEditorBufferSize); - addField(fEditorSerialTimeout); - addField(fEditorNetworkTimeout); - } - protected void setupListeners() { - TerminalSelectionHandler selectionHandler; - Button ctlButton; - - selectionHandler = new TerminalSelectionHandler(); - ctlButton = fEditorLimitOutput.getChangeControl(getFieldEditorParent()); - ctlButton.addSelectionListener(selectionHandler); - } - public class TerminalBooleanFieldEditor extends BooleanFieldEditor { - public TerminalBooleanFieldEditor(String strName, String strLabel, - Composite ctlParent) { - super(strName, strLabel, ctlParent); - } - public Button getChangeControl(Composite parent) { - return super.getChangeControl(parent); - } - } - protected class TerminalSelectionHandler extends SelectionAdapter { - protected TerminalSelectionHandler() { - super(); - } - public void widgetSelected(SelectionEvent event) { - Object source; - Button ctlButton; - - source = event.getSource(); - ctlButton = fEditorLimitOutput - .getChangeControl(getFieldEditorParent()); - - if (source == ctlButton) { - onLimitOutputSelected(); - } - } - - } -} diff --git a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/TerminalSettingsDlg.java b/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/TerminalSettingsDlg.java deleted file mode 100644 index a79f5c03b..000000000 --- a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/TerminalSettingsDlg.java +++ /dev/null @@ -1,157 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2006 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 - * - * Initial Contributors: - * The following Wind River employees contributed to the Terminal component - * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, - * Helmut Haigermoser and Ted Williams. - * - * Contributors: - * Michael Scharf (Wind River) - split into core, view and connector plugins - * Martin Oberhuber (Wind River) - fixed copyright headers and beautified - *******************************************************************************/ -package org.eclipse.tm.terminal.internal.view; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.tm.terminal.ISettingsPage; -import org.eclipse.tm.terminal.ITerminalConnector; - -class TerminalSettingsDlg extends Dialog { - private Combo fCtlConnTypeCombo; - private final ITerminalConnector[] fConnectors; - private final ISettingsPage[] fPages; - private int fSelectedConnector; - private PageBook fPageBook; - private IDialogSettings fDialogSettings; - - public TerminalSettingsDlg(Shell shell, ITerminalConnector[] connectors, ITerminalConnector connector) { - super(shell); - fConnectors=connectors; - fPages=new ISettingsPage[fConnectors.length]; - for (int i = 0; i < fConnectors.length; i++) { - fPages[i]=fConnectors[i].makeSettingsPage(); - if(fConnectors[i]==connector) - fSelectedConnector=i; - } - } - protected void okPressed() { - if (!validateSettings()) - return; - if(fSelectedConnector>=0) { - fPages[fSelectedConnector].saveSettings(); - } - super.okPressed(); - } - protected void cancelPressed() { - fSelectedConnector=-1; - super.cancelPressed(); - } - public int open() { - setShellStyle(getShellStyle() | SWT.RESIZE); - return super.open(); - } - protected void configureShell(Shell newShell) { - super.configureShell(newShell); - - newShell.setText(ViewMessages.TERMINALSETTINGS); - } - protected Control createDialogArea(Composite parent) { - Composite ctlComposite = (Composite) super.createDialogArea(parent); - setupPanel(ctlComposite); - setupListeners(); - initFields(); - - return ctlComposite; - } - private void initFields() { - // Load controls - for (int i = 0; i < fPages.length; i++) { - String name=fPages[i].getName(); - fCtlConnTypeCombo.add(name); - if(fSelectedConnector==i) { - fCtlConnTypeCombo.select(i); - selectPage(i); - } - } - } - private boolean validateSettings() { - if(fSelectedConnector<0) - return true; - return fPages[fSelectedConnector].validateSettings(); - } - private void setupPanel(Composite wndParent) { - setupConnTypePanel(wndParent); - setupSettingsGroup(wndParent); - } - private void setupConnTypePanel(Composite wndParent) { - Group wndGroup; - GridLayout gridLayout; - GridData gridData; - - wndGroup = new Group(wndParent, SWT.NONE); - gridLayout = new GridLayout(1, true); - gridData = new GridData(GridData.FILL_HORIZONTAL); - - wndGroup.setLayout(gridLayout); - wndGroup.setLayoutData(gridData); - wndGroup.setText(ViewMessages.CONNECTIONTYPE + ":"); //$NON-NLS-1$ - - fCtlConnTypeCombo = new Combo(wndGroup, SWT.DROP_DOWN | SWT.READ_ONLY); - gridData = new GridData(GridData.FILL_HORIZONTAL); - gridData.widthHint = 200; - fCtlConnTypeCombo.setLayoutData(gridData); - } - private void setupSettingsGroup(Composite parent) { - Group group = new Group(parent, SWT.NONE); - group.setText(ViewMessages.SETTINGS + ":"); //$NON-NLS-1$ - group.setLayout(new GridLayout()); - group.setLayoutData(new GridData(GridData.FILL_BOTH)); - fPageBook=new PageBook(group,SWT.NONE,230,0); - fPageBook.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - - for (int i = 0; i < fPages.length; i++) { - fPages[i].createControl(fPageBook); - } - } - private void setupListeners() { - fCtlConnTypeCombo.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent event) { - selectPage(fCtlConnTypeCombo.getSelectionIndex()); - } - }); - } - public ITerminalConnector getConnector() { - if(fSelectedConnector>=0) - return fConnectors[fSelectedConnector]; - return null; - } - private void selectPage(int index) { - fSelectedConnector=index; - Control[] pages=fPageBook.getChildren(); - fPageBook.showPage(pages[fSelectedConnector]); - } - protected IDialogSettings getDialogBoundsSettings() { - IDialogSettings ds=TerminalViewPlugin.getDefault().getDialogSettings(); - fDialogSettings = ds.getSection(getClass().getName()); - if (fDialogSettings == null) { - fDialogSettings = ds.addNewSection(getClass().getName()); - } - return fDialogSettings; - } -} diff --git a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/TerminalView.java b/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/TerminalView.java deleted file mode 100644 index 4434dd770..000000000 --- a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/TerminalView.java +++ /dev/null @@ -1,645 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2006 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 - * - * Initial Contributors: - * The following Wind River employees contributed to the Terminal component - * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, - * Helmut Haigermoser and Ted Williams. - * - * Contributors: - * Michael Scharf (Wind River) - split into core, view and connector plugins - * Martin Oberhuber (Wind River) - fixed copyright headers and beautified - *******************************************************************************/ -package org.eclipse.tm.terminal.internal.view; - -import org.eclipse.core.runtime.Preferences; -import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.custom.StyledText; -import org.eclipse.swt.dnd.TextTransfer; -import org.eclipse.swt.events.MenuEvent; -import org.eclipse.swt.events.MenuListener; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.tm.terminal.ISettingsStore; -import org.eclipse.tm.terminal.ITerminalConnector; -import org.eclipse.tm.terminal.Logger; -import org.eclipse.tm.terminal.TerminalConnectorExtension; -import org.eclipse.tm.terminal.TerminalState; -import org.eclipse.tm.terminal.control.ITerminalListener; -import org.eclipse.tm.terminal.control.ITerminalViewControl; -import org.eclipse.tm.terminal.control.TerminalViewControlFactory; -import org.eclipse.tm.terminal.internal.actions.TerminalAction; -import org.eclipse.tm.terminal.internal.actions.TerminalActionClearAll; -import org.eclipse.tm.terminal.internal.actions.TerminalActionConnect; -import org.eclipse.tm.terminal.internal.actions.TerminalActionCopy; -import org.eclipse.tm.terminal.internal.actions.TerminalActionCut; -import org.eclipse.tm.terminal.internal.actions.TerminalActionDisconnect; -import org.eclipse.tm.terminal.internal.actions.TerminalActionNewTerminal; -import org.eclipse.tm.terminal.internal.actions.TerminalActionPaste; -import org.eclipse.tm.terminal.internal.actions.TerminalActionSelectAll; -import org.eclipse.tm.terminal.internal.actions.TerminalActionSettings; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IMemento; -import org.eclipse.ui.IViewSite; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchActionConstants; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.actions.ActionFactory; -import org.eclipse.ui.actions.RetargetAction; -import org.eclipse.ui.contexts.IContextActivation; -import org.eclipse.ui.contexts.IContextService; -import org.eclipse.ui.internal.WorkbenchWindow; -import org.eclipse.ui.part.ViewPart; - -public class TerminalView extends ViewPart implements ITerminalView, ITerminalListener { - public static final String FONT_DEFINITION = "terminal.views.view.font.definition"; //$NON-NLS-1$ - - protected ITerminalViewControl fCtlTerminal; - - protected TerminalAction fActionTerminalNewTerminal; - - protected TerminalAction fActionTerminalConnect; - - protected TerminalAction fActionTerminalDisconnect; - - protected TerminalAction fActionTerminalSettings; - - protected TerminalAction fActionEditCopy; - - protected TerminalAction fActionEditCut; - - protected TerminalAction fActionEditPaste; - - protected TerminalAction fActionEditClearAll; - - protected TerminalAction fActionEditSelectAll; - - protected TerminalMenuHandlerEdit fMenuHandlerEdit; - - protected TerminalPropertyChangeHandler fPropertyChangeHandler; - - protected boolean fMenuAboutToShow; - - private SettingsStore fStore; - - public TerminalView() { - Logger - .log("==============================================================="); //$NON-NLS-1$ - } - - private void XXXXX() { - Preferences preferences = TerminalViewPlugin.getDefault().getPluginPreferences(); - boolean bLimitOutput = preferences.getBoolean(TerminalPreferencePage.PREF_LIMITOUTPUT); - int bufferLineLimit = preferences.getInt(TerminalPreferencePage.PREF_BUFFERLINES); - - } - // TerminalTarget interface - public void setState(final TerminalState state) { - Runnable runnable=new Runnable() { - public void run() { - updateStatus(); - onTerminalStatus(); - } - }; - if(Thread.currentThread()==Display.getDefault().getThread()) - runnable.run(); - else - Display.getDefault().syncExec(runnable); - } - - - /** - * Display a new Terminal view. This method is called when the user clicks the New - * Terminal button in any Terminal view's toolbar. - */ - public void onTerminalNewTerminal() { - Logger.log("creating new Terminal instance."); //$NON-NLS-1$ - - try { - // The second argument to showView() is a unique String identifying the - // secondary view instance. If it ever matches a previously used secondary - // view identifier, then this call will not create a new Terminal view, - // which is undesireable. Therefore, we append the current time in - // milliseconds to the secondary view identifier to ensure it is always - // unique. This code runs only when the user clicks the New Terminal - // button, so there is no risk that this code will run twice in a single - // millisecond. - - getSite().getPage().showView( - "org.eclipse.tm.terminal.view.TerminalView",//$NON-NLS-1$ - "SecondaryTerminal" + System.currentTimeMillis(), //$NON-NLS-1$ - IWorkbenchPage.VIEW_ACTIVATE); - } catch (PartInitException ex) { - Logger.logException(ex); - } - } - - public void onTerminalConnect() { - if (isConnected()) - return; - if(fCtlTerminal.getTerminalConnection()==null) - setConnector(showSettingsDialog()); - fCtlTerminal.connectTerminal(); - } - - public void updateStatus() { - updateTerminalConnect(); - updateTerminalDisconnect(); - updateTerminalSettings(); - } - - public void updateTerminalConnect() { - boolean bEnabled = ((!isConnecting()) && (!fCtlTerminal.isConnected())); - - fActionTerminalConnect.setEnabled(bEnabled); - } - - private boolean isConnecting() { - return fCtlTerminal.getState()==TerminalState.CONNECTING; - } - private boolean isConnected() { - return fCtlTerminal.getState()==TerminalState.CONNECTED; - } - public void onTerminalDisconnect() { - fCtlTerminal.disconnectTerminal(); - } - - public void updateTerminalDisconnect() { - boolean bEnabled = ((isConnecting()) || (fCtlTerminal.isConnected())); - fActionTerminalDisconnect.setEnabled(bEnabled); - } - - public void onTerminalSettings() { - ITerminalConnector c=showSettingsDialog(); - if(c!=null) { - setConnector(c); - - onTerminalConnect(); - } - } - - private ITerminalConnector showSettingsDialog() { - // When the settings dialog is opened, load the Terminal settings from the - // persistent settings. - - TerminalSettingsDlg dlgTerminalSettings = new TerminalSettingsDlg(getViewSite().getShell(),fCtlTerminal.getConnectors(),fCtlTerminal.getTerminalConnection()); - - Logger.log("opening Settings dialog."); //$NON-NLS-1$ - - if (dlgTerminalSettings.open() == Window.CANCEL) { - Logger.log("Settings dialog cancelled."); //$NON-NLS-1$ - return null; - } - - Logger.log("Settings dialog OK'ed."); //$NON-NLS-1$ - - // When the settings dialog is closed, we persist the Terminal settings. - - saveSettings(dlgTerminalSettings.getConnector()); - return dlgTerminalSettings.getConnector(); - } - - private void setConnector(ITerminalConnector connector) { - fCtlTerminal.setConnector(connector); - } - - public void updateTerminalSettings() { - boolean bEnabled; - - bEnabled = ((!isConnecting()) && (!fCtlTerminal - .isConnected())); - - fActionTerminalSettings.setEnabled(bEnabled); - } - - public void setTerminalTitle(String strTitle) { - if (fCtlTerminal.isDisposed()) - return; - - if (strTitle != null) { - // When parameter 'data' is not null, it is a String containing text to - // display in the view's content description line. This is used by class - // TerminalText when it processes an ANSI OSC escape sequence that commands - // the terminal to display text in its title bar. - } else { - // When parameter 'data' is null, we construct a descriptive string to - // display in the content description line. - String strConnected = getStateDisplayName(fCtlTerminal.getState()); - String status=""; //$NON-NLS-1$ - status=fCtlTerminal.getStatusString(strConnected); - strTitle = ViewMessages.PROP_TITLE + status; - } - - setContentDescription(strTitle); - getViewSite().getActionBars().getStatusLineManager().setMessage( - strTitle); - } - public void onTerminalStatus() { - setTerminalTitle(null); - } - - private String getStateDisplayName(TerminalState state) { - if(state==TerminalState.CONNECTED) { - return ViewMessages.STATE_CONNECTED; - } else if(state==TerminalState.CONNECTING) { - return ViewMessages.STATE_CONNECTING; - } else if(state==TerminalState.OPENED) { - return ViewMessages.STATE_OPENED; - } else if(state==TerminalState.CLOSED) { - return ViewMessages.STATE_CLOSED; - } else { - throw new IllegalStateException(state.toString()); - } - } - - public void onTerminalFontChanged() { - fCtlTerminal.getCtlText().setFont(JFaceResources.getFont(FONT_DEFINITION)); - - // Tell the TerminalControl singleton that the font has changed. - - fCtlTerminal.onFontChanged(); - } - - public void onEditCopy() { - String selection=fCtlTerminal.getSelection(); - - if (!selection.equals("")) {//$NON-NLS-1$ - fCtlTerminal.copy(); - } else { - fCtlTerminal.sendKey('\u0003'); - } - } - - public void updateEditCopy() { - boolean bEnabled=true; - - if (fMenuAboutToShow) { - bEnabled = fCtlTerminal.getSelection().length()>0; - } - - fActionEditCopy.setEnabled(bEnabled); - } - - public void onEditCut() { - fCtlTerminal.sendKey('\u0018'); - } - - public void updateEditCut() { - boolean bEnabled; - - bEnabled = !fMenuAboutToShow; - fActionEditCut.setEnabled(bEnabled); - } - - public void onEditPaste() { - fCtlTerminal.paste(); - } - - public void updateEditPaste() { - String strText = (String) fCtlTerminal.getClipboard().getContents(TextTransfer.getInstance()); - - boolean bEnabled = ((strText != null) && (!strText.equals("")) && (isConnected()));//$NON-NLS-1$ - - fActionEditPaste.setEnabled(bEnabled); - } - - public void onEditClearAll() { - fCtlTerminal.clearTerminal(); - } - - public void updateEditClearAll() { - fActionEditClearAll.setEnabled(!fCtlTerminal.isEmpty()); - } - - public void onEditSelectAll() { - fCtlTerminal.selectAll(); - } - - public void updateEditSelectAll() { - fActionEditSelectAll.setEnabled(!fCtlTerminal.isEmpty()); - } - - // ViewPart interface - - public void createPartControl(Composite wndParent) { - // Bind plugin.xml key bindings to this plugin. Overrides global Control-W key - // sequence. - - setPartName(ViewMessages.PROP_TITLE); - - setupControls(wndParent); - setupActions(); - setupMenus(); - setupLocalToolBars(); - setupContextMenus(); - setupListeners(wndParent); - - onTerminalStatus(); - } - - public void dispose() { - Logger.log("entered."); //$NON-NLS-1$ - - setPartName("Terminal"); //$NON-NLS-1$ - - TerminalViewPlugin plugin; - IWorkbench workbench; - WorkbenchWindow workbenchWindow; - MenuManager menuMgr; - Menu menu; - - JFaceResources.getFontRegistry().removeListener(fPropertyChangeHandler); - plugin = TerminalViewPlugin.getDefault(); - workbench = plugin.getWorkbench(); - workbenchWindow = (WorkbenchWindow) workbench - .getActiveWorkbenchWindow(); - menuMgr = workbenchWindow.getMenuManager(); - menuMgr = (MenuManager) menuMgr - .findMenuUsingPath(IWorkbenchActionConstants.M_EDIT); - menu = menuMgr.getMenu(); - - menuMgr.removeMenuListener(fMenuHandlerEdit); - - if (menu != null) - menu.removeMenuListener(fMenuHandlerEdit); - - fCtlTerminal.disposeTerminal(); - } - - /** - * Passing the focus request to the viewer's control. - */ - public void setFocus() { - fCtlTerminal.setFocus(); - } - - /** - * This method creates the top-level control for the Terminal view. - */ - protected void setupControls(Composite wndParent) { - ITerminalConnector[] connectors=TerminalConnectorExtension.getTerminalConnectors(); - fCtlTerminal = TerminalViewControlFactory.makeControl(this, wndParent, connectors); - String connectionType=fStore.get("ConnectionType"); //$NON-NLS-1$ - for (int i = 0; i < connectors.length; i++) { - connectors[i].load(getStore(connectors[i])); - if(connectors[i].getId().equals(connectionType)) - fCtlTerminal.setConnector(connectors[i]); - } - } - private void saveSettings(ITerminalConnector connector) { - ITerminalConnector[] connectors=fCtlTerminal.getConnectors(); - for (int i = 0; i < connectors.length; i++) { - connectors[i].save(getStore(connectors[i])); - } - if(connector!=null) { - fStore.put("ConnectionType",connector.getId()); //$NON-NLS-1$ - } - } - - public void init(IViewSite site, IMemento memento) throws PartInitException { - super.init(site, memento); - fStore=new SettingsStore(memento); - } - - public void saveState(IMemento memento) { - super.saveState(memento); - fStore.saveState(memento); - } - private ISettingsStore getStore(ITerminalConnector connector) { - return new SettingStorePrefixDecorator(fStore,connector.getClass().getName()+"."); //$NON-NLS-1$ - } - - protected void setupActions() { - fActionTerminalNewTerminal = new TerminalActionNewTerminal(this); - fActionTerminalConnect = new TerminalActionConnect(this); - fActionTerminalDisconnect = new TerminalActionDisconnect(this); - fActionTerminalSettings = new TerminalActionSettings(this); - fActionEditCopy = new TerminalActionCopy(this); - fActionEditCut = new TerminalActionCut(this); - fActionEditPaste = new TerminalActionPaste(this); - fActionEditClearAll = new TerminalActionClearAll(this); - fActionEditSelectAll = new TerminalActionSelectAll(this); - - IActionBars actionBars = getViewSite().getActionBars(); - actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), fActionEditCopy); - - actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), fActionEditCut); - - actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), fActionEditPaste); - - actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), fActionEditSelectAll); - } - - protected void setupMenus() { - TerminalViewPlugin plugin; - IWorkbench workbench; - WorkbenchWindow workbenchWindow; - MenuManager menuMgr; - Menu menu; - - fMenuHandlerEdit = new TerminalMenuHandlerEdit(); - plugin = TerminalViewPlugin.getDefault(); - workbench = plugin.getWorkbench(); - workbenchWindow = (WorkbenchWindow) workbench - .getActiveWorkbenchWindow(); - menuMgr = workbenchWindow.getMenuManager(); - menuMgr = (MenuManager) menuMgr - .findMenuUsingPath(IWorkbenchActionConstants.M_EDIT); - menu = menuMgr.getMenu(); - - menuMgr.addMenuListener(fMenuHandlerEdit); - menu.addMenuListener(fMenuHandlerEdit); - } - - protected void setupLocalToolBars() { - IToolBarManager toolBarMgr = getViewSite().getActionBars().getToolBarManager(); - - toolBarMgr.add(fActionTerminalNewTerminal); - toolBarMgr.add(fActionTerminalConnect); - toolBarMgr.add(fActionTerminalDisconnect); - toolBarMgr.add(fActionTerminalSettings); - } - - protected void setupContextMenus() { - StyledText ctlText; - MenuManager menuMgr; - Menu menu; - TerminalContextMenuHandler contextMenuHandler; - - ctlText = fCtlTerminal.getCtlText(); - menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$ - menu = menuMgr.createContextMenu(ctlText); - contextMenuHandler = new TerminalContextMenuHandler(); - - ctlText.setMenu(menu); - menuMgr.setRemoveAllWhenShown(true); - menuMgr.addMenuListener(contextMenuHandler); - menu.addMenuListener(contextMenuHandler); - } - - protected void loadContextMenus(IMenuManager menuMgr) { - menuMgr.add(fActionEditCopy); - menuMgr.add(fActionEditPaste); - menuMgr.add(new Separator()); - menuMgr.add(fActionEditClearAll); - menuMgr.add(fActionEditSelectAll); - - // Other plug-ins can contribute there actions here - menuMgr.add(new Separator("Additions")); //$NON-NLS-1$ - } - - protected void setupListeners(Composite wndParent) { - fPropertyChangeHandler = new TerminalPropertyChangeHandler(); - JFaceResources.getFontRegistry().addListener(fPropertyChangeHandler); - } - - // Inner classes - - protected class TerminalMenuHandlerEdit implements MenuListener, IMenuListener { - protected String fActionDefinitionIdCopy; - - protected String fActionDefinitionIdPaste; - - protected String fActionDefinitionIdSelectAll; - - protected int fAcceleratorCopy; - - protected int fAcceleratorPaste; - - protected int fAcceleratorSelectAll; - - protected TerminalMenuHandlerEdit() { - super(); - - fActionDefinitionIdCopy = ""; //$NON-NLS-1$ - fActionDefinitionIdPaste = ""; //$NON-NLS-1$ - fActionDefinitionIdSelectAll = ""; //$NON-NLS-1$ - - fAcceleratorCopy = 0; - fAcceleratorPaste = 0; - fAcceleratorSelectAll = 0; - } - public void menuAboutToShow(IMenuManager menuMgr) { - - fMenuAboutToShow = true; - updateEditCopy(); - updateEditCut(); - updateEditPaste(); - updateEditSelectAll(); - - ActionContributionItem item = (ActionContributionItem) menuMgr.find(ActionFactory.COPY.getId()); - RetargetAction action = (RetargetAction) item.getAction(); - fActionDefinitionIdCopy = action.getActionDefinitionId(); - fAcceleratorCopy = action.getAccelerator(); - action.setActionDefinitionId(null); - action.enableAccelerator(false); - item.update(); - - item = (ActionContributionItem) menuMgr.find(ActionFactory.PASTE.getId()); - action = (RetargetAction) item.getAction(); - fActionDefinitionIdPaste = action.getActionDefinitionId(); - fAcceleratorPaste = action.getAccelerator(); - action.setActionDefinitionId(null); - action.enableAccelerator(false); - item.update(); - - item = (ActionContributionItem) menuMgr.find(ActionFactory.SELECT_ALL.getId()); - action = (RetargetAction) item.getAction(); - fActionDefinitionIdSelectAll = action.getActionDefinitionId(); - fAcceleratorSelectAll = action.getAccelerator(); - action.setActionDefinitionId(null); - action.enableAccelerator(false); - item.update(); - } - public void menuShown(MenuEvent event) { - // do nothing - } - public void menuHidden(MenuEvent event) { - TerminalViewPlugin plugin; - IWorkbench workbench; - WorkbenchWindow workbenchWindow; - MenuManager menuMgr; - ActionContributionItem item; - RetargetAction action; - - fMenuAboutToShow = false; - updateEditCopy(); - updateEditCut(); - - plugin = TerminalViewPlugin.getDefault(); - workbench = plugin.getWorkbench(); - workbenchWindow = (WorkbenchWindow) workbench - .getActiveWorkbenchWindow(); - menuMgr = workbenchWindow.getMenuManager(); - menuMgr = (MenuManager) menuMgr - .findMenuUsingPath(IWorkbenchActionConstants.M_EDIT); - - item = (ActionContributionItem) menuMgr.find(ActionFactory.COPY - .getId()); - action = (RetargetAction) item.getAction(); - action.setActionDefinitionId(fActionDefinitionIdCopy); - action.setAccelerator(fAcceleratorCopy); - action.enableAccelerator(true); - item.update(); - - item = (ActionContributionItem) menuMgr.find(ActionFactory.PASTE - .getId()); - action = (RetargetAction) item.getAction(); - action.setActionDefinitionId(fActionDefinitionIdPaste); - action.setAccelerator(fAcceleratorPaste); - action.enableAccelerator(true); - item.update(); - - item = (ActionContributionItem) menuMgr - .find(ActionFactory.SELECT_ALL.getId()); - action = (RetargetAction) item.getAction(); - action.setActionDefinitionId(fActionDefinitionIdSelectAll); - action.setAccelerator(fAcceleratorSelectAll); - action.enableAccelerator(true); - item.update(); - } - } - - protected class TerminalContextMenuHandler implements MenuListener, IMenuListener { - public void menuHidden(MenuEvent event) { - fMenuAboutToShow = false; - updateEditCopy(); - } - - public void menuShown(MenuEvent e) { - // - } - public void menuAboutToShow(IMenuManager menuMgr) { - fMenuAboutToShow = true; - updateEditCopy(); - updateEditCut(); - updateEditPaste(); - updateEditClearAll(); - - loadContextMenus(menuMgr); - } - } - - protected class TerminalPropertyChangeHandler implements IPropertyChangeListener { - public void propertyChange(PropertyChangeEvent event) { - if (event.getProperty().equals(FONT_DEFINITION)) { - onTerminalFontChanged(); - } - } - } -} diff --git a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/TerminalViewPlugin.java b/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/TerminalViewPlugin.java deleted file mode 100644 index 3ba5f8ae9..000000000 --- a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/TerminalViewPlugin.java +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2006 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 - * - * Initial Contributors: - * The following Wind River employees contributed to the Terminal component - * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, - * Helmut Haigermoser and Ted Williams. - * - * Contributors: - * Michael Scharf (Wind River) - split into core, view and connector plugins - * Martin Oberhuber (Wind River) - fixed copyright headers and beautified - *******************************************************************************/ -package org.eclipse.tm.terminal.internal.view; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.HashMap; -import java.util.Iterator; - -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.tm.terminal.Logger; -import org.eclipse.ui.plugin.AbstractUIPlugin; - -public class TerminalViewPlugin extends AbstractUIPlugin { - protected static TerminalViewPlugin fDefault; - public static final String PLUGIN_HOME = "org.eclipse.tm.terminal"; //$NON-NLS-1$ - public static final String HELP_VIEW = PLUGIN_HOME + ".terminal_view"; //$NON-NLS-1$ - - /** - * The constructor. - */ - public TerminalViewPlugin() { - fDefault = this; - } - protected void initializeImageRegistry(ImageRegistry imageRegistry) { - HashMap map; - - map = new HashMap(); - - try { - // Local toolbars - map.put(ImageConsts.IMAGE_NEW_TERMINAL, "newterminal.gif"); //$NON-NLS-1$ - map.put(ImageConsts.IMAGE_CLCL_CONNECT, "connect_co.gif"); //$NON-NLS-1$ - map.put(ImageConsts.IMAGE_CLCL_DISCONNECT, "disconnect_co.gif"); //$NON-NLS-1$ - map.put(ImageConsts.IMAGE_CLCL_SETTINGS, "properties_tsk.gif"); //$NON-NLS-1$ - - loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_LOCALTOOL, map); - - map.clear(); - - // Enabled local toolbars - map.put(ImageConsts.IMAGE_NEW_TERMINAL, "newterminal.gif"); //$NON-NLS-1$ - map.put(ImageConsts.IMAGE_ELCL_CONNECT, "connect_co.gif"); //$NON-NLS-1$ - map.put(ImageConsts.IMAGE_ELCL_DISCONNECT, "disconnect_co.gif"); //$NON-NLS-1$ - map.put(ImageConsts.IMAGE_ELCL_SETTINGS, "properties_tsk.gif"); //$NON-NLS-1$ - - loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_ELCL, map); - - map.clear(); - - // Disabled local toolbars - map.put(ImageConsts.IMAGE_NEW_TERMINAL, "newterminal.gif"); //$NON-NLS-1$ - map.put(ImageConsts.IMAGE_DLCL_CONNECT, "connect_co.gif"); //$NON-NLS-1$ - map.put(ImageConsts.IMAGE_DLCL_DISCONNECT, "disconnect_co.gif"); //$NON-NLS-1$ - map.put(ImageConsts.IMAGE_DLCL_SETTINGS, "properties_tsk.gif"); //$NON-NLS-1$ - - loadImageRegistry(imageRegistry, ImageConsts.IMAGE_DIR_DLCL, map); - - map.clear(); - } catch (MalformedURLException malformedURLException) { - malformedURLException.printStackTrace(); - } - } - protected void initializeDefaultPreferences(IPreferenceStore store) { - store.setDefault(TerminalPreferencePage.PREF_LIMITOUTPUT, - TerminalPreferencePage.DEFAULT_LIMITOUTPUT); - store.setDefault(TerminalPreferencePage.PREF_BUFFERLINES, - TerminalPreferencePage.DEFAULT_BUFFERLINES); - store.setDefault(TerminalPreferencePage.PREF_TIMEOUT_SERIAL, - TerminalPreferencePage.DEFAULT_TIMEOUT_SERIAL); - store.setDefault(TerminalPreferencePage.PREF_TIMEOUT_NETWORK, - TerminalPreferencePage.DEFAULT_TIMEOUT_NETWORK); - } - /** - * Returns the shared instance. - */ - public static TerminalViewPlugin getDefault() { - return fDefault; - } - - public static boolean isLogInfoEnabled() { - return isOptionEnabled(Logger.TRACE_DEBUG_LOG_INFO); - } - public static boolean isLogErrorEnabled() { - return isOptionEnabled(Logger.TRACE_DEBUG_LOG_ERROR); - } - public static boolean isLogEnabled() { - return isOptionEnabled(Logger.TRACE_DEBUG_LOG); - } - - public static boolean isOptionEnabled(String strOption) { - String strEnabled; - Boolean boolEnabled; - boolean bEnabled; - - strEnabled = Platform.getDebugOption(strOption); - if (strEnabled == null) - return false; - - boolEnabled = new Boolean(strEnabled); - bEnabled = boolEnabled.booleanValue(); - - return bEnabled; - } - protected void loadImageRegistry(ImageRegistry imageRegistry, - String strDir, HashMap map) throws MalformedURLException { - URL url; - ImageDescriptor imageDescriptor; - Iterator keys; - String strKey; - String strFile; - - keys = map.keySet().iterator(); - - while (keys.hasNext()) { - strKey = (String) keys.next(); - strFile = (String) map.get(strKey); - - if (strFile != null) { - url = TerminalViewPlugin.getDefault().getBundle().getEntry( - ImageConsts.IMAGE_DIR_ROOT + strDir + strFile); - imageDescriptor = ImageDescriptor.createFromURL(url); - imageRegistry.put(strKey, imageDescriptor); - } - } - } -} diff --git a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/ViewMessages.java b/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/ViewMessages.java deleted file mode 100644 index 3bf151524..000000000 --- a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/ViewMessages.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2006 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 - * - * Initial Contributors: - * The following Wind River employees contributed to the Terminal component - * that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, - * Helmut Haigermoser and Ted Williams. - * - * Contributors: - * Michael Scharf (Wind River) - split into core, view and connector plugins - * Martin Oberhuber (Wind River) - fixed copyright headers and beautified - *******************************************************************************/ -package org.eclipse.tm.terminal.internal.view; - -import org.eclipse.osgi.util.NLS; - -public class ViewMessages extends NLS { - static { - NLS.initializeMessages(ViewMessages.class.getName(), ViewMessages.class); - } - public static String PROP_TITLE; - public static String SETTINGS; - - public static String TERMINALSETTINGS; - public static String CONNECTIONTYPE; - - public static String LIMITOUTPUT; - public static String BUFFERLINES; - public static String SERIALTIMEOUT; - public static String NETWORKTIMEOUT; - - public static String STATE_CONNECTED; - public static String STATE_CONNECTING; - public static String STATE_OPENED; - public static String STATE_CLOSED; - -} diff --git a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/ViewMessages.properties b/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/ViewMessages.properties deleted file mode 100644 index 72901a74a..000000000 --- a/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/terminal/internal/view/ViewMessages.properties +++ /dev/null @@ -1,31 +0,0 @@ -############################################################################### -# Copyright (c) 2003, 2006 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 -# -# Initial Contributors: -# The following Wind River employees contributed to the Terminal component -# that contains this file: Chris Thew, Fran Litterio, Stephen Lamb, -# Helmut Haigermoser and Ted Williams. -# -# Contributors: -# Michael Scharf (Wind River) - split into core, view and connector plugins -# Martin Oberhuber (Wind River) - fixed copyright headers and beautified -############################################################################### -PROP_TITLE = Terminal -SETTINGS = Settings - -TERMINALSETTINGS = Terminal Settings -CONNECTIONTYPE = Connection Type - -LIMITOUTPUT = Limit terminal output -BUFFERLINES = Terminal buffer lines: -SERIALTIMEOUT = Serial timeout (seconds): -NETWORKTIMEOUT = Network timeout (seconds): - -STATE_CONNECTED = CONNECTED -STATE_CONNECTING = CONNECTING... -STATE_OPENED = OPENED -STATE_CLOSED = CLOSED |