November 30, 2017
++ The Eclipse Foundation makes available all content in this plug-in + ("Content"). Unless otherwise indicated below, the Content + is provided to you under the terms and conditions of the Eclipse + Public License Version 2.0 ("EPL"). A copy of the EPL is + available at https://www.eclipse.org/legal/epl-2.0. + For purposes of the EPL, "Program" will mean the Content. +
+ ++ If you did not receive this Content directly from the Eclipse + Foundation, the Content is being redistributed by another party + ("Redistributor") and different terms and conditions may + apply to your use of any object code in the Content. Check the + Redistributor's license that was provided with the Content. If no such + license exists, contact the Redistributor. Unless otherwise indicated + below, the terms and conditions of the EPL still apply to any source + code in the Content and such source code may be obtained at https://www.eclipse.org. +
+ + + + \ No newline at end of file diff --git a/terminal/plugins/org.eclipse.tm.terminal.connector.local/build.properties b/terminal/plugins/org.eclipse.tm.terminal.connector.local/build.properties new file mode 100644 index 00000000000..57cf32c46f8 --- /dev/null +++ b/terminal/plugins/org.eclipse.tm.terminal.connector.local/build.properties @@ -0,0 +1,20 @@ +############################################################################### +# Copyright (c) 2012, 2018 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 2.0 which accompanies this distribution, and is +# available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# Wind River Systems - initial API and implementation +############################################################################### +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + plugin.properties,\ + about.html,\ + icons/ +src.includes = about.html diff --git a/terminal/plugins/org.eclipse.tm.terminal.connector.local/icons/eview16/terminal_view.gif b/terminal/plugins/org.eclipse.tm.terminal.connector.local/icons/eview16/terminal_view.gif new file mode 100644 index 00000000000..bbb6a9e153e Binary files /dev/null and b/terminal/plugins/org.eclipse.tm.terminal.connector.local/icons/eview16/terminal_view.gif differ diff --git a/terminal/plugins/org.eclipse.tm.terminal.connector.local/plugin.properties b/terminal/plugins/org.eclipse.tm.terminal.connector.local/plugin.properties new file mode 100644 index 00000000000..b45a1f68957 --- /dev/null +++ b/terminal/plugins/org.eclipse.tm.terminal.connector.local/plugin.properties @@ -0,0 +1,27 @@ +################################################################################## +# Copyright (c) 2011, 2018 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 2.0 which accompanies this distribution, and is +# available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# Wind River Systems - initial API and implementation +################################################################################## + +pluginName = Terminal Local Connector +providerName = Eclipse + +# ----- Commands and Menu contributions ----- +LocalLauncherDelegate.label=Local Terminal + +command.launch.name=Open Local Terminal on Selection + +menu.showIn.localterminal.label = Terminal + +TerminalConnector.local=Local + +# ----- Preference Pages ----- + +preference.page.name=Local Terminal diff --git a/terminal/plugins/org.eclipse.tm.terminal.connector.local/plugin.xml b/terminal/plugins/org.eclipse.tm.terminal.connector.local/plugin.xml new file mode 100644 index 00000000000..a6c9f688610 --- /dev/null +++ b/terminal/plugins/org.eclipse.tm.terminal.connector.local/plugin.xml @@ -0,0 +1,200 @@ + + + + +Image object instance.
+ *
+ * @param key The key the image is registered with.
+ * @return The Image object instance or null.
+ */
+ public static Image getImage(String key) {
+ return getDefault().getImageRegistry().get(key);
+ }
+
+ /**
+ * Loads the image registered under the specified key from the image
+ * registry and returns the ImageDescriptor object instance.
+ *
+ * @param key The key the image is registered with.
+ * @return The ImageDescriptor object instance or null.
+ */
+ public static ImageDescriptor getImageDescriptor(String key) {
+ return getDefault().getImageRegistry().getDescriptor(key);
+ }
+}
diff --git a/terminal/plugins/org.eclipse.tm.terminal.connector.local/src/org/eclipse/tm/terminal/connector/local/controls/LocalWizardConfigurationPanel.java b/terminal/plugins/org.eclipse.tm.terminal.connector.local/src/org/eclipse/tm/terminal/connector/local/controls/LocalWizardConfigurationPanel.java
new file mode 100644
index 00000000000..fd7d49911aa
--- /dev/null
+++ b/terminal/plugins/org.eclipse.tm.terminal.connector.local/src/org/eclipse/tm/terminal/connector/local/controls/LocalWizardConfigurationPanel.java
@@ -0,0 +1,187 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2018 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 2.0 which accompanies this distribution, and is
+ * available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.terminal.connector.local.controls;
+
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.fieldassist.ControlDecoration;
+import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.tm.terminal.view.core.interfaces.constants.ITerminalsConnectorConstants;
+import org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanelContainer;
+import org.eclipse.tm.terminal.view.ui.panels.AbstractExtendedConfigurationPanel;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.WorkbenchEncoding;
+import org.osgi.framework.Bundle;
+
+/**
+ * Serial wizard configuration panel implementation.
+ */
+public class LocalWizardConfigurationPanel extends AbstractExtendedConfigurationPanel {
+
+ private Object resource;
+
+ /**
+ * Constructor.
+ *
+ * @param container The configuration panel container or null.
+ */
+ public LocalWizardConfigurationPanel(IConfigurationPanelContainer container) {
+ super(container);
+ }
+
+ @Override
+ public void setupPanel(Composite parent) {
+ Composite panel = new Composite(parent, SWT.NONE);
+ panel.setLayout(new GridLayout());
+ panel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ // Create the encoding selection combo
+ createEncodingUI(panel, false);
+
+ // Set the default encoding:
+ // Default UTF-8 on Mac or Windows for Local, Preferences:Platform encoding otherwise
+ if (Platform.OS_MACOSX.equals(Platform.getOS()) || Platform.OS_WIN32.equals(Platform.getOS())) {
+ setEncoding("UTF-8"); //$NON-NLS-1$
+ } else {
+ String encoding = WorkbenchEncoding.getWorkbenchDefaultEncoding();
+ if (encoding != null && !"".equals(encoding)) //$NON-NLS-1$
+ setEncoding(encoding);
+ }
+
+ // Fill the rest of the panel with a label to be able to
+ // set a height and width hint for the dialog
+ Label label = new Label(panel, SWT.HORIZONTAL);
+ GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ layoutData.widthHint = 300;
+ layoutData.heightHint = 80;
+ label.setLayoutData(layoutData);
+
+ Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
+ if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) {
+ resource = getSelectionResource();
+ }
+
+ setControl(panel);
+ }
+
+ @Override
+ protected void decorateEncoding(ControlDecoration encodingComboDecorator, String encoding) {
+ if ((Platform.OS_MACOSX.equals(Platform.getOS()) || Platform.OS_WIN32.equals(Platform.getOS()))
+ && !"UTF-8".equals(encoding)) { //$NON-NLS-1$
+ Image decorationImage = FieldDecorationRegistry.getDefault()
+ .getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage();
+ encodingComboDecorator.setImage(decorationImage);
+ encodingComboDecorator.setDescriptionText(Messages.LocalWizardConfigurationPanel_encoding_does_not_match);
+ encodingComboDecorator.show();
+ } else {
+ super.decorateEncoding(encodingComboDecorator, encoding);
+ }
+ }
+
+ @Override
+ public void setupData(Mapnull.
+ */
+ private org.eclipse.core.resources.IResource getSelectionResource() {
+ ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
+ ISelection selection = selectionService != null ? selectionService.getSelection() : StructuredSelection.EMPTY;
+
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ Object element = ((IStructuredSelection) selection).getFirstElement();
+ if (element instanceof org.eclipse.core.resources.IResource) {
+ return ((org.eclipse.core.resources.IResource) element);
+ }
+ if (element instanceof IAdaptable) {
+ return ((IAdaptable) element).getAdapter(org.eclipse.core.resources.IResource.class);
+ }
+ }
+ return null;
+ }
+}
diff --git a/terminal/plugins/org.eclipse.tm.terminal.connector.local/src/org/eclipse/tm/terminal/connector/local/controls/Messages.java b/terminal/plugins/org.eclipse.tm.terminal.connector.local/src/org/eclipse/tm/terminal/connector/local/controls/Messages.java
new file mode 100644
index 00000000000..e579af85dd0
--- /dev/null
+++ b/terminal/plugins/org.eclipse.tm.terminal.connector.local/src/org/eclipse/tm/terminal/connector/local/controls/Messages.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2021 Kichwa Coders Canada Inc. and others.
+ *
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License 2.0 which accompanies this distribution, and is
+ * available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+package org.eclipse.tm.terminal.connector.local.controls;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @noreference This class is not intended to be referenced by clients.
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.tm.terminal.connector.local.controls.Messages"; //$NON-NLS-1$
+ public static String LocalWizardConfigurationPanel_encoding_does_not_match;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/terminal/plugins/org.eclipse.tm.terminal.connector.local/src/org/eclipse/tm/terminal/connector/local/controls/Messages.properties b/terminal/plugins/org.eclipse.tm.terminal.connector.local/src/org/eclipse/tm/terminal/connector/local/controls/Messages.properties
new file mode 100644
index 00000000000..3b02208cad2
--- /dev/null
+++ b/terminal/plugins/org.eclipse.tm.terminal.connector.local/src/org/eclipse/tm/terminal/connector/local/controls/Messages.properties
@@ -0,0 +1,10 @@
+###############################################################################
+# Copyright (c) 2021 Kichwa Coders Canada Inc. and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+###############################################################################
+LocalWizardConfigurationPanel_encoding_does_not_match=The selected encoding does not match the terminal being connected to. Recommended encoding is UTF-8.
diff --git a/terminal/plugins/org.eclipse.tm.terminal.connector.local/src/org/eclipse/tm/terminal/connector/local/launcher/LocalLauncherDelegate.java b/terminal/plugins/org.eclipse.tm.terminal.connector.local/src/org/eclipse/tm/terminal/connector/local/launcher/LocalLauncherDelegate.java
new file mode 100644
index 00000000000..6a102666d10
--- /dev/null
+++ b/terminal/plugins/org.eclipse.tm.terminal.connector.local/src/org/eclipse/tm/terminal/connector/local/launcher/LocalLauncherDelegate.java
@@ -0,0 +1,426 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2018 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 2.0 which accompanies this distribution, and is
+ * available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ * Dirk Fauth
+ * The default implementation constructs a title like "Serial <port> (Start time) ".
+ *
+ * @return The terminal title string or null.
+ */
+ private String getTerminalTitle(Map