diff --git a/features/org.eclipse.tcf.te.terminals.feature/.project b/features/org.eclipse.tcf.te.terminals.feature/.project new file mode 100644 index 00000000000..9c5ef5a018f --- /dev/null +++ b/features/org.eclipse.tcf.te.terminals.feature/.project @@ -0,0 +1,28 @@ + + + org.eclipse.tcf.te.terminals.feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + + + 1311579318584 + + 10 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-target + + + + diff --git a/features/org.eclipse.tcf.te.terminals.feature/build.properties b/features/org.eclipse.tcf.te.terminals.feature/build.properties new file mode 100644 index 00000000000..c8eb6010921 --- /dev/null +++ b/features/org.eclipse.tcf.te.terminals.feature/build.properties @@ -0,0 +1,13 @@ +############################################################################### +# Copyright (c) 2012, 2014 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +############################################################################### +bin.includes = feature.xml,\ + feature.properties,\ + p2.inf +src.includes = feature.properties diff --git a/features/org.eclipse.tcf.te.terminals.feature/feature.properties b/features/org.eclipse.tcf.te.terminals.feature/feature.properties new file mode 100644 index 00000000000..39214dfd3e0 --- /dev/null +++ b/features/org.eclipse.tcf.te.terminals.feature/feature.properties @@ -0,0 +1,38 @@ +################################################################################## +# Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +################################################################################## +# feature.properties +# contains externalized strings for feature.xml +# "%foo" in feature.xml corresponds to the key "foo" in this file +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# This file should be translated. + +# "featureName" property - name of the feature +featureName=Terminals View + +# "providerName" property - name of the company that provides the feature +providerName=Eclipse.org - Target Explorer + +# "updateSiteName" property - label for the update site +updateSiteName=Eclipse Update Site + +# "description" property - description of the feature +description=An integrated Eclipse View for the local command prompt (console) or \ + remote hosts (SSH, Telnet, Serial, TCF). Works on Windows, Linux, Mac and Solaris. \ + Requires Eclipse 3.8.2 or newer and a Java 7 or newer JRE. + +# "copyright" property - text of the "Feature Update Copyright" +copyright=\ +Copyright (c) 2011, 2015 Wind River Systems, Inc. and others.\n\ +All rights reserved. This program and the accompanying materials\n\ +are made available under the terms of the Eclipse Public License v1.0\n\ +which accompanies this distribution, and is available at\n\ +http://www.eclipse.org/legal/epl-v10.html + +################ end of copyright property #################################### diff --git a/features/org.eclipse.tcf.te.terminals.feature/feature.xml b/features/org.eclipse.tcf.te.terminals.feature/feature.xml new file mode 100644 index 00000000000..a1c2dccdcf0 --- /dev/null +++ b/features/org.eclipse.tcf.te.terminals.feature/feature.xml @@ -0,0 +1,91 @@ + + + + + %description + + + + %copyright + + + + %license + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/features/org.eclipse.tcf.te.terminals.feature/p2.inf b/features/org.eclipse.tcf.te.terminals.feature/p2.inf new file mode 100644 index 00000000000..86a0e388bbc --- /dev/null +++ b/features/org.eclipse.tcf.te.terminals.feature/p2.inf @@ -0,0 +1,22 @@ +############################################################################### +# Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +############################################################################### + +# Make the org.eclipse.cdt.native feature dependency "optional" since it didn't +# exist in CDT 8.3 and we can also work on top of CDT 8.3. + +# The real dependencies are all properly managed via p2.inf in the +# org.eclipse.tcf.te.ui.terminals.process/META-INF/p2.inf file. +# The only benefit of requesting the feature here is that it allow pulling in +# additional fragments that we are not aware of in the bundle's p2.inf. + +requires.0.namespace = org.eclipse.equinox.p2.iu +requires.0.name = org.eclipse.cdt.native.feature.group +requires.0.greedy = true +requires.0.optional = true diff --git a/features/org.eclipse.tcf.te.terminals.feature/pom.xml b/features/org.eclipse.tcf.te.terminals.feature/pom.xml new file mode 100644 index 00000000000..b00a96bf5ae --- /dev/null +++ b/features/org.eclipse.tcf.te.terminals.feature/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + + + org.eclipse.tcf + org.eclipse.tcf.maven-build + 1.3.0-SNAPSHOT + ../../../admin/pom-build.xml + + + 1.3.0.qualifier + org.eclipse.tcf.te.terminals.feature + eclipse-feature + + + true + + diff --git a/features/org.eclipse.tcf.te.terminals.rse.feature/.project b/features/org.eclipse.tcf.te.terminals.rse.feature/.project new file mode 100644 index 00000000000..70a2da45c60 --- /dev/null +++ b/features/org.eclipse.tcf.te.terminals.rse.feature/.project @@ -0,0 +1,28 @@ + + + org.eclipse.tcf.te.terminals.rse.feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + + + 1311579318584 + + 10 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-target + + + + diff --git a/features/org.eclipse.tcf.te.terminals.rse.feature/build.properties b/features/org.eclipse.tcf.te.terminals.rse.feature/build.properties new file mode 100644 index 00000000000..d9e56c50b07 --- /dev/null +++ b/features/org.eclipse.tcf.te.terminals.rse.feature/build.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2012, 2014 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +############################################################################### +bin.includes = feature.xml,\ + feature.properties +src.includes = feature.properties diff --git a/features/org.eclipse.tcf.te.terminals.rse.feature/feature.properties b/features/org.eclipse.tcf.te.terminals.rse.feature/feature.properties new file mode 100644 index 00000000000..87c3fe99805 --- /dev/null +++ b/features/org.eclipse.tcf.te.terminals.rse.feature/feature.properties @@ -0,0 +1,37 @@ +################################################################################## +# Copyright (c) 2014, 2015 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +################################################################################## +# feature.properties +# contains externalized strings for feature.xml +# "%foo" in feature.xml corresponds to the key "foo" in this file +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# This file should be translated. + +# "featureName" property - name of the feature +featureName=Remote System Explorer Terminals View add-in + +# "providerName" property - name of the company that provides the feature +providerName=Eclipse.org - Target Explorer + +# "updateSiteName" property - label for the update site +updateSiteName=Eclipse Update Site + +# "description" property - description of the feature +description=Integrates the Terminals view into the Remote System Explorer. \ + Works on Windows, Linux, Mac and Solaris. Requires Eclipse 3.8.2 or newer and a Java 7 or newer JRE. + +# "copyright" property - text of the "Feature Update Copyright" +copyright=\ +Copyright (c) 2014, 2015 Wind River Systems, Inc. and others.\n\ +All rights reserved. This program and the accompanying materials\n\ +are made available under the terms of the Eclipse Public License v1.0\n\ +which accompanies this distribution, and is available at\n\ +http://www.eclipse.org/legal/epl-v10.html + +################ end of copyright property #################################### diff --git a/features/org.eclipse.tcf.te.terminals.rse.feature/feature.xml b/features/org.eclipse.tcf.te.terminals.rse.feature/feature.xml new file mode 100644 index 00000000000..43c91f160c1 --- /dev/null +++ b/features/org.eclipse.tcf.te.terminals.rse.feature/feature.xml @@ -0,0 +1,47 @@ + + + + + %description + + + + %copyright + + + + %license + + + + + + + + + + + + + + + + + + + + + + diff --git a/features/org.eclipse.tcf.te.terminals.rse.feature/pom.xml b/features/org.eclipse.tcf.te.terminals.rse.feature/pom.xml new file mode 100644 index 00000000000..00e31fdcebc --- /dev/null +++ b/features/org.eclipse.tcf.te.terminals.rse.feature/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + + + org.eclipse.tcf + org.eclipse.tcf.maven-build + 1.3.0-SNAPSHOT + ../../../admin/pom-build.xml + + + 1.3.0.qualifier + org.eclipse.tcf.te.terminals.rse.feature + eclipse-feature + + + true + + diff --git a/features/org.eclipse.tcf.te.terminals.rse.sdk.feature/.project b/features/org.eclipse.tcf.te.terminals.rse.sdk.feature/.project new file mode 100644 index 00000000000..a750dc9c205 --- /dev/null +++ b/features/org.eclipse.tcf.te.terminals.rse.sdk.feature/.project @@ -0,0 +1,33 @@ + + + org.eclipse.tcf.te.terminals.rse.sdk.feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + org.eclipse.pde.ds.core.builder + + + + + + org.eclipse.pde.FeatureNature + + + + 1311579318584 + + 10 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-target + + + + diff --git a/features/org.eclipse.tcf.te.terminals.rse.sdk.feature/build.properties b/features/org.eclipse.tcf.te.terminals.rse.sdk.feature/build.properties new file mode 100644 index 00000000000..d9e56c50b07 --- /dev/null +++ b/features/org.eclipse.tcf.te.terminals.rse.sdk.feature/build.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2012, 2014 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +############################################################################### +bin.includes = feature.xml,\ + feature.properties +src.includes = feature.properties diff --git a/features/org.eclipse.tcf.te.terminals.rse.sdk.feature/feature.properties b/features/org.eclipse.tcf.te.terminals.rse.sdk.feature/feature.properties new file mode 100644 index 00000000000..23361eb9e6e --- /dev/null +++ b/features/org.eclipse.tcf.te.terminals.rse.sdk.feature/feature.properties @@ -0,0 +1,37 @@ +################################################################################## +# Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +################################################################################## +# feature.properties +# contains externalized strings for feature.xml +# "%foo" in feature.xml corresponds to the key "foo" in this file +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# This file should be translated. + +# "featureName" property - name of the feature +featureName=Remote System Explorer Terminals View add-in, SDK + +# "providerName" property - name of the company that provides the feature +providerName=Eclipse.org - Target Explorer + +# "updateSiteName" property - label for the update site +updateSiteName=Eclipse Update Site + +# "description" property - description of the feature +description=Integrates the Terminals view into the Remote System Explorer. \ + Works on Windows, Linux, Mac and Solaris. Requires Eclipse 3.8.2 or newer and a Java 7 or newer JRE. + +# "copyright" property - text of the "Feature Update Copyright" +copyright=\ +Copyright (c) 2014 Wind River Systems, Inc. and others.\n\ +All rights reserved. This program and the accompanying materials\n\ +are made available under the terms of the Eclipse Public License v1.0\n\ +which accompanies this distribution, and is available at\n\ +http://www.eclipse.org/legal/epl-v10.html + +################ end of copyright property #################################### diff --git a/features/org.eclipse.tcf.te.terminals.rse.sdk.feature/feature.xml b/features/org.eclipse.tcf.te.terminals.rse.sdk.feature/feature.xml new file mode 100644 index 00000000000..b1bfa84c7a7 --- /dev/null +++ b/features/org.eclipse.tcf.te.terminals.rse.sdk.feature/feature.xml @@ -0,0 +1,38 @@ + + + + + %description + + + + %copyright + + + + %license + + + + + + + + + + + + + + diff --git a/features/org.eclipse.tcf.te.terminals.rse.sdk.feature/pom.xml b/features/org.eclipse.tcf.te.terminals.rse.sdk.feature/pom.xml new file mode 100644 index 00000000000..69a6bdc6c48 --- /dev/null +++ b/features/org.eclipse.tcf.te.terminals.rse.sdk.feature/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + + + org.eclipse.tcf + org.eclipse.tcf.maven-build + 1.3.0-SNAPSHOT + ../../../admin/pom-build.xml + + + 1.3.0.qualifier + org.eclipse.tcf.te.terminals.rse.sdk.feature + eclipse-feature + + + true + + diff --git a/features/org.eclipse.tcf.te.terminals.sdk.feature/.project b/features/org.eclipse.tcf.te.terminals.sdk.feature/.project new file mode 100644 index 00000000000..22f1191393b --- /dev/null +++ b/features/org.eclipse.tcf.te.terminals.sdk.feature/.project @@ -0,0 +1,33 @@ + + + org.eclipse.tcf.te.terminals.sdk.feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + org.eclipse.pde.ds.core.builder + + + + + + org.eclipse.pde.FeatureNature + + + + 1311579318584 + + 10 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-target + + + + diff --git a/features/org.eclipse.tcf.te.terminals.sdk.feature/build.properties b/features/org.eclipse.tcf.te.terminals.sdk.feature/build.properties new file mode 100644 index 00000000000..d9e56c50b07 --- /dev/null +++ b/features/org.eclipse.tcf.te.terminals.sdk.feature/build.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2012, 2014 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +############################################################################### +bin.includes = feature.xml,\ + feature.properties +src.includes = feature.properties diff --git a/features/org.eclipse.tcf.te.terminals.sdk.feature/feature.properties b/features/org.eclipse.tcf.te.terminals.sdk.feature/feature.properties new file mode 100644 index 00000000000..0ba33f07709 --- /dev/null +++ b/features/org.eclipse.tcf.te.terminals.sdk.feature/feature.properties @@ -0,0 +1,38 @@ +################################################################################## +# Copyright (c) 2011, 2014 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +################################################################################## +# feature.properties +# contains externalized strings for feature.xml +# "%foo" in feature.xml corresponds to the key "foo" in this file +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# This file should be translated. + +# "featureName" property - name of the feature +featureName=Terminals View, SDK + +# "providerName" property - name of the company that provides the feature +providerName=Eclipse.org - Target Explorer + +# "updateSiteName" property - label for the update site +updateSiteName=Eclipse Update Site + +# "description" property - description of the feature +description=An integrated Eclipse View for the local command prompt (console) or \ + remote hosts via (SSH, Telnet, Serial, TCF). Works on Windows, Linux, Mac and Solaris. \ + Requires Eclipse 3.8.2 or newer and a Java 7 or newer JRE. + +# "copyright" property - text of the "Feature Update Copyright" +copyright=\ +Copyright (c) 2011, 2014 Wind River Systems, Inc. and others.\n\ +All rights reserved. This program and the accompanying materials\n\ +are made available under the terms of the Eclipse Public License v1.0\n\ +which accompanies this distribution, and is available at\n\ +http://www.eclipse.org/legal/epl-v10.html + +################ end of copyright property #################################### diff --git a/features/org.eclipse.tcf.te.terminals.sdk.feature/feature.xml b/features/org.eclipse.tcf.te.terminals.sdk.feature/feature.xml new file mode 100644 index 00000000000..85d255b6d00 --- /dev/null +++ b/features/org.eclipse.tcf.te.terminals.sdk.feature/feature.xml @@ -0,0 +1,79 @@ + + + + + %description + + + + %copyright + + + + %license + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/features/org.eclipse.tcf.te.terminals.sdk.feature/pom.xml b/features/org.eclipse.tcf.te.terminals.sdk.feature/pom.xml new file mode 100644 index 00000000000..57048c75ed8 --- /dev/null +++ b/features/org.eclipse.tcf.te.terminals.sdk.feature/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + + + org.eclipse.tcf + org.eclipse.tcf.maven-build + 1.3.0-SNAPSHOT + ../../../admin/pom-build.xml + + + 1.3.0.qualifier + org.eclipse.tcf.te.terminals.sdk.feature + eclipse-feature + + + true + + diff --git a/plugins/org.eclipse.tcf.te.core.terminals/.classpath b/plugins/org.eclipse.tcf.te.core.terminals/.classpath new file mode 100644 index 00000000000..ad32c83a788 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/plugins/org.eclipse.tcf.te.core.terminals/.options b/plugins/org.eclipse.tcf.te.core.terminals/.options new file mode 100644 index 00000000000..cd0d16fd131 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/.options @@ -0,0 +1 @@ +org.eclipse.tcf.te.core.terminals/debugmode = 0 diff --git a/plugins/org.eclipse.tcf.te.core.terminals/.project b/plugins/org.eclipse.tcf.te.core.terminals/.project new file mode 100644 index 00000000000..755248325f2 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/.project @@ -0,0 +1,39 @@ + + + org.eclipse.tcf.te.core.terminals + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + + + 1329501981620 + + 10 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-target + + + + diff --git a/plugins/org.eclipse.tcf.te.core.terminals/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.tcf.te.core.terminals/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..536dbb4bfda --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,362 @@ +#Sat Oct 15 08:44:04 CEST 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=warning +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=0 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=0 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=100 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true +org.eclipse.jdt.core.formatter.lineSplit=100 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/plugins/org.eclipse.tcf.te.core.terminals/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.tcf.te.core.terminals/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000000..88bb9570e83 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,56 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_Target Explorer Java STD +formatter_settings_version=12 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=false +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/plugins/org.eclipse.tcf.te.core.terminals/.settings/org.eclipse.pde.prefs b/plugins/org.eclipse.tcf.te.core.terminals/.settings/org.eclipse.pde.prefs new file mode 100644 index 00000000000..cf80c8bc5b8 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/.settings/org.eclipse.pde.prefs @@ -0,0 +1,32 @@ +compilers.f.unresolved-features=1 +compilers.f.unresolved-plugins=1 +compilers.incompatible-environment=1 +compilers.p.build=1 +compilers.p.build.bin.includes=1 +compilers.p.build.encodings=2 +compilers.p.build.java.compiler=2 +compilers.p.build.java.compliance=1 +compilers.p.build.missing.output=2 +compilers.p.build.output.library=1 +compilers.p.build.source.library=1 +compilers.p.build.src.includes=1 +compilers.p.deprecated=1 +compilers.p.discouraged-class=1 +compilers.p.internal=1 +compilers.p.missing-packages=1 +compilers.p.missing-version-export-package=2 +compilers.p.missing-version-import-package=1 +compilers.p.missing-version-require-bundle=1 +compilers.p.no-required-att=0 +compilers.p.not-externalized-att=2 +compilers.p.unknown-attribute=1 +compilers.p.unknown-class=1 +compilers.p.unknown-element=1 +compilers.p.unknown-identifier=1 +compilers.p.unknown-resource=1 +compilers.p.unresolved-ex-points=0 +compilers.p.unresolved-import=0 +compilers.s.create-docs=false +compilers.s.doc-folder=doc +compilers.s.open-tags=1 +eclipse.preferences.version=1 diff --git a/plugins/org.eclipse.tcf.te.core.terminals/META-INF/MANIFEST.MF b/plugins/org.eclipse.tcf.te.core.terminals/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..0cf3a8a0ee7 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/META-INF/MANIFEST.MF @@ -0,0 +1,21 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.tcf.te.core.terminals;singleton:=true +Bundle-Version: 1.3.0.qualifier +Bundle-Activator: org.eclipse.tcf.te.core.terminals.activator.CoreBundleActivator +Bundle-Vendor: %providerName +Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400", + org.eclipse.core.runtime;bundle-version="3.8.0" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Bundle-Localization: plugin +Export-Package: org.eclipse.tcf.te.core.terminals, + org.eclipse.tcf.te.core.terminals.activator;x-internal:=true, + org.eclipse.tcf.te.core.terminals.interfaces, + org.eclipse.tcf.te.core.terminals.interfaces.constants, + org.eclipse.tcf.te.core.terminals.internal;x-internal:=true, + org.eclipse.tcf.te.core.terminals.nls;x-internal:=true, + org.eclipse.tcf.te.core.terminals.preferences, + org.eclipse.tcf.te.core.terminals.tracing, + org.eclipse.tcf.te.core.terminals.utils diff --git a/plugins/org.eclipse.tcf.te.core.terminals/about.html b/plugins/org.eclipse.tcf.te.core.terminals/about.html new file mode 100644 index 00000000000..0f07cf034df --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

May 24, 2012

+

License

+ +

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 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +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 http://www.eclipse.org.

+ + + \ No newline at end of file diff --git a/plugins/org.eclipse.tcf.te.core.terminals/about.ini b/plugins/org.eclipse.tcf.te.core.terminals/about.ini new file mode 100644 index 00000000000..27e63d60c20 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/about.ini @@ -0,0 +1,27 @@ +# about.ini +# contains information about a feature +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# "%key" are externalized strings defined in about.properties +# This file does not need to be translated. + +# Property "aboutText" contains blurb for "About" dialog (translated) +aboutText=%blurb + +# Property "windowImage" contains path to window icon (16x16) +# needed for primary features only + +# Property "featureImage" contains path to feature image (32x32) +featureImage=te-feature.png + +# Property "aboutImage" contains path to product image (500x330 or 115x164) +# needed for primary features only + +# Property "appName" contains name of the application (not translated) +# needed for primary features only + +# Property "welcomePage" contains path to welcome page (special XML-based format) +# optional + +# Property "welcomePerspective" contains the id of the perspective in which the +# welcome page is to be opened. +# optional \ No newline at end of file diff --git a/plugins/org.eclipse.tcf.te.core.terminals/about.mappings b/plugins/org.eclipse.tcf.te.core.terminals/about.mappings new file mode 100644 index 00000000000..bddaab43109 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/about.mappings @@ -0,0 +1,6 @@ +# about.mappings +# contains fill-ins for about.properties +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# This file does not need to be translated. + +0=@build@ \ No newline at end of file diff --git a/plugins/org.eclipse.tcf.te.core.terminals/about.properties b/plugins/org.eclipse.tcf.te.core.terminals/about.properties new file mode 100644 index 00000000000..3c677ca90e1 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/about.properties @@ -0,0 +1,24 @@ +################################################################################ +# Copyright (c) 2006, 2015 Wind River Systems, Inc. and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Martin Oberhuber - initial API and implementation +################################################################################ +# about.properties +# contains externalized strings for about.ini +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# fill-ins are supplied by about.mappings +# This file should be translated. +# +# Do not translate any values surrounded by {} + +blurb=TCF Terminals\n\ +\n\ +Version: {featureVersion}\n\ +\n\ +(c) Copyright Wind River Systems, Inc. and others 2011, 2015. All rights reserved.\n\ +Visit http://marketplace.eclipse.org/content/tcf-terminals diff --git a/plugins/org.eclipse.tcf.te.core.terminals/build.properties b/plugins/org.eclipse.tcf.te.core.terminals/build.properties new file mode 100644 index 00000000000..2cee913a557 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/build.properties @@ -0,0 +1,20 @@ +############################################################################### +# Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +############################################################################### +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.properties,\ + about.html,\ + plugin.xml,\ + about.ini,\ + about.mappings,\ + about.properties,\ + te-feature.png diff --git a/plugins/org.eclipse.tcf.te.core.terminals/plugin.properties b/plugins/org.eclipse.tcf.te.core.terminals/plugin.properties new file mode 100644 index 00000000000..7b9c05f4e64 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/plugin.properties @@ -0,0 +1,14 @@ +################################################################################## +# Copyright (c) 2015 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +################################################################################## + +pluginName = Terminals Core +providerName = Eclipse.org - Target Explorer + +ExtensionPoint.contextPropertiesProviders = Terminal Context Properties Providers diff --git a/plugins/org.eclipse.tcf.te.core.terminals/plugin.xml b/plugins/org.eclipse.tcf.te.core.terminals/plugin.xml new file mode 100644 index 00000000000..541260cff2d --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/plugin.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/plugins/org.eclipse.tcf.te.core.terminals/pom.xml b/plugins/org.eclipse.tcf.te.core.terminals/pom.xml new file mode 100644 index 00000000000..bcef6fca921 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + + org.eclipse.tcf + org.eclipse.tcf.maven-build + 1.3.0-SNAPSHOT + ../../../admin/pom-build.xml + + + 1.3.0.qualifier + org.eclipse.tcf.te.core.terminals + eclipse-plugin + diff --git a/plugins/org.eclipse.tcf.te.core.terminals/schema/contextPropertiesProviders.exsd b/plugins/org.eclipse.tcf.te.core.terminals/schema/contextPropertiesProviders.exsd new file mode 100644 index 00000000000..929f094d543 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/schema/contextPropertiesProviders.exsd @@ -0,0 +1,129 @@ + + + + + + + + + This extension point is used to contribute terminal context properties providers. The context properties provider allows querying desired properties for a given context. +<p> +The terminal context is passed in as default variable to the enablement expression evaluation. The terminal context is not expected to be iteratable or countable. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Declares a terminal context properties provider contribution. + + + + + + + + + + The class that implements <code>org.eclipse.tcf.te.core.terminals.interfaces.ITerminalContextPropertiesProvider</code>. + + + + + + + + + + + + + + + Target Explorer 1.3.0 + + + + + + + + + This is an example of the extension point usage: +<p> +<pre><code> + <extension point="org.eclipse.tcf.te.core.terminals.contextPropertiesProviders"> + <contextPropertiesProvider + class="com.my.contribution.MyContextPropertiesProviderImpl"> + </contextPropertiesProvider> + </extension> +</code></pre> + + + + + + + + + The provider of a terminal context properties provider must implement <samp>org.eclipse.tcf.te.core.terminals.interfaces.ITerminalContextPropertiesProvider</samp>. + + + + + + + + + + Copyright (c) 2015 Wind River Systems, Inc. and others. + +All rights reserved. + +This program and the accompanying materials are made available under the terms +of the Eclipse Public License v1.0 which accompanies this distribution, and is +available at http://www.eclipse.org/legal/epl-v10.html. + + + + diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/TerminalContextPropertiesProviderFactory.java b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/TerminalContextPropertiesProviderFactory.java new file mode 100644 index 00000000000..c0bddc9bce8 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/TerminalContextPropertiesProviderFactory.java @@ -0,0 +1,228 @@ +/******************************************************************************* + * Copyright (c) 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.core.terminals; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.expressions.EvaluationContext; +import org.eclipse.core.expressions.EvaluationResult; +import org.eclipse.core.expressions.Expression; +import org.eclipse.core.expressions.ExpressionConverter; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExecutableExtension; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.osgi.util.NLS; +import org.eclipse.tcf.te.core.terminals.activator.CoreBundleActivator; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalContextPropertiesProvider; +import org.eclipse.tcf.te.core.terminals.nls.Messages; + +/** + * Terminal context properties provider factory. + */ +public final class TerminalContextPropertiesProviderFactory { + // Flag to remember if the contributions got loaded + private static boolean contributionsLoaded = false; + + // The list of all loaded contributions + private static final List contributions = new ArrayList(); + + // The proxy used to achieve lazy class loading and plug-in activation + private static class Proxy implements IExecutableExtension { + // Reference to the configuration element + private IConfigurationElement configElement = null; + // The class implementing the provider + public String clazz; + // The context properties provider instance + private ITerminalContextPropertiesProvider provider = null; + // The converted expression + private Expression expression; + + /** + * Constructor. + */ + protected Proxy() { + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object) + */ + @Override + public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { + Assert.isNotNull(config); + this.configElement = config; + + // Read the class attribute. + // Throws an exception if the attribute value is empty or null. + clazz = config.getAttribute("class"); //$NON-NLS-1$ + if (clazz == null || "".equals(clazz.trim())) { //$NON-NLS-1$ + throw new CoreException(new Status(IStatus.ERROR, + CoreBundleActivator.getUniqueIdentifier(), + NLS.bind(Messages.Extension_error_missingRequiredAttribute, "class", config.getContributor().getName()))); //$NON-NLS-1$ + } + + // Read the "enablement" sub element of the extension + IConfigurationElement[] children = configElement.getChildren("enablement"); //$NON-NLS-1$ + if (children == null || children.length == 0) { + throw new CoreException(new Status(IStatus.ERROR, + CoreBundleActivator.getUniqueIdentifier(), + NLS.bind(Messages.Extension_error_missingRequiredAttribute, "enablement", config.getContributor().getName()))); //$NON-NLS-1$ + } + // Only one "enablement" element is expected + expression = ExpressionConverter.getDefault().perform(children[0]); + } + + /** + * Return the real terminal context properties provider instance for this proxy. + */ + protected ITerminalContextPropertiesProvider getProvider() { + if (provider == null && configElement != null) { + try { + // Create the service class instance via the configuration element + Object provider = configElement.createExecutableExtension("class"); //$NON-NLS-1$ + if (provider instanceof ITerminalContextPropertiesProvider) { + this.provider = (ITerminalContextPropertiesProvider)provider; + } + else { + IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "Terminal context properties provider '" + provider.getClass().getName() + "' not of type ITerminalContextPropertiesProvider."); //$NON-NLS-1$ //$NON-NLS-2$ + Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(status); + } + } + catch (CoreException e) { + IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "Cannot create terminal context properties provider '" + clazz + "'.", e); //$NON-NLS-1$ //$NON-NLS-2$ + Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(status); + } + } + return provider; + } + + /** + * Returns if or if not the context properties provider contribution is enabled for + * the given terminal context. + * + * @param context The terminal context or null. + * @return True if the context properties provider contribution is enabled + * for the given terminal context, false otherwise. + */ + protected boolean isEnabled(Object context) { + if (context == null) { + return getEnablement() == null; + } + + Expression enablement = getEnablement(); + + // The service contribution is enabled by default if no expression is specified. + boolean enabled = enablement == null; + + if (enablement != null) { + // Set the default variable to the service context. + EvaluationContext evalContext = new EvaluationContext(null, context); + // Allow plug-in activation + evalContext.setAllowPluginActivation(true); + // Evaluate the expression + try { + enabled = enablement.evaluate(evalContext).equals(EvaluationResult.TRUE); + } catch (CoreException e) { + IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), e.getLocalizedMessage(), e); + Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(status); + } + } + + return enabled; + } + + /** + * Returns the enablement expression. + * + * @return The enablement expression or null. + */ + protected Expression getEnablement() { + return expression; + } + } + + + /** + * Creates a new terminal context properties provider proxy instance and initialize it. + * + * @param config The configuration element. Must not be null. + * @return The new terminal context properties provider proxy instance. + */ + private static Proxy getProxy(IConfigurationElement config) { + Assert.isNotNull(config); + Proxy proxy = new Proxy(); + try { + proxy.setInitializationData(config, null, null); + } catch (CoreException e) { + if (Platform.inDebugMode()) { + Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(e.getStatus()); + } + } + return proxy; + } + + /** + * Load the terminal context properties provider contributions. + */ + private static void loadContributions() { + IExtensionPoint ep = Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.tcf.te.core.terminals.contextPropertiesProviders"); //$NON-NLS-1$ + if (ep != null) { + IExtension[] extensions = ep.getExtensions(); + if (extensions != null) { + for (IExtension extension : extensions) { + IConfigurationElement[] configElements = extension.getConfigurationElements(); + if (configElements != null) { + for (IConfigurationElement configElement : configElements) { + if ("contextPropertiesProvider".equals(configElement.getName())) { //$NON-NLS-1$ + Proxy proxy = getProxy(configElement); + contributions.add(proxy); + } + } + } + } + } + } + } + + /** + * Get the terminal context properties provider for the given context. The first terminal + * context properties provider which is enabled is returned. + * + * @param context The terminal context. Must not be null. + * + * @return The service or null. + */ + public static ITerminalContextPropertiesProvider getProvider(Object context) { + Assert.isNotNull(context); + + // Load the contributions if not yet loaded + synchronized (contributions) { + if (!contributionsLoaded) { + loadContributions(); + contributionsLoaded = true; + } + } + + for (Proxy proxy : contributions) { + if (proxy.isEnabled(context)) { + return proxy.getProvider(); + } + } + + return null; + } + +} diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/TerminalServiceFactory.java b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/TerminalServiceFactory.java new file mode 100644 index 00000000000..4b5eba9c958 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/TerminalServiceFactory.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.core.terminals; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.tcf.te.core.terminals.activator.CoreBundleActivator; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService; +import org.eclipse.tcf.te.core.terminals.nls.Messages; +import org.osgi.framework.Bundle; + +/** + * Terminal service factory implementation. + *

+ * Provides access to the terminal service instance. + */ +public final class TerminalServiceFactory { + private static ITerminalService instance = null; + + static { + // Tries to instantiate the terminal service implementation + // from the o.e.tcf.te.ui.terminals bundle + Bundle bundle = Platform.getBundle("org.eclipse.tcf.te.ui.terminals"); //$NON-NLS-1$ + if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) { + try { + Class clazz = bundle.loadClass("org.eclipse.tcf.te.ui.terminals.services.TerminalService"); //$NON-NLS-1$ + instance = (ITerminalService) clazz.newInstance(); + } + catch (Exception e) { + if (Platform.inDebugMode()) { + Platform.getLog(bundle).log(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), Messages.TerminalServiceFactory_error_serviceImplLoadFailed, e)); + } + } + } + } + + /** + * Returns the terminal service instance. + */ + public static ITerminalService getService() { + return instance; + } +} diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/activator/CoreBundleActivator.java b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/activator/CoreBundleActivator.java new file mode 100644 index 00000000000..054468888df --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/activator/CoreBundleActivator.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.core.terminals.activator; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class CoreBundleActivator implements BundleActivator { + // The bundle context + private static BundleContext context; + + /** + * Returns the bundle context + * + * @return the bundle context + */ + public static BundleContext getContext() { + return context; + } + + /** + * Convenience method which returns the unique identifier of this plugin. + */ + public static String getUniqueIdentifier() { + if (getContext() != null && getContext().getBundle() != null) { + return getContext().getBundle().getSymbolicName(); + } + return "org.eclipse.tcf.te.core.terminals"; //$NON-NLS-1$ + } + + /* (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext bundleContext) throws Exception { + CoreBundleActivator.context = bundleContext; + } + + /* (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext bundleContext) throws Exception { + CoreBundleActivator.context = null; + } +} diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalContextPropertiesProvider.java b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalContextPropertiesProvider.java new file mode 100644 index 00000000000..41f2cd3e79f --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalContextPropertiesProvider.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.core.terminals.interfaces; + +import java.util.Map; + +/** + * Terminal context properties provider. + *

+ * The context properties provider allows querying desired properties + * for a given context. The context is typically an element from a selection + * and the inner structure of the element is unknown to the terminal. + */ +public interface ITerminalContextPropertiesProvider { + + /** + * Returns a unmodifiable map containing the target address and port for the given context, + * if it can be determined. + *

+ * A context may return multiple target addresses and ports if the context can be reached using + * different connection methods. + *

+ * Note: + *

+ * + * @param context The context to get the target addresses and ports from. Must not be null. + * @return The unmodifiable map containing the target addresses and ports, or null. + */ + public Map getTargetAddress(Object context); + + /** + * Returns the property value stored under the given property key. If the property does not + * exist, null is returned. + * + * @param context The context to get the property from. Must not be null. + * @param key The property key. Must not be null. + * + * @return The stored property value or null. + */ + public Object getProperty(Object context, String key); +} diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalService.java b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalService.java new file mode 100644 index 00000000000..e4c90c5878c --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalService.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * Copyright (c) 2011 - 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.core.terminals.interfaces; + +import java.util.Map; + +import org.eclipse.core.runtime.IStatus; + +/** + * Terminals service. + */ +public interface ITerminalService { + + /** + * Client call back interface. + */ + public interface Done { + /** + * Called when the terminal service operation is done. + * + * @param status The status of the terminal service operation. + */ + public void done(IStatus status); + } + + /** + * Opens a terminal asynchronously and invokes the given callback if done. + * + * @param properties The terminal properties. Must not be null. + * @param done The callback to invoke if finished or null. + */ + public void openConsole(Map properties, Done done); + + /** + * Close the terminal asynchronously and invokes the given callback if done. + * + * @param properties The terminal properties. Must not be null. + * @param done The callback to invoke if finished or null. + */ + public void closeConsole(Map properties, Done done); + + /** + * Terminate (disconnect) the terminal asynchronously and invokes the given callback if done. + * + * @param properties The terminal properties. Must not be null. + * @param done The callback to invoke if finished or null. + */ + public void terminateConsole(Map properties, Done done); + + /** + * Register the given listener to receive notifications about terminal events. + * Calling this method multiple times with the same listener has no effect. + + * @param listener The terminal tab listener. Must not be null. + */ + public void addTerminalTabListener(ITerminalTabListener listener); + + /** + * Unregister the given listener from receiving notifications about terminal + * events. Calling this method multiple times with the same listener + * has no effect. + * + * @param listener The terminal tab listener. Must not be null. + */ + public void removeTerminalTabListener(ITerminalTabListener listener); +} diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalServiceOutputStreamMonitorListener.java b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalServiceOutputStreamMonitorListener.java new file mode 100644 index 00000000000..dda3704b018 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalServiceOutputStreamMonitorListener.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2014 - 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.core.terminals.interfaces; + +/** + * An interface to be implemented by listeners who want to listen + * to the streams data without interfering with the original data receiver. + *

+ * Listeners are invoked within the monitor processing thread. + */ +public interface ITerminalServiceOutputStreamMonitorListener { + + /** + * Signals that some content has been read from the monitored stream. + * + * @param byteBuffer The byte stream. Must not be null. + * @param bytesRead The number of bytes that were read into the read buffer. + */ + public void onContentReadFromStream(byte[] byteBuffer, int bytesRead); +} diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalTabListener.java b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalTabListener.java new file mode 100644 index 00000000000..77e3e04eb13 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/ITerminalTabListener.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.core.terminals.interfaces; + +/** + * Listener to implement and to register to get notified about + * terminal tabs events, like the disposal of a terminal tab. + */ +public interface ITerminalTabListener { + + /** + * Invoked once a terminal tab got disposed. The source object is + * the disposed tab item and data is the custom data object associated + * with the disposed tab item. + * + * @param source The disposed tab item. Must not be null. + * @param data The custom data object associated with the disposed tab item or null. + */ + public void terminalTabDisposed(Object source, Object data); +} diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/IContextPropertiesConstants.java b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/IContextPropertiesConstants.java new file mode 100644 index 00000000000..b2e98aacd39 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/IContextPropertiesConstants.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * Copyright (c) 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.core.terminals.interfaces.constants; + +/** + * Defines the terminal context properties constants. + */ +public interface IContextPropertiesConstants { + + /** + * Target name. + *

+ * The target name is not meant to be identical with the targets network name. It can + * be the targets network name, but it can be any other string identifying the target + * to the user as well. The name is for display only, it is not meant to be used for + * communicating with the target. + */ + public static String PROP_NAME = "name"; //$NON-NLS-1$ + + /** + * Target agent address. + *

+ * The value is typically the address an agent running at the target. + */ + public static String PROP_ADDRESS = "address"; //$NON-NLS-1$ + + /** + * Target agent port. + *

+ * The value is typically the port an agent running at the target. + */ + public static String PROP_PORT = "port"; //$NON-NLS-1$ + + /** + * The default user name to use to log into the target. + */ + public static String PROP_DEFAULT_USER = "defaultUser"; //$NON-NLS-1$ + + /** + * The default encoding to use. + */ + public static String PROP_DEFAULT_ENCODING = "defaultEncoding"; //$NON-NLS-1$ +} diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/ILineSeparatorConstants.java b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/ILineSeparatorConstants.java new file mode 100644 index 00000000000..8fea4b82df7 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/ILineSeparatorConstants.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2011 - 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.core.terminals.interfaces.constants; + +/** + * Line separator constants. + *

+ * Copied from org.eclipse.tcf.internal.terminal.local.ILocalTerminalSettings. + */ +public interface ILineSeparatorConstants { + + /** + * The line separator setting CR (carriage return only; for example, used by Mac OS 9). + */ + public final static String LINE_SEPARATOR_CR = "\\r"; //$NON-NLS-1$ + + /** + * The line separator setting CRLF (carriage return and line feed; for example, used by + * Windows). + */ + public final static String LINE_SEPARATOR_CRLF = "\\r\\n"; //$NON-NLS-1$ + + /** + * The line separator setting LF (line feed only; used by all UNIX-based systems). + */ + public final static String LINE_SEPARATOR_LF = "\\n"; //$NON-NLS-1$ +} diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/ITerminalsConnectorConstants.java b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/ITerminalsConnectorConstants.java new file mode 100644 index 00000000000..fe7b65295b5 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/interfaces/constants/ITerminalsConnectorConstants.java @@ -0,0 +1,322 @@ +/******************************************************************************* + * Copyright (c) 2011 - 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + * Max Weninger (Wind River) - [361352] [TERMINALS][SSH] Add SSH terminal support + *******************************************************************************/ +package org.eclipse.tcf.te.core.terminals.interfaces.constants; + +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalServiceOutputStreamMonitorListener; + + +/** + * Defines the terminals connector constants. + */ +public interface ITerminalsConnectorConstants { + + /** + * Property: The unique id of the terminals view to open. + *

+ * Property Type: {@link String} + */ + public static final String PROP_ID = "id"; //$NON-NLS-1$ + + /** + * Property: The unique secondary id of the terminals view to open. + *

+ * Property Type: {@link String} + */ + public static final String PROP_SECONDARY_ID = "secondaryId"; //$NON-NLS-1$ + + /** + * Property: The title of the terminal tab to open. + *

+ * Property Type: {@link String} + */ + public static final String PROP_TITLE = "title"; //$NON-NLS-1$ + + /** + * Property: The encoding of the terminal tab to open. + *

+ * Property Type: {@link String} + */ + public static final String PROP_ENCODING = "encoding"; //$NON-NLS-1$ + + /** + * Property: Custom data object to associate with the terminal tab. + *

+ * Property Type: {@link Object} + */ + public static final String PROP_DATA = "data"; //$NON-NLS-1$ + + /** + * Property: External selection to associate with the terminal tab. + *

+ * Property Type: {@link org.eclipse.jface.viewers.ISelection} + */ + public static final String PROP_SELECTION = "selection"; //$NON-NLS-1$ + + /** + * Property: Flag to force a new terminal tab. + *

+ * Property Type: {@link Boolean} + */ + public static final String PROP_FORCE_NEW = "terminal.forceNew"; //$NON-NLS-1$ + + /** + * Property: Terminals launcher delegate id. + *

+ * Property Type: {@link String} + */ + public static final String PROP_DELEGATE_ID = "delegateId"; //$NON-NLS-1$ + + /** + * Property: Specific terminal connector type id. Allows clients to + * override the specifically used terminal connector + * implementation for a given type. + *

+ * Property Type: {@link String} + */ + public static final String PROP_TERMINAL_CONNECTOR_ID = "tm.terminal.connector.id"; //$NON-NLS-1$ + + // ***** Generic terminals connector properties ***** + + /** + * Property: Timeout to be passed to the terminal connector. The specific terminal + * connector implementation may interpret this value differently. If not + * set, the terminal connector may use a default value. + *

+ * Property Type: {@link Integer} + */ + public static final String PROP_TIMEOUT = "timeout"; //$NON-NLS-1$ + + /** + * Property: Flag to control if a local echo is needed from the terminal widget. + *

Typical for process and streams terminals. + *

+ * Property Type: {@link Boolean} + */ + public static final String PROP_LOCAL_ECHO = "localEcho"; //$NON-NLS-1$ + + /** + * Property: Data flag to tell the terminal to not reconnect when hitting enter + * in a disconnected terminal. + *

+ * Property Type: {@link Boolean} + */ + public static final String PROP_DATA_NO_RECONNECT = "data.noReconnect"; //$NON-NLS-1$ + + /** + * Property: The line separator expected by the remote terminal on input streams and + * send by the remote terminal on output streams. + *

Typical for process and streams terminals. + *

+ * Property Type: {@link String} + */ + public static final String PROP_LINE_SEPARATOR = "lineSeparator"; //$NON-NLS-1$ + + /** + * Property: The list of stdout listeners to attach to the corresponding stream monitor. + *

Typical for process and streams terminals. + *

+ * Property Type: {@link ITerminalServiceOutputStreamMonitorListener} array + */ + public static final String PROP_STDOUT_LISTENERS = "stdoutListeners"; //$NON-NLS-1$ + + /** + * Property: The list of stderr listeners to attach to the corresponding stream monitor. + *

Typical for process and streams terminals. + *

+ * Property Type: {@link ITerminalServiceOutputStreamMonitorListener} array + */ + public static final String PROP_STDERR_LISTENERS = "stderrListeners"; //$NON-NLS-1$ + + /** + * Property: If set to true, backslashes are translated to + * slashes before pasting the text to the terminal widget. + *

+ * Property Type: {@link Boolean} + */ + public static final String PROP_TRANSLATE_BACKSLASHES_ON_PASTE = "translateBackslashesOnPaste"; //$NON-NLS-1$ + + // ***** IP based terminals connector properties ***** + + /** + * Property: Host name or IP address the terminal server is running. + *

Typical for telnet or ssh terminals. + *

+ * Property Type: {@link String} + */ + public static final String PROP_IP_HOST = "ip.host"; //$NON-NLS-1$ + + /** + * Property: Port at which the terminal server is providing the console input and output. + *

Typical for telnet or ssh terminals. + *

+ * Property Type: {@link Integer} + */ + public static final String PROP_IP_PORT = "ip.port"; //$NON-NLS-1$ + + /** + * Property: An offset to add to the specified port number. + *

Typical for telnet or ssh terminals. + *

+ * Property Type: {@link Integer} + */ + public static final String PROP_IP_PORT_OFFSET = "ip.port.offset"; //$NON-NLS-1$ + + // ***** Process based terminals connector properties ***** + + /** + * Property: Process image path. + *

Typical for process terminals. + *

+ * Property Type: {@link String} + */ + public static final String PROP_PROCESS_PATH = "process.path"; //$NON-NLS-1$ + + /** + * Property: Process arguments. + *

Typical for process terminals. + *

+ * Property Type: {@link String} + */ + public static final String PROP_PROCESS_ARGS = "process.args"; //$NON-NLS-1$ + + /** + * Property: Process arguments. + *

Typical for process terminals. + *

+ * Property Type: {@link String} + */ + public static final String PROP_PROCESS_WORKING_DIR = "process.working_dir"; //$NON-NLS-1$ + + /** + * Property: Process environment. + *

Typical for process terminals. + *

+ * Property Type: {@link String} array + */ + public static final String PROP_PROCESS_ENVIRONMENT = "process.environment"; //$NON-NLS-1$ + + /** + * Property: Flag to merge process environment with native environment. + *

Typical for process terminals. + *

+ * Property Type: {@link Boolean} + */ + public static final String PROP_PROCESS_MERGE_ENVIRONMENT = "process.environment.merge"; //$NON-NLS-1$ + + /** + * Property: Runtime process instance. + *

Typical for process terminals. + *

+ * Property Type: {@link Process} + */ + public static final String PROP_PROCESS_OBJ = "process"; //$NON-NLS-1$ + + /** + * Property: Runtime process PTY instance. + *

Typical for process terminals. + *

+ * Property Type: {@link org.eclipse.cdt.utils.pty.PTY} + */ + public static final String PROP_PTY_OBJ = "pty"; //$NON-NLS-1$ + + // ***** Streams based terminals connector properties ***** + + /** + * Property: Stdin streams instance. + *

Typical for streams terminals. + *

+ * Property Type: {@link OutputStream} + */ + public static final String PROP_STREAMS_STDIN = "streams.stdin"; //$NON-NLS-1$ + + /** + * Property: Stdout streams instance. + *

Typical for streams terminals. + *

+ * Property Type: {@link InputStream} + */ + public static final String PROP_STREAMS_STDOUT = "streams.stdout"; //$NON-NLS-1$ + + /** + * Property: Stderr streams instance. + *

Typical for streams terminals. + *

+ * Property Type: {@link InputStream} + */ + public static final String PROP_STREAMS_STDERR = "streams.stderr"; //$NON-NLS-1$ + + // ***** Ssh specific properties ***** + + /** + * Property: ssh keep alive value. + *

+ * Property Type: {@link Integer} + */ + public static final String PROP_SSH_KEEP_ALIVE = "ssh.keep_alive"; //$NON-NLS-1$ + + /** + * Property: Ssh password. + *

+ * Property Type: {@link String} + */ + public static final String PROP_SSH_PASSWORD = "ssh.password"; //$NON-NLS-1$ + + /** + * Property: Ssh user. + *

+ * Property Type: {@link String} + */ + public static final String PROP_SSH_USER = "ssh.user"; //$NON-NLS-1$ + + // ***** Serial specific properties ***** + + /** + * The serial device name. + *

+ * Property Type: {@link String} + */ + public static final String PROP_SERIAL_DEVICE = "serial.device"; //$NON-NLS-1$ + + /** + * The baud rate. + *

+ * Property Type: {@link String} + */ + public static final String PROP_SERIAL_BAUD_RATE = "serial.baudrate"; //$NON-NLS-1$ + + /** + * The data bits + *

+ * Property Type: {@link String} + */ + public static final String PROP_SERIAL_DATA_BITS = "serial.databits"; //$NON-NLS-1$ + + /** + * The parity + *

+ * Property Type: {@link String} + */ + public static final String PROP_SERIAL_PARITY = "serial.parity"; //$NON-NLS-1$ + + /** + * The stop bits + *

+ * Property Type: {@link String} + */ + public static final String PROP_SERIAL_STOP_BITS = "serial.stopbits"; //$NON-NLS-1$ + + /** + * The flow control + *

+ * Property Type: {@link String} + */ + public static final String PROP_SERIAL_FLOW_CONTROL = "serial.flowcontrol"; //$NON-NLS-1$ +} diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/internal/PropertyTester.java b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/internal/PropertyTester.java new file mode 100644 index 00000000000..b2b3dba8d49 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/internal/PropertyTester.java @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2011, 2014 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.core.terminals.internal; + +import org.eclipse.tcf.te.core.terminals.TerminalContextPropertiesProviderFactory; + + + +/** + * Property tester implementation. + */ +public class PropertyTester extends org.eclipse.core.expressions.PropertyTester { + + /* (non-Javadoc) + * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object) + */ + @Override + public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { + + // "hasContextPropertiesProvider": Checks if a context properties provider is available for the given receiver. + if ("hasContextPropertiesProvider".equals(property)) { //$NON-NLS-1$ + boolean hasProvider = TerminalContextPropertiesProviderFactory.getProvider(receiver) != null; + return expectedValue instanceof Boolean ? ((Boolean)expectedValue).equals(Boolean.valueOf(hasProvider)) : hasProvider; + } + + return false; + } + +} diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/nls/Messages.java b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/nls/Messages.java new file mode 100644 index 00000000000..23cc87c4636 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/nls/Messages.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.core.terminals.nls; + +import org.eclipse.osgi.util.NLS; + +/** + * Externalized strings management. + */ +public class Messages extends NLS { + + // The plug-in resource bundle name + private static final String BUNDLE_NAME = "org.eclipse.tcf.te.core.terminals.nls.Messages"; //$NON-NLS-1$ + + /** + * Static constructor. + */ + static { + // Load message values from bundle file + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + // **** Declare externalized string id's down here ***** + + public static String TerminalServiceFactory_error_serviceImplLoadFailed; + + public static String Extension_error_missingRequiredAttribute; +} diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/nls/Messages.properties b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/nls/Messages.properties new file mode 100644 index 00000000000..212cd1893c1 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/nls/Messages.properties @@ -0,0 +1,14 @@ +############################################################################### +# Copyright (c) 2015 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +############################################################################### + +TerminalServiceFactory_error_serviceImplLoadFailed=Failed to load terminal service implementation. + +Extension_error_missingRequiredAttribute=Required attribute "{0}" missing for extension "{1}"! + diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/preferences/ScopedEclipsePreferences.java b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/preferences/ScopedEclipsePreferences.java new file mode 100644 index 00000000000..33d505f2ce6 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/preferences/ScopedEclipsePreferences.java @@ -0,0 +1,459 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.core.terminals.preferences; + +import java.io.OutputStream; +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.ISafeRunnable; +import org.eclipse.core.runtime.ListenerList; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.SafeRunner; +import org.eclipse.core.runtime.preferences.DefaultScope; +import org.eclipse.core.runtime.preferences.IEclipsePreferences; +import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener; +import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent; +import org.eclipse.core.runtime.preferences.IPreferenceFilter; +import org.eclipse.core.runtime.preferences.IScopeContext; +import org.eclipse.core.runtime.preferences.InstanceScope; +import org.osgi.service.prefs.BackingStoreException; + +/** + * Helper class to handle scoped Eclipse preferences for plug-in's. Scoped + * preferences means a given preference context plus the default preferences + * scope. + *

+ * On changes a {@link PreferenceChangeEvent} is sent to inform all listeners of the change. + * + * @see IEclipsePreferences + * @see IEclipsePreferences.PreferenceChangeEvent + * @see IEclipsePreferences.IPreferenceChangeListener + */ +public class ScopedEclipsePreferences { + /** + * The preferences scope qualifier. + */ + private final String qualifier; + + /** + * The default scope preference node. + */ + protected final IEclipsePreferences defaultPrefs; + + /** + * The context scope preference node. + */ + protected final IEclipsePreferences contextScopePrefs; + + /** + * The registered preference change listeners. + */ + private final ListenerList listeners = new ListenerList(); + + /** + * Constructor. + *

+ * Initialize the scoped preferences with a new instance scope for the given qualifier. The default + * scope is determined by calling DefaultScope().getNode(qualifier). + * + * @param qualifier The qualifier for the preferences (in example the unique identifier of a plugin). Must not be null. + */ + public ScopedEclipsePreferences(String qualifier) { + this(InstanceScope.INSTANCE, qualifier); + } + + /** + * Constructor. + *

+ * Initialize the scoped preferences with the given scope. The default scope + * is determined by calling DefaultScope().getNode(qualifier). + * + * @param context The preference scope context. Must not be null. + * @param qualifier The qualifier for the preferences (in example the unique identifier of a plugin). Must not be null. + */ + public ScopedEclipsePreferences(IScopeContext context, String qualifier) { + Assert.isNotNull(context); + Assert.isNotNull(qualifier); + this.qualifier = qualifier; + defaultPrefs = DefaultScope.INSTANCE.getNode(getQualifier()); + contextScopePrefs = context.getNode(getQualifier()); + } + + /** + * Returns the qualifier that is used to get the preferences. + * For plugin preferences, this is the unique identifier of the plugin. + */ + protected final String getQualifier() { + return qualifier; + } + + /** + * Exports the preferences to the stream. + *

+ * Note: The stream will be closed after the export. + * + * @param stream The stream to where preferences and defaults should be exported. + */ + public void exportPreferences(OutputStream stream) { + Assert.isNotNull(stream); + try { + IPreferenceFilter filter = new IPreferenceFilter() { + /* (non-Javadoc) + * @see org.eclipse.core.runtime.preferences.IPreferenceFilter#getScopes() + */ + @Override + public String[] getScopes() { + return new String[] { InstanceScope.SCOPE }; + } + /* (non-Javadoc) + * @see org.eclipse.core.runtime.preferences.IPreferenceFilter#getMapping(java.lang.String) + */ + @Override + public Map getMapping(String scope) { + return null; + } + }; + + Platform.getPreferencesService().exportPreferences(contextScopePrefs, new IPreferenceFilter[] { filter }, stream); + stream.close(); + } + catch (Exception e) { + } + } + + /** + * Check whether a key is set or not. + * + * @param key The key to check. + * @return null if the key does not exist. + */ + public boolean containsKey(String key) { + return Platform.getPreferencesService().getString(getQualifier(), key, null, null) != null; + } + + /** + * Get a String preference value. + * + * @param key The preference key. + * @return The value of the preference key or the default value if not set. + */ + public final String getString(String key) { + return Platform.getPreferencesService().getString(getQualifier(), key, null, null); + } + + /** + * Get a boolean preference value. + * + * @param key The preference key. + * @return The value of the preference key or the default value if not set. + */ + public final boolean getBoolean(String key) { + return Platform.getPreferencesService().getBoolean(getQualifier(), key, false, null); + } + + /** + * Get an int preference value. + * + * @param key The preference key. + * @return The value of the preference key or the default value if not set. + */ + public final int getInt(String key) { + return Platform.getPreferencesService().getInt(getQualifier(), key, 0, null); + } + + /** + * Get a long preference value. + * + * @param key The preference key. + * @return The value of the preference key or the default value if not set. + */ + public final long getLong(String key) { + return Platform.getPreferencesService().getLong(getQualifier(), key, 0, null); + } + + /** + * Get a default String preference value. + * + * @param key The preference key. + * @return The default value of the preference key or null. + */ + public final String getDefaultString(String key) { + return defaultPrefs.get(key, null); + } + + /** + * Get a default boolean preference value. + * + * @param key The preference key. + * @return The default value of the preference key or null. + */ + public final boolean getDefaultBoolean(String key) { + return defaultPrefs.getBoolean(key, false); + } + + /** + * Get a default int preference value. + * + * @param key The preference key. + * @return The default value of the preference key or null. + */ + public final int getDefaultInt(String key) { + return defaultPrefs.getInt(key, 0); + } + + /** + * Get a default long preference value. + * + * @param key The preference key. + * @return The default value of the preference key or null. + */ + public final long getDefaultLong(String key) { + return defaultPrefs.getLong(key, 0); + } + + /** + * Set a String preference value. If the value is null or is equal to + * the default value, the entry will be removed. + *

+ * A {@link PreferenceChangeEvent} is fired, if the value has changed. + * + * @param key The preference key. + * @return The value of the preference key. + */ + public void putString(String key, String value) { + String defValue = defaultPrefs.get(key, null); + String instValue = getString(key); + if (value == null || value.equals(defValue)) { + contextScopePrefs.remove(key); + flushAndNotify(contextScopePrefs, key, instValue, defValue); + } + else if (!value.equals(instValue)) { + contextScopePrefs.put(key, value); + flushAndNotify(contextScopePrefs, key, instValue, value); + } + } + + /** + * Set a boolean preference value. If the value is equal the default value, + * the entry will be removed. + *

+ * A {@link PreferenceChangeEvent} is fired, if the value has changed. + * + * @param key The preference key. + * @return The value of the preference key. + */ + public void putBoolean(String key, boolean value) { + boolean defValue = defaultPrefs.getBoolean(key, false); + boolean instValue = getBoolean(key); + if (value == defValue) { + contextScopePrefs.remove(key); + flushAndNotify(contextScopePrefs, key, Boolean.toString(instValue), Boolean.toString(defValue)); + } + else if (value != instValue) { + contextScopePrefs.putBoolean(key, value); + flushAndNotify(contextScopePrefs, key, Boolean.toString(instValue), Boolean.toString(value)); + } + } + + /** + * Set an int preference value. If the value is equal to the default value, + * the entry will be removed. + *

+ * A {@link PreferenceChangeEvent} is fired, if the value has changed. The old + * and new values are string representation in base 10. + * + * @param key The preference key. + * @return The value of the preference key. + */ + public void putInt(String key, int value) { + int defValue = defaultPrefs.getInt(key, 0); + int instValue = getInt(key); + if (value == defValue) { + contextScopePrefs.remove(key); + flushAndNotify(contextScopePrefs, key, Integer.toString(instValue), Integer.toString(defValue)); + } + else if (value != instValue) { + contextScopePrefs.putInt(key, value); + flushAndNotify(contextScopePrefs, key, Integer.toString(instValue), Integer.toString(value)); + } + } + + /** + * Set a long preference value. If the given value is equal to the default + * value, the entry will be removed. + *

+ * A {@link PreferenceChangeEvent} is fired, if the value has changed. The old + * and new values are string representation in base 10. + * + * @param key The preference key. + * @return The value of the preference key. + */ + public void putLong(String key, long value) { + long defValue = defaultPrefs.getLong(key, 0); + long instValue = getLong(key); + if (value == defValue) { + contextScopePrefs.remove(key); + flushAndNotify(contextScopePrefs, key, Long.toString(instValue), Long.toString(defValue)); + } + else if (value != instValue) { + contextScopePrefs.putLong(key, value); + flushAndNotify(contextScopePrefs, key, Long.toString(instValue), Long.toString(value)); + } + } + + /** + * Set a default String preference value. If the given value is null, + * the entry will be removed. + *

+ * A {@link PreferenceChangeEvent} is fired, if the value has changed. + * + * @param key The preference key. + * @return The default value of the preference key. + */ + public void putDefaultString(String key, String value) { + String defValue = defaultPrefs.get(key, null); + if (value == null) { + defaultPrefs.remove(key); + flushAndNotify(defaultPrefs, key, defValue, null); + } + else if (!value.equals(defValue)) { + defaultPrefs.put(key, value); + flushAndNotify(defaultPrefs, key, defValue, value); + } + } + + /** + * Set a default boolean preference value. + *

+ * A {@link PreferenceChangeEvent} is fired, if the value has changed. + * + * @param key The preference key. + * @return The default value of the preference key. + */ + public void putDefaultBoolean(String key, boolean value) { + boolean defValue = defaultPrefs.getBoolean(key, false); + if (value != defValue) { + defaultPrefs.putBoolean(key, value); + flushAndNotify(defaultPrefs, key, Boolean.toString(defValue), Boolean.toString(value)); + } + } + + /** + * Set a default int preference value. + *

+ * A {@link PreferenceChangeEvent} is fired, if the value has changed. The old + * and new values are string representation in base 10. + * + * @param key The preference key. + * @return The default value of the preference key. + */ + public void putDefaultInt(String key, int value) { + int defValue = defaultPrefs.getInt(key, 0); + if (value != defValue) { + defaultPrefs.putInt(key, value); + flushAndNotify(defaultPrefs, key, Integer.toString(defValue), Integer.toString(value)); + } + } + + /** + * Set a default long preference value. + *

+ * A {@link PreferenceChangeEvent} is fired, if the value has changed. The old + * and new values are string representation in base 10. + * + * @param key The preference key. + * @return The default value of the preference key. + */ + public void putDefaultLong(String key, long value) { + long defValue = defaultPrefs.getLong(key, 0); + if (value != defValue) { + defaultPrefs.putLong(key, value); + flushAndNotify(defaultPrefs, key, Long.toString(defValue), Long.toString(value)); + } + } + + /** + * Write back the changes to the store and notify all listeners about the changed key. + * + * @param node The preference node which has changed. Must not be null. + * @param key The key of the changed preference. Must not be null. + * @param oldValue The old value as a {@link String}, or null. + * @param newValue The new value as a {@link String}, or null. + */ + protected final void flushAndNotify(IEclipsePreferences node, String key, String oldValue, String newValue) { + // Flush the preferences to the persistence store + try { node.flush(); } catch (BackingStoreException e) { /* Ignored on purpose */ } + + // Notify the listeners + firePreferenceEvent(node, key, oldValue, newValue); + } + + /** + * Register the given listener to receive notifications of preference changes to this node. + * Calling this method multiple times with the same listener has no effect. The given listener + * argument must not be null. + * + * @param listener The preference change listener. Must not be null. + */ + public void addPreferenceChangeListener(IPreferenceChangeListener listener) { + Assert.isNotNull(listener); + listeners.add(listener); + } + + /** + * De-register the given listener from receiving notifications of preference changes + * to this node. Calling this method multiple times with the same listener has no + * effect. The given listener argument must not be null. + * + * @param listener The preference change listener. Must not be null. + */ + public void removePreferenceChangeListener(IPreferenceChangeListener listener) { + Assert.isNotNull(listener); + listeners.remove(listener); + } + + /** + * Convenience method for notifying the registered preference change listeners. + * + * @param node The preference node which has changed. Must not be null. + * @param key The key of the changed preference. Must not be null. + * @param oldValue The old value as a {@link String}, or null. + * @param newValue The new value as a {@link String}, or null. + */ + protected void firePreferenceEvent(IEclipsePreferences node, String key, String oldValue, String newValue) { + Assert.isNotNull(node); + Assert.isNotNull(key); + + // If no listener is registered, we are done here + if (listeners.isEmpty()) return; + + // Get the list or currently registered listeners + Object[] l = listeners.getListeners(); + // Create the preference change event + final PreferenceChangeEvent event = new PreferenceChangeEvent(node, key, oldValue, newValue); + for (int i = 0; i < l.length; i++) { + final IPreferenceChangeListener listener = (IPreferenceChangeListener) l[i]; + ISafeRunnable job = new ISafeRunnable() { + @Override + public void handleException(Throwable exception) { + // already logged in Platform#run() + } + + @Override + public void run() throws Exception { + listener.preferenceChange(event); + } + }; + SafeRunner.run(job); + } + } + +} diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/tracing/TraceHandler.java b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/tracing/TraceHandler.java new file mode 100644 index 00000000000..fcce8ab071d --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/tracing/TraceHandler.java @@ -0,0 +1,295 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.core.terminals.tracing; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.tcf.te.core.terminals.activator.CoreBundleActivator; + +/** + * Helper class to handle tracing using the platforms debug capabilities. + */ +public class TraceHandler { + /** + * The bundle identifier. + */ + private final String identifier; + + /** + * The tracer instance. + */ + private Tracer tracer = null; + + /** + * The tracer is responsible for writing the trace message to the desired + * output media. + */ + protected static class Tracer { + + /** + * The bundle identifier. + */ + private final String fIdentifier; + + /** + * The qualifier for the default "<bundle identifier>/debugmode" + * tracing slot. + */ + private final String fDebugModeQualifier; + + /** + * Constructor. + * + * @param identifier The bundle identifier. Must not be null. + */ + public Tracer(String identifier) { + Assert.isNotNull(identifier); + fIdentifier = identifier; + + // Initialize the debug mode qualifier + fDebugModeQualifier = fIdentifier + "/debugmode"; //$NON-NLS-1$ + } + + /** + * Returns the value of the debug mode tracing slot. + *

+ * If not set, or the value is not an {@link Integer}, the method returns 0. + * + * @return The debug mode value. + */ + protected int getDebugMode() { + try { + String mode = Platform.getDebugOption(fDebugModeQualifier); + if (mode != null && Integer.decode(mode).intValue() > 0) { + return Integer.decode(mode).intValue(); + } + } catch (NumberFormatException e) { /* ignored on purpose */ } + + return 0; + } + + /** + * Check if the specified trace slot is enabled. + * + * @param slotId The name of the slot. + * @return true if the slot is defined and enabled, false otherwise. + */ + protected boolean isSlotEnabled(String slotId) { + return fIdentifier != null ? Boolean.parseBoolean(Platform.getDebugOption(fIdentifier + "/" + slotId)) : false; //$NON-NLS-1$ + } + + /** + * Check if tracing is enabled for given mode and slot. + * + * @param debugMode The debug mode for the current debug. + * @param slotId The name of the slot. + * + * @return true if the debug should be written, false otherwise. + */ + protected final boolean isEnabled(int debugMode, String slotId) { + return getDebugMode() < 0 || + (debugMode <= getDebugMode() && + (slotId == null || slotId.trim().length() == 0 || isSlotEnabled(slotId))); + } + + /** + * Format the trace message. + * + * @param message The trace message. + * @param debugMode The debug mode. + * @param slotId The name of the slot. + * @param severity The severity. See {@link IStatus} for valid severity values. + * @param clazz The class that calls this tracer. + * + * @see IStatus + */ + protected String getFormattedDebugMessage(String message, int debugMode, String slotId, int severity, Object clazz) { + StringBuffer debug = new StringBuffer(); + if (slotId != null || clazz != null) { + if (clazz != null) { + String name = clazz instanceof Class ? ((Class)clazz).getSimpleName() : clazz.getClass().getSimpleName(); + debug.append(name.trim().length() > 0 ? name.trim() : clazz instanceof Class ? ((Class)clazz).getName() : clazz.getClass().getName()); + } + if (slotId != null) { + debug.append(" at "); //$NON-NLS-1$ + debug.append(slotId); + } + if (debugMode >= 0) { + debug.append(" (Mode "); //$NON-NLS-1$ + debug.append(debugMode); + debug.append(')'); + } + debug.append('\n'); + debug.append('\t'); + } + debug.append(message); + + return debug.toString(); + } + + /** + * Write the trace message. + * + * @param message The trace message. + * @param debugMode The debug mode. + * @param slotId The name of the slot. + * @param severity The severity. See {@link IStatus} for valid severity values. + * @param clazz The class that calls this tracer. + * + * @see IStatus + */ + protected void write(String message, int debugMode, String slotId, int severity, Object clazz) { + String formattedMessage = getFormattedDebugMessage(message, debugMode, slotId, severity, clazz); + if (severity == IStatus.ERROR || severity == IStatus.WARNING) { + System.err.println(formattedMessage); + } + else { + System.out.println(formattedMessage); + } + } + + /** + * Trace the given message with the given debug mode and slot. + * + * @param message The trace message. + * @param debugMode The debug mode. + * @param slotId The name of the slot. + * @param severity The severity. See {@link IStatus} for valid severity values. + * @param clazz The class that calls this tracer. + * + * @see IStatus + */ + public final void trace(String message, int debugMode, String slotId, int severity, Object clazz) { + if (isEnabled(debugMode, slotId)) { + write(message, debugMode, slotId, severity, clazz); + } + } + } + + /** + * Constructor. + *

+ * Initializes the tracing handler with the given bundle identifier. + * + * @param identifier The bundle identifier or null. + */ + public TraceHandler(String identifier) { + this.identifier = identifier != null ? identifier : CoreBundleActivator.getUniqueIdentifier(); + Assert.isNotNull(this.identifier); + } + + /** + * Returns the identifier. + */ + protected final String getIdentifier() { + return identifier; + } + + /** + * Returns the tracer instance. Create a new tracer instance + * on first invocation. + * + * @return The tracer instance. + */ + protected Tracer getTracer() { + if (tracer == null) { + tracer = new Tracer(identifier); + } + return tracer; + } + + /** + * Return the current debug mode. + */ + public final int getDebugMode() { + return getTracer().getDebugMode(); + } + + /** + * Check whether a trace slot is enabled. The debug mode defaults + * to 0. + * + * @param slotId The name of the slot. + * + * @return true if the slot is enabled, false otherwise. + */ + public final boolean isSlotEnabled(String slotId) { + return isSlotEnabled(0, slotId); + } + + /** + * Check whether a trace slot is enabled with the given debug mode. + * + * @param debugMode The debug mode + * @param slotId The name of the slot. + * + * @return true if the slot is enabled, false otherwise. + */ + public final boolean isSlotEnabled(int debugMode, String slotId) { + return getTracer().isEnabled(debugMode, slotId); + } + + /** + * Trace the given message. + *

+ * The message severity will be {@link IStatus#INFO} and the message will be + * traced unconditionally. + * + * @param message The message. + * @param clazz The class that calls this tracer or null. + */ + public final void trace(String message, Object clazz) { + getTracer().trace(message, 0, null, IStatus.INFO, clazz); + } + + /** + * Trace the given message. + *

+ * The message severity will be {@link IStatus#INFO}. + * + * @param message The message. + * @param debugMode The minimum debug mode that has to be set to write out the message. + * @param clazz The class that calls this tracer or null. + */ + public final void trace(String message, int debugMode, Object clazz) { + getTracer().trace(message, debugMode, null, IStatus.INFO, clazz); + } + + /** + * Trace the given message. + *

+ * The message severity will be {@link IStatus#INFO} and the debug mode + * will default to 0. + * + * @param message The message. + * @param slotId The slot that has to be enabled to write out the message. + * @param clazz The class that calls this tracer or null. + */ + public final void trace(String message, String slotId, Object clazz) { + getTracer().trace(message, 0, slotId, IStatus.INFO, clazz); + } + + /** + * Trace the given message. + * + * @param message The message. + * @param debugMode The minimum debug mode that has to be set to write out the message. + * @param slotId The slot that has to be enabled to write out the message. + * @param severity The severity. See {@link IStatus} for valid severity values. + * @param clazz The class that calls this tracer or null. + * + * @see IStatus + */ + public final void trace(String message, int debugMode, String slotId, int severity, Object clazz) { + getTracer().trace(message, debugMode, slotId, severity, clazz); + } + +} diff --git a/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/utils/Env.java b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/utils/Env.java new file mode 100644 index 00000000000..2605d765812 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/utils/Env.java @@ -0,0 +1,231 @@ +/******************************************************************************* + * Copyright (c) 2013, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.core.terminals.utils; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.Platform; +import org.eclipse.osgi.service.environment.Constants; + +/** + * Environment handling utility methods. + */ +public class Env { + + // Reference to the monitor to lock if determining the native environment + private final static Object ENV_GET_MONITOR = new Object(); + + // Reference to the native environment with the case of the variable names preserved + private static Map nativeEnvironmentCasePreserved = null; + + /** + * Returns the merged environment of the native environment and the passed + * in environment. Passed in variables will overwrite the native environment + * if the same variables are set there. + *

+ * For use with terminals, the parameter terminal should be set to + * true. In this case, the method will assure that the TERM + * environment variable is always set to ANSI and is not overwritten + * by the passed in environment. + * + * @param envp The environment to set on top of the native environment or null. + * @param terminal True if used with an terminal, false otherwise. + * + * @return The merged environment. + */ + public static String[] getEnvironment(String[] envp, boolean terminal) { + // Get the cached native environment + Map nativeEnv = getNativeEnvironmentCasePreserved(); + // Make a copy of the native environment so it can be manipulated without changing + // the cached environment + Map env = new LinkedHashMap(nativeEnv); + // Set the TERM environment variable if in terminal mode + if (terminal) env.put("TERM", "xterm"); //$NON-NLS-1$ //$NON-NLS-2$ + + // On Windows, the environment variable names are not case-sensitive. However, + // we desire to preserve the original case. Build up a translation map between + // an all lowercase name and the original environment name + Map k2n = null; + if (Platform.OS_WIN32.equals(Platform.getOS())) { + k2n = new HashMap(); + for (String name : env.keySet()) { + k2n.put(name.toLowerCase(), name); + } + } + + // If a "local" environment is provided, merge it with the native + // environment. + if (envp != null) { + for (int i = 0; i < envp.length; i++) { + // The full provided variable in form "name=value" + String envpPart = envp[i]; + // Split the variable + String[] parts = envpPart.split("=");//$NON-NLS-1$ + String name = parts[0].trim(); + // Map the variable name to the real environment name (Windows only) + if (Platform.OS_WIN32.equals(Platform.getOS())) { + if (k2n.containsKey(name.toLowerCase())) { + String candidate = k2n.get(name.toLowerCase()); + Assert.isNotNull(candidate); + name = candidate; + } + // Filter out environment variables with bad names + if ("".equals(name.trim()) || name.contains("=") || name.contains(":")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + continue; + } + } + // Get the variable value + String value = parts.length > 1 ? parts[1].trim() : ""; //$NON-NLS-1$ + // Don't overwrite the TERM variable if in terminal mode + if (terminal && "TERM".equals(name)) continue; //$NON-NLS-1$ + // If a variable with the name does not exist, just append it + if (!env.containsKey(name) && !"".equals(value)) { //$NON-NLS-1$ + env.put(name, value); + } else if (env.containsKey(name)) { + // If the value contains the special placeholder "", remove the variable from the environment + if ("".equals(value)) {//$NON-NLS-1$ + env.remove(name); + } else { + // A variable with the name already exist, check if the value is different + String oldValue = env.get(name); + if (oldValue != null && !oldValue.equals(value) || oldValue == null && value != null) { + env.put(name, value); + } + } + } + } + } + + // Convert into an array of strings + List keys = new ArrayList(env.keySet()); + // On Windows hosts, sort the environment keys + if (Platform.OS_WIN32.equals(Platform.getOS())) Collections.sort(keys); + Iterator iter = keys.iterator(); + List strings = new ArrayList(env.size()); + StringBuilder buffer = null; + while (iter.hasNext()) { + String key = iter.next(); + buffer = new StringBuilder(key); + buffer.append('=').append(env.get(key)); + strings.add(buffer.toString()); + } + + return strings.toArray(new String[strings.size()]); + } + + /** + * Determine the native environment. + * + * @return The native environment, or an empty map. + */ + private static Map getNativeEnvironmentCasePreserved() { + synchronized (ENV_GET_MONITOR) { + if (nativeEnvironmentCasePreserved == null) { + nativeEnvironmentCasePreserved = new LinkedHashMap(); + cacheNativeEnvironment(nativeEnvironmentCasePreserved); + } + return new LinkedHashMap(nativeEnvironmentCasePreserved); + } + } + + /** + * Query the native environment and store it to the specified cache. + * + * @param cache The environment cache. Must not be null. + */ + private static void cacheNativeEnvironment(Map cache) { + Assert.isNotNull(cache); + + try { + String nativeCommand = null; + if (Platform.getOS().equals(Constants.OS_WIN32)) { + nativeCommand = "cmd.exe /C set"; //$NON-NLS-1$ + } else if (!Platform.getOS().equals(Constants.OS_UNKNOWN)) { + nativeCommand = "env"; //$NON-NLS-1$ + } + if (nativeCommand == null) { return; } + Process process = Runtime.getRuntime().exec(nativeCommand); + + // read process directly on other platforms + // we need to parse out matching '{' and '}' for function declarations in .bash environments + // pattern is [function name]=() { and we must find the '}' on its own line with no trailing ';' + InputStream stream = process.getInputStream(); + InputStreamReader isreader = new InputStreamReader(stream); + BufferedReader reader = new BufferedReader(isreader); + try { + String line = reader.readLine(); + String key = null; + String value = null; + while (line != null) { + int func = line.indexOf("=()"); //$NON-NLS-1$ + if (func > 0) { + key = line.substring(0, func); + // scan until we find the closing '}' with no following chars + value = line.substring(func + 1); + while (line != null && !line.equals("}")) { //$NON-NLS-1$ + line = reader.readLine(); + if (line != null) { + value += line; + } + } + line = reader.readLine(); + } else { + int separator = line.indexOf('='); + if (separator > 0) { + key = line.substring(0, separator); + value = line.substring(separator + 1); + StringBuilder bufValue = new StringBuilder(value); + line = reader.readLine(); + if (line != null) { + // this line has a '=' read ahead to check next line for '=', might be broken on more + // than one line + separator = line.indexOf('='); + while (separator < 0) { + bufValue.append(line.trim()); + line = reader.readLine(); + if (line == null) { + // if next line read is the end of the file quit the loop + break; + } + separator = line.indexOf('='); + } + } + value = bufValue.toString(); + } + } + if (key != null) { + cache.put(key, value); + key = null; + value = null; + } else { + line = reader.readLine(); + } + } + } finally { + reader.close(); + } + } catch (IOException e) { + // Native environment-fetching code failed. + // This can easily happen and is not useful to log. + } + } + +} diff --git a/plugins/org.eclipse.tcf.te.core.terminals/te-feature.png b/plugins/org.eclipse.tcf.te.core.terminals/te-feature.png new file mode 100644 index 00000000000..8e1143d7de2 Binary files /dev/null and b/plugins/org.eclipse.tcf.te.core.terminals/te-feature.png differ diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/.classpath b/plugins/org.eclipse.tcf.te.ui.terminals.local/.classpath new file mode 100644 index 00000000000..ad32c83a788 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/.options b/plugins/org.eclipse.tcf.te.ui.terminals.local/.options new file mode 100644 index 00000000000..b396734183f --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/.options @@ -0,0 +1 @@ +org.eclipse.tcf.te.ui.terminals.local/debugmode = 0 diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/.project b/plugins/org.eclipse.tcf.te.ui.terminals.local/.project new file mode 100644 index 00000000000..f86fbb751ca --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/.project @@ -0,0 +1,39 @@ + + + org.eclipse.tcf.te.ui.terminals.local + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + + + 0 + + 10 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-target + + + + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..24dad4464e4 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,362 @@ +#Tue Oct 11 11:53:38 CEST 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=warning +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=0 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=0 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=100 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true +org.eclipse.jdt.core.formatter.lineSplit=100 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000000..88bb9570e83 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,56 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_Target Explorer Java STD +formatter_settings_version=12 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=false +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.pde.prefs b/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.pde.prefs new file mode 100644 index 00000000000..cf80c8bc5b8 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/.settings/org.eclipse.pde.prefs @@ -0,0 +1,32 @@ +compilers.f.unresolved-features=1 +compilers.f.unresolved-plugins=1 +compilers.incompatible-environment=1 +compilers.p.build=1 +compilers.p.build.bin.includes=1 +compilers.p.build.encodings=2 +compilers.p.build.java.compiler=2 +compilers.p.build.java.compliance=1 +compilers.p.build.missing.output=2 +compilers.p.build.output.library=1 +compilers.p.build.source.library=1 +compilers.p.build.src.includes=1 +compilers.p.deprecated=1 +compilers.p.discouraged-class=1 +compilers.p.internal=1 +compilers.p.missing-packages=1 +compilers.p.missing-version-export-package=2 +compilers.p.missing-version-import-package=1 +compilers.p.missing-version-require-bundle=1 +compilers.p.no-required-att=0 +compilers.p.not-externalized-att=2 +compilers.p.unknown-attribute=1 +compilers.p.unknown-class=1 +compilers.p.unknown-element=1 +compilers.p.unknown-identifier=1 +compilers.p.unknown-resource=1 +compilers.p.unresolved-ex-points=0 +compilers.p.unresolved-import=0 +compilers.s.create-docs=false +compilers.s.doc-folder=doc +compilers.s.open-tags=1 +eclipse.preferences.version=1 diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/MANIFEST.MF b/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..84f9ad6ac24 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/MANIFEST.MF @@ -0,0 +1,30 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.tcf.te.ui.terminals.local;singleton:=true +Bundle-Version: 1.3.0.qualifier +Bundle-Activator: org.eclipse.tcf.te.ui.terminals.local.activator.UIPlugin +Bundle-Vendor: %providerName +Import-Package: org.eclipse.cdt.utils.pty;mandatory:=native +Require-Bundle: org.eclipse.cdt.core;bundle-version="5.6";resolution:=optional, + org.eclipse.core.expressions;bundle-version="3.4.400", + org.eclipse.core.resources;bundle-version="3.8.1";resolution:=optional, + org.eclipse.core.runtime;bundle-version="3.8.0", + org.eclipse.core.variables;bundle-version="3.2.600", + org.eclipse.debug.ui;bundle-version="3.8.1";resolution:=optional, + org.eclipse.tcf.te.core.terminals;bundle-version="1.3.0", + org.eclipse.tcf.te.ui.terminals;bundle-version="1.3.0", + org.eclipse.tcf.te.ui.terminals.process;bundle-version="1.3.0", + org.eclipse.tm.terminal;bundle-version="3.3.1", + org.eclipse.ui;bundle-version="3.8.0" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Bundle-Localization: plugin +Export-Package: org.eclipse.tcf.te.ui.terminals.local.activator;x-internal:=true, + org.eclipse.tcf.te.ui.terminals.local.controls, + org.eclipse.tcf.te.ui.terminals.local.help, + org.eclipse.tcf.te.ui.terminals.local.launcher, + org.eclipse.tcf.te.ui.terminals.local.nls;x-internal:=true, + org.eclipse.tcf.te.ui.terminals.local.showin, + org.eclipse.tcf.te.ui.terminals.local.showin.interfaces, + org.eclipse.tcf.te.ui.terminals.local.showin.preferences diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/p2.inf b/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/p2.inf new file mode 100644 index 00000000000..9bd5194fa74 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/p2.inf @@ -0,0 +1,82 @@ +############################################################################### +# Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +############################################################################### + +# Most of the dependencies exposed here are actually covered in the feature.xml +# This file ensures that the current bundle has all it needs, even if installed +# without the enclosing org.eclipse.tcf.te.terminals.feature . +# See also https://bugs.eclipse.org/bugs/show_bug.cgi?id=435150 . + +# 1. Make the optional cdt.core dependency non-greedy: Use (or update to proper +# version!) when installed, but do not install automatically since the newer +# org.eclipse.cdt.core.native can satisfy the dependency better. We use this +# trick since CDT 8.3 had no version on export-package yet but we do want +# a version constraint. +requires.0.namespace = org.eclipse.equinox.p2.iu +requires.0.name = org.eclipse.cdt.core +#requires.0.range = [5.6, 6.0) +requires.0.greedy = false +requires.0.optional = true + +#requires.1.namespace = org.eclipse.equinox.p2.iu +#requires.1.name = org.eclipse.cdt.core.native +#requires.1.range = [5.6, 6.0) +#requires.1.greedy = true +#requires.1.optional = true + +# 2. Add the required fragments for local terminal support with proper version. +requires.2.namespace = org.eclipse.equinox.p2.iu +requires.2.name = org.eclipse.cdt.core.aix +#requires.2.range = [5.3, 6.0) +requires.2.filter = (osgi.os=aix) + +requires.3.namespace = org.eclipse.equinox.p2.iu +requires.3.name = org.eclipse.cdt.core.linux +#requires.3.range = [5.2, 6.0) +requires.3.filter = (osgi.os=linux) + +requires.4.namespace = org.eclipse.equinox.p2.iu +requires.4.name = org.eclipse.cdt.core.linux.ppc64 +#requires.4.range = [5.1, 6.0) +requires.4.filter = (&(osgi.os=linux)(osgi.arch=ppc64)) + +requires.5.namespace = org.eclipse.equinox.p2.iu +requires.5.name = org.eclipse.cdt.core.linux.x86 +#requires.5.range = [5.2, 6.0) +requires.5.filter = (&(osgi.os=linux)(osgi.arch=x86)) + +requires.6.namespace = org.eclipse.equinox.p2.iu +requires.6.name = org.eclipse.cdt.core.linux.x86_64 +#requires.6.range = [5.2, 6.0) +requires.6.filter = (&(osgi.os=linux)(osgi.arch=x86_64)) + +requires.7.namespace = org.eclipse.equinox.p2.iu +requires.7.name = org.eclipse.cdt.core.macosx +#requires.7.range = [5.2, 6.0) +requires.7.filter = (osgi.os=macosx) + +requires.8.namespace = org.eclipse.equinox.p2.iu +requires.8.name = org.eclipse.cdt.core.solaris +#requires.8.range = [5.2, 6.0) +requires.8.filter = (&(osgi.os=solaris)(osgi.arch=sparc)) + +requires.9.namespace = org.eclipse.equinox.p2.iu +requires.9.name = org.eclipse.cdt.core.win32 +#requires.9.range = [5.3, 6.0) +requires.9.filter = (osgi.os=win32) + +requires.10.namespace = org.eclipse.equinox.p2.iu +requires.10.name = org.eclipse.cdt.core.win32.x86 +#requires.10.range = [5.2, 6.0) +requires.10.filter = (&(osgi.os=win32)(osgi.arch=x86)) + +requires.11.namespace = org.eclipse.equinox.p2.iu +requires.11.name = org.eclipse.cdt.core.win32.x86_64 +#requires.11.range = [5.2, 6.0) +requires.11.filter = (&(osgi.os=win32)(osgi.arch=x86_64)) diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/about.html b/plugins/org.eclipse.tcf.te.ui.terminals.local/about.html new file mode 100644 index 00000000000..0f07cf034df --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

May 24, 2012

+

License

+ +

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 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +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 http://www.eclipse.org.

+ + + \ No newline at end of file diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/build.properties b/plugins/org.eclipse.tcf.te.ui.terminals.local/build.properties new file mode 100644 index 00000000000..a17f48f7453 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/build.properties @@ -0,0 +1,17 @@ +############################################################################### +# Copyright (c) 2012, 2014 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +############################################################################### +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + plugin.properties,\ + about.html,\ + icons/ diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/contexts.xml b/plugins/org.eclipse.tcf.te.ui.terminals.local/contexts.xml new file mode 100644 index 00000000000..2dbe1516c5b --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/contexts.xml @@ -0,0 +1,6 @@ + + + + Add or modify an external executable added to the 'Show In' context menu. + + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/icons/eview16/terminal_view.gif b/plugins/org.eclipse.tcf.te.ui.terminals.local/icons/eview16/terminal_view.gif new file mode 100644 index 00000000000..bbb6a9e153e Binary files /dev/null and b/plugins/org.eclipse.tcf.te.ui.terminals.local/icons/eview16/terminal_view.gif differ diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.properties b/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.properties new file mode 100644 index 00000000000..ceb5be00523 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.properties @@ -0,0 +1,23 @@ +################################################################################## +# Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +################################################################################## + +pluginName = Terminals Local Connector +providerName = Eclipse.org - Target Explorer + +# ----- Commands and Menu contributions ----- +LocalLauncherDelegate.label=Local Terminal + +command.launch.name=Open Local Terminal on Selection + +menu.showIn.localterminal.label = Terminals + +# ----- Preference Pages ----- + +preference.page.name=Local Terminal diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.xml b/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.xml new file mode 100644 index 00000000000..45808813c7c --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.xml @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/pom.xml b/plugins/org.eclipse.tcf.te.ui.terminals.local/pom.xml new file mode 100644 index 00000000000..144c83e1fc1 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + + org.eclipse.tcf + org.eclipse.tcf.maven-build + 1.3.0-SNAPSHOT + ../../../admin/pom-build.xml + + + 1.3.0.qualifier + org.eclipse.tcf.te.ui.terminals.local + eclipse-plugin + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/activator/UIPlugin.java b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/activator/UIPlugin.java new file mode 100644 index 00000000000..80de64f1c4c --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/activator/UIPlugin.java @@ -0,0 +1,127 @@ +/******************************************************************************* + * Copyright (c) 2012 - 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.local.activator; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.graphics.Image; +import org.eclipse.tcf.te.core.terminals.preferences.ScopedEclipsePreferences; +import org.eclipse.tcf.te.core.terminals.tracing.TraceHandler; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class UIPlugin extends AbstractUIPlugin { + // The shared instance + private static UIPlugin plugin; + // The scoped preferences instance + private static volatile ScopedEclipsePreferences scopedPreferences; + // The trace handler instance + private static volatile TraceHandler traceHandler; + + /** + * The constructor + */ + public UIPlugin() { + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static UIPlugin getDefault() { + return plugin; + } + + /** + * Convenience method which returns the unique identifier of this plug-in. + */ + public static String getUniqueIdentifier() { + if (getDefault() != null && getDefault().getBundle() != null) { + return getDefault().getBundle().getSymbolicName(); + } + return "org.eclipse.tcf.te.ui.terminals.local"; //$NON-NLS-1$ + } + + /** + * Return the scoped preferences for this plug-in. + */ + public static ScopedEclipsePreferences getScopedPreferences() { + if (scopedPreferences == null) { + scopedPreferences = new ScopedEclipsePreferences(getUniqueIdentifier()); + } + return scopedPreferences; + } + + /** + * Returns the bundles trace handler. + * + * @return The bundles trace handler. + */ + public static TraceHandler getTraceHandler() { + if (traceHandler == null) { + traceHandler = new TraceHandler(getUniqueIdentifier()); + } + return traceHandler; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + scopedPreferences = null; + traceHandler = null; + super.stop(context); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry) + */ + @Override + protected void initializeImageRegistry(ImageRegistry registry) { + super.initializeImageRegistry(registry); + } + + /** + * Loads the image registered under the specified key from the image + * registry and returns the 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/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java new file mode 100644 index 00000000000..63f452e9c77 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java @@ -0,0 +1,194 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.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.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.swt.SWT; +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.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer; +import org.eclipse.tcf.te.ui.terminals.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); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#setupPanel(org.eclipse.swt.widgets.Composite) + */ + @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)) setEncoding(encoding); //$NON-NLS-1$ + } + + // 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); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#setupData(java.util.Map) + */ + @Override + public void setupData(Map data) { + if (data == null) return; + + String value = (String)data.get(ITerminalsConnectorConstants.PROP_ENCODING); + if (value != null) setEncoding(value); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#extractData(java.util.Map) + */ + @Override + public void extractData(Map data) { + // set the terminal connector id for local terminal + data.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tcf.te.ui.terminals.local.LocalConnector"); //$NON-NLS-1$ + + // Store the encoding + data.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding()); + + Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$ + if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) { + // if we have a IResource selection use the location for working directory + if (resource instanceof org.eclipse.core.resources.IResource){ + String dir = ((org.eclipse.core.resources.IResource)resource).getProject().getLocation().toString(); + data.put(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR, dir); + } + } + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#fillSettingsForHost(java.lang.String) + */ + @Override + protected void fillSettingsForHost(String host){ + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#saveSettingsForHost(boolean) + */ + @Override + protected void saveSettingsForHost(boolean add){ + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel#isValid() + */ + @Override + public boolean isValid(){ + return true; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String) + */ + @Override + public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) { + // Save the encodings widget values + doSaveEncodingsWidgetValues(settings, idPrefix); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String) + */ + @Override + public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) { + // Restore the encodings widget values + doRestoreEncodingsWidgetValues(settings, idPrefix); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#getHostFromSettings() + */ + @Override + protected String getHostFromSettings() { + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#isWithHostList() + */ + @Override + public boolean isWithHostList() { + return false; + } + + /** + * Returns the IResource from the current selection + * + * @return the IResource, or null. + */ + 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 (org.eclipse.core.resources.IResource) ((IAdaptable) element).getAdapter(org.eclipse.core.resources.IResource.class); + } + } + return null; + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/help/IContextHelpIds.java b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/help/IContextHelpIds.java new file mode 100644 index 00000000000..5f7b4108173 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/help/IContextHelpIds.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.local.help; + +import org.eclipse.tcf.te.ui.terminals.local.activator.UIPlugin; + + +/** + * UI Context help id definitions. + */ +public interface IContextHelpIds { + + /** + * UI plug-in common context help id prefix. + */ + public final static String PREFIX = UIPlugin.getUniqueIdentifier() + "."; //$NON-NLS-1$ + + /** + * External executables dialog. + */ + public final static String EXTERNAL_EXECUTABLES_DIALOG = PREFIX + "ExternalExecutablesDialog"; //$NON-NLS-1$ +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java new file mode 100644 index 00000000000..1baa6bf4e31 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java @@ -0,0 +1,402 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.local.launcher; + +import java.io.File; +import java.net.InetAddress; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.UnknownHostException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.eclipse.cdt.utils.pty.PTY; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.URIUtil; +import org.eclipse.core.variables.IStringVariableManager; +import org.eclipse.core.variables.VariablesPlugin; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.tcf.te.core.terminals.TerminalServiceFactory; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalServiceOutputStreamMonitorListener; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ILineSeparatorConstants; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer; +import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler; +import org.eclipse.tcf.te.ui.terminals.internal.SettingsStore; +import org.eclipse.tcf.te.ui.terminals.launcher.AbstractLauncherDelegate; +import org.eclipse.tcf.te.ui.terminals.local.activator.UIPlugin; +import org.eclipse.tcf.te.ui.terminals.local.controls.LocalWizardConfigurationPanel; +import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IPreferenceKeys; +import org.eclipse.tcf.te.ui.terminals.process.ProcessSettings; +import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore; +import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector; +import org.eclipse.tm.internal.terminal.provisional.api.TerminalConnectorExtension; +import org.eclipse.ui.ISelectionService; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.WorkbenchEncoding; +import org.osgi.framework.Bundle; + +/** + * Serial launcher delegate implementation. + */ +@SuppressWarnings("restriction") +public class LocalLauncherDelegate extends AbstractLauncherDelegate { + + private final IMementoHandler mementoHandler = new LocalMementoHandler(); + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#needsUserConfiguration() + */ + @Override + public boolean needsUserConfiguration() { + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer) + */ + @Override + public IConfigurationPanel getPanel(IConfigurationPanelContainer container) { + return new LocalWizardConfigurationPanel(container); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#execute(java.util.Map, org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done) + */ + @Override + public void execute(Map properties, Done done) { + Assert.isNotNull(properties); + + // Set the terminal tab title + String terminalTitle = getTerminalTitle(properties); + if (terminalTitle != null) { + properties.put(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle); + } + + // If not configured, set the default encodings for the local terminal + if (!properties.containsKey(ITerminalsConnectorConstants.PROP_ENCODING)) { + String encoding = null; + // 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())) { + encoding = "UTF-8"; //$NON-NLS-1$ + } else { + encoding = WorkbenchEncoding.getWorkbenchDefaultEncoding(); + } + if (encoding != null && !"".equals(encoding)) properties.put(ITerminalsConnectorConstants.PROP_ENCODING, encoding); //$NON-NLS-1$ + } + + // For local terminals, force a new terminal tab each time it is launched, + // if not set otherwise from outside + if (!properties.containsKey(ITerminalsConnectorConstants.PROP_FORCE_NEW)) { + properties.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, Boolean.TRUE); + } + + // Initialize the local terminal working directory. + // By default, start the local terminal in the users home directory + String initialCwd = UIPlugin.getScopedPreferences().getString(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD); + String cwd = null; + if (initialCwd == null || IPreferenceKeys.PREF_INITIAL_CWD_USER_HOME.equals(initialCwd) || "".equals(initialCwd.trim())) { //$NON-NLS-1$ + cwd = System.getProperty("user.home"); //$NON-NLS-1$ + } else if (IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_HOME.equals(initialCwd)) { + String eclipseHomeLocation = System.getProperty("eclipse.home.location"); //$NON-NLS-1$ + if (eclipseHomeLocation != null) { + try { + URI uri = URIUtil.fromString(eclipseHomeLocation); + File f = URIUtil.toFile(uri); + cwd = f.getAbsolutePath(); + } catch (URISyntaxException ex) { /* ignored on purpose */ } + } + } else if (IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_WS.equals(initialCwd)) { + Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$ + if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) { + if (org.eclipse.core.resources.ResourcesPlugin.getWorkspace() != null + && org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot() != null + && org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation() != null) { + cwd = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString(); + } + } + } else { + try { + // Resolve possible dynamic variables + IStringVariableManager vm = VariablesPlugin.getDefault().getStringVariableManager(); + String resolved = vm.performStringSubstitution(initialCwd); + + IPath p = new Path(resolved); + if (p.toFile().canRead() && p.toFile().isDirectory()) { + cwd = p.toOSString(); + } + } catch (CoreException ex) { + if (Platform.inDebugMode()) { + UIPlugin.getDefault().getLog().log(ex.getStatus()); + } + } + } + + if (cwd != null && !"".equals(cwd)) { //$NON-NLS-1$ + properties.put(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR, cwd); + } + + // If the current selection resolved to an folder, default the working directory + // to that folder and update the terminal title + ISelectionService service = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService(); + if ((service != null && service.getSelection() != null) || properties.containsKey(ITerminalsConnectorConstants.PROP_SELECTION)) { + ISelection selection = (ISelection)properties.get(ITerminalsConnectorConstants.PROP_SELECTION); + if (selection == null) selection = service.getSelection(); + if (selection instanceof IStructuredSelection && !selection.isEmpty()) { + String dir = null; + Iterator iter = ((IStructuredSelection)selection).iterator(); + while (iter.hasNext()) { + Object element = iter.next(); + + Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$ + if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) { + // If the element is not an IResource, try to adapt to IResource + if (!(element instanceof org.eclipse.core.resources.IResource)) { + Object adapted = element instanceof IAdaptable ? ((IAdaptable)element).getAdapter(org.eclipse.core.resources.IResource.class) : null; + if (adapted == null) adapted = Platform.getAdapterManager().getAdapter(element, org.eclipse.core.resources.IResource.class); + if (adapted != null) element = adapted; + } + + if (element instanceof org.eclipse.core.resources.IResource && ((org.eclipse.core.resources.IResource)element).exists()) { + IPath location = ((org.eclipse.core.resources.IResource)element).getLocation(); + if (location == null) continue; + if (location.toFile().isFile()) location = location.removeLastSegments(1); + if (location.toFile().isDirectory() && location.toFile().canRead()) { + dir = location.toFile().getAbsolutePath(); + break; + } + } + + if (element instanceof IPath || element instanceof File) { + File f = element instanceof IPath ? ((IPath)element).toFile() : (File)element; + if (f.isDirectory() && f.canRead()) { + dir = f.getAbsolutePath(); + break; + } + } + } + } + if (dir != null) { + properties.put(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR, dir); + + String basename = new Path(dir).lastSegment(); + properties.put(ITerminalsConnectorConstants.PROP_TITLE, basename + " (" + terminalTitle + ")"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + } + + // Get the terminal service + ITerminalService terminal = TerminalServiceFactory.getService(); + // If not available, we cannot fulfill this request + if (terminal != null) { + terminal.openConsole(properties, done); + } + } + + /** + * Returns the terminal title string. + *

+ * The default implementation constructs a title like "Serial <port> (Start time) ". + * + * @return The terminal title string or null. + */ + private String getTerminalTitle(Map properties) { + try { + String hostname = InetAddress.getLocalHost().getHostName(); + if (hostname != null && !"".equals(hostname.trim())) { //$NON-NLS-1$ + return hostname; + } + } catch (UnknownHostException e) { /* ignored on purpose */ } + return "Local"; //$NON-NLS-1$ + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class) + */ + @Override + public Object getAdapter(Class adapter) { + if (IMementoHandler.class.equals(adapter)) { + return mementoHandler; + } + return super.getAdapter(adapter); + } + + /** + * Returns the default shell to launch. Looks at the environment + * variable "SHELL" first before assuming some default default values. + * + * @return The default shell to launch. + */ + private final File defaultShell() { + String shell = null; + if (Platform.OS_WIN32.equals(Platform.getOS())) { + if (System.getenv("ComSpec") != null && !"".equals(System.getenv("ComSpec").trim())) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + shell = System.getenv("ComSpec").trim(); //$NON-NLS-1$ + } else { + shell = "cmd.exe"; //$NON-NLS-1$ + } + } + if (shell == null) { + shell = UIPlugin.getScopedPreferences().getString(IPreferenceKeys.PREF_LOCAL_TERMINAL_DEFAULT_SHELL_UNIX); + if (shell == null || "".equals(shell)) { //$NON-NLS-1$ + if (System.getenv("SHELL") != null && !"".equals(System.getenv("SHELL").trim())) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + shell = System.getenv("SHELL").trim(); //$NON-NLS-1$ + } else { + shell = "/bin/sh"; //$NON-NLS-1$ + } + } + } + + return new File(shell); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#createTerminalConnector(java.util.Map) + */ + @Override + public ITerminalConnector createTerminalConnector(Map properties) { + Assert.isNotNull(properties); + + // Check for the terminal connector id + String connectorId = (String)properties.get(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID); + if (connectorId == null) connectorId = "org.eclipse.tcf.te.ui.terminals.local.LocalConnector"; //$NON-NLS-1$ + + // Extract the process properties using defaults + String image; + if (!properties.containsKey(ITerminalsConnectorConstants.PROP_PROCESS_PATH) + || properties.get(ITerminalsConnectorConstants.PROP_PROCESS_PATH) == null) { + File defaultShell = defaultShell(); + image = defaultShell.isAbsolute() ? defaultShell.getAbsolutePath() : defaultShell.getPath(); + } else { + image = (String)properties.get(ITerminalsConnectorConstants.PROP_PROCESS_PATH); + } + + String arguments = (String)properties.get(ITerminalsConnectorConstants.PROP_PROCESS_ARGS); + if (arguments == null && !Platform.OS_WIN32.equals(Platform.getOS())) { + arguments = UIPlugin.getScopedPreferences().getString(IPreferenceKeys.PREF_LOCAL_TERMINAL_DEFAULT_SHELL_UNIX_ARGS); + } + + // Determine if a PTY will be used + boolean isUsingPTY = (properties.get(ITerminalsConnectorConstants.PROP_PROCESS_OBJ) == null && PTY.isSupported(PTY.Mode.TERMINAL)) + || properties.get(ITerminalsConnectorConstants.PROP_PTY_OBJ) instanceof PTY; + + boolean localEcho = false; + if (!properties.containsKey(ITerminalsConnectorConstants.PROP_LOCAL_ECHO) + || !(properties.get(ITerminalsConnectorConstants.PROP_LOCAL_ECHO) instanceof Boolean)) { + // On Windows, turn on local echo by default if no PTY is used (bug 433645) + if (Platform.OS_WIN32.equals(Platform.getOS())) { + localEcho = !isUsingPTY; + } + } else { + localEcho = ((Boolean)properties.get(ITerminalsConnectorConstants.PROP_LOCAL_ECHO)).booleanValue(); + } + + String lineSeparator = null; + if (!properties.containsKey(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR) + || !(properties.get(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR) instanceof String)) { + // No line separator will be set if a PTY is used + if (!isUsingPTY) { + lineSeparator = Platform.OS_WIN32.equals(Platform.getOS()) ? ILineSeparatorConstants.LINE_SEPARATOR_CRLF : ILineSeparatorConstants.LINE_SEPARATOR_LF; + } + } else { + lineSeparator = (String)properties.get(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR); + } + + Process process = (Process)properties.get(ITerminalsConnectorConstants.PROP_PROCESS_OBJ); + PTY pty = (PTY)properties.get(ITerminalsConnectorConstants.PROP_PTY_OBJ); + ITerminalServiceOutputStreamMonitorListener[] stdoutListeners = (ITerminalServiceOutputStreamMonitorListener[])properties.get(ITerminalsConnectorConstants.PROP_STDOUT_LISTENERS); + ITerminalServiceOutputStreamMonitorListener[] stderrListeners = (ITerminalServiceOutputStreamMonitorListener[])properties.get(ITerminalsConnectorConstants.PROP_STDERR_LISTENERS); + String workingDir = (String)properties.get(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR); + + String[] envp = null; + if (properties.containsKey(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT) && + properties.get(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT) != null && + properties.get(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT) instanceof String[]){ + envp = (String[])properties.get(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT); + } + + // Set the ECLIPSE_HOME and ECLIPSE_WORKSPACE environment variables + List envpList = new ArrayList(); + if (envp != null) envpList.addAll(Arrays.asList(envp)); + + // ECLIPSE_HOME + String eclipseHomeLocation = System.getProperty("eclipse.home.location"); //$NON-NLS-1$ + if (eclipseHomeLocation != null) { + try { + URI uri = URIUtil.fromString(eclipseHomeLocation); + File f = URIUtil.toFile(uri); + envpList.add("ECLIPSE_HOME=" + f.getAbsolutePath()); //$NON-NLS-1$ + } catch (URISyntaxException e) { /* ignored on purpose */ } + } + + // ECLIPSE_WORKSPACE + Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$ + if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) { + if (org.eclipse.core.resources.ResourcesPlugin.getWorkspace() != null + && org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot() != null + && org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation() != null) { + envpList.add("ECLIPSE_WORKSPACE=" + org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString()); //$NON-NLS-1$ + } + } + + // Convert back into a string array + envp = envpList.toArray(new String[envpList.size()]); + + Assert.isTrue(image != null || process != null); + + // Construct the terminal settings store + ISettingsStore store = new SettingsStore(); + + // Construct the process settings + ProcessSettings processSettings = new ProcessSettings(); + processSettings.setImage(image); + processSettings.setArguments(arguments); + processSettings.setProcess(process); + processSettings.setPTY(pty); + processSettings.setLocalEcho(localEcho); + processSettings.setLineSeparator(lineSeparator); + processSettings.setStdOutListeners(stdoutListeners); + processSettings.setStdErrListeners(stderrListeners); + processSettings.setWorkingDir(workingDir); + processSettings.setEnvironment(envp); + + if (properties.containsKey(ITerminalsConnectorConstants.PROP_PROCESS_MERGE_ENVIRONMENT)) { + Object value = properties.get(ITerminalsConnectorConstants.PROP_PROCESS_MERGE_ENVIRONMENT); + processSettings.setMergeWithNativeEnvironment(value instanceof Boolean ? ((Boolean)value).booleanValue() : false); + } + + // And save the settings to the store + processSettings.save(store); + + // Construct the terminal connector instance + ITerminalConnector connector = TerminalConnectorExtension.makeTerminalConnector(connectorId); + if (connector != null) { + // Apply default settings + connector.makeSettingsPage(); + // And load the real settings + connector.load(store); + } + + return connector; + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherHandler.java b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherHandler.java new file mode 100644 index 00000000000..aa51e164605 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherHandler.java @@ -0,0 +1,78 @@ +/******************************************************************************* + * Copyright (c) 2014, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.local.launcher; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate; +import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IPathEditorInput; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * Local terminal launcher handler implementation. + */ +public class LocalLauncherHandler extends AbstractHandler { + + /* (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + // Get the current selection + ISelection selection = HandlerUtil.getCurrentSelection(event); + + // If the selection is not a structured selection, check if there is an active + // editor and get the path from the editor input + if (!(selection instanceof IStructuredSelection)) { + IEditorInput input = HandlerUtil.getActiveEditorInput(event); + if (input instanceof IPathEditorInput) { + IPath path = ((IPathEditorInput)input).getPath(); + if (path != null) { + if (path.toFile().isFile()) path = path.removeLastSegments(1); + if (path.toFile().isDirectory() && path.toFile().canRead()) selection = new StructuredSelection(path); + } + } + } + + // Get all applicable launcher delegates for the current selection + ILauncherDelegate[] delegates = LauncherDelegateManager.getInstance().getApplicableLauncherDelegates(selection); + // Find the local terminal launcher delegate + ILauncherDelegate delegate = null; + for (ILauncherDelegate candidate : delegates) { + if ("org.eclipse.tcf.te.ui.terminals.local.launcher.local".equals(candidate.getId())) { //$NON-NLS-1$ + delegate = candidate; + break; + } + } + + // Launch the local terminal + if (delegate != null) { + Map properties = new HashMap(); + properties.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegate.getId()); + properties.put(ITerminalsConnectorConstants.PROP_SELECTION, selection); + + delegate.execute(properties, null); + } + + return null; + } + +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalMementoHandler.java b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalMementoHandler.java new file mode 100644 index 00000000000..67f5ac618a0 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalMementoHandler.java @@ -0,0 +1,40 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.local.launcher; + +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler; +import org.eclipse.ui.IMemento; + +/** + * Local terminal connection memento handler implementation. + */ +public class LocalMementoHandler implements IMementoHandler { + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#saveState(org.eclipse.ui.IMemento, java.util.Map) + */ + @Override + public void saveState(IMemento memento, Map properties) { + Assert.isNotNull(memento); + Assert.isNotNull(properties); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#restoreState(org.eclipse.ui.IMemento, java.util.Map) + */ + @Override + public void restoreState(IMemento memento, Map properties) { + Assert.isNotNull(memento); + Assert.isNotNull(properties); + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.java b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.java new file mode 100644 index 00000000000..aff56bf5b6a --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2011 - 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.local.nls; + +import org.eclipse.osgi.util.NLS; + +/** + * Process terminal connector plug-in externalized strings management. + */ +public class Messages extends NLS { + + // The plug-in resource bundle name + private static final String BUNDLE_NAME = "org.eclipse.tcf.te.ui.terminals.local.nls.Messages"; //$NON-NLS-1$ + + /** + * Static constructor. + */ + static { + // Load message values from bundle file + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + // **** Declare externalized string id's down here ***** + + public static String ProcessConnector_error_creatingProcess; + + public static String PreferencePage_label; + public static String PreferencePage_executables_label; + public static String PreferencePage_executables_column_name_label; + public static String PreferencePage_executables_column_path_label; + public static String PreferencePage_executables_button_add_label; + public static String PreferencePage_executables_button_edit_label; + public static String PreferencePage_executables_button_remove_label; + public static String PreferencePage_workingDir_label; + public static String PreferencePage_workingDir_userhome_label; + public static String PreferencePage_workingDir_eclipsehome_label; + public static String PreferencePage_workingDir_eclipsews_label; + public static String PreferencePage_workingDir_button_browse; + public static String PreferencePage_workingDir_note_label; + public static String PreferencePage_workingDir_note_text; + public static String PreferencePage_workingDir_button_variables; + public static String PreferencePage_workingDir_invalid; + public static String PreferencePage_command_label; + public static String PreferencePage_command_button_browse; + public static String PreferencePage_command_invalid; + public static String PreferencePage_command_note_label; + public static String PreferencePage_command_note_text; + public static String PreferencePage_command_arguments_label; + + public static String ExternalExecutablesDialog_title_add; + public static String ExternalExecutablesDialog_title_edit; + public static String ExternalExecutablesDialog_button_add; + public static String ExternalExecutablesDialog_button_browse; + public static String ExternalExecutablesDialog_field_path; + public static String ExternalExecutablesDialog_field_name; + public static String ExternalExecutablesDialog_field_args; + public static String ExternalExecutablesDialog_field_icon; + public static String ExternalExecutablesDialog_field_translate; +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.properties b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.properties new file mode 100644 index 00000000000..8bc8c292ae5 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.properties @@ -0,0 +1,46 @@ +############################################################################### +# Copyright (c) 2012 - 2015 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +############################################################################### + +ProcessConnector_error_creatingProcess=Exception when creating process. Possibly caused by: {0} + +ExternalExecutablesDialog_title_add=Add External Executable +ExternalExecutablesDialog_title_edit=Edit External Executable +ExternalExecutablesDialog_button_add=Add +ExternalExecutablesDialog_button_browse=Browse... +ExternalExecutablesDialog_field_path=Path: +ExternalExecutablesDialog_field_name=Name: +ExternalExecutablesDialog_field_args=Arguments: +ExternalExecutablesDialog_field_icon=Icon: +ExternalExecutablesDialog_field_translate=Translate Backslashes on Paste + +# ----- Preference Pages ----- + +PreferencePage_label=Local Terminal Settings: +PreferencePage_executables_label="Show In ..." Custom Entries +PreferencePage_executables_column_name_label=Name +PreferencePage_executables_column_path_label=Path +PreferencePage_executables_button_add_label=Add... +PreferencePage_executables_button_edit_label=Edit... +PreferencePage_executables_button_remove_label=Remove +PreferencePage_workingDir_label=Initial Working Directory +PreferencePage_workingDir_userhome_label=User home +PreferencePage_workingDir_eclipsehome_label=Eclipse home +PreferencePage_workingDir_eclipsews_label=Eclipse workspace +PreferencePage_workingDir_button_browse=&Browse... +PreferencePage_workingDir_note_label=Note: +PreferencePage_workingDir_note_text=The chosen initial working directory might be overwritten by the current selection of the active view. +PreferencePage_workingDir_button_variables=&Variables... +PreferencePage_workingDir_invalid=Selected initial working directory is not a directory or is not readable. +PreferencePage_command_label=Shell Command +PreferencePage_command_button_browse=&Browse... +PreferencePage_command_invalid=Selected shell command is not a file or is not readable or executable. +PreferencePage_command_note_label=Note: +PreferencePage_command_note_text=Leave the shell command empty to fallback to the SHELL environment variable or if not set, to /bin/sh. +PreferencePage_command_arguments_label=Arguments: diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/DynamicContributionItems.java b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/DynamicContributionItems.java new file mode 100644 index 00000000000..6be5842e924 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/DynamicContributionItems.java @@ -0,0 +1,129 @@ +/******************************************************************************* + * Copyright (c) 2014, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.local.showin; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.ActionContributionItem; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.action.IContributionItem; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate; +import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager; +import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IExternalExecutablesProperties; +import org.eclipse.ui.ISelectionService; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.CompoundContributionItem; +import org.eclipse.ui.menus.IWorkbenchContribution; +import org.eclipse.ui.services.IServiceLocator; + +/** + * Dynamic "Show In" contribution items implementation. + */ +public class DynamicContributionItems extends CompoundContributionItem implements IWorkbenchContribution { + // Service locator to located the handler service. + protected IServiceLocator serviceLocator; + // Reference to the local terminal launcher delegate + /* default */ ILauncherDelegate delegate; + + /* (non-Javadoc) + * @see org.eclipse.ui.menus.IWorkbenchContribution#initialize(org.eclipse.ui.services.IServiceLocator) + */ + @Override + public void initialize(IServiceLocator serviceLocator) { + this.serviceLocator = serviceLocator; + + // Get the local terminal launcher delegate + delegate = LauncherDelegateManager.getInstance().getLauncherDelegate("org.eclipse.tcf.te.ui.terminals.local.launcher.local", false); //$NON-NLS-1$ + } + + /* (non-Javadoc) + * @see org.eclipse.ui.actions.CompoundContributionItem#getContributionItems() + */ + @Override + protected IContributionItem[] getContributionItems() { + List items = new ArrayList(); + + if (delegate != null) { + List> l = ExternalExecutablesManager.load(); + if (l != null && !l.isEmpty()) { + for (Map executableData : l) { + String name = executableData.get(IExternalExecutablesProperties.PROP_NAME); + String path = executableData.get(IExternalExecutablesProperties.PROP_PATH); + String args = executableData.get(IExternalExecutablesProperties.PROP_ARGS); + String icon = executableData.get(IExternalExecutablesProperties.PROP_ICON); + + String strTranslate = executableData.get(IExternalExecutablesProperties.PROP_TRANSLATE); + boolean translate = strTranslate != null ? Boolean.parseBoolean(strTranslate) : false; + + if (name != null && !"".equals(name) && path != null && !"".equals(path)) { //$NON-NLS-1$ //$NON-NLS-2$ + IAction action = createAction(name, path, args, translate); + + ImageData id = icon != null ? ExternalExecutablesManager.loadImage(icon) : null; + if (id != null) { + ImageDescriptor desc = ImageDescriptor.createFromImageData(id); + if (desc != null) action.setImageDescriptor(desc); + } + + IContributionItem item = new ActionContributionItem(action); + items.add(item); + } + } + } + } + + return items.toArray(new IContributionItem[items.size()]); + } + + /** + * Creates the action to execute. + * + * @param label The label. Must not be null. + * @param path The executable path. Must not be null. + * @param args The executable arguments or null. + * @param translate Translate backslashes. + * + * @return The action to execute. + */ + protected IAction createAction(final String label, final String path, final String args, final boolean translate) { + Assert.isNotNull(label); + Assert.isNotNull(path); + + IAction action = new Action(label) { + @Override + public void run() { + Assert.isNotNull(delegate); + + ISelectionService service = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService(); + ISelection selection = service != null ? service.getSelection() : null; + if (selection != null && selection.isEmpty()) selection = null; + + Map properties = new HashMap(); + properties.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegate.getId()); + if (selection != null) properties.put(ITerminalsConnectorConstants.PROP_SELECTION, selection); + properties.put(ITerminalsConnectorConstants.PROP_PROCESS_PATH, path); + if (args != null) properties.put(ITerminalsConnectorConstants.PROP_PROCESS_ARGS, args); + properties.put(ITerminalsConnectorConstants.PROP_TRANSLATE_BACKSLASHES_ON_PASTE, Boolean.valueOf(translate)); + + delegate.execute(properties, null); + } + }; + + return action; + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesDialog.java b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesDialog.java new file mode 100644 index 00000000000..44e57c5625b --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesDialog.java @@ -0,0 +1,460 @@ +/******************************************************************************* + * Copyright (c) 2014, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.local.showin; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.TrayDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +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.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.tcf.te.ui.terminals.local.help.IContextHelpIds; +import org.eclipse.tcf.te.ui.terminals.local.nls.Messages; +import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IExternalExecutablesProperties; +import org.eclipse.ui.PlatformUI; +import org.osgi.framework.Bundle; + +/** + * External executables dialog implementation. + */ +public class ExternalExecutablesDialog extends TrayDialog { + private String contextHelpId = null; + private final boolean edit; + + private Text name; + /* default */ Text path; + private Text args; + /* default */ Text icon; + private Button translate; + + /* default */ String last_filter_path = null; + /* default */ String last_filter_icon = null; + + private Map executableData; + + /** + * Constructor. + * + * @param shell The parent shell or null. + */ + public ExternalExecutablesDialog(Shell shell, boolean edit) { + super(shell); + this.edit = edit; + + this.contextHelpId = IContextHelpIds.EXTERNAL_EXECUTABLES_DIALOG; + setHelpAvailable(true); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) + */ + @Override + protected final Control createDialogArea(Composite parent) { + if (contextHelpId != null) { + PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, contextHelpId); + } + + // Let the super implementation create the dialog area control + Control control = super.createDialogArea(parent); + // Setup the inner panel as scrollable composite + if (control instanceof Composite) { + ScrolledComposite sc = new ScrolledComposite((Composite)control, SWT.V_SCROLL); + + GridLayout layout = new GridLayout(1, true); + layout.marginHeight = 0; layout.marginWidth = 0; + layout.verticalSpacing = 0; layout.horizontalSpacing = 0; + + sc.setLayout(layout); + sc.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); + + sc.setExpandHorizontal(true); + sc.setExpandVertical(true); + + Composite composite = new Composite(sc, SWT.NONE); + composite.setLayout(new GridLayout()); + + // Setup the dialog area content + createDialogAreaContent(composite); + + sc.setContent(composite); + sc.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + + // Return the scrolled composite as new dialog area control + control = sc; + } + + return control; + } + + /** + * Creates the dialog area content. + * + * @param parent The parent composite. Must not be null. + */ + protected void createDialogAreaContent(Composite parent) { + Assert.isNotNull(parent); + + setDialogTitle(edit ? Messages.ExternalExecutablesDialog_title_edit : Messages.ExternalExecutablesDialog_title_add); + + Composite panel = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(2, false); + layout.marginHeight = 0; layout.marginWidth = 0; + panel.setLayout(layout); + GridData layoutData = new GridData(SWT.FILL, SWT.CENTER, true, true); + layoutData.widthHint = convertWidthInCharsToPixels(50); + panel.setLayoutData(layoutData); + + Label label = new Label(panel, SWT.HORIZONTAL); + label.setText(Messages.ExternalExecutablesDialog_field_name); + layoutData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false); + label.setLayoutData(layoutData); + + name = new Text(panel, SWT.HORIZONTAL | SWT.SINGLE | SWT.BORDER); + layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false); + layoutData.widthHint = convertWidthInCharsToPixels(30); + name.setLayoutData(layoutData); + name.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + validate(); + } + }); + + label = new Label(panel, SWT.HORIZONTAL); + label.setText(Messages.ExternalExecutablesDialog_field_path); + layoutData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false); + label.setLayoutData(layoutData); + + Composite panel2 = new Composite(panel, SWT.NONE); + layout = new GridLayout(2, false); + layout.marginHeight = 0; layout.marginWidth = 0; + panel2.setLayout(layout); + layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false); + panel2.setLayoutData(layoutData); + + path = new Text(panel2, SWT.HORIZONTAL | SWT.SINGLE | SWT.BORDER); + layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false); + layoutData.widthHint = convertWidthInCharsToPixels(30); + path.setLayoutData(layoutData); + path.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + validate(); + } + }); + + Button button = new Button(panel2, SWT.PUSH); + button.setText(Messages.ExternalExecutablesDialog_button_browse); + layoutData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false); + layoutData.widthHint = convertWidthInCharsToPixels(10); + button.setLayoutData(layoutData); + button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + FileDialog dialog = new FileDialog(getShell(), SWT.OPEN); + + String selectedFile = path.getText(); + if (selectedFile != null && selectedFile.trim().length() > 0) { + IPath filePath = new Path(selectedFile); + // If the selected file points to an directory, use the directory as is + IPath filterPath = filePath.toFile().isDirectory() ? filePath : filePath.removeLastSegments(1); + while (filterPath != null && filterPath.segmentCount() > 1 && !filterPath.toFile().exists()) { + filterPath = filterPath.removeLastSegments(1); + } + String filterFileName = filePath.toFile().isDirectory() || !filePath.toFile().exists() ? null : filePath.lastSegment(); + + if (filterPath != null && !filterPath.isEmpty()) dialog.setFilterPath(filterPath.toString()); + if (filterFileName != null) dialog.setFileName(filterFileName); + } else { + String workspace = null; + Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$ + if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) { + workspace = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString(); + } + + String filterPath = last_filter_path != null ? last_filter_path : workspace; + dialog.setFilterPath(filterPath); + } + + selectedFile = dialog.open(); + if (selectedFile != null) { + last_filter_path = dialog.getFilterPath(); + path.setText(selectedFile); + } + } + }); + + label = new Label(panel, SWT.HORIZONTAL); + label.setText(Messages.ExternalExecutablesDialog_field_args); + layoutData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false); + label.setLayoutData(layoutData); + + args = new Text(panel, SWT.HORIZONTAL | SWT.SINGLE | SWT.BORDER); + layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false); + layoutData.widthHint = convertWidthInCharsToPixels(30); + args.setLayoutData(layoutData); + args.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + validate(); + } + }); + + label = new Label(panel, SWT.HORIZONTAL); + label.setText(Messages.ExternalExecutablesDialog_field_icon); + layoutData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false); + label.setLayoutData(layoutData); + + panel2 = new Composite(panel, SWT.NONE); + layout = new GridLayout(2, false); + layout.marginHeight = 0; layout.marginWidth = 0; + panel2.setLayout(layout); + layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false); + panel2.setLayoutData(layoutData); + + icon = new Text(panel2, SWT.HORIZONTAL | SWT.SINGLE | SWT.BORDER); + layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false); + layoutData.widthHint = convertWidthInCharsToPixels(30); + icon.setLayoutData(layoutData); + icon.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + validate(); + } + }); + + button = new Button(panel2, SWT.PUSH); + button.setText(Messages.ExternalExecutablesDialog_button_browse); + layoutData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false); + layoutData.widthHint = convertWidthInCharsToPixels(10); + button.setLayoutData(layoutData); + button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + FileDialog dialog = new FileDialog(getShell(), SWT.OPEN); + + String selectedFile = icon.getText(); + if (selectedFile != null && selectedFile.trim().length() > 0) { + IPath filePath = new Path(selectedFile); + // If the selected file points to an directory, use the directory as is + IPath filterPath = filePath.toFile().isDirectory() ? filePath : filePath.removeLastSegments(1); + while (filterPath != null && filterPath.segmentCount() > 1 && !filterPath.toFile().exists()) { + filterPath = filterPath.removeLastSegments(1); + } + String filterFileName = filePath.toFile().isDirectory() || !filePath.toFile().exists() ? null : filePath.lastSegment(); + + if (filterPath != null && !filterPath.isEmpty()) dialog.setFilterPath(filterPath.toString()); + if (filterFileName != null) dialog.setFileName(filterFileName); + } else { + String workspace = null; + Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$ + if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) { + workspace = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString(); + } + + String filterPath = last_filter_icon != null ? last_filter_icon : workspace; + dialog.setFilterPath(filterPath); + } + + selectedFile = dialog.open(); + if (selectedFile != null) { + last_filter_icon = dialog.getFilterPath(); + icon.setText(selectedFile); + } + } + }); + + translate = new Button(panel, SWT.CHECK); + translate.setText(Messages.ExternalExecutablesDialog_field_translate); + layoutData = new GridData(SWT.FILL, SWT.TOP, true, false); + layoutData.horizontalSpan = 2; + translate.setLayoutData(layoutData); + translate.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + validate(); + } + }); + + if (executableData != null) { + String value = executableData.get(IExternalExecutablesProperties.PROP_NAME); + name.setText(value != null && !"".equals(value.trim()) ? value : ""); //$NON-NLS-1$ //$NON-NLS-2$ + value = executableData.get(IExternalExecutablesProperties.PROP_PATH); + path.setText(value != null && !"".equals(value.trim()) ? value : ""); //$NON-NLS-1$ //$NON-NLS-2$ + value = executableData.get(IExternalExecutablesProperties.PROP_ARGS); + args.setText(value != null && !"".equals(value.trim()) ? value : ""); //$NON-NLS-1$ //$NON-NLS-2$ + value = executableData.get(IExternalExecutablesProperties.PROP_ICON); + icon.setText(value != null && !"".equals(value.trim()) ? value : ""); //$NON-NLS-1$ //$NON-NLS-2$ + value = executableData.get(IExternalExecutablesProperties.PROP_TRANSLATE); + translate.setSelection(value != null ? Boolean.parseBoolean(value) : false); + } + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.TrayDialog#createButtonBar(org.eclipse.swt.widgets.Composite) + */ + @Override + protected Control createButtonBar(Composite parent) { + Control control = super.createButtonBar(parent); + validate(); + return control; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#createButton(org.eclipse.swt.widgets.Composite, int, java.lang.String, boolean) + */ + @Override + protected Button createButton(Composite parent, int id, String label, boolean defaultButton) { + if (IDialogConstants.OK_ID == id && !edit) { + label = Messages.ExternalExecutablesDialog_button_add; + } + return super.createButton(parent, id, label, defaultButton); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTrayDialog#okPressed() + */ + @Override + protected void okPressed() { + if (name != null && path != null) { + // Extract the executable properties + if (executableData == null) executableData = new HashMap(); + + String value = name.getText(); + if (value != null && !"".equals(value.trim())) { //$NON-NLS-1$ + executableData.put(IExternalExecutablesProperties.PROP_NAME, value); + } else { + executableData.remove(IExternalExecutablesProperties.PROP_NAME); + } + + value = path.getText(); + if (value != null && !"".equals(value.trim())) { //$NON-NLS-1$ + executableData.put(IExternalExecutablesProperties.PROP_PATH, value); + } else { + executableData.remove(IExternalExecutablesProperties.PROP_PATH); + } + + value = args.getText(); + if (value != null && !"".equals(value.trim())) { //$NON-NLS-1$ + executableData.put(IExternalExecutablesProperties.PROP_ARGS, value); + } else { + executableData.remove(IExternalExecutablesProperties.PROP_ARGS); + } + + value = icon.getText(); + if (value != null && !"".equals(value.trim())) { //$NON-NLS-1$ + executableData.put(IExternalExecutablesProperties.PROP_ICON, value); + } else { + executableData.remove(IExternalExecutablesProperties.PROP_ICON); + } + + if (translate.getSelection()) { + executableData.put(IExternalExecutablesProperties.PROP_TRANSLATE, Boolean.TRUE.toString()); + } else { + executableData.remove(IExternalExecutablesProperties.PROP_TRANSLATE); + } + } else { + executableData = null; + } + super.okPressed(); + } + + @Override + protected void cancelPressed() { + // If the user pressed cancel, the dialog needs to return null + executableData = null; + super.cancelPressed(); + } + + /** + * Returns the executable properties the user entered. + * + * @return The executable properties or null. + */ + public Map getExecutableData() { + return executableData; + } + + /** + * Set or reset the executable properties. This method has effect + * only if called before opening the dialog. + * + * @param data The executable properties or null. + */ + public void setExecutableData(Map data) { + if (data == null) { + executableData = data; + } else { + executableData = new HashMap(data); + } + } + + /** + * Validate the dialog. + */ + public void validate() { + boolean valid = true; + + if (name != null && !name.isDisposed()) { + valid = !"".equals(name.getText()); //$NON-NLS-1$ + } + + if (path != null && !path.isDisposed()) { + String value = path.getText(); + if (!"".equals(value)) { //$NON-NLS-1$ + File f = new File(value); + valid |= f.isAbsolute() && f.canRead(); + } else { + valid = false; + } + } + + if (icon != null && !icon.isDisposed()) { + String value = icon.getText(); + if (!"".equals(value)) { //$NON-NLS-1$ + File f = new File(value); + valid |= f.isAbsolute() && f.canRead(); + } + } + + Button okButton = getButton(IDialogConstants.OK_ID); + if (okButton != null) okButton.setEnabled(valid); + } + + /** + * Sets the title for this dialog. + * + * @param title The title. + */ + public void setDialogTitle(String title) { + if (getShell() != null && !getShell().isDisposed()) { + getShell().setText(title); + } + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesInitializer.java b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesInitializer.java new file mode 100644 index 00000000000..1bcca4a52c1 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesInitializer.java @@ -0,0 +1,88 @@ +/******************************************************************************* + * Copyright (c) 2014, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.local.showin; + +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IExternalExecutablesProperties; +import org.eclipse.ui.IStartup; + +/** + * External executables data initializer. + */ +public class ExternalExecutablesInitializer implements IStartup { + + /* (non-Javadoc) + * @see org.eclipse.ui.IStartup#earlyStartup() + */ + @Override + public void earlyStartup() { + // On Windows, initialize the "Git Bash" custom "Show In" menu entry + if (Platform.OS_WIN32.equals(Platform.getOS())) { + String gitPath = null; + String iconPath = null; + + String path = System.getenv("PATH"); //$NON-NLS-1$ + if (path != null) { + StringTokenizer tokenizer = new StringTokenizer(path, ";"); //$NON-NLS-1$ + while (tokenizer.hasMoreTokens()) { + String token = tokenizer.nextToken(); + File f = new File(token, "git.exe"); //$NON-NLS-1$ + if (f.canRead()) { + File f2 = new File(f.getParentFile().getParentFile(), "bin/sh.exe"); //$NON-NLS-1$ + if (f2.canExecute()) { + gitPath = f2.getAbsolutePath(); + } + + f2 = new File(f.getParentFile().getParentFile(), "etc/git.ico"); //$NON-NLS-1$ + if (f2.canRead()) { + iconPath = f2.getAbsolutePath(); + } + + break; + } + } + } + + if (gitPath != null) { + // Load the configured external executables + List> l = ExternalExecutablesManager.load(); + if (l == null) l = new ArrayList>(); + // Find a entry labeled "Git Bash" + Map m = null; + for (Map candidate : l) { + String name = candidate.get(IExternalExecutablesProperties.PROP_NAME); + if ("Git Bash".equals(name)) { //$NON-NLS-1$ + m = candidate; + break; + } + } + + if (m == null) { + m = new HashMap(); + m.put(IExternalExecutablesProperties.PROP_NAME, "Git Bash"); //$NON-NLS-1$ + m.put(IExternalExecutablesProperties.PROP_PATH, gitPath); + m.put(IExternalExecutablesProperties.PROP_ARGS, "--login -i"); //$NON-NLS-1$ + if (iconPath != null) m.put(IExternalExecutablesProperties.PROP_ICON, iconPath); + m.put(IExternalExecutablesProperties.PROP_TRANSLATE, Boolean.TRUE.toString()); + + l.add(m); + ExternalExecutablesManager.save(l); + } + } + } + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesManager.java b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesManager.java new file mode 100644 index 00000000000..1e797d92f08 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesManager.java @@ -0,0 +1,181 @@ +/******************************************************************************* + * Copyright (c) 2014, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.local.showin; + +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Properties; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Platform; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.swt.graphics.ImageLoader; +import org.eclipse.tcf.te.ui.terminals.local.activator.UIPlugin; + +/** + * External executables manager implementation. + */ +public class ExternalExecutablesManager { + + /** + * Loads the list of all saved external executables. + * + * @return The list of all saved external executables or null. + */ + public static List> load() { + List> l = new ArrayList>(); + + IPath stateLocation = UIPlugin.getDefault().getStateLocation(); + if (stateLocation != null) { + File f = stateLocation.append(".executables/data.properties").toFile(); //$NON-NLS-1$ + if (f.canRead()) { + FileReader r = null; + + try { + Properties data = new Properties(); + r= new FileReader(f); + data.load(r); + + Map> c = new HashMap>(); + for (String name : data.stringPropertyNames()) { + if (name == null || name.indexOf('.') == -1) continue; + int ix = name.indexOf('.'); + String n = name.substring(0, ix); + String k = (ix + 1) < name.length() ? name.substring(ix + 1) : null; + if (n == null || k == null) continue; + + Integer i = null; + try { i = Integer.decode(n); } catch (NumberFormatException e) { /* ignored on purpose */ } + if (i == null) continue; + + Map m = c.get(i); + if (m == null) { + m = new HashMap(); + c.put(i, m); + } + Assert.isNotNull(m); + + m.put(k, data.getProperty(name)); + } + + List k = new ArrayList(c.keySet()); + Collections.sort(k); + for (Integer i : k) { + Map m = c.get(i); + if (m != null && !m.isEmpty()) l.add(m); + } + } catch (Exception e) { + if (Platform.inDebugMode()) { + e.printStackTrace(); + } + } finally { + if (r != null) try { r.close(); } catch (IOException e) { /* ignored on purpose */ } + } + } + } + + return l; + } + + /** + * Saves the list of external executables. + * + * @param l The list of external executables or null. + */ + public static void save(List> l) { + IPath stateLocation = UIPlugin.getDefault().getStateLocation(); + if (stateLocation != null) { + File f = stateLocation.append(".executables/data.properties").toFile(); //$NON-NLS-1$ + if (f.isFile() && (l == null || l.isEmpty())) { + @SuppressWarnings("unused") + boolean s = f.delete(); + } else { + FileWriter w = null; + + try { + Properties data = new Properties(); + for (int i = 0; i < l.size(); i++) { + Map m = l.get(i); + for (Entry e : m.entrySet()) { + String key = Integer.toString(i) + "." + e.getKey(); //$NON-NLS-1$ + data.setProperty(key, e.getValue()); + } + } + + if (!f.exists()) { + @SuppressWarnings("unused") + boolean s = f.getParentFile().mkdirs(); + s = f.createNewFile(); + } + w = new FileWriter(f); + data.store(w, null); + } catch (Exception e) { + if (Platform.inDebugMode()) { + e.printStackTrace(); + } + } finally { + if (w != null) { + try { + w.flush(); + w.close(); + } catch (IOException e) { + /* ignored on purpose */ + } + } + } + } + } + } + + /** + * Loads the image data suitable for showing an icon in a menu + * (16 x 16, 8bit depth) from the given file. + * + * @param path The image file path. Must not be null. + * @return The image data or null. + */ + public static ImageData loadImage(String path) { + Assert.isNotNull(path); + + ImageData id = null; + + ImageLoader loader = new ImageLoader(); + ImageData[] data = loader.load(path); + + if (data != null) { + for (ImageData d : data) { + if (d.height == 16 && d.width == 16) { + if (id == null || id.height != 16 && id.width != 16) { + id = d; + } else if (d.depth < id.depth && d.depth >= 8){ + id = d; + } + } else { + if (id == null) { + id = d; + } else if (id.height != 16 && d.height < id.height && id.width != 16 && d.width < id.width) { + id = d; + } + } + } + } + + return id; + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/interfaces/IExternalExecutablesProperties.java b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/interfaces/IExternalExecutablesProperties.java new file mode 100644 index 00000000000..daf625d045c --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/interfaces/IExternalExecutablesProperties.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.local.showin.interfaces; + +/** + * External executables data property names. + */ +public interface IExternalExecutablesProperties { + + /** + * The name/label of the external executable. + */ + public final String PROP_NAME = "Name"; //$NON-NLS-1$ + + /** + * The absolute path of the external executable. + */ + public final String PROP_PATH = "Path"; //$NON-NLS-1$ + + /** + * The arguments to pass to the external executable. + */ + public final String PROP_ARGS = "Args"; //$NON-NLS-1$ + + /** + * The absolute path to the icon representing the external executable. + */ + public final String PROP_ICON = "Icon"; //$NON-NLS-1$ + + /** + * If set, backslashes are translated to forward slashes on paste. + */ + public final String PROP_TRANSLATE = "Translate"; //$NON-NLS-1$ +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/interfaces/IPreferenceKeys.java b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/interfaces/IPreferenceKeys.java new file mode 100644 index 00000000000..631ac16c159 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/interfaces/IPreferenceKeys.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * Copyright (c) 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.local.showin.interfaces; + +/** + * Terminals plug-in preference key definitions. + */ +public interface IPreferenceKeys { + /** + * Preference keys family prefix. + */ + public final String PREF_TERMINAL = "terminals"; //$NON-NLS-1$ + + /** + * Preference key: Local terminal initial working directory. + */ + public final String PREF_LOCAL_TERMINAL_INITIAL_CWD = PREF_TERMINAL + ".localTerminalInitialCwd"; //$NON-NLS-1$ + + /** + * Preference value: Local terminal initial working directory is "User home" + */ + public final String PREF_INITIAL_CWD_USER_HOME = "userhome"; //$NON-NLS-1$ + + /** + * Preference value: Local terminal initial working directory is "Eclipse home" + */ + public final String PREF_INITIAL_CWD_ECLIPSE_HOME = "eclipsehome"; //$NON-NLS-1$ + + /** + * Preference value: Local terminal initial working directory is "Eclipse workspace" + */ + public final String PREF_INITIAL_CWD_ECLIPSE_WS = "eclipsews"; //$NON-NLS-1$ + + /** + * Preference key: Local terminal default shell command on Unix hosts. + */ + public final String PREF_LOCAL_TERMINAL_DEFAULT_SHELL_UNIX = PREF_TERMINAL + ".localTerminalDefaultShellUnix"; //$NON-NLS-1$ + + /** + * Preference key: Local terminal default shell command arguments on Unix hosts. + */ + public final String PREF_LOCAL_TERMINAL_DEFAULT_SHELL_UNIX_ARGS = PREF_TERMINAL + ".localTerminalDefaultShellUnixArgs"; //$NON-NLS-1$ +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencePage.java b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencePage.java new file mode 100644 index 00000000000..c47135dd48f --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencePage.java @@ -0,0 +1,678 @@ +/******************************************************************************* + * Copyright (c) 2014 - 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.local.showin.preferences; + +import java.io.File; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.URIUtil; +import org.eclipse.core.variables.IStringVariableManager; +import org.eclipse.core.variables.VariablesPlugin; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.viewers.ColumnViewerToolTipSupport; +import org.eclipse.jface.viewers.ColumnWeightData; +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.TableLayout; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.Text; +import org.eclipse.tcf.te.ui.terminals.controls.NoteCompositeHelper; +import org.eclipse.tcf.te.ui.terminals.local.activator.UIPlugin; +import org.eclipse.tcf.te.ui.terminals.local.nls.Messages; +import org.eclipse.tcf.te.ui.terminals.local.showin.ExternalExecutablesDialog; +import org.eclipse.tcf.te.ui.terminals.local.showin.ExternalExecutablesManager; +import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IExternalExecutablesProperties; +import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IPreferenceKeys; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; +import org.osgi.framework.Bundle; + +/** + * Terminals top preference page implementation. + */ +public class PreferencePage extends org.eclipse.jface.preference.PreferencePage implements IWorkbenchPreferencePage { + /* default */ TableViewer viewer; + private Button addButton; + private Button editButton; + private Button removeButton; + /* default */ Combo workingDir; + private Button browseButton; + + private Button variablesButton; + private boolean hasVariablesButton = false; + + /* default */ Text command; + private Button commandBrowseButton; + private Text arguments; + + /* default */ final List> executables = new ArrayList>(); + /* default */ final Map images = new HashMap(); + + /* default */ static final Object[] NO_ELEMENTS = new Object[0]; + + /* (non-Javadoc) + * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) + */ + @Override + public void init(IWorkbench workbench) { + Bundle bundle = Platform.getBundle("org.eclipse.debug.ui"); //$NON-NLS-1$ + if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) { + hasVariablesButton = true; + } + } + + /* (non-Javadoc) + * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) + */ + @Override + protected Control createContents(final Composite parent) { + final GC gc = new GC(parent); + gc.setFont(JFaceResources.getDialogFont()); + + Composite panel = new Composite(parent, SWT.NONE); + panel.setLayout(new GridLayout()); + GridData layoutData = new GridData(SWT.FILL, SWT.BEGINNING, true, false); + panel.setLayoutData(layoutData); + + Label label = new Label(panel, SWT.HORIZONTAL); + label.setText(Messages.PreferencePage_label); + label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + + if (!Platform.OS_WIN32.equals(Platform.getOS())) { + Group group = new Group(panel, SWT.NONE); + group.setText(Messages.PreferencePage_command_label); + group.setLayout(new GridLayout(2, false)); + group.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); + + command = new Text(group, SWT.SINGLE | SWT.BORDER); + command.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + command.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + boolean valid = true; + String message = null; + + String text = command.getText(); + if (text != null && !"".equals(text.trim())) { //$NON-NLS-1$ + IPath p = new Path(text.trim()); + valid = p.toFile().isFile() && p.toFile().canRead() && p.toFile().canExecute(); + if (!valid) message = Messages.PreferencePage_command_invalid; + } + + setValid(valid); + setErrorMessage(message); + } + }); + + commandBrowseButton = new Button(group, SWT.PUSH); + commandBrowseButton.setText(Messages.PreferencePage_command_button_browse); + layoutData = new GridData(SWT.FILL, SWT.CENTER, false, false); + layoutData.widthHint = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), 14); + commandBrowseButton.setLayoutData(layoutData); + commandBrowseButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + FileDialog dialog = new FileDialog(parent.getShell(), SWT.OPEN); + + String text = command.getText(); + if (text != null && !"".equals(text.trim())) { //$NON-NLS-1$ + IPath p = new Path(text); + + if (p.toFile().isFile() || !p.toFile().exists()) { + dialog.setFilterPath(p.removeLastSegments(1).toOSString()); + dialog.setFileName(p.lastSegment()); + } else if (p.toFile().isDirectory()) { + dialog.setFilterPath(p.toOSString()); + } + } + + String selected = dialog.open(); + if (selected != null) { + IPath sp = new Path(selected); + command.setText(sp.toOSString()); + } + } + }); + + String cmd = UIPlugin.getScopedPreferences().getString(IPreferenceKeys.PREF_LOCAL_TERMINAL_DEFAULT_SHELL_UNIX); + if (cmd != null && !"".equals(cmd)) { //$NON-NLS-1$ + command.setText(new Path(cmd).toOSString()); + } + + Composite argsPanel = new Composite(group, SWT.NONE); + GridLayout layout = new GridLayout(2, false); + layout.marginHeight = 0; layout.marginWidth = 0; + argsPanel.setLayout(layout); + layoutData = new GridData(SWT.FILL, SWT.BEGINNING, true, false); + layoutData.horizontalSpan = 2; + argsPanel.setLayoutData(layoutData); + + label = new Label(argsPanel, SWT.NONE); + label.setText(Messages.PreferencePage_command_arguments_label); + + arguments = new Text(argsPanel, SWT.SINGLE | SWT.BORDER); + arguments.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + + String args = UIPlugin.getScopedPreferences().getString(IPreferenceKeys.PREF_LOCAL_TERMINAL_DEFAULT_SHELL_UNIX_ARGS); + if (args != null && !"".equals(args)) { //$NON-NLS-1$ + arguments.setText(args); + } + + NoteCompositeHelper.createNoteComposite(group.getFont(), group, Messages.PreferencePage_command_note_label, Messages.PreferencePage_command_note_text); + } + + Group group = new Group(panel, SWT.NONE); + group.setText(Messages.PreferencePage_workingDir_label); + group.setLayout(new GridLayout(hasVariablesButton ? 3 : 2, false)); + group.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); + + workingDir = new Combo(group, SWT.DROP_DOWN); + Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$ + if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) { + workingDir.setItems(new String[] { Messages.PreferencePage_workingDir_userhome_label, Messages.PreferencePage_workingDir_eclipsehome_label, Messages.PreferencePage_workingDir_eclipsews_label }); + } else { + workingDir.setItems(new String[] { Messages.PreferencePage_workingDir_userhome_label, Messages.PreferencePage_workingDir_eclipsehome_label }); + } + workingDir.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + workingDir.select(0); + workingDir.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + boolean valid = true; + String message = null; + + String text = workingDir.getText(); + if (text != null && !"".equals(text.trim()) //$NON-NLS-1$ + && !Messages.PreferencePage_workingDir_userhome_label.equals(text) + && !Messages.PreferencePage_workingDir_eclipsehome_label.equals(text) + && !Messages.PreferencePage_workingDir_eclipsews_label.equals(text)) { + try { + // Resolve possible dynamic variables + IStringVariableManager vm = VariablesPlugin.getDefault().getStringVariableManager(); + String resolved = vm.performStringSubstitution(text.trim()); + + IPath p = new Path(resolved); + valid = p.toFile().canRead() && p.toFile().isDirectory(); + if (!valid) message = Messages.PreferencePage_workingDir_invalid; + } catch (CoreException ex) { + valid = false; + message = ex.getLocalizedMessage(); + } + } + + setValid(valid); + setErrorMessage(message); + } + }); + + browseButton = new Button(group, SWT.PUSH); + browseButton.setText(Messages.PreferencePage_workingDir_button_browse); + layoutData = new GridData(SWT.FILL, SWT.CENTER, false, false); + layoutData.widthHint = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), 14); + browseButton.setLayoutData(layoutData); + browseButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + IPath uh = null; + IPath eh = null; + IPath ew = null; + + // HOME + String home = System.getProperty("user.home"); //$NON-NLS-1$ + if (home != null && !"".equals(home)) uh = new Path(home); //$NON-NLS-1$ + + // ECLIPSE_HOME + String eclipseHomeLocation = System.getProperty("eclipse.home.location"); //$NON-NLS-1$ + if (eclipseHomeLocation != null) { + try { + URI uri = URIUtil.fromString(eclipseHomeLocation); + File f = URIUtil.toFile(uri); + eh = new Path(f.getAbsolutePath()); + } catch (URISyntaxException ex) { /* ignored on purpose */ } + } + + // ECLIPSE_WORKSPACE + Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$ + if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) { + if (org.eclipse.core.resources.ResourcesPlugin.getWorkspace() != null + && org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot() != null + && org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation() != null) { + ew = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation(); + } + } + + DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.OPEN); + + // Determine the filter path + String text = workingDir.getText(); + if (Messages.PreferencePage_workingDir_userhome_label.equals(text)) { + dialog.setFilterPath(uh.toOSString()); + } else if (Messages.PreferencePage_workingDir_eclipsehome_label.equals(text)) { + dialog.setFilterPath(eh.toOSString()); + } else if (Messages.PreferencePage_workingDir_eclipsews_label.equals(text)) { + dialog.setFilterPath(ew.toOSString()); + } else if (text != null && !"".equals(text.trim())) { //$NON-NLS-1$ + try { + // Resolve possible dynamic variables + IStringVariableManager vm = VariablesPlugin.getDefault().getStringVariableManager(); + String resolved = vm.performStringSubstitution(text.trim()); + dialog.setFilterPath(resolved); + } catch (CoreException ex) { + if (Platform.inDebugMode()) { + UIPlugin.getDefault().getLog().log(ex.getStatus()); + } + } + } + + String selected = dialog.open(); + if (selected != null) { + IPath sp = new Path(selected); + + if (uh.equals(sp)) { + workingDir.select(0); + } else if (eh.equals(sp)) { + workingDir.select(1); + } else if (ew.equals(sp)) { + workingDir.select(2); + } else { + workingDir.setText(sp.toOSString()); + } + } + } + }); + + if (hasVariablesButton) { + variablesButton = new Button(group, SWT.PUSH); + variablesButton.setText(Messages.PreferencePage_workingDir_button_variables); + layoutData = new GridData(SWT.FILL, SWT.CENTER, false, false); + layoutData.widthHint = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), 14); + variablesButton.setLayoutData(layoutData); + variablesButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + org.eclipse.debug.ui.StringVariableSelectionDialog dialog = new org.eclipse.debug.ui.StringVariableSelectionDialog(getShell()); + dialog.open(); + String expression = dialog.getVariableExpression(); + if (expression != null) { + if ("${eclipse_home}".equals(expression)) { //$NON-NLS-1$ + workingDir.select(1); + } else if ("${workspace_loc}".equals(expression)) { //$NON-NLS-1$ + workingDir.select(2); + } else { + workingDir.setText(expression); + } + } + } + }); + } + + String initialCwd = UIPlugin.getScopedPreferences().getString(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD); + if (initialCwd == null || IPreferenceKeys.PREF_INITIAL_CWD_USER_HOME.equals(initialCwd) || "".equals(initialCwd.trim())) { //$NON-NLS-1$ + workingDir.select(0); + } else if (IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_HOME.equals(initialCwd) || "${eclipse_home}".equals(initialCwd)) { //$NON-NLS-1$ + workingDir.select(1); + } else if (IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_WS.equals(initialCwd) || "${workspace_loc}".equals(initialCwd)) { //$NON-NLS-1$ + workingDir.select(2); + } else { + workingDir.setText(new Path(initialCwd).toOSString()); + } + + NoteCompositeHelper.createNoteComposite(group.getFont(), group, Messages.PreferencePage_workingDir_note_label, Messages.PreferencePage_workingDir_note_text); + + group = new Group(panel, SWT.NONE); + group.setText(Messages.PreferencePage_executables_label); + group.setLayout(new GridLayout(2, false)); + group.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); + + viewer = new TableViewer(group, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION); + + Table table = viewer.getTable(); + table.setHeaderVisible(true); + table.setLinesVisible(true); + + TableColumn column = new TableColumn(table, SWT.LEFT); + column.setText(Messages.PreferencePage_executables_column_name_label); + column = new TableColumn(table, SWT.LEFT); + column.setText(Messages.PreferencePage_executables_column_path_label); + + ColumnViewerToolTipSupport.enableFor(viewer); + + TableLayout tableLayout = new TableLayout(); + tableLayout.addColumnData(new ColumnWeightData(35)); + tableLayout.addColumnData(new ColumnWeightData(65)); + table.setLayout(tableLayout); + + layoutData = new GridData(SWT.FILL, SWT.FILL, true, true); + layoutData.heightHint = Dialog.convertHeightInCharsToPixels(gc.getFontMetrics(), 10); + table.setLayoutData(layoutData); + + Composite buttonsPanel = new Composite(group, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.marginHeight = 0; layout.marginWidth = 0; + buttonsPanel.setLayout(layout); + buttonsPanel.setLayoutData(new GridData(SWT.LEAD, SWT.BEGINNING, false, false)); + + addButton = new Button(buttonsPanel, SWT.PUSH); + addButton.setText(Messages.PreferencePage_executables_button_add_label); + layoutData = new GridData(SWT.FILL, SWT.CENTER, false, false); + layoutData.widthHint = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), 10); + addButton.setLayoutData(layoutData); + addButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + ExternalExecutablesDialog dialog = new ExternalExecutablesDialog(PreferencePage.this.getShell(), false); + if (dialog.open() == Window.OK) { + // Get the executable properties and add it to the the list + Map executableData = dialog.getExecutableData(); + if (executableData != null && !executables.contains(executableData)) { + executables.add(executableData); + viewer.refresh(); + } + } + } + }); + + editButton = new Button(buttonsPanel, SWT.PUSH); + editButton.setText(Messages.PreferencePage_executables_button_edit_label); + layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false); + layoutData.widthHint = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), 10); + editButton.setLayoutData(layoutData); + editButton.addSelectionListener(new SelectionAdapter() { + @SuppressWarnings("unchecked") + @Override + public void widgetSelected(SelectionEvent e) { + ISelection s = viewer.getSelection(); + if (s instanceof IStructuredSelection && !s.isEmpty()) { + Object element = ((IStructuredSelection)s).getFirstElement(); + if (element instanceof Map) { + final Map m = (Map)element; + ExternalExecutablesDialog dialog = new ExternalExecutablesDialog(PreferencePage.this.getShell(), true); + dialog.setExecutableData(m); + if (dialog.open() == Window.OK) { + Map executableData = dialog.getExecutableData(); + if (executableData != null) { + m.clear(); + m.putAll(executableData); + viewer.refresh(); + } + } + } + } + } + }); + + removeButton = new Button(buttonsPanel, SWT.PUSH); + removeButton.setText(Messages.PreferencePage_executables_button_remove_label); + layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false); + layoutData.widthHint = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), 10); + removeButton.setLayoutData(layoutData); + removeButton.addSelectionListener(new SelectionAdapter() { + @SuppressWarnings("unchecked") + @Override + public void widgetSelected(SelectionEvent e) { + ISelection s = viewer.getSelection(); + if (s instanceof IStructuredSelection && !s.isEmpty()) { + Iterator iterator = ((IStructuredSelection)s).iterator(); + while (iterator.hasNext()) { + Object element = iterator.next(); + if (element instanceof Map) { + Map m = (Map)element; + executables.remove(m); + } + viewer.refresh(); + } + } + } + }); + + viewer.setContentProvider(new IStructuredContentProvider() { + @Override + public Object[] getElements(Object inputElement) { + if (inputElement instanceof List && !((List)inputElement).isEmpty()) { + return ((List)inputElement).toArray(); + } + return NO_ELEMENTS; + } + + @Override + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + } + + @Override + public void dispose() { + } + }); + + viewer.setLabelProvider(new ITableLabelProvider() { + @SuppressWarnings("unchecked") + @Override + public String getColumnText(Object element, int columnIndex) { + if (element instanceof Map) { + Map m = (Map)element; + + switch (columnIndex) { + case 0: + return (String)m.get(IExternalExecutablesProperties.PROP_NAME); + case 1: + return (String)m.get(IExternalExecutablesProperties.PROP_PATH); + } + } + return null; + } + + @SuppressWarnings("unchecked") + @Override + public Image getColumnImage(Object element, int columnIndex) { + Image i = null; + + if (element instanceof Map) { + switch (columnIndex) { + case 0: + Map m = (Map)element; + String icon = (String) m.get(IExternalExecutablesProperties.PROP_ICON); + if (icon != null) { + i = images.get(icon); + if (i == null) { + ImageData id = ExternalExecutablesManager.loadImage(icon); + if (id != null) { + ImageDescriptor d = ImageDescriptor.createFromImageData(id); + if (d != null) i = d.createImage(); + if (i != null) images.put(icon, i); + } + } + } + break; + case 1: + break; + } + } + + return i; + } + + @Override + public void removeListener(ILabelProviderListener listener) { + } + + @Override + public boolean isLabelProperty(Object element, String property) { + return false; + } + + @Override + public void dispose() { + } + + @Override + public void addListener(ILabelProviderListener listener) { + } + }); + + List> l = ExternalExecutablesManager.load(); + if (l != null) executables.addAll(l); + + viewer.setInput(executables); + + viewer.addPostSelectionChangedListener(new ISelectionChangedListener() { + @Override + public void selectionChanged(SelectionChangedEvent event) { + updateButtons(); + } + }); + + updateButtons(); + + gc.dispose(); + + return panel; + } + + /** + * Updates the button states. + */ + protected void updateButtons() { + if (viewer != null) { + addButton.setEnabled(true); + + ISelection selection = viewer.getSelection(); + + boolean hasSelection = selection != null && !selection.isEmpty(); + int count = selection instanceof IStructuredSelection ? ((IStructuredSelection)selection).size() : 0; + + editButton.setEnabled(hasSelection && count == 1); + removeButton.setEnabled(hasSelection && count > 0); + } else { + addButton.setEnabled(false); + editButton.setEnabled(false); + removeButton.setEnabled(false); + } + } + + /* (non-Javadoc) + * @see org.eclipse.jface.preference.PreferencePage#performDefaults() + */ + @Override + protected void performDefaults() { + if (!Platform.OS_WIN32.equals(Platform.getOS())) { + command.setText(""); //$NON-NLS-1$ + arguments.setText(""); //$NON-NLS-1$ + } + + String initialCwd = UIPlugin.getScopedPreferences().getDefaultString(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD); + if (initialCwd == null || IPreferenceKeys.PREF_INITIAL_CWD_USER_HOME.equals(initialCwd) || "".equals(initialCwd.trim())) { //$NON-NLS-1$ + workingDir.select(0); + } else if (IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_HOME.equals(initialCwd) || "${eclipse_home}".equals(initialCwd)) { //$NON-NLS-1$ + workingDir.select(1); + } else if (IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_WS.equals(initialCwd) || "${workspace_loc}".equals(initialCwd)) { //$NON-NLS-1$ + workingDir.select(2); + } else { + workingDir.setText(new Path(initialCwd).toOSString()); + } + + executables.clear(); + List> l = ExternalExecutablesManager.load(); + if (l != null) executables.addAll(l); + viewer.refresh(); + + super.performDefaults(); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.preference.PreferencePage#performOk() + */ + @Override + public boolean performOk() { + if (!Platform.OS_WIN32.equals(Platform.getOS())) { + String text = command.getText(); + IPath p = new Path(text.trim()); + UIPlugin.getScopedPreferences().putString(IPreferenceKeys.PREF_LOCAL_TERMINAL_DEFAULT_SHELL_UNIX, p.toFile().isFile() && p.toFile().canRead() && p.toFile().canExecute() ? p.toOSString() : null); + + text = arguments.getText(); + UIPlugin.getScopedPreferences().putString(IPreferenceKeys.PREF_LOCAL_TERMINAL_DEFAULT_SHELL_UNIX_ARGS, !"".equals(text.trim()) ? text.trim() : null); //$NON-NLS-1$ + } + + String text = workingDir.getText(); + if (text == null || Messages.PreferencePage_workingDir_userhome_label.equals(text) || "".equals(text.trim())) { //$NON-NLS-1$ + UIPlugin.getScopedPreferences().putString(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD, null); + } else if (Messages.PreferencePage_workingDir_eclipsehome_label.equals(text)) { + UIPlugin.getScopedPreferences().putString(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD, IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_HOME); + } else if (Messages.PreferencePage_workingDir_eclipsews_label.equals(text)) { + UIPlugin.getScopedPreferences().putString(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD, IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_WS); + } else { + try { + // Resolve possible dynamic variables + IStringVariableManager vm = VariablesPlugin.getDefault().getStringVariableManager(); + String resolved = vm.performStringSubstitution(text.trim()); + + IPath p = new Path(resolved); + UIPlugin.getScopedPreferences().putString(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD, p.toFile().canRead() && p.toFile().isDirectory() ? text.trim() : null); + } catch (CoreException e) { + if (Platform.inDebugMode()) { + UIPlugin.getDefault().getLog().log(e.getStatus()); + } + } + } + + ExternalExecutablesManager.save(executables); + + return super.performOk(); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.DialogPage#dispose() + */ + @Override + public void dispose() { + for (Image i : images.values()) { + i.dispose(); + } + images.clear(); + super.dispose(); + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencesInitializer.java b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencesInitializer.java new file mode 100644 index 00000000000..036e3e34e31 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencesInitializer.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.local.showin.preferences; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.tcf.te.core.terminals.preferences.ScopedEclipsePreferences; +import org.eclipse.tcf.te.ui.terminals.local.activator.UIPlugin; +import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IPreferenceKeys; + +/** + * Terminals default preferences initializer. + */ +public class PreferencesInitializer extends AbstractPreferenceInitializer { + + /** + * Constructor. + */ + public PreferencesInitializer() { + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() + */ + @Override + public void initializeDefaultPreferences() { + ScopedEclipsePreferences prefs = UIPlugin.getScopedPreferences(); + + prefs.putDefaultString(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD, IPreferenceKeys.PREF_INITIAL_CWD_USER_HOME); + prefs.putDefaultString(IPreferenceKeys.PREF_LOCAL_TERMINAL_DEFAULT_SHELL_UNIX, null); + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.process/.classpath b/plugins/org.eclipse.tcf.te.ui.terminals.process/.classpath new file mode 100644 index 00000000000..ad32c83a788 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.process/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.process/.options b/plugins/org.eclipse.tcf.te.ui.terminals.process/.options new file mode 100644 index 00000000000..a9f0396bb4e --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.process/.options @@ -0,0 +1 @@ +org.eclipse.tcf.te.ui.terminals.process/debugmode = 0 diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.process/.project b/plugins/org.eclipse.tcf.te.ui.terminals.process/.project new file mode 100644 index 00000000000..65fc5f297b3 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.process/.project @@ -0,0 +1,39 @@ + + + org.eclipse.tcf.te.ui.terminals.process + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + + + 1329502082911 + + 10 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-target + + + + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.process/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.tcf.te.ui.terminals.process/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..24dad4464e4 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.process/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,362 @@ +#Tue Oct 11 11:53:38 CEST 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=warning +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=0 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=0 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=100 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true +org.eclipse.jdt.core.formatter.lineSplit=100 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.process/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.tcf.te.ui.terminals.process/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000000..88bb9570e83 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.process/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,56 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_Target Explorer Java STD +formatter_settings_version=12 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=false +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.process/.settings/org.eclipse.pde.prefs b/plugins/org.eclipse.tcf.te.ui.terminals.process/.settings/org.eclipse.pde.prefs new file mode 100644 index 00000000000..cf80c8bc5b8 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.process/.settings/org.eclipse.pde.prefs @@ -0,0 +1,32 @@ +compilers.f.unresolved-features=1 +compilers.f.unresolved-plugins=1 +compilers.incompatible-environment=1 +compilers.p.build=1 +compilers.p.build.bin.includes=1 +compilers.p.build.encodings=2 +compilers.p.build.java.compiler=2 +compilers.p.build.java.compliance=1 +compilers.p.build.missing.output=2 +compilers.p.build.output.library=1 +compilers.p.build.source.library=1 +compilers.p.build.src.includes=1 +compilers.p.deprecated=1 +compilers.p.discouraged-class=1 +compilers.p.internal=1 +compilers.p.missing-packages=1 +compilers.p.missing-version-export-package=2 +compilers.p.missing-version-import-package=1 +compilers.p.missing-version-require-bundle=1 +compilers.p.no-required-att=0 +compilers.p.not-externalized-att=2 +compilers.p.unknown-attribute=1 +compilers.p.unknown-class=1 +compilers.p.unknown-element=1 +compilers.p.unknown-identifier=1 +compilers.p.unknown-resource=1 +compilers.p.unresolved-ex-points=0 +compilers.p.unresolved-import=0 +compilers.s.create-docs=false +compilers.s.doc-folder=doc +compilers.s.open-tags=1 +eclipse.preferences.version=1 diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.process/META-INF/MANIFEST.MF b/plugins/org.eclipse.tcf.te.ui.terminals.process/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..db4041309cd --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.process/META-INF/MANIFEST.MF @@ -0,0 +1,24 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.tcf.te.ui.terminals.process;singleton:=true +Bundle-Version: 1.3.0.qualifier +Bundle-Activator: org.eclipse.tcf.te.ui.terminals.process.activator.UIPlugin +Bundle-Vendor: %providerName +Import-Package: org.eclipse.cdt.utils.pty;mandatory:=native, + org.eclipse.cdt.utils.spawner;mandatory:=native +Require-Bundle: org.eclipse.cdt.core;bundle-version="5.6";resolution:=optional, + org.eclipse.core.expressions;bundle-version="3.4.400", + org.eclipse.core.resources;bundle-version="3.8.1";resolution:=optional, + org.eclipse.core.runtime;bundle-version="3.8.0", + org.eclipse.tcf.te.core.terminals;bundle-version="1.3.0", + org.eclipse.tcf.te.ui.terminals;bundle-version="1.3.0", + org.eclipse.tm.terminal;bundle-version="3.3.1", + org.eclipse.ui;bundle-version="3.8.0" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Bundle-Localization: plugin +Export-Package: org.eclipse.tcf.te.ui.terminals.process, + org.eclipse.tcf.te.ui.terminals.process.activator;x-internal:=true, + org.eclipse.tcf.te.ui.terminals.process.help, + org.eclipse.tcf.te.ui.terminals.process.nls;x-internal:=true diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.process/META-INF/p2.inf b/plugins/org.eclipse.tcf.te.ui.terminals.process/META-INF/p2.inf new file mode 100644 index 00000000000..9bd5194fa74 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.process/META-INF/p2.inf @@ -0,0 +1,82 @@ +############################################################################### +# Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +############################################################################### + +# Most of the dependencies exposed here are actually covered in the feature.xml +# This file ensures that the current bundle has all it needs, even if installed +# without the enclosing org.eclipse.tcf.te.terminals.feature . +# See also https://bugs.eclipse.org/bugs/show_bug.cgi?id=435150 . + +# 1. Make the optional cdt.core dependency non-greedy: Use (or update to proper +# version!) when installed, but do not install automatically since the newer +# org.eclipse.cdt.core.native can satisfy the dependency better. We use this +# trick since CDT 8.3 had no version on export-package yet but we do want +# a version constraint. +requires.0.namespace = org.eclipse.equinox.p2.iu +requires.0.name = org.eclipse.cdt.core +#requires.0.range = [5.6, 6.0) +requires.0.greedy = false +requires.0.optional = true + +#requires.1.namespace = org.eclipse.equinox.p2.iu +#requires.1.name = org.eclipse.cdt.core.native +#requires.1.range = [5.6, 6.0) +#requires.1.greedy = true +#requires.1.optional = true + +# 2. Add the required fragments for local terminal support with proper version. +requires.2.namespace = org.eclipse.equinox.p2.iu +requires.2.name = org.eclipse.cdt.core.aix +#requires.2.range = [5.3, 6.0) +requires.2.filter = (osgi.os=aix) + +requires.3.namespace = org.eclipse.equinox.p2.iu +requires.3.name = org.eclipse.cdt.core.linux +#requires.3.range = [5.2, 6.0) +requires.3.filter = (osgi.os=linux) + +requires.4.namespace = org.eclipse.equinox.p2.iu +requires.4.name = org.eclipse.cdt.core.linux.ppc64 +#requires.4.range = [5.1, 6.0) +requires.4.filter = (&(osgi.os=linux)(osgi.arch=ppc64)) + +requires.5.namespace = org.eclipse.equinox.p2.iu +requires.5.name = org.eclipse.cdt.core.linux.x86 +#requires.5.range = [5.2, 6.0) +requires.5.filter = (&(osgi.os=linux)(osgi.arch=x86)) + +requires.6.namespace = org.eclipse.equinox.p2.iu +requires.6.name = org.eclipse.cdt.core.linux.x86_64 +#requires.6.range = [5.2, 6.0) +requires.6.filter = (&(osgi.os=linux)(osgi.arch=x86_64)) + +requires.7.namespace = org.eclipse.equinox.p2.iu +requires.7.name = org.eclipse.cdt.core.macosx +#requires.7.range = [5.2, 6.0) +requires.7.filter = (osgi.os=macosx) + +requires.8.namespace = org.eclipse.equinox.p2.iu +requires.8.name = org.eclipse.cdt.core.solaris +#requires.8.range = [5.2, 6.0) +requires.8.filter = (&(osgi.os=solaris)(osgi.arch=sparc)) + +requires.9.namespace = org.eclipse.equinox.p2.iu +requires.9.name = org.eclipse.cdt.core.win32 +#requires.9.range = [5.3, 6.0) +requires.9.filter = (osgi.os=win32) + +requires.10.namespace = org.eclipse.equinox.p2.iu +requires.10.name = org.eclipse.cdt.core.win32.x86 +#requires.10.range = [5.2, 6.0) +requires.10.filter = (&(osgi.os=win32)(osgi.arch=x86)) + +requires.11.namespace = org.eclipse.equinox.p2.iu +requires.11.name = org.eclipse.cdt.core.win32.x86_64 +#requires.11.range = [5.2, 6.0) +requires.11.filter = (&(osgi.os=win32)(osgi.arch=x86_64)) diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.process/about.html b/plugins/org.eclipse.tcf.te.ui.terminals.process/about.html new file mode 100644 index 00000000000..0f07cf034df --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.process/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

May 24, 2012

+

License

+ +

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 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +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 http://www.eclipse.org.

+ + + \ No newline at end of file diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.process/build.properties b/plugins/org.eclipse.tcf.te.ui.terminals.process/build.properties new file mode 100644 index 00000000000..1d978e3432b --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.process/build.properties @@ -0,0 +1,16 @@ +############################################################################### +# Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +############################################################################### +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + plugin.properties,\ + about.html diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.process/plugin.properties b/plugins/org.eclipse.tcf.te.ui.terminals.process/plugin.properties new file mode 100644 index 00000000000..3b864f4b95f --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.process/plugin.properties @@ -0,0 +1,22 @@ +################################################################################## +# Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +################################################################################## + +pluginName = Terminals Process Connector +providerName = Eclipse.org - Target Explorer + +# ----- Terminal Connectors ----- + +TerminalConnector.process=Process Connector (hidden) + +# ----- Terminal Launcher Delegates ----- + +ProcessLauncherDelegate.label=Streams Terminal + +# ----- Commands and Menu contributions ----- diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.process/plugin.xml b/plugins/org.eclipse.tcf.te.ui.terminals.process/plugin.xml new file mode 100644 index 00000000000..068e51399a7 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.process/plugin.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.process/pom.xml b/plugins/org.eclipse.tcf.te.ui.terminals.process/pom.xml new file mode 100644 index 00000000000..859eb193202 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.process/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + + org.eclipse.tcf + org.eclipse.tcf.maven-build + 1.3.0-SNAPSHOT + ../../../admin/pom-build.xml + + + 1.3.0.qualifier + org.eclipse.tcf.te.ui.terminals.process + eclipse-plugin + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessConnector.java b/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessConnector.java new file mode 100644 index 00000000000..98400b7384f --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessConnector.java @@ -0,0 +1,304 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.process; + +import java.io.File; +import java.io.IOException; +import java.io.StreamTokenizer; +import java.io.StringReader; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.cdt.utils.pty.PTY; +import org.eclipse.cdt.utils.spawner.ProcessFactory; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ILineSeparatorConstants; +import org.eclipse.tcf.te.core.terminals.utils.Env; +import org.eclipse.tcf.te.ui.terminals.manager.ConsoleManager; +import org.eclipse.tcf.te.ui.terminals.process.nls.Messages; +import org.eclipse.tcf.te.ui.terminals.streams.AbstractStreamsConnector; +import org.eclipse.tm.internal.terminal.emulator.VT100Emulator; +import org.eclipse.tm.internal.terminal.emulator.VT100TerminalControl; +import org.eclipse.tm.internal.terminal.provisional.api.ISettingsPage; +import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore; +import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl; +import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; + +/** + * Process connector implementation. + */ +@SuppressWarnings("restriction") +public class ProcessConnector extends AbstractStreamsConnector { + // Reference to the process settings + private final ProcessSettings settings; + + // Reference to the PTY instance. + private PTY pty; + // Reference to the launched process instance. + private Process process; + // Reference to the process monitor + private ProcessMonitor monitor; + + // The terminal width and height. Initially unknown. + private int width = -1; + private int height = -1; + + /** + * Constructor. + */ + public ProcessConnector() { + this(new ProcessSettings()); + } + + /** + * Constructor. + * + * @param settings The process settings. Must not be null + */ + public ProcessConnector(ProcessSettings settings) { + super(); + + Assert.isNotNull(settings); + this.settings = settings; + } + + /** + * Returns the process object or null if the + * connector is connector. + * + * @return The process object or null. + */ + public Process getProcess() { + return process; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#connect(org.eclipse.tcf.internal.terminal.provisional.api.ITerminalControl) + */ + @Override + public void connect(ITerminalControl control) { + Assert.isNotNull(control); + super.connect(control); + + pty = null; + width = -1; + height = -1; + + try { + boolean isAnsiTerminal = false; + + // Try to determine process and PTY instance from the process settings + process = settings.getProcess(); + pty = settings.getPTY(); + + // No process -> create PTY on supported platforms and execute + // process image. + if (process == null) { + if (PTY.isSupported(PTY.Mode.TERMINAL)) { + try { + pty = new PTY(PTY.Mode.TERMINAL); + + // Initialize the terminal size + VT100Emulator text = ((VT100TerminalControl)control).getTerminalText(); + text.fontChanged(); + } catch (IOException e) { + // PTY not supported + } + } + + // Build up the command + StringBuilder command = new StringBuilder(settings.getImage()); + String arguments = settings.getArguments(); + if (arguments != null && !"".equals(arguments.trim())) { //$NON-NLS-1$ + // Append to the command now + command.append(" "); //$NON-NLS-1$ + command.append(arguments.trim()); + } + + File workingDir =null; + if (settings.getWorkingDir()!=null){ + workingDir = new File(settings.getWorkingDir()); + } + + String[] envp = null; + if (settings.getEnvironment()!=null){ + envp = settings.getEnvironment(); + } + + if (settings.isMergeWithNativeEnvironment()) { + envp = Env.getEnvironment(envp, true); + } + + isAnsiTerminal = getTermVariable(envp).startsWith("ansi"); //$NON-NLS-1$ + + if (pty != null) { + // A PTY is available -> can use the ProcessFactory. + + // Tokenize the command (ProcessFactory takes an array) + StreamTokenizer st = new StreamTokenizer(new StringReader(command.toString())); + st.resetSyntax(); + st.whitespaceChars(0, 32); + st.whitespaceChars(0xa0, 0xa0); + st.wordChars(33, 255); + st.quoteChar('"'); + st.quoteChar('\''); + + List argv = new ArrayList(); + int ttype = st.nextToken(); + while (ttype != StreamTokenizer.TT_EOF) { + argv.add(st.sval); + ttype = st.nextToken(); + } + + // Execute the process + process = ProcessFactory.getFactory().exec(argv.toArray(new String[argv.size()]), envp, workingDir, pty); + } else { + // No PTY -> just execute via the standard Java Runtime implementation. + process = Runtime.getRuntime().exec(command.toString(), envp, workingDir); + } + } + + String lineSeparator = settings.getLineSeparator(); + if (lineSeparator == null && pty == null) { + lineSeparator = System.getProperty("line.separator"); //$NON-NLS-1$ + if ("\r".equals(lineSeparator)) { //$NON-NLS-1$ + lineSeparator = ILineSeparatorConstants.LINE_SEPARATOR_CR; + } + else if ("\n".equals(lineSeparator)) { //$NON-NLS-1$ + lineSeparator = ILineSeparatorConstants.LINE_SEPARATOR_LF; + } + else { + lineSeparator = ILineSeparatorConstants.LINE_SEPARATOR_CRLF; + } + } + + // Setup the listeners + setStdoutListeners(settings.getStdOutListeners()); + setStderrListeners(settings.getStdErrListeners()); + + // Enable VT100 line wrapping if we are connected via pty + // And TERM is VT100 compatible + if (pty != null && !isAnsiTerminal) + control.setVT100LineWrapping(true); + + // connect the streams + connectStreams(control, process.getOutputStream(), process.getInputStream(), (pty == null ? process.getErrorStream() : null), settings.isLocalEcho(), lineSeparator); + + // Set the terminal control state to CONNECTED + control.setState(TerminalState.CONNECTED); + + // Create the process monitor + monitor = new ProcessMonitor(this); + monitor.startMonitoring(); + } catch (IOException e) { + // Disconnect right away + disconnect(); + // Lookup the tab item + CTabItem item = ConsoleManager.getInstance().findConsole(control); + if (item != null) item.dispose(); + // Get the error message from the exception + String msg = e.getLocalizedMessage() != null ? e.getLocalizedMessage() : ""; //$NON-NLS-1$ + Assert.isNotNull(msg); + // Strip away "Exec_tty error:" + msg = msg.replace("Exec_tty error:", "").trim(); //$NON-NLS-1$ //$NON-NLS-2$ + // Repackage into a more user friendly error + msg = NLS.bind(Messages.ProcessConnector_error_creatingProcess, settings.getImage(), msg); + // Open an error dialog + MessageDialog.openError(control.getShell(), Messages.ProcessConnector_error_title, msg); + } + } + + private static String getTermVariable(String[] envp) { + if (envp != null && !Platform.OS_WIN32.equals(Platform.getOS())) + for (String var : envp) + if (var.startsWith("TERM=")) //$NON-NLS-1$ + return var.substring(5); + return "xterm"; //$NON-NLS-1$ + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#isLocalEcho() + */ + @Override + public boolean isLocalEcho() { + return settings.isLocalEcho(); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#doDisconnect() + */ + @Override + public void doDisconnect() { + // Stop monitoring the process + monitor.dispose(); + + // Dispose the streams + super.doDisconnect(); + + // Dispose the process + if (process != null) { process.destroy(); process = null; } + + // Set the terminal control state to CLOSED. + fControl.setState(TerminalState.CLOSED); + } + + // ***** Process Connector settings handling ***** + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#makeSettingsPage() + */ + @Override + public ISettingsPage makeSettingsPage() { + return new ProcessSettingsPage(settings); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#getSettingsSummary() + */ + @Override + public String getSettingsSummary() { + return settings.getImage() != null ? settings.getImage() : ""; //$NON-NLS-1$ + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#load(org.eclipse.tcf.internal.terminal.provisional.api.ISettingsStore) + */ + @Override + public void load(ISettingsStore store) { + settings.load(store); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#save(org.eclipse.tcf.internal.terminal.provisional.api.ISettingsStore) + */ + @Override + public void save(ISettingsStore store) { + settings.save(store); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#setTerminalSize(int, int) + */ + @Override + public void setTerminalSize(int newWidth, int newHeight) { + if (width != newWidth || height != newHeight) { + width = newWidth; + height = newHeight; + if (pty != null) { + pty.setTerminalSize(newWidth, newHeight); + } + } + } + +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessLauncherDelegate.java b/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessLauncherDelegate.java new file mode 100644 index 00000000000..fc78d60dee1 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessLauncherDelegate.java @@ -0,0 +1,134 @@ +/******************************************************************************* + * Copyright (c) 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.process; + +import java.util.Map; + +import org.eclipse.cdt.utils.pty.PTY; +import org.eclipse.core.runtime.Assert; +import org.eclipse.tcf.te.core.terminals.TerminalServiceFactory; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalServiceOutputStreamMonitorListener; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer; +import org.eclipse.tcf.te.ui.terminals.internal.SettingsStore; +import org.eclipse.tcf.te.ui.terminals.launcher.AbstractLauncherDelegate; +import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore; +import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector; +import org.eclipse.tm.internal.terminal.provisional.api.TerminalConnectorExtension; + +/** + * Process launcher delegate implementation. + */ +@SuppressWarnings("restriction") +public class ProcessLauncherDelegate extends AbstractLauncherDelegate { + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#needsUserConfiguration() + */ + @Override + public boolean needsUserConfiguration() { + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer) + */ + @Override + public IConfigurationPanel getPanel(IConfigurationPanelContainer container) { + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#execute(java.util.Map, org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done) + */ + @Override + public void execute(Map properties, Done done) { + Assert.isNotNull(properties); + + // Get the terminal service + ITerminalService terminal = TerminalServiceFactory.getService(); + // If not available, we cannot fulfill this request + if (terminal != null) { + terminal.openConsole(properties, done); + } + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#createTerminalConnector(java.util.Map) + */ + @Override + public ITerminalConnector createTerminalConnector(Map properties) { + Assert.isNotNull(properties); + + // Check for the terminal connector id + String connectorId = (String)properties.get(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID); + if (connectorId == null) connectorId = "org.eclipse.tcf.te.ui.terminals.ProcessConnector"; //$NON-NLS-1$ + + // Extract the process properties + String image = (String)properties.get(ITerminalsConnectorConstants.PROP_PROCESS_PATH); + String arguments = (String)properties.get(ITerminalsConnectorConstants.PROP_PROCESS_ARGS); + Process process = (Process)properties.get(ITerminalsConnectorConstants.PROP_PROCESS_OBJ); + PTY pty = (PTY)properties.get(ITerminalsConnectorConstants.PROP_PTY_OBJ); + Object value = properties.get(ITerminalsConnectorConstants.PROP_LOCAL_ECHO); + boolean localEcho = value instanceof Boolean ? ((Boolean)value).booleanValue() : false; + String lineSeparator = (String)properties.get(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR); + ITerminalServiceOutputStreamMonitorListener[] stdoutListeners = (ITerminalServiceOutputStreamMonitorListener[])properties.get(ITerminalsConnectorConstants.PROP_STDOUT_LISTENERS); + ITerminalServiceOutputStreamMonitorListener[] stderrListeners = (ITerminalServiceOutputStreamMonitorListener[])properties.get(ITerminalsConnectorConstants.PROP_STDERR_LISTENERS); + String workingDir = (String)properties.get(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR); + + String[] envp = null; + if (properties.containsKey(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT) && + properties.get(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT) != null && + properties.get(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT) instanceof String[]){ + envp = (String[])properties.get(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT); + } + + Assert.isTrue(image != null || process != null); + + // Construct the terminal settings store + ISettingsStore store = new SettingsStore(); + + // Construct the process settings + ProcessSettings processSettings = new ProcessSettings(); + processSettings.setImage(image); + processSettings.setArguments(arguments); + processSettings.setProcess(process); + processSettings.setPTY(pty); + processSettings.setLocalEcho(localEcho); + processSettings.setLineSeparator(lineSeparator); + processSettings.setStdOutListeners(stdoutListeners); + processSettings.setStdErrListeners(stderrListeners); + processSettings.setWorkingDir(workingDir); + processSettings.setEnvironment(envp); + + if (properties.containsKey(ITerminalsConnectorConstants.PROP_PROCESS_MERGE_ENVIRONMENT)) { + value = properties.get(ITerminalsConnectorConstants.PROP_PROCESS_MERGE_ENVIRONMENT); + processSettings.setMergeWithNativeEnvironment(value instanceof Boolean ? ((Boolean)value).booleanValue() : false); + } + + // And save the settings to the store + processSettings.save(store); + + // Construct the terminal connector instance + ITerminalConnector connector = TerminalConnectorExtension.makeTerminalConnector(connectorId); + if (connector != null) { + // Apply default settings + connector.makeSettingsPage(); + // And load the real settings + connector.load(store); + } + + return connector; + } + +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessMonitor.java b/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessMonitor.java new file mode 100644 index 00000000000..f9cce8b650f --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessMonitor.java @@ -0,0 +1,107 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.process; + +import org.eclipse.core.runtime.Assert; + + +/** + * Process monitor implementation. + */ +public class ProcessMonitor { + // Reference to the parent process connector + private final ProcessConnector processConnector; + // Reference to the monitored process + private final Process process; + // Reference to the monitor thread + private Thread thread; + // Flag to mark the monitor disposed + private boolean disposed; + + + /** + * Constructor. + * + * @param processConnector The parent process connector. Must not be null. + */ + public ProcessMonitor(ProcessConnector processConnector) { + super(); + + Assert.isNotNull(processConnector); + this.processConnector = processConnector; + + // Query the monitored process for easier access + this.process = processConnector.getProcess(); + } + + /** + * Dispose the process monitor. + */ + public void dispose() { + // Set the disposed status + disposed = true; + // Not initialized -> return immediately + if (thread == null) return; + + // Copy the reference + final Thread oldThread = thread; + // Unlink the monitor from the thread + thread = null; + // And interrupt the writer thread + oldThread.interrupt(); + } + + /** + * Starts the terminal output stream monitor. + */ + public void startMonitoring() { + // If already initialized -> return immediately + if (thread != null) return; + + // Create a new runnable which is constantly reading from the stream + Runnable runnable = new Runnable() { + @Override + public void run() { + monitorProcess(); + } + }; + + // Create the monitor thread + thread = new Thread(runnable, "Terminal Process Monitor Thread"); //$NON-NLS-1$ + + // Configure the monitor thread + thread.setDaemon(true); + + // Start the processing + thread.start(); + } + + /** + * Monitors the associated system process, waiting for it to terminate, + * and notifies the associated process monitor's. + */ + @SuppressWarnings("restriction") + public void monitorProcess() { + // If already disposed -> return immediately + if (disposed) return; + + try { + // Wait for the monitored process to terminate + process.waitFor(); + } catch (InterruptedException ie) { + // clear interrupted state + Thread.interrupted(); + } finally { + // Dispose the parent process connector + if (!disposed) + processConnector.disconnect(); + } + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessSettings.java b/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessSettings.java new file mode 100644 index 00000000000..4a306ddfbc3 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessSettings.java @@ -0,0 +1,299 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.process; + +import org.eclipse.cdt.utils.pty.PTY; +import org.eclipse.core.runtime.Assert; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalServiceOutputStreamMonitorListener; +import org.eclipse.tcf.te.ui.terminals.internal.SettingsStore; +import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore; + +/** + * Process connector settings implementation. + */ +@SuppressWarnings("restriction") +public class ProcessSettings { + // Reference to the process image + private String image; + // Reference to the process arguments (space separated string) + private String arguments; + // Reference to the process object + private Process process; + // Reference to the pseudo terminal object + private PTY pty; + // Flag to control the local echo (defaults to true if + // the PTY is not supported on the current host platform) + private boolean localEcho = !PTY.isSupported(); + // The line separator setting + private String lineSeparator = null; + // The list of stdout output listeners + private ITerminalServiceOutputStreamMonitorListener[] stdoutListeners = null; + // The list of stderr output listeners + private ITerminalServiceOutputStreamMonitorListener[] stderrListeners = null; + // working directory for process + private String workingDir; + // environment + private String[] environment; + // Flag to control if the provided environment is + // automatically merged with the native process environment. + // Defaults to "true". + private boolean mergeWithNativeEnvironment = true; + + /** + * Sets the process image. + * + * @param image The process image or null. + */ + public void setImage(String image) { + this.image = image; + } + + /** + * Returns the process image. + * + * @return The process image or null. + */ + public String getImage() { + return image; + } + + /** + * Sets the process arguments. + *

+ * The arguments are space separated. The caller is responsible for + * correct quoting. + * + * @param arguments The process arguments or null. + */ + public void setArguments(String arguments) { + this.arguments = arguments; + } + + /** + * Returns the process arguments. + * + * @return The process arguments as space separated list or null. + */ + public String getArguments() { + return arguments; + } + + /** + * Sets the process object. + * + * @param image The process object or null. + */ + public void setProcess(Process process) { + this.process = process; + } + + /** + * Returns the process object. + * + * @return The process object or null. + */ + public Process getProcess() { + return process; + } + + /** + * Sets the pseudo terminal object. + * + * @param pty The pseudo terminal or null. + */ + public void setPTY(PTY pty) { + this.pty = pty; + // If the PTY is set to "null", the local echo will be set to "true" + if (pty == null) setLocalEcho(true); + } + + /** + * Returns the pseudo terminal object. + * + * @return The pseudo terminal or null. + */ + public PTY getPTY() { + return pty; + } + + /** + * Sets if the process requires a local echo from the + * terminal widget. + * + * @param value Specify true to enable the local echo, false otherwise. + */ + public void setLocalEcho(boolean value) { + this.localEcho = value; + } + + /** + * Returns true if the process requires a local echo + * from the terminal widget. + * + * @return True if local echo is enabled, false otherwise. + */ + public boolean isLocalEcho() { + return localEcho; + } + + /** + * Sets the process line separator. + * + * @param separator The process line separator null. + */ + public void setLineSeparator(String separator) { + this.lineSeparator = separator; + } + + /** + * Returns the process line separator. + * + * @return The process line separator or null. + */ + public String getLineSeparator() { + return lineSeparator; + } + + /** + * Sets the list of stdout listeners. + * + * @param listeners The list of stdout listeners or null. + */ + public void setStdOutListeners(ITerminalServiceOutputStreamMonitorListener[] listeners) { + this.stdoutListeners = listeners; + } + + /** + * Returns the list of stdout listeners. + * + * @return The list of stdout listeners or null. + */ + public ITerminalServiceOutputStreamMonitorListener[] getStdOutListeners() { + return stdoutListeners; + } + + /** + * Sets the list of stderr listeners. + * + * @param listeners The list of stderr listeners or null. + */ + public void setStdErrListeners(ITerminalServiceOutputStreamMonitorListener[] listeners) { + this.stderrListeners = listeners; + } + + /** + * Returns the list of stderr listeners. + * + * @return The list of stderr listeners or null. + */ + public ITerminalServiceOutputStreamMonitorListener[] getStdErrListeners() { + return stderrListeners; + } + + /** + * Returns the working directory + * + * @return + */ + public String getWorkingDir() { + return this.workingDir; + } + + /** + * Sets the working directory of the process + * + * @param workingDir the absolute path of the working directory + */ + public void setWorkingDir(String workingDir) { + this.workingDir = workingDir; + } + + /** + * Get the process environment + * + * @return + */ + public String[] getEnvironment() { + return environment; + } + + /** + * Sets the process environment + * + * @param environment - will be added to the "parent" environment of the process + */ + public void setEnvironment(String[] environment) { + this.environment = environment; + } + + /** + * Returns if or if not the provided environment is merged with + * the native process environment. + * + * @return True if the provided environment is merged with the native process environment, false otherwise. + */ + public boolean isMergeWithNativeEnvironment() { + return mergeWithNativeEnvironment; + } + + /** + * Sets if or if not the provided environment is merged with the + * native process environment. + * + * @param value True if the provided environment is merged with the native process environment, false otherwise. + */ + public void setMergeWithNativeEnvironment(boolean value) { + this.mergeWithNativeEnvironment = value; + } + + /** + * Loads the process settings from the given settings store. + * + * @param store The settings store. Must not be null. + */ + public void load(ISettingsStore store) { + Assert.isNotNull(store); + image = store.get("Path", null);//$NON-NLS-1$ + arguments = store.get("Arguments", null); //$NON-NLS-1$ + localEcho = Boolean.parseBoolean(store.get("LocalEcho", Boolean.FALSE.toString())); //$NON-NLS-1$ + mergeWithNativeEnvironment = Boolean.parseBoolean(store.get("MergeWithNativeEnvironment", Boolean.FALSE.toString())); //$NON-NLS-1$ + lineSeparator = store.get("LineSeparator", null); //$NON-NLS-1$ + workingDir = store.get("WorkingDir", null); //$NON-NLS-1$ + if (store instanceof SettingsStore) { + process = (Process)((SettingsStore)store).getSettings().get("Process"); //$NON-NLS-1$ + pty = (PTY)((SettingsStore)store).getSettings().get("PTY"); //$NON-NLS-1$ + stdoutListeners = (ITerminalServiceOutputStreamMonitorListener[])((SettingsStore)store).getSettings().get("StdOutListeners"); //$NON-NLS-1$ + stderrListeners = (ITerminalServiceOutputStreamMonitorListener[])((SettingsStore)store).getSettings().get("StdErrListeners"); //$NON-NLS-1$ + environment = (String[])((SettingsStore)store).getSettings().get("Environment"); //$NON-NLS-1$ + } + } + + /** + * Saves the process settings to the given settings store. + * + * @param store The settings store. Must not be null. + */ + public void save(ISettingsStore store) { + Assert.isNotNull(store); + store.put("Path", image);//$NON-NLS-1$ + store.put("Arguments", arguments); //$NON-NLS-1$ + store.put("LocalEcho", Boolean.toString(localEcho)); //$NON-NLS-1$ + store.put("MergeWithNativeEnvironment", Boolean.toString(mergeWithNativeEnvironment)); //$NON-NLS-1$ + store.put("LineSeparator", lineSeparator); //$NON-NLS-1$ + store.put("WorkingDir", workingDir); //$NON-NLS-1$ + if (store instanceof SettingsStore) { + ((SettingsStore)store).getSettings().put("Process", process); //$NON-NLS-1$ + ((SettingsStore)store).getSettings().put("PTY", pty); //$NON-NLS-1$ + ((SettingsStore)store).getSettings().put("StdOutListeners", stdoutListeners); //$NON-NLS-1$ + ((SettingsStore)store).getSettings().put("StdErrListeners", stderrListeners); //$NON-NLS-1$ + ((SettingsStore)store).getSettings().put("Environment", environment); //$NON-NLS-1$ + } + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessSettingsPage.java b/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessSettingsPage.java new file mode 100644 index 00000000000..ab4d292ee4e --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessSettingsPage.java @@ -0,0 +1,196 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.process; + +import org.eclipse.cdt.utils.pty.PTY; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +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.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.tcf.te.ui.terminals.nls.Messages; +import org.eclipse.tm.internal.terminal.provisional.api.AbstractSettingsPage; +import org.eclipse.ui.PlatformUI; +import org.osgi.framework.Bundle; + +/** + * Process connector settings page implementation. + */ +@SuppressWarnings("restriction") +public class ProcessSettingsPage extends AbstractSettingsPage { + private Text processImageSelectorControl; + private Button processImageSelectorControlButton; + private Text processArgumentsControl; + private Button localEchoSelectorControl; + private Text processWorkingDirControl; + + private final ProcessSettings settings; + + /** + * Constructor. + * + * @param settings + */ + public ProcessSettingsPage(ProcessSettings settings) { + super(); + + Assert.isNotNull(settings); + this.settings = settings; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.provisional.api.ISettingsPage#createControl(org.eclipse.swt.widgets.Composite) + */ + @Override + public void createControl(Composite parent) { + Composite composite = new Composite(parent, SWT.NONE); + composite.setLayout(new GridLayout()); + composite.setLayoutData(new GridData(GridData.FILL_BOTH)); + + // The entry fields shall be properly aligned + Composite panel = new Composite(composite, SWT.NONE); + GridLayout layout = new GridLayout(2, false); + layout.marginWidth = 0; layout.marginHeight = 0; + panel.setLayout(layout); + panel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + // Create the process image selector control + Label label = new Label(panel, SWT.HORIZONTAL); + label.setText(Messages.ProcessSettingsPage_processImagePathSelectorControl_label); + + // Text field and browse button are aligned it their own panel + Composite innerPanel = new Composite(panel, SWT.NONE); + layout = new GridLayout(2, false); + layout.marginWidth = 0; layout.marginHeight = 0; + innerPanel.setLayout(layout); + innerPanel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + processImageSelectorControl = new Text(innerPanel, SWT.SINGLE | SWT.BORDER); + processImageSelectorControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + processImageSelectorControlButton = new Button(innerPanel, SWT.PUSH); + processImageSelectorControlButton.setText(Messages.ProcessSettingsPage_processImagePathSelectorControl_button); + processImageSelectorControlButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + onBrowseButtonSelected(e); + } + }); + + // Create the process arguments control + label = new Label(panel, SWT.HORIZONTAL); + label.setText(Messages.ProcessSettingsPage_processArgumentsControl_label); + + processArgumentsControl = new Text(panel, SWT.SINGLE | SWT.BORDER); + processArgumentsControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + // Create the process arguments control + label = new Label(panel, SWT.HORIZONTAL); + label.setText(Messages.ProcessSettingsPage_processWorkingDirControl_label); + + processWorkingDirControl = new Text(panel, SWT.SINGLE | SWT.BORDER); + processWorkingDirControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + // Create the local echo check box + localEchoSelectorControl = new Button(composite, SWT.CHECK); + localEchoSelectorControl.setText(Messages.ProcessSettingsPage_localEchoSelectorControl_label); + localEchoSelectorControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + localEchoSelectorControl.setSelection(!PTY.isSupported()); + + // Initialize the control content + loadSettings(); + } + + /** + * Called once the user pressed the browse button. + * + * @param e The selection event or null. + */ + protected void onBrowseButtonSelected(SelectionEvent e) { + // Determine the shell + Shell shell = e != null ? e.widget.getDisplay().getActiveShell() : PlatformUI.getWorkbench().getDisplay().getActiveShell(); + + // create a standard file dialog + FileDialog dialog = new FileDialog(shell, SWT.OPEN); + dialog.setText(Messages.ProcessSettingsPage_dialogTitle); + + // the dialog should open within the directory of the currently selected + // file. If no file has been currently selected, it should open within the + // last browsed directory. + String selectedFile = processImageSelectorControl.getText(); + if (selectedFile != null && selectedFile.trim().length() > 0) { + IPath filePath = new Path(selectedFile); + // If the selected file points to an directory, use the directory as is + IPath filterPath = filePath.toFile().isDirectory() ? filePath : filePath.removeLastSegments(1); + String filterFileName = filePath.toFile().isDirectory() || !filePath.toFile().exists() ? null : filePath.lastSegment(); + + if (!filterPath.isEmpty()) { + dialog.setFilterPath(filterPath.toString()); + } + if (filterFileName != null) { + dialog.setFileName(filterFileName); + } + } else { + Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$ + if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) { + dialog.setFilterPath(org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString()); + } + } + + // Open the dialog + selectedFile = dialog.open(); + if (selectedFile != null) { + processImageSelectorControl.setText(selectedFile); + } + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.provisional.api.ISettingsPage#saveSettings() + */ + @Override + public void saveSettings() { + settings.setImage(processImageSelectorControl.getText()); + settings.setArguments(processArgumentsControl.getText()); + settings.setLocalEcho(localEchoSelectorControl.getSelection()); + settings.setWorkingDir(processWorkingDirControl.getText()); + settings.setProcess(null); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.provisional.api.ISettingsPage#loadSettings() + */ + @Override + public void loadSettings() { + processImageSelectorControl.setText(settings.getImage()); + processArgumentsControl.setText(settings.getArguments()); + localEchoSelectorControl.setSelection(settings.isLocalEcho()); + processWorkingDirControl.setText(settings.getWorkingDir()); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.provisional.api.ISettingsPage#validateSettings() + */ + @Override + public boolean validateSettings() { + // The settings are considered valid if the selected process image can be read. + String selectedFile = processImageSelectorControl.getText(); + return selectedFile != null && !"".equals(selectedFile.trim()) && new Path(selectedFile).toFile().canRead(); //$NON-NLS-1$ + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/activator/UIPlugin.java b/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/activator/UIPlugin.java new file mode 100644 index 00000000000..87d195c745c --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/activator/UIPlugin.java @@ -0,0 +1,113 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.process.activator; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.graphics.Image; +import org.eclipse.tcf.te.core.terminals.tracing.TraceHandler; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class UIPlugin extends AbstractUIPlugin { + // The shared instance + private static UIPlugin plugin; + + // The trace handler instance + private static volatile TraceHandler traceHandler; + + /** + * The constructor + */ + public UIPlugin() { + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static UIPlugin getDefault() { + return plugin; + } + + /** + * Convenience method which returns the unique identifier of this plugin. + */ + public static String getUniqueIdentifier() { + if (getDefault() != null && getDefault().getBundle() != null) { + return getDefault().getBundle().getSymbolicName(); + } + return "org.eclipse.tcf.te.ui.terminals.process"; //$NON-NLS-1$ + } + + /** + * Returns the bundles trace handler. + * + * @return The bundles trace handler. + */ + public static TraceHandler getTraceHandler() { + if (traceHandler == null) { + traceHandler = new TraceHandler(getUniqueIdentifier()); + } + return traceHandler; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry) + */ + @Override + protected void initializeImageRegistry(ImageRegistry registry) { + super.initializeImageRegistry(registry); + } + + /** + * Loads the image registered under the specified key from the image + * registry and returns the 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/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/help/IContextHelpIds.java b/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/help/IContextHelpIds.java new file mode 100644 index 00000000000..3fb81c57ff0 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/help/IContextHelpIds.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.process.help; + +import org.eclipse.tcf.te.ui.terminals.process.activator.UIPlugin; + + +/** + * Context help id definitions. + */ +public interface IContextHelpIds { + + /** + * UI plug-in common context help id prefix. + */ + public final static String PREFIX = UIPlugin.getUniqueIdentifier() + "."; //$NON-NLS-1$ + + // ***** Message dialog boxes ***** + + /** + * Process connector: Create process failed + */ + public final static String MESSAGE_CREATE_PROCESS_FAILED = PREFIX + ".status.messageCreateProcessFailed"; //$NON-NLS-1$ +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/nls/Messages.java b/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/nls/Messages.java new file mode 100644 index 00000000000..60656fa69e0 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/nls/Messages.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2011, 2014 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.process.nls; + +import org.eclipse.osgi.util.NLS; + +/** + * Process terminal connector plug-in externalized strings management. + */ +public class Messages extends NLS { + + // The plug-in resource bundle name + private static final String BUNDLE_NAME = "org.eclipse.tcf.te.ui.terminals.process.nls.Messages"; //$NON-NLS-1$ + + /** + * Static constructor. + */ + static { + // Load message values from bundle file + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + // **** Declare externalized string id's down here ***** + + public static String ProcessConnector_error_title; + public static String ProcessConnector_error_creatingProcess; +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/nls/Messages.properties b/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/nls/Messages.properties new file mode 100644 index 00000000000..a3755e8a086 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/nls/Messages.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2012, 2014 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +############################################################################### + +ProcessConnector_error_title=Error +ProcessConnector_error_creatingProcess=Failed to execute ''{0}''.\n\nPossibly caused by:\n{1} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.rse/.classpath b/plugins/org.eclipse.tcf.te.ui.terminals.rse/.classpath new file mode 100644 index 00000000000..ad32c83a788 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.rse/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.rse/.options b/plugins/org.eclipse.tcf.te.ui.terminals.rse/.options new file mode 100644 index 00000000000..b396734183f --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.rse/.options @@ -0,0 +1 @@ +org.eclipse.tcf.te.ui.terminals.local/debugmode = 0 diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.rse/.project b/plugins/org.eclipse.tcf.te.ui.terminals.rse/.project new file mode 100644 index 00000000000..6dbc964fb5e --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.rse/.project @@ -0,0 +1,39 @@ + + + org.eclipse.tcf.te.ui.terminals.rse + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + + + 0 + + 10 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-target + + + + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.rse/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.tcf.te.ui.terminals.rse/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..24dad4464e4 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.rse/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,362 @@ +#Tue Oct 11 11:53:38 CEST 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=warning +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=0 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=0 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=100 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true +org.eclipse.jdt.core.formatter.lineSplit=100 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.rse/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.tcf.te.ui.terminals.rse/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000000..88bb9570e83 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.rse/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,56 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_Target Explorer Java STD +formatter_settings_version=12 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=false +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.rse/.settings/org.eclipse.pde.prefs b/plugins/org.eclipse.tcf.te.ui.terminals.rse/.settings/org.eclipse.pde.prefs new file mode 100644 index 00000000000..cf80c8bc5b8 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.rse/.settings/org.eclipse.pde.prefs @@ -0,0 +1,32 @@ +compilers.f.unresolved-features=1 +compilers.f.unresolved-plugins=1 +compilers.incompatible-environment=1 +compilers.p.build=1 +compilers.p.build.bin.includes=1 +compilers.p.build.encodings=2 +compilers.p.build.java.compiler=2 +compilers.p.build.java.compliance=1 +compilers.p.build.missing.output=2 +compilers.p.build.output.library=1 +compilers.p.build.source.library=1 +compilers.p.build.src.includes=1 +compilers.p.deprecated=1 +compilers.p.discouraged-class=1 +compilers.p.internal=1 +compilers.p.missing-packages=1 +compilers.p.missing-version-export-package=2 +compilers.p.missing-version-import-package=1 +compilers.p.missing-version-require-bundle=1 +compilers.p.no-required-att=0 +compilers.p.not-externalized-att=2 +compilers.p.unknown-attribute=1 +compilers.p.unknown-class=1 +compilers.p.unknown-element=1 +compilers.p.unknown-identifier=1 +compilers.p.unknown-resource=1 +compilers.p.unresolved-ex-points=0 +compilers.p.unresolved-import=0 +compilers.s.create-docs=false +compilers.s.doc-folder=doc +compilers.s.open-tags=1 +eclipse.preferences.version=1 diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.rse/META-INF/MANIFEST.MF b/plugins/org.eclipse.tcf.te.ui.terminals.rse/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..906a5890c77 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.rse/META-INF/MANIFEST.MF @@ -0,0 +1,22 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.tcf.te.ui.terminals.rse;singleton:=true +Bundle-Version: 1.3.0.qualifier +Bundle-Activator: org.eclipse.tcf.te.ui.terminals.rse.activator.UIPlugin +Bundle-Vendor: %providerName +Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400", + org.eclipse.core.runtime;bundle-version="3.8.0", + org.eclipse.rse.core;bundle-version="3.3.100", + org.eclipse.rse.subsystems.files.core;bundle-version="3.3.1", + org.eclipse.rse.ui;bundle-version="3.3.100", + org.eclipse.tcf.te.core.terminals;bundle-version="1.3.0", + org.eclipse.tcf.te.ui.terminals;bundle-version="1.3.0", + org.eclipse.tm.terminal;bundle-version="3.3.1", + org.eclipse.ui;bundle-version="3.8.0" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Bundle-Localization: plugin +Export-Package: org.eclipse.tcf.te.ui.terminals.rse.activator;x-internal:=true, + org.eclipse.tcf.te.ui.terminals.rse.internal;x-internal:=true, + org.eclipse.tcf.te.ui.terminals.rse.nls;x-internal:=true diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.rse/about.html b/plugins/org.eclipse.tcf.te.ui.terminals.rse/about.html new file mode 100644 index 00000000000..0f07cf034df --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.rse/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

May 24, 2012

+

License

+ +

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 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +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 http://www.eclipse.org.

+ + + \ No newline at end of file diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.rse/build.properties b/plugins/org.eclipse.tcf.te.ui.terminals.rse/build.properties new file mode 100644 index 00000000000..ea545022931 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.rse/build.properties @@ -0,0 +1,17 @@ +############################################################################### +# Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +############################################################################### +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + plugin.properties,\ + about.html,\ + icons/ diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.rse/icons/eview16/terminal_view.gif b/plugins/org.eclipse.tcf.te.ui.terminals.rse/icons/eview16/terminal_view.gif new file mode 100644 index 00000000000..bbb6a9e153e Binary files /dev/null and b/plugins/org.eclipse.tcf.te.ui.terminals.rse/icons/eview16/terminal_view.gif differ diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.rse/plugin.properties b/plugins/org.eclipse.tcf.te.ui.terminals.rse/plugin.properties new file mode 100644 index 00000000000..5fa615038a3 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.rse/plugin.properties @@ -0,0 +1,22 @@ +################################################################################## +# Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +################################################################################## + +pluginName = Terminals RSE Add-on +providerName = Eclipse.org - Target Explorer + +# ----- Commands and Menu contributions ----- + +command.launch.name=Open Terminal +command.launch.label=Open Terminal... +command.launch.tooltip=Open a Terminal + +# ----- Terminal Launcher Delegates ----- + +SshLauncherDelegate.label=SSH Terminal diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.rse/plugin.xml b/plugins/org.eclipse.tcf.te.ui.terminals.rse/plugin.xml new file mode 100644 index 00000000000..25a58712bc0 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.rse/plugin.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.rse/pom.xml b/plugins/org.eclipse.tcf.te.ui.terminals.rse/pom.xml new file mode 100644 index 00000000000..70a8617810d --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.rse/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + + org.eclipse.tcf + org.eclipse.tcf.maven-build + 1.3.0-SNAPSHOT + ../../../admin/pom-build.xml + + + 1.3.0.qualifier + org.eclipse.tcf.te.ui.terminals.rse + eclipse-plugin + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/activator/UIPlugin.java b/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/activator/UIPlugin.java new file mode 100644 index 00000000000..614dbaaf896 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/activator/UIPlugin.java @@ -0,0 +1,113 @@ +/******************************************************************************* + * Copyright (c) 2014, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.rse.activator; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.graphics.Image; +import org.eclipse.tcf.te.core.terminals.tracing.TraceHandler; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class UIPlugin extends AbstractUIPlugin { + // The shared instance + private static UIPlugin plugin; + + // The trace handler instance + private static volatile TraceHandler traceHandler; + + /** + * The constructor + */ + public UIPlugin() { + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static UIPlugin getDefault() { + return plugin; + } + + /** + * Convenience method which returns the unique identifier of this plugin. + */ + public static String getUniqueIdentifier() { + if (getDefault() != null && getDefault().getBundle() != null) { + return getDefault().getBundle().getSymbolicName(); + } + return "org.eclipse.tcf.te.ui.terminals.rse"; //$NON-NLS-1$ + } + + /** + * Returns the bundles trace handler. + * + * @return The bundles trace handler. + */ + public static TraceHandler getTraceHandler() { + if (traceHandler == null) { + traceHandler = new TraceHandler(getUniqueIdentifier()); + } + return traceHandler; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry) + */ + @Override + protected void initializeImageRegistry(ImageRegistry registry) { + super.initializeImageRegistry(registry); + } + + /** + * Loads the image registered under the specified key from the image + * registry and returns the 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/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/LaunchTerminalHandler.java b/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/LaunchTerminalHandler.java new file mode 100644 index 00000000000..c70f8299367 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/LaunchTerminalHandler.java @@ -0,0 +1,90 @@ +/******************************************************************************* + * Copyright (c) 2014, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.rse.internal; + +import java.util.Map; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.window.Window; +import org.eclipse.rse.core.filters.ISystemFilterReference; +import org.eclipse.rse.core.model.IHost; +import org.eclipse.rse.core.model.IRSEModelObject; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate; +import org.eclipse.tcf.te.ui.terminals.internal.dialogs.LaunchTerminalSettingsDialog; +import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * Launch terminal handler implementation. + */ +@SuppressWarnings("restriction") +public class LaunchTerminalHandler extends AbstractHandler { + + /* (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + // Get the active shell + Shell shell = HandlerUtil.getActiveShell(event); + // Get the current selection + ISelection selection = HandlerUtil.getCurrentSelection(event); + if (selection instanceof IStructuredSelection && !selection.isEmpty()) { + // The handler is enabled only if just one element is selected + Object element = ((IStructuredSelection) selection).getFirstElement(); + if (element instanceof IRSEModelObject || element instanceof IRemoteFile) { + // Determine the host + IHost host = null; + + if (element instanceof IHost) host = (IHost) element; + if (host == null && element instanceof ISubSystem) host = ((ISubSystem) element).getHost(); + if (host == null && element instanceof ISystemFilterReference) host = ((ISystemFilterReference) element).getSubSystem().getHost(); + if (host == null && element instanceof IRemoteFile) host = ((IRemoteFile) element).getHost(); + + if (host != null) { + // Open the launch terminal settings dialog with the SSH panel only + LaunchTerminalSettingsDialog dialog = new LaunchTerminalSettingsDialog(shell) { + @Override + protected boolean isFiltered(ISelection selection, ILauncherDelegate delegate) { + Assert.isNotNull(delegate); + return !"org.eclipse.tcf.te.ui.terminals.ssh.launcher.ssh".equals(delegate.getId()); //$NON-NLS-1$ + } + }; + dialog.setSelection(new StructuredSelection(host)); + + if (dialog.open() == Window.OK) { + // Get the terminal settings from the dialog + Map properties = dialog.getSettings(); + if (properties != null) { + String delegateId = (String)properties.get(ITerminalsConnectorConstants.PROP_DELEGATE_ID); + Assert.isNotNull(delegateId); + ILauncherDelegate delegate = LauncherDelegateManager.getInstance().getLauncherDelegate(delegateId, false); + Assert.isNotNull(delegateId); + delegate.execute(properties, null); + } + } + } + } + } + + return null; + } + +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/PropertyTester.java b/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/PropertyTester.java new file mode 100644 index 00000000000..5aa6ea07990 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/PropertyTester.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.rse.internal; + +import java.util.Arrays; +import java.util.List; + +import org.eclipse.rse.core.filters.ISystemFilterReference; +import org.eclipse.rse.core.model.IHost; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; + + + +/** + * Terminals RSE add-on property tester implementation. + */ +public class PropertyTester extends org.eclipse.core.expressions.PropertyTester { + // Supported system type id's + private final static String[] VALID_SYSTEM_TYPES = new String[] { + "org.eclipse.rse.systemtype.linux", //$NON-NLS-1$ + "org.eclipse.rse.systemtype.unix", //$NON-NLS-1$ + "org.eclipse.rse.systemtype.aix", //$NON-NLS-1$ + "org.eclipse.rse.systemtype.ssh" //$NON-NLS-1$ + }; + + private final static List VALID_SYSTEM_TYPES_LIST = Arrays.asList(VALID_SYSTEM_TYPES); + + /* (non-Javadoc) + * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object) + */ + @Override + public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { + // Determine the host object + IHost host = null; + + if (receiver instanceof IHost) host = (IHost) receiver; + if (host == null && receiver instanceof ISubSystem) host = ((ISubSystem) receiver).getHost(); + if (host == null && receiver instanceof ISystemFilterReference) host = ((ISystemFilterReference) receiver).getSubSystem().getHost(); + if (host == null && receiver instanceof IRemoteFile) host = ((IRemoteFile) receiver).getHost(); + + if (host != null) { + if ("isVisible".equals(property) && expectedValue instanceof Boolean) { //$NON-NLS-1$ + String systemTypeID = host.getSystemType().getId(); + boolean validID = systemTypeID != null ? VALID_SYSTEM_TYPES_LIST.contains(systemTypeID) : false; + return ((Boolean)expectedValue).booleanValue() == validID; + } + } + + return false; + } + +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/TerminalContextPropertiesProvider.java b/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/TerminalContextPropertiesProvider.java new file mode 100644 index 00000000000..706379f6a88 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/internal/TerminalContextPropertiesProvider.java @@ -0,0 +1,67 @@ +/******************************************************************************* + * Copyright (c) 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.rse.internal; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.rse.core.model.IHost; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalContextPropertiesProvider; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.IContextPropertiesConstants; + +/** + * Terminal context properties provider implementation. + */ +public class TerminalContextPropertiesProvider implements ITerminalContextPropertiesProvider { + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.core.terminals.interfaces.ITerminalContextPropertiesProvider#getTargetAddress(java.lang.Object) + */ + @Override + public Map getTargetAddress(Object context) { + if (context instanceof IHost) { + IHost host = (IHost) context; + + Map props = new HashMap(); + props.put(IContextPropertiesConstants.PROP_ADDRESS, host.getHostName()); + props.put(IContextPropertiesConstants.PROP_NAME, host.getName()); + + return props; + } + + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.core.terminals.interfaces.ITerminalContextPropertiesProvider#getProperty(java.lang.Object, java.lang.String) + */ + @Override + public Object getProperty(Object context, String key) { + if (context instanceof IHost) { + IHost host = (IHost) context; + + if (IContextPropertiesConstants.PROP_DEFAULT_USER.equals(key)) { + String user = host.getDefaultUserId(); + if (user != null && !"".equals(user.trim())) { //$NON-NLS-1$ + return user; + } + } + + if (IContextPropertiesConstants.PROP_DEFAULT_ENCODING.equals(key)) { + String encoding = host.getDefaultEncoding(true); + if (encoding != null && !"".equals(encoding)) { //$NON-NLS-1$ + return encoding; + } + } + } + return null; + } + +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/nls/Messages.java b/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/nls/Messages.java new file mode 100644 index 00000000000..7732c2e7178 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/nls/Messages.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.rse.nls; + +import org.eclipse.osgi.util.NLS; + +/** + * Externalized strings management. + */ +public class Messages extends NLS { + + // The plug-in resource bundle name + private static final String BUNDLE_NAME = "org.eclipse.tcf.te.ui.terminals.rse.nls.Messages"; //$NON-NLS-1$ + + /** + * Static constructor. + */ + static { + // Load message values from bundle file + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + // **** Declare externalized string id's down here ***** + +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/nls/Messages.properties b/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/nls/Messages.properties new file mode 100644 index 00000000000..2e332db1c3d --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.rse/src/org/eclipse/tcf/te/ui/terminals/rse/nls/Messages.properties @@ -0,0 +1,10 @@ +############################################################################### +# Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +############################################################################### + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.serial/.classpath b/plugins/org.eclipse.tcf.te.ui.terminals.serial/.classpath new file mode 100644 index 00000000000..ad32c83a788 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.serial/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.serial/.options b/plugins/org.eclipse.tcf.te.ui.terminals.serial/.options new file mode 100644 index 00000000000..9d8591b7606 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.serial/.options @@ -0,0 +1,2 @@ +org.eclipse.tcf.te.ui.terminals.serial/debugmode = 0 +org.eclipse.tcf.te.ui.terminals.serial/trace/serialLinePanel = false diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.serial/.project b/plugins/org.eclipse.tcf.te.ui.terminals.serial/.project new file mode 100644 index 00000000000..e4317e21b12 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.serial/.project @@ -0,0 +1,28 @@ + + + org.eclipse.tcf.te.ui.terminals.serial + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..4754bba05f6 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,362 @@ +#Wed Oct 19 12:10:57 CEST 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=warning +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=0 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=0 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=100 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true +org.eclipse.jdt.core.formatter.lineSplit=100 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000000..88bb9570e83 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,56 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_Target Explorer Java STD +formatter_settings_version=12 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=false +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.pde.prefs b/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.pde.prefs new file mode 100644 index 00000000000..cf80c8bc5b8 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.pde.prefs @@ -0,0 +1,32 @@ +compilers.f.unresolved-features=1 +compilers.f.unresolved-plugins=1 +compilers.incompatible-environment=1 +compilers.p.build=1 +compilers.p.build.bin.includes=1 +compilers.p.build.encodings=2 +compilers.p.build.java.compiler=2 +compilers.p.build.java.compliance=1 +compilers.p.build.missing.output=2 +compilers.p.build.output.library=1 +compilers.p.build.source.library=1 +compilers.p.build.src.includes=1 +compilers.p.deprecated=1 +compilers.p.discouraged-class=1 +compilers.p.internal=1 +compilers.p.missing-packages=1 +compilers.p.missing-version-export-package=2 +compilers.p.missing-version-import-package=1 +compilers.p.missing-version-require-bundle=1 +compilers.p.no-required-att=0 +compilers.p.not-externalized-att=2 +compilers.p.unknown-attribute=1 +compilers.p.unknown-class=1 +compilers.p.unknown-element=1 +compilers.p.unknown-identifier=1 +compilers.p.unknown-resource=1 +compilers.p.unresolved-ex-points=0 +compilers.p.unresolved-import=0 +compilers.s.create-docs=false +compilers.s.doc-folder=doc +compilers.s.open-tags=1 +eclipse.preferences.version=1 diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.serial/META-INF/MANIFEST.MF b/plugins/org.eclipse.tcf.te.ui.terminals.serial/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..beca7769c7c --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.serial/META-INF/MANIFEST.MF @@ -0,0 +1,24 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.tcf.te.ui.terminals.serial;singleton:=true +Bundle-Version: 1.3.0.qualifier +Bundle-Activator: org.eclipse.tcf.te.ui.terminals.serial.activator.UIPlugin +Bundle-Vendor: %providerName +Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400", + org.eclipse.core.runtime;bundle-version="3.8.0", + org.eclipse.equinox.security;bundle-version="1.1.100", + org.eclipse.tcf.te.core.terminals;bundle-version="1.3.0", + org.eclipse.tcf.te.ui.terminals;bundle-version="1.3.0", + org.eclipse.tm.terminal;bundle-version="3.3.1", + org.eclipse.tm.terminal.serial;bundle-version="2.1.400", + org.eclipse.ui;bundle-version="3.8.0" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Bundle-Localization: plugin +Export-Package: org.eclipse.tcf.te.ui.terminals.serial.activator;x-internal:=true, + org.eclipse.tcf.te.ui.terminals.serial.controls, + org.eclipse.tcf.te.ui.terminals.serial.interfaces, + org.eclipse.tcf.te.ui.terminals.serial.launcher, + org.eclipse.tcf.te.ui.terminals.serial.nls;x-internal:=true +Import-Package: gnu.io;resolution:=optional diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.serial/about.html b/plugins/org.eclipse.tcf.te.ui.terminals.serial/about.html new file mode 100644 index 00000000000..0f07cf034df --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.serial/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

May 24, 2012

+

License

+ +

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 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +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 http://www.eclipse.org.

+ + + \ No newline at end of file diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.serial/build.properties b/plugins/org.eclipse.tcf.te.ui.terminals.serial/build.properties new file mode 100644 index 00000000000..221a2d955c1 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.serial/build.properties @@ -0,0 +1,16 @@ +############################################################################### +# Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +############################################################################### +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.properties,\ + plugin.xml,\ + about.html diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.serial/plugin.properties b/plugins/org.eclipse.tcf.te.ui.terminals.serial/plugin.properties new file mode 100644 index 00000000000..d66a9e897ba --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.serial/plugin.properties @@ -0,0 +1,16 @@ +################################################################################## +# Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +################################################################################## + +pluginName = Terminals Serial Extensions +providerName = Eclipse.org - Target Explorer + +# ----- Terminal Launcher Delegates ----- + +SerialLauncherDelegate.label=Serial Terminal \ No newline at end of file diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.serial/plugin.xml b/plugins/org.eclipse.tcf.te.ui.terminals.serial/plugin.xml new file mode 100644 index 00000000000..ebb08e2cf35 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.serial/plugin.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.serial/pom.xml b/plugins/org.eclipse.tcf.te.ui.terminals.serial/pom.xml new file mode 100644 index 00000000000..5014b6d9f1a --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.serial/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + + org.eclipse.tcf + org.eclipse.tcf.maven-build + 1.3.0-SNAPSHOT + ../../../admin/pom-build.xml + + + 1.3.0.qualifier + org.eclipse.tcf.te.ui.terminals.serial + eclipse-plugin + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/activator/UIPlugin.java b/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/activator/UIPlugin.java new file mode 100644 index 00000000000..19ac52a269b --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/activator/UIPlugin.java @@ -0,0 +1,111 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.serial.activator; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.graphics.Image; +import org.eclipse.tcf.te.core.terminals.tracing.TraceHandler; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class UIPlugin extends AbstractUIPlugin { + // The shared instance + private static UIPlugin plugin; + // The trace handler instance + private static volatile TraceHandler traceHandler; + + /** + * The constructor + */ + public UIPlugin() { + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static UIPlugin getDefault() { + return plugin; + } + + /** + * Convenience method which returns the unique identifier of this plugin. + */ + public static String getUniqueIdentifier() { + if (getDefault() != null && getDefault().getBundle() != null) { + return getDefault().getBundle().getSymbolicName(); + } + return "org.eclipse.tcf.te.ui.terminals.serial"; //$NON-NLS-1$ + } + + /** + * Returns the bundles trace handler. + * + * @return The bundles trace handler. + */ + public static TraceHandler getTraceHandler() { + if (traceHandler == null) { + traceHandler = new TraceHandler(getUniqueIdentifier()); + } + return traceHandler; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry) + */ + @Override + protected void initializeImageRegistry(ImageRegistry registry) { + } + + /** + * Loads the image registered under the specified key from the image + * registry and returns the 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/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialConfigurationPanel.java b/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialConfigurationPanel.java new file mode 100644 index 00000000000..8459fcf8911 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialConfigurationPanel.java @@ -0,0 +1,133 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.serial.controls; + +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer; +import org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel; + +/** + * Serial wizard configuration panel implementation. + */ +public class SerialConfigurationPanel extends AbstractExtendedConfigurationPanel { + + private SerialLinePanel serialSettingsPage; + + /** + * Constructor. + * + * @param container The configuration panel container or null. + */ + public SerialConfigurationPanel(IConfigurationPanelContainer container) { + super(container); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#setupPanel(org.eclipse.swt.widgets.Composite) + */ + @Override + public void setupPanel(Composite parent) { + Composite panel = new Composite(parent, SWT.NONE); + panel.setLayout(new GridLayout()); + GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); + panel.setLayoutData(data); + + // Create the host selection combo + if (isWithoutSelection()) createHostsUI(panel, true); + + serialSettingsPage = new SerialLinePanel(getContainer()); + serialSettingsPage.setupPanel(panel); + + // Create the encoding selection combo + createEncodingUI(panel, true); + + setControl(panel); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#extractData(java.util.Map) + */ + @Override + public void extractData(Map data) { + // set the terminal connector id for serial + data.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tm.internal.terminal.serial.SerialConnector"); //$NON-NLS-1$ + + serialSettingsPage.extractData(data); + data.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding()); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel#fillSettingsForHost(java.lang.String) + */ + @Override + protected void fillSettingsForHost(String host){ + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel#saveSettingsForHost(boolean) + */ + @Override + protected void saveSettingsForHost(boolean add){ + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#isValid() + */ + @Override + public boolean isValid(){ + return serialSettingsPage.isValid(); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String) + */ + @Override + public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) { + Assert.isNotNull(settings); + serialSettingsPage.doSaveWidgetValues(settings, idPrefix); + // Save the encodings widget values + doSaveEncodingsWidgetValues(settings, idPrefix); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String) + */ + @Override + public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) { + Assert.isNotNull(settings); + serialSettingsPage.doRestoreWidgetValues(settings, idPrefix); + // Restore the encodings widget values + doRestoreEncodingsWidgetValues(settings, idPrefix); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel#getHostFromSettings() + */ + @Override + protected String getHostFromSettings() { + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel#isWithHostList() + */ + @Override + public boolean isWithHostList() { + return false; + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialLinePanel.java b/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialLinePanel.java new file mode 100644 index 00000000000..0e8feb62ddc --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialLinePanel.java @@ -0,0 +1,787 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.serial.controls; + +import gnu.io.CommPortIdentifier; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Enumeration; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.dialogs.IInputValidator; +import org.eclipse.jface.dialogs.IMessageProvider; +import org.eclipse.jface.dialogs.InputDialog; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +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.Label; +import org.eclipse.swt.widgets.Text; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer; +import org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel; +import org.eclipse.tcf.te.ui.terminals.serial.activator.UIPlugin; +import org.eclipse.tcf.te.ui.terminals.serial.interfaces.ITraceIds; +import org.eclipse.tcf.te.ui.terminals.serial.nls.Messages; +import org.eclipse.ui.PlatformUI; + +/** + * Serial line terminal launcher configuration panel implementation. + */ +public class SerialLinePanel extends AbstractConfigurationPanel { + public static final String fcDefaultTTYSpeed = "9600"; //$NON-NLS-1$ + public static final String fcDefaultTTYDeviceWin32 = "COM1"; //$NON-NLS-1$ + public static final String fcDefaultTTYDeviceSolaris = "/dev/cua/a"; //$NON-NLS-1$ + public static final String fcDefaultTTYDeviceLinux = "/dev/ttyS0"; //$NON-NLS-1$ + public static final String fcDefaultTTYDatabits = "8"; //$NON-NLS-1$ + public static final String fcDefaultTTYParity = "None"; //$NON-NLS-1$ + public static final String fcDefaultTTYStopbits = "1"; //$NON-NLS-1$ + public static final String fcDefaultTTYFlowControl = "None"; //$NON-NLS-1$ + public static final String fcDefaultTTYTimeout = "5"; //$NON-NLS-1$ + public static final String fcEditableTTYOther = "Other..."; //$NON-NLS-1$ + + private static final String[] fcTTYSpeedRates = { "600", //$NON-NLS-1$ + "1200", //$NON-NLS-1$ + "2400", //$NON-NLS-1$ + "4800", //$NON-NLS-1$ + "9600", //$NON-NLS-1$ + "14400", //$NON-NLS-1$ + "19200", //$NON-NLS-1$ + "38400", //$NON-NLS-1$ + "57600", //$NON-NLS-1$ + "115200" //$NON-NLS-1$ + }; + + private static final String[] fcTTYDatabits = { + "8", "7" //$NON-NLS-1$ //$NON-NLS-2$ + }; + + private static final String[] fcTTYParity = { + "None", "Odd", "Even" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + }; + + private static final String[] fcTTYStopbits = { + "1", "2" //$NON-NLS-1$ //$NON-NLS-2$ + }; + + private static final String[] fcTTYFlowControl = { + "None", "Hardware", "Software" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + }; + + Label hostTTYDeviceLabel; + Combo hostTTYDeviceCombo; + Label hostTTYSpeedLabel; + Combo hostTTYSpeedCombo; + Label hostTTYBitsLabel; + Combo hostTTYBitsCombo; + Label hostTTYParityLabel; + Combo hostTTYParityCombo; + Label hostTTYStopbitsLabel; + Combo hostTTYStopbitsCombo; + Label hostTTYFlowControlLabel; + Combo hostTTYFlowControlCombo; + Label hostTTYTimeoutLabel; + Text hostTTYTimeoutText; + + // Keep the fInputValidator protected! + protected IInputValidator inputValidatorBaud; + + int lastSelected = -1; + int lastSelectedBaud = -1; + + /** + * Constructor. + * + * @param container The configuration panel container or null. + */ + public SerialLinePanel(IConfigurationPanelContainer container) { + super(container); + } + + protected class CustomSerialBaudRateInputValidator implements IInputValidator { + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String) + */ + @Override + public String isValid(String newText) { + if (newText != null && newText.trim().length() > 0) { + if (!newText.matches("[0-9]*")) { //$NON-NLS-1$ + return Messages.SerialLinePanel_error_invalidCharactesBaudRate; + } + } else if (newText != null) { + // Empty string is an error without message (see interface)! + return ""; //$NON-NLS-1$ + } + return null; + } + } + + /** + * Returns the input validator to be used for checking the custom serial + * baud rate for basic plausibility. + */ + protected IInputValidator getCustomSerialBaudRateInputValidator() { + if (inputValidatorBaud == null) { + inputValidatorBaud = new CustomSerialBaudRateInputValidator(); + } + return inputValidatorBaud; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#setupPanel(org.eclipse.swt.widgets.Composite) + */ + @Override + public void setupPanel(Composite parent) { + Assert.isNotNull(parent); + + Composite panel = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.marginHeight = 0; layout.marginWidth = 0; + panel.setLayout(layout); + panel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + panel.setBackground(parent.getBackground()); + + setControl(panel); + + final Composite client = new Composite(parent, SWT.NONE); + Assert.isNotNull(client); + client.setLayout(new GridLayout(2, false)); + client.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + client.setBackground(panel.getBackground()); + + // Host TTY settings + hostTTYDeviceLabel = new Label(client, SWT.NONE); + hostTTYDeviceLabel.setText(Messages.SerialLinePanel_hostTTYDevice_label); + + hostTTYDeviceCombo = new Combo(client, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); + hostTTYDeviceCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + hostTTYDeviceCombo.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + // if the user selected the special editable device, show a dialog asking for the device name + if (fcEditableTTYOther.equals(hostTTYDeviceCombo.getText())) { + List tty = new ArrayList(); + List tcp = new ArrayList(); + String selected = hostTTYDeviceCombo.getItem(lastSelected); + for (String device : hostTTYDeviceCombo.getItems()) { + if (!device.equalsIgnoreCase(fcEditableTTYOther)) { + if (device.toUpperCase().startsWith("TCP:")) { //$NON-NLS-1$ + tcp.add(device); + } + else { + tty.add(device); + } + } + } + SerialPortAddressDialog dialog = new SerialPortAddressDialog(client.getShell(), selected, tty, tcp); + if (dialog.open() == Window.OK) { + // retrieve the custom serial device name and set it to the combobox drop + String device = dialog.getData(); + if (device != null && device.trim().length() > 0) { + hostTTYDeviceCombo.add(device.trim()); + hostTTYDeviceCombo.setText(device.trim()); + } else if (lastSelected != -1) { + hostTTYDeviceCombo.setText(hostTTYDeviceCombo.getItem(lastSelected)); + } + } else if (lastSelected != -1){ + hostTTYDeviceCombo.setText(hostTTYDeviceCombo.getItem(lastSelected)); + } + } + lastSelected = hostTTYDeviceCombo.getSelectionIndex(); + + IConfigurationPanelContainer container = SerialLinePanel.this.getContainer(); + if (container != null) container.validate(); + } + }); + + hostTTYSpeedLabel = new Label(client, SWT.NONE); + hostTTYSpeedLabel.setText(Messages.SerialLinePanel_hostTTYSpeed_label); + + hostTTYSpeedCombo = new Combo(client, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); + hostTTYSpeedCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + hostTTYSpeedCombo.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + // if the user selected the special editable baud rate, show a dialog asking for the baud rate + if (fcEditableTTYOther.equals(hostTTYSpeedCombo.getText())) { + InputDialog dialog = new InputDialog(getControl().getShell(), + Messages.SerialLinePanel_customSerialBaudRate_title, + Messages.SerialLinePanel_customSerialBaudRate_message, + "", //$NON-NLS-1$ + getCustomSerialBaudRateInputValidator()); + if (dialog.open() == Window.OK) { + // retrieve the custom serial device name and set it to the combobox drop + String device = dialog.getValue(); + if (device != null && device.trim().length() > 0) { + int index = hostTTYSpeedCombo.indexOf(fcEditableTTYOther); + if (index != -1 && index == hostTTYSpeedCombo.getItemCount() - 1) { + hostTTYSpeedCombo.add(device.trim()); + } else if (index != -1) { + hostTTYSpeedCombo.setItem(index + 1, device.trim()); + } + hostTTYSpeedCombo.setText(device.trim()); + } else if (lastSelectedBaud != -1) { + hostTTYSpeedCombo.setText(hostTTYSpeedCombo.getItem(lastSelectedBaud)); + } + } else if (lastSelectedBaud != -1){ + hostTTYSpeedCombo.setText(hostTTYSpeedCombo.getItem(lastSelectedBaud)); + } + } + lastSelectedBaud = hostTTYSpeedCombo.getSelectionIndex(); + + IConfigurationPanelContainer container = SerialLinePanel.this.getContainer(); + if (container != null) container.validate(); + } + }); + + // Query the list of available serial port interfaces. + UIPlugin.getTraceHandler().trace("SerialLinePanel: Start quering the available comm ports.", ITraceIds.TRACE_SERIAL_LINE_PANEL, this); //$NON-NLS-1$ + + // Query the serial devices now. + BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() { + @Override + public void run() { + queryAvailableSerialDevices(); + } + }); + + // add a special device which is being the editable one if requested at the end of the list + hostTTYDeviceCombo.add(fcEditableTTYOther); + + if (hostTTYDeviceCombo.indexOf(getDefaultHostTTYDevice()) != -1) { + hostTTYDeviceCombo.setText(getDefaultHostTTYDevice()); + } else { + if ("".equals(hostTTYDeviceCombo.getText()) && hostTTYDeviceCombo.getItemCount() > 0) { //$NON-NLS-1$ + // USI: For SWT-GTK we need the special empty entry as well. Otherwise we will have problems + // getting the selection changed event! + if (hostTTYDeviceCombo.getItemCount() == 1 + && fcEditableTTYOther.equals(hostTTYDeviceCombo.getItem(0))) { + hostTTYDeviceCombo.add("", 0); //$NON-NLS-1$ + } + hostTTYDeviceCombo.setText(hostTTYDeviceCombo.getItem(0)); + } + } + + if (hostTTYDeviceCombo.getItemCount() > 0) { + hostTTYDeviceCombo.setEnabled(true); + } else { + hostTTYDeviceCombo.setEnabled(false); + } + lastSelected = hostTTYDeviceCombo.getSelectionIndex(); + + for (String fcTTYSpeedRate : fcTTYSpeedRates) { + hostTTYSpeedCombo.add(fcTTYSpeedRate); + } + hostTTYSpeedCombo.add(fcEditableTTYOther); + + hostTTYSpeedCombo.setText(fcDefaultTTYSpeed); + lastSelectedBaud = hostTTYSpeedCombo.getSelectionIndex(); + + // add the advanced serial options + hostTTYBitsLabel = new Label(client, SWT.NONE); + hostTTYBitsLabel.setText(Messages.SerialLinePanel_hostTTYDatabits_label); + hostTTYBitsCombo = new Combo(client, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); + hostTTYBitsCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + hostTTYBitsCombo.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + IConfigurationPanelContainer container = SerialLinePanel.this.getContainer(); + if (container != null) container.validate(); + } + }); + + for (String fcTTYDatabit : fcTTYDatabits) { + hostTTYBitsCombo.add(fcTTYDatabit); + } + hostTTYBitsCombo.setText(fcDefaultTTYDatabits); + + hostTTYParityLabel = new Label(client, SWT.NONE); + hostTTYParityLabel.setText(Messages.SerialLinePanel_hostTTYParity_label); + hostTTYParityCombo = new Combo(client, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); + hostTTYParityCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + hostTTYParityCombo.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + IConfigurationPanelContainer container = SerialLinePanel.this.getContainer(); + if (container != null) container.validate(); + } + }); + + for (String element : fcTTYParity) { + hostTTYParityCombo.add(element); + } + hostTTYParityCombo.setText(fcDefaultTTYParity); + + hostTTYStopbitsLabel = new Label(client, SWT.NONE); + hostTTYStopbitsLabel.setText(Messages.SerialLinePanel_hostTTYStopbits_label); + hostTTYStopbitsCombo = new Combo(client, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); + hostTTYStopbitsCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + hostTTYStopbitsCombo.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + IConfigurationPanelContainer container = SerialLinePanel.this.getContainer(); + if (container != null) container.validate(); + } + }); + + for (String fcTTYStopbit : fcTTYStopbits) { + hostTTYStopbitsCombo.add(fcTTYStopbit); + } + hostTTYStopbitsCombo.setText(fcDefaultTTYStopbits); + + hostTTYFlowControlLabel = new Label(client, SWT.NONE); + hostTTYFlowControlLabel.setText(Messages.SerialLinePanel_hostTTYFlowControl_label); + hostTTYFlowControlCombo = new Combo(client, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); + hostTTYFlowControlCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + hostTTYFlowControlCombo.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + IConfigurationPanelContainer container = SerialLinePanel.this.getContainer(); + if (container != null) container.validate(); + } + }); + + for (String element : fcTTYFlowControl) { + hostTTYFlowControlCombo.add(element); + } + hostTTYFlowControlCombo.setText(fcDefaultTTYFlowControl); + + hostTTYTimeoutLabel = new Label(client, SWT.NONE); + hostTTYTimeoutLabel.setText(Messages.SerialLinePanel_hostTTYTimeout_label); + hostTTYTimeoutText = new Text(client, SWT.SINGLE | SWT.BORDER); + hostTTYTimeoutText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + hostTTYTimeoutText.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + IConfigurationPanelContainer container = SerialLinePanel.this.getContainer(); + if (container != null) container.validate(); + } + }); + hostTTYTimeoutText.setText(fcDefaultTTYTimeout); + } + + /** + * Query the list of serial devices. + */ + protected void queryAvailableSerialDevices() { + // Avoid printing the library version output to stdout if the platform + // is not in debug mode. + String prop = System.getProperty("gnu.io.rxtx.NoVersionOutput"); //$NON-NLS-1$ + if (prop == null && !Platform.inDebugMode()) { + System.setProperty("gnu.io.rxtx.NoVersionOutput", "true"); //$NON-NLS-1$ //$NON-NLS-2$ + } + + // java.lang.UnsatisfiedLinkError: ../plugins/gnu.io.rxtx.solaris.sparc_2.1.7.200702281917/os/solaris/sparc/librxtxSerial.so: + // Can't load Sparc 32-bit .so on a Sparc 32-bit platform + // May happen in CommPortIdentifier static constructor! + try { + Enumeration ttyPortIds = CommPortIdentifier.getPortIdentifiers(); + if (!ttyPortIds.hasMoreElements()) { + UIPlugin.getTraceHandler().trace("SerialLinePanel: NO comm ports available at all!", ITraceIds.TRACE_SERIAL_LINE_PANEL, this); //$NON-NLS-1$ + } + final List ports = new ArrayList(); + while (ttyPortIds.hasMoreElements()) { + CommPortIdentifier port = ttyPortIds.nextElement(); + String type = "unknown"; //$NON-NLS-1$ + if (port.getPortType() == CommPortIdentifier.PORT_PARALLEL) { + type = "parallel"; //$NON-NLS-1$ + } + if (port.getPortType() == CommPortIdentifier.PORT_SERIAL) { + type = "serial"; //$NON-NLS-1$ + } + UIPlugin.getTraceHandler().trace("SerialLinePanel: Found comm port: name='" + port.getName() + "', type='" + type, ITraceIds.TRACE_SERIAL_LINE_PANEL, this); //$NON-NLS-1$ //$NON-NLS-2$ + // only add serial ports + if (port.getPortType() == CommPortIdentifier.PORT_SERIAL) { + UIPlugin.getTraceHandler().trace("SerialLinePanel: Adding found serial comm port to combo!", ITraceIds.TRACE_SERIAL_LINE_PANEL, this); //$NON-NLS-1$ + if (!ports.contains(port.getName())) { + ports.add(port.getName()); + } + } + } + if (!ports.isEmpty()) { + Collections.sort(ports); + // This method may executed in a separate thread. We must spawn back + // into the UI thread to execute the adding of the ports to the control. + PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { + @Override + public void run() { + for (String port : ports) { + hostTTYDeviceCombo.add(port); + } + } + }); + } + } catch (UnsatisfiedLinkError e) { + IStatus status = new Status(IStatus.WARNING, UIPlugin.getUniqueIdentifier(), + Messages.SerialLinePanel_warning_FailedToLoadSerialPorts, e); + UIPlugin.getDefault().getLog().log(status); + } catch (NoClassDefFoundError e) { + // The NoClassDefFoundError happens the second time if the load of the library + // failed once! We do ignore this error completely! + } + } + + /** + * Enables or disables the configuration panels controls. + * + * @param enabled Specify true to enable the controls, false otherwise. + */ + @Override + public void setEnabled(boolean enabled) { + hostTTYDeviceLabel.setEnabled(enabled); + hostTTYDeviceCombo.setEnabled(enabled); + hostTTYSpeedLabel.setEnabled(enabled); + hostTTYSpeedCombo.setEnabled(enabled); + hostTTYBitsLabel.setEnabled(enabled); + hostTTYBitsCombo.setEnabled(enabled); + hostTTYParityLabel.setEnabled(enabled); + hostTTYParityCombo.setEnabled(enabled); + hostTTYStopbitsLabel.setEnabled(enabled); + hostTTYStopbitsCombo.setEnabled(enabled); + hostTTYFlowControlLabel.setEnabled(enabled); + hostTTYFlowControlCombo.setEnabled(enabled); + } + + /** + * The name of the serial ports differ between the host platforms, so we have to + * detect the default host TTY device based on the host platform. + */ + public String getDefaultHostTTYDevice() { + String osName = System.getProperty("os.name"); //$NON-NLS-1$ + // Linux ? + if (osName.equalsIgnoreCase("Linux")) { //$NON-NLS-1$ + return fcDefaultTTYDeviceLinux; + } + // Solaris ? + if (osName.equalsIgnoreCase("SunOS")) { //$NON-NLS-1$ + return fcDefaultTTYDeviceSolaris; + } + // Windows ? + if (osName.toLowerCase().startsWith("windows")) { //$NON-NLS-1$ + return fcDefaultTTYDeviceWin32; + } + return ""; //$NON-NLS-1$ + } + + /** + * Returns the default value for the serial port speed setting in bit/s + */ + public String getDefaultHostTTYSpeed() { + return fcDefaultTTYSpeed; + } + + /** + * Returns the default value for the serial port data bits setting + */ + public String getDefaultHostTTYDatabits() { + return fcDefaultTTYDatabits; + } + + /** + * Returns the default value for the serial port parity setting + */ + public String getDefaultHostTTYParity() { + return fcDefaultTTYParity; + } + + /** + * Returns the default value for the serial port stop bits setting + */ + public String getDefaultHostTTYStopbits() { + return fcDefaultTTYStopbits; + } + + /** + * Returns the default value for the serial port flow control setting + */ + public String getDefaultHostTTYFlowControl() { + return fcDefaultTTYFlowControl; + } + + /** + * Returns the default value for the serial port timeout setting. + */ + public String getDefaultHostTTYTimeout() { + return fcDefaultTTYTimeout; + } + + /** + * Set the text to the combo if available as selectable option. + * + * @param combo The combo box control. Must not be null. + * @param value The value to set. Must not be null. + */ + protected void doSetTextInCombo(Combo combo, String value) { + Assert.isNotNull(combo); + Assert.isNotNull(value); + if (combo.indexOf(value) != 1) { + combo.setText(value); + } + } + + /** + * Select the given tty device if available. + * + * @param value The tty device to select. Must not be null. + */ + public void setSelectedTTYDevice(String value) { + doSetTextInCombo(hostTTYDeviceCombo, value); + } + + /** + * Select the given tty device if available. The method + * will do nothing if the specified index is invalid. + * + * @param index The index of the tty device to select. + */ + public void setSelectedTTYDevice(int index) { + if (index >= 0 && index < hostTTYDeviceCombo.getItemCount()) { + hostTTYDeviceCombo.setText(hostTTYDeviceCombo.getItem(index)); + } + } + + /** + * Select the given tty device speed if available. + * + * @param value The tty device speed to select. Must not be null. + */ + public void setSelectedTTYSpeed(String value) { + doSetTextInCombo(hostTTYSpeedCombo, value); + } + + /** + * Select the given tty device data bit configuration if available. + * + * @param value The tty device data bit configuration to select. Must not be null. + */ + public void setSelectedTTYDatabits(String value) { + doSetTextInCombo(hostTTYBitsCombo, value); + } + + /** + * Select the given tty device parity configuration if available. + * + * @param value The tty device parity configuration to select. Must not be null. + */ + public void setSelectedTTYParity(String value) { + doSetTextInCombo(hostTTYParityCombo, value); + } + + /** + * Select the given tty device stop bit configuration if available. + * + * @param value The tty device stop bit configuration to select. Must not be null. + */ + public void setSelectedTTYStopbits(String value) { + doSetTextInCombo(hostTTYStopbitsCombo, value); + } + + /** + * Select the given tty device flow control configuration if available. + * + * @param value The tty device flow control configuration to select. Must not be null. + */ + public void setSelectedTTYFlowControl(String value) { + doSetTextInCombo(hostTTYFlowControlCombo, value); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel#isValid() + */ + @Override + public boolean isValid() { + String selectedTTYDevice = hostTTYDeviceCombo.getText(); + if (selectedTTYDevice == null || selectedTTYDevice.trim().length() == 0) { + setMessage(Messages.SerialLinePanel_error_emptyHostTTYDevice, IMessageProvider.ERROR); + return false; + } + + if (fcEditableTTYOther.equals(selectedTTYDevice)) { + setMessage(Messages.SerialLinePanel_info_editableTTYDeviceSelected, IMessageProvider.INFORMATION); + return false; + } + + String selectedTTYSpeedRate = hostTTYSpeedCombo.getText(); + if (selectedTTYSpeedRate == null || selectedTTYSpeedRate.trim().length() == 0) { + setMessage(Messages.SerialLinePanel_error_emptyHostTTYSpeedRate, IMessageProvider.ERROR); + return false; + } + + if (fcEditableTTYOther.equals(selectedTTYSpeedRate)) { + setMessage(Messages.SerialLinePanel_info_editableTTYBaudRateSelected, IMessageProvider.INFORMATION); + return false; + } + + String option = hostTTYBitsCombo.getText(); + if (option == null || option.trim().length() == 0) { + setMessage(Messages.SerialLinePanel_error_emptyHostTTYDatabits, IMessageProvider.ERROR); + return false; + } + + option = hostTTYParityCombo.getText(); + if (option == null || option.trim().length() == 0) { + setMessage(Messages.SerialLinePanel_error_emptyHostTTYParity, IMessageProvider.ERROR); + return false; + } + + option = hostTTYStopbitsCombo.getText(); + if (option == null || option.trim().length() == 0) { + setMessage(Messages.SerialLinePanel_error_emptyHostTTYStopbits, IMessageProvider.ERROR); + return false; + } + + option = hostTTYFlowControlCombo.getText(); + if (option == null || option.trim().length() == 0) { + setMessage(Messages.SerialLinePanel_error_emptyHostTTYFlowControl, IMessageProvider.ERROR); + return false; + } + + option = hostTTYTimeoutText.getText(); + if (option == null || option.trim().length() == 0) { + setMessage(Messages.SerialLinePanel_error_emptyHostTTYFlowControl, IMessageProvider.ERROR); + return false; + } + + return true; + } + + private final String fcSelectedTTYDeviceSlotId = "SerialLinePanel.selectedTTYDevice." + System.getProperty("os.name"); //$NON-NLS-1$ //$NON-NLS-2$ + private final String fcSelectedTTYSpeedRateSlotId = "SerialLinePanel.selectedTTYSpeedRate." + System.getProperty("os.name"); //$NON-NLS-1$ //$NON-NLS-2$ + private final String fcSelectedTTYDatabitsSlotId = "SerialLinePanel.selectedTTYDatabits." + System.getProperty("os.name"); //$NON-NLS-1$ //$NON-NLS-2$ + private final String fcSelectedTTYParitySlotId = "SerialLinePanel.selectedTTYParity." + System.getProperty("os.name"); //$NON-NLS-1$ //$NON-NLS-2$ + private final String fcSelectedTTYStopbitsSlotId = "SerialLinePanel.selectedTTYStopbits." + System.getProperty("os.name"); //$NON-NLS-1$ //$NON-NLS-2$ + private final String fcSelectedTTYFlowControlSlotId = "SerialLinePanel.selectedTTYFlowControl." + System.getProperty("os.name"); //$NON-NLS-1$ //$NON-NLS-2$ + private final String fcSelectedTTYTimeoutSlotId = "SerialLinePanel.selectedTTYTimeout." + System.getProperty("os.name"); //$NON-NLS-1$ //$NON-NLS-2$ + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String) + */ + @Override + public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) { + Assert.isNotNull(settings); + + String selectedTTYDevice = settings.get(prefixDialogSettingsSlotId(fcSelectedTTYDeviceSlotId, idPrefix)); + if (selectedTTYDevice != null && selectedTTYDevice.trim().length() > 0) { + if (hostTTYDeviceCombo.indexOf(selectedTTYDevice) != -1) { + hostTTYDeviceCombo.setText(selectedTTYDevice); + } + } + + String selectedTTYSpeedRate = settings.get(prefixDialogSettingsSlotId(fcSelectedTTYSpeedRateSlotId, idPrefix)); + if (selectedTTYSpeedRate != null && selectedTTYSpeedRate.trim().length() > 0) { + if (hostTTYSpeedCombo.indexOf(selectedTTYSpeedRate) != -1) { + hostTTYSpeedCombo.setText(selectedTTYSpeedRate); + } + } + + String option = settings.get(prefixDialogSettingsSlotId(fcSelectedTTYDatabitsSlotId, idPrefix)); + if (option != null && option.trim().length() > 0 && hostTTYBitsCombo.indexOf(option) != -1) { + hostTTYBitsCombo.setText(option); + } + + option = settings.get(prefixDialogSettingsSlotId(fcSelectedTTYParitySlotId, idPrefix)); + if (option != null && option.trim().length() > 0 && hostTTYParityCombo.indexOf(option) != -1) { + hostTTYParityCombo.setText(option); + } + + option = settings.get(prefixDialogSettingsSlotId(fcSelectedTTYStopbitsSlotId, idPrefix)); + if (option != null && option.trim().length() > 0 && hostTTYStopbitsCombo.indexOf(option) != -1) { + hostTTYStopbitsCombo.setText(option); + } + + option = settings.get(prefixDialogSettingsSlotId(fcSelectedTTYFlowControlSlotId, idPrefix)); + if (option != null && option.trim().length() > 0 && hostTTYFlowControlCombo.indexOf(option) != -1) { + hostTTYFlowControlCombo.setText(option); + } + + option = settings.get(prefixDialogSettingsSlotId(fcSelectedTTYTimeoutSlotId, idPrefix)); + if (option != null && option.trim().length() > 0 && !option.equals(hostTTYTimeoutText.getText())) { + hostTTYTimeoutText.setText(option); + } + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String) + */ + @Override + public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) { + Assert.isNotNull(settings); + + settings.put(prefixDialogSettingsSlotId(fcSelectedTTYDeviceSlotId, idPrefix), hostTTYDeviceCombo.getText()); + settings.put(prefixDialogSettingsSlotId(fcSelectedTTYSpeedRateSlotId, idPrefix), hostTTYSpeedCombo.getText()); + + settings.put(prefixDialogSettingsSlotId(fcSelectedTTYDatabitsSlotId, idPrefix), hostTTYBitsCombo.getText()); + settings.put(prefixDialogSettingsSlotId(fcSelectedTTYParitySlotId, idPrefix), hostTTYParityCombo.getText()); + settings.put(prefixDialogSettingsSlotId(fcSelectedTTYStopbitsSlotId, idPrefix), hostTTYStopbitsCombo.getText()); + settings.put(prefixDialogSettingsSlotId(fcSelectedTTYFlowControlSlotId, idPrefix), hostTTYFlowControlCombo.getText()); + settings.put(prefixDialogSettingsSlotId(fcSelectedTTYTimeoutSlotId, idPrefix), hostTTYTimeoutText.getText()); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#setupData(java.util.Map) + */ + @Override + public void setupData(Map data) { + if (data == null) return; + + hostTTYDeviceCombo.setText((String)data.get(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE)); + hostTTYSpeedCombo.setText((String)data.get(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE)); + + hostTTYBitsCombo.setText((String)data.get(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS)); + hostTTYParityCombo.setText((String)data.get(ITerminalsConnectorConstants.PROP_SERIAL_PARITY)); + hostTTYStopbitsCombo.setText((String)data.get(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS)); + hostTTYFlowControlCombo.setText((String)data.get(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL)); + + Object value = data.get(ITerminalsConnectorConstants.PROP_TIMEOUT); + if (value instanceof Integer) { + hostTTYTimeoutText.setText(((Integer)value).toString()); + } + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#extractData(java.util.Map) + */ + @Override + public void extractData(Map data) { + if (data == null) return; + + data.put(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE, hostTTYDeviceCombo.getText()); + data.put(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE, hostTTYSpeedCombo.getText()); + + data.put(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS, hostTTYBitsCombo.getText()); + data.put(ITerminalsConnectorConstants.PROP_SERIAL_PARITY, hostTTYParityCombo.getText()); + data.put(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS, hostTTYStopbitsCombo.getText()); + data.put(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL, hostTTYFlowControlCombo.getText()); + + if (hostTTYTimeoutText.getText() != null) { + Integer timeout = null; + try { + timeout = Integer.decode(hostTTYTimeoutText.getText()); + } catch (NumberFormatException e) { /* ignored on purpose */ } + if (timeout != null) data.put(ITerminalsConnectorConstants.PROP_TIMEOUT, timeout); + else data.remove(ITerminalsConnectorConstants.PROP_TIMEOUT); + } + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialPortAddressDialog.java b/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialPortAddressDialog.java new file mode 100644 index 00000000000..1e5632c420c --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialPortAddressDialog.java @@ -0,0 +1,689 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.serial.controls; + +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.dialogs.IMessageProvider; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.VerifyEvent; +import org.eclipse.swt.events.VerifyListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.tcf.te.ui.terminals.serial.activator.UIPlugin; +import org.eclipse.tcf.te.ui.terminals.serial.nls.Messages; +import org.eclipse.ui.PlatformUI; + +/** + * Serial line port or address dialog. + */ +public class SerialPortAddressDialog extends TitleAreaDialog implements IMessageProvider { + private String contextHelpId = null; + + private String message; + private int messageType; + private String errorMessage; + private String title; + + // The default message is shown to the user if no other message is set + private String defaultMessage; + private int defaultMessageType; + + Button ttyControlSelector; + Combo ttyControl; + Button tcpControlSelector; + Combo addressControl; + Combo portControl; + Label portLabel; + + List ttyHistory; + List tcpHistory; + + String data = null; + + // regular expressions for validator + /* default */ static final String IP_CHARACTERS_REGEX = "[0-9][0-9\\.]*"; //$NON-NLS-1$ + /* default */ static final String IP_FRAGMENT_REGEX = "([0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])"; //$NON-NLS-1$ + /* default */ static final String IP_REGEX = IP_FRAGMENT_REGEX + "(\\." + IP_FRAGMENT_REGEX + "){3}[ ]*"; //$NON-NLS-1$ //$NON-NLS-2$ + + // RFC 1034 - ftp://ftp.rfc-editor.org/in-notes/std/std13.txt + /* default */ static final String NAME_CHARACTERS_REGEX = "[a-zA-Z][0-9a-zA-Z\\-_\\.]*"; //$NON-NLS-1$ + // characters that can be set at the beginning + /* default */ static final String NAME_START_REGEX = "[a-zA-Z]"; //$NON-NLS-1$ + // characters that can be set after the starting character + /* default */ static final String NAME_FOLLOW_REGEX = "[a-zA-Z0-9-_]"; //$NON-NLS-1$ + // characters that can be set at the end + /* default */ static final String NAME_END_REGEX = "[a-zA-Z0-9]"; //$NON-NLS-1$ + // single name fragment + /* default */ static final String NAME_FRAGMENT_REGEX = "(" + NAME_START_REGEX + "(" + NAME_FOLLOW_REGEX + "*" + NAME_END_REGEX + ")?)"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + + /* default */ static final String NAME_REGEX = NAME_FRAGMENT_REGEX + "(\\." + NAME_FRAGMENT_REGEX + ")*[ ]*"; //$NON-NLS-1$ //$NON-NLS-2$ + + /** + * Constructor. + * @param parentShell + */ + public SerialPortAddressDialog(Shell parentShell, String selected, List ttyHistory, List tcpHistory) { + super(parentShell); + this.ttyHistory = ttyHistory; + this.tcpHistory = tcpHistory; + this.data = selected; + + this.contextHelpId = UIPlugin.getUniqueIdentifier() + ".SerialPortAddressDialog"; //$NON-NLS-1$ + setHelpAvailable(true); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#isResizable() + */ + @Override + protected boolean isResizable() { + return true; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#create() + */ + @Override + public void create() { + super.create(); + + // If the dialog got set a message, make sure the message is really shown + // to the user from the beginning. + if (isMessageSet()) { + if (errorMessage != null) { + super.setErrorMessage(errorMessage); + } + else { + super.setMessage(message, messageType); + } + } else if (defaultMessage != null) { + // Default message set + super.setMessage(defaultMessage, defaultMessageType); + } + + // If the dialog got set a title, make sure the title is shown + if (title != null) { + super.setTitle(title); + } + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) + */ + @Override + protected final Control createDialogArea(Composite parent) { + if (contextHelpId != null) { + PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, contextHelpId); + } + + // Let the super implementation create the dialog area control + Control control = super.createDialogArea(parent); + // Setup the inner panel as scrollable composite + if (control instanceof Composite) { + ScrolledComposite sc = new ScrolledComposite((Composite)control, SWT.V_SCROLL); + + GridLayout layout = new GridLayout(1, true); + layout.marginHeight = 0; layout.marginWidth = 0; + layout.verticalSpacing = 0; layout.horizontalSpacing = 0; + + sc.setLayout(layout); + sc.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL)); + + sc.setExpandHorizontal(true); + sc.setExpandVertical(true); + + Composite composite = new Composite(sc, SWT.NONE); + composite.setLayout(new GridLayout()); + + // Setup the dialog area content + createDialogAreaContent(composite); + + sc.setContent(composite); + sc.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + + // Return the scrolled composite as new dialog area control + control = sc; + } + + return control; + } + + /** + * Creates the dialog area content. + * + * @param parent The parent composite. Must not be null. + */ + protected void createDialogAreaContent(Composite parent) { + Assert.isNotNull(parent); + + setDialogTitle(Messages.SerialPortAddressDialog_dialogtitle); + setTitle(Messages.SerialPortAddressDialog_title); + + Composite ttyComp = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + ttyComp.setLayout(layout); + GridData layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false); + layoutData.widthHint = 250; + ttyComp.setLayoutData(layoutData); + + Composite panel = new Composite(ttyComp, SWT.NONE); + layout = new GridLayout(2, false); + layout.marginHeight = 0; layout.marginWidth = 0; + panel.setLayout(layout); + layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false); + panel.setLayoutData(layoutData); + + ttyControlSelector = new Button(panel, SWT.RADIO); + ttyControlSelector.setText(Messages.SerialLinePanel_hostTTYDevice_label); + layoutData = new GridData(SWT.LEAD, SWT.CENTER, false, false); + ttyControlSelector.setLayoutData(layoutData); + ttyControlSelector.setSelection(true); + ttyControlSelector.addSelectionListener(new SelectionAdapter(){ + @Override + public void widgetSelected(SelectionEvent e) { + boolean selected = ttyControlSelector.getSelection(); + setTTYControlEnabled(selected); + setTCPControlEnabled(!selected); + onModify(); + } + }); + + ttyControl = new Combo(panel, SWT.DROP_DOWN); + layoutData = new GridData(SWT.FILL, SWT.FILL, true, true); + ttyControl.setLayoutData(layoutData); + ttyControl.addModifyListener(new ModifyListener(){ + @Override + public void modifyText(ModifyEvent e) { + onModify(); + } + }); + + parent.getDisplay().asyncExec(new Runnable() { + @Override + public void run() { + boolean enable = ttyHistory != null && ttyHistory.contains(data); + setTTYControlEnabled(enable); + setTCPControlEnabled(!enable); + onModify(); + } + }); + + Composite tcpComp = new Composite(parent, SWT.NONE); + layout = new GridLayout(2, true); + tcpComp.setLayout(layout); + layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false); + tcpComp.setLayoutData(layoutData); + + Composite tcpAddrComp = new Composite(tcpComp, SWT.NONE); + layout = new GridLayout(2, false); + layout.marginWidth = 0; layout.marginHeight = 0; + tcpAddrComp.setLayout(layout); + layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false); + tcpAddrComp.setLayoutData(layoutData); + + tcpControlSelector = new Button(tcpAddrComp, SWT.RADIO); + tcpControlSelector.setText(Messages.SerialPortAddressDialog_address); + layoutData = new GridData(SWT.LEAD, SWT.CENTER, false, false); + tcpControlSelector.setLayoutData(layoutData); + tcpControlSelector.setSelection(false); + tcpControlSelector.addSelectionListener(new SelectionAdapter(){ + @Override + public void widgetSelected(SelectionEvent e) { + boolean selected = tcpControlSelector.getSelection(); + setTTYControlEnabled(!selected); + setTCPControlEnabled(selected); + onModify(); + } + }); + + addressControl = new Combo(tcpAddrComp, SWT.DROP_DOWN); + layoutData = new GridData(SWT.FILL, SWT.FILL, true, true); + addressControl.setLayoutData(layoutData); + addressControl.addModifyListener(new ModifyListener(){ + @Override + public void modifyText(ModifyEvent e) { + onModify(); + } + }); + + Composite tcpPortComp = new Composite(tcpComp, SWT.NONE); + layout = new GridLayout(2, false); + layout.marginWidth = 0; layout.marginHeight = 0; + tcpPortComp.setLayout(layout); + layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false); + tcpPortComp.setLayoutData(layoutData); + + portLabel = new Label(tcpPortComp, SWT.HORIZONTAL); + portLabel.setText(Messages.SerialPortAddressDialog_port); + layoutData = new GridData(SWT.LEAD, SWT.CENTER, false, false); + portLabel.setLayoutData(layoutData); + + portControl = new Combo(tcpPortComp, SWT.DROP_DOWN); + layoutData = new GridData(SWT.FILL, SWT.FILL, true, true); + portControl.setLayoutData(layoutData); + portControl.addVerifyListener(new VerifyListener() { + @Override + public void verifyText(VerifyEvent e) { + StringBuilder buffer = new StringBuilder(((Combo)e.widget).getText()); + + try { + if (e.end > e.start) { + buffer.replace(e.start, e.end, e.text); + } else if (e.end >= 0) { + buffer.insert(e.end, e.text); + } + } catch (StringIndexOutOfBoundsException exc) { /* ignored on purpose */ } + + String fulltext = buffer.toString(); + e.doit = fulltext.matches("([0-9]{0,5})|(0((x|X)[0-9a-fA-F]{0,4})?)"); //$NON-NLS-1$ + + if (e.doit && fulltext.length() > 0 && !fulltext.equalsIgnoreCase("0x")) { //$NON-NLS-1$ + try { + int value = Integer.decode(fulltext).intValue(); + if (value < 0 || value > 65535) { + e.doit = false; + } + } + catch (Exception ex) { + e.doit = false; + } + } + } + }); + portControl.addModifyListener(new ModifyListener(){ + @Override + public void modifyText(ModifyEvent e) { + onModify(); + } + }); + + // Trigger the runnable after having created all controls! + parent.getDisplay().asyncExec(new Runnable() { + @Override + public void run() { + boolean enable = tcpHistory != null && tcpHistory.contains(data); + setTTYControlEnabled(!enable); + setTCPControlEnabled(enable); + onModify(); + } + }); + + applyDialogFont(ttyComp); + applyDialogFont(tcpComp); + + setupData(); + } + + private void setupData() { + setTTYControlEnabled(true); + setTCPControlEnabled(false); + if (ttyHistory != null && !ttyHistory.isEmpty()) { + for (String tty : ttyHistory) { + if (tty != null && tty.trim().length() > 0 && ttyControl.indexOf(tty) == -1) { + ttyControl.add(tty.trim()); + } + if (tty != null && tty.equals(data)) { + ttyControl.setText(tty.trim()); + } + } + } + if (tcpHistory != null && !tcpHistory.isEmpty()) { + for (String tcp : tcpHistory) { + String[] data = tcp.split(":"); //$NON-NLS-1$ + if (data.length > 1) { + if (data[1] != null && data[1].trim().length() > 0 && ttyControl.indexOf(data[1]) == -1) { + addressControl.add(data[1].trim()); + } + } + if (data.length > 2) { + if (data[2] != null && data[2].trim().length() > 0 && ttyControl.indexOf(data[2]) == -1) { + addressControl.add(data[2].trim()); + } + } + if (tcp.equals(this.data)) { + setTTYControlEnabled(false); + setTCPControlEnabled(true); + if (data.length > 1) { + addressControl.setText(data[1]); + } + if (data.length > 2) { + portControl.setText(data[2]); + } + } + } + } + onModify(); + } + + void setTTYControlEnabled(boolean enable) { + ttyControlSelector.setSelection(enable); + ttyControl.setEnabled(enable); + } + + void setTCPControlEnabled(boolean enable) { + tcpControlSelector.setSelection(enable); + addressControl.setEnabled(enable); + portControl.setEnabled(enable); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.TrayDialog#createButtonBar(org.eclipse.swt.widgets.Composite) + */ + @Override + protected Control createButtonBar(Composite parent) { + Control control = super.createButtonBar(parent); + setButtonEnabled(OK, false); + return control; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.dialogs.CustomTitleAreaDialog#okPressed() + */ + @Override + protected void okPressed() { + if (ttyControlSelector.getSelection()) { + data = ttyControl.getText(); + } + else { + data = "tcp:" + addressControl.getText() + ":" + portControl.getText(); //$NON-NLS-1$ //$NON-NLS-2$ + } + super.okPressed(); + } + + /** + * Called from the single controls if the content of the controls changed. + */ + protected void onModify() { + setMessage(null); + + boolean valid = false; + + if (ttyControlSelector.getSelection()) { + valid = isTtyControlValid(); + } else { + valid = isAddressControlValid(); + valid &= isPortControlValid(); + } + + if (getMessage() == null) { + setDefaultMessage(Messages.SerialPortAddressDialog_message, IMessageProvider.INFORMATION); + } + + setButtonEnabled(OK, valid); + } + + private static final Pattern validCharacters = Platform.OS_WIN32.equals(Platform.getOS()) ? Pattern.compile("[\\w]+") : Pattern.compile("[\\w/]+"); //$NON-NLS-1$ //$NON-NLS-2$ + + /** + * Validates the tty device control. + * + * @return True if the control is valid, false otherwise. + */ + protected boolean isTtyControlValid() { + if (ttyControl == null || ttyControl.isDisposed()) return false; + + boolean valid = true; + + String m = null; + int mt = IMessageProvider.NONE; + + String newText = ttyControl.getText(); + Assert.isNotNull(newText); + if (newText.trim().length() > 0) { + Matcher matcher = validCharacters.matcher(newText); + if (!matcher.matches()) { + m = Messages.SerialLinePanel_error_invalidCharactes; + mt = IMessageProvider.ERROR; + } + } + else { + m = Messages.SerialLinePanel_error_emptyHostTTYDevice; + mt = IMessageProvider.INFORMATION; + } + + valid = mt != IMessageProvider.ERROR; + if (mt > getMessageType()) setMessage(m, mt); + + return valid; + } + + /** + * Validates the address control. + * + * @return True if the control is valid, false otherwise. + */ + protected boolean isAddressControlValid() { + if (addressControl == null || addressControl.isDisposed()) return false; + + boolean valid = true; + + String m = null; + int mt = IMessageProvider.NONE; + + String ipOrHostName = addressControl.getText(); + + // info message when value is empty + if (ipOrHostName == null || ipOrHostName.trim().length() == 0) { + m = Messages.SerialPortAddressDialog_Information_MissingTargetNameAddress; + mt = IMessageProvider.INFORMATION; + } else { + ipOrHostName = ipOrHostName.trim(); + // check IP address when only numeric values and '.' are entered + if (ipOrHostName.matches(IP_CHARACTERS_REGEX)) { + if (!ipOrHostName.matches(IP_REGEX)) { + m = Messages.SerialPortAddressDialog_Error_InvalidTargetIpAddress; + mt = IMessageProvider.ERROR; + } + } + else if (ipOrHostName.matches(NAME_CHARACTERS_REGEX)) { + if (!ipOrHostName.matches(NAME_REGEX)) { + m = Messages.SerialPortAddressDialog_Error_InvalidTargetNameAddress; + mt = IMessageProvider.ERROR; + } + } + else { + m = Messages.SerialPortAddressDialog_Error_InvalidTargetNameAddress; + mt = IMessageProvider.ERROR; + } + } + + valid = mt != IMessageProvider.ERROR; + if (mt > getMessageType()) setMessage(m, mt); + + return valid; + } + + /** + * Validates the port control. + * + * @return True if the control is valid, false otherwise. + */ + protected boolean isPortControlValid() { + if (portControl == null || portControl.isDisposed()) return false; + + boolean valid = true; + + String m = null; + int mt = IMessageProvider.NONE; + + String newText = portControl.getText(); + Assert.isNotNull(newText); + if (newText.trim().length() > 0) { + if (!newText.matches("([0-9]{0,5})|(0((x|X)[0-9a-fA-F]{0,4})?)")) { //$NON-NLS-1$ + m = Messages.SerialPortAddressDialog_Error_InvalidPort; + mt = IMessageProvider.ERROR; + } else { + try { + int value = Integer.decode(newText).intValue(); + if (value < 0 || value > 65535) { + m = Messages.SerialPortAddressDialog_Error_InvalidPortRange; + mt = IMessageProvider.ERROR; + } + } + catch (Exception ex) { /* ignored on purpose */ } + } + } + else { + m = Messages.SerialPortAddressDialog_Information_MissingPort; + mt = IMessageProvider.INFORMATION; + } + + valid = mt != IMessageProvider.ERROR; + if (mt > getMessageType()) setMessage(m, mt); + + return valid; + } + + /** + * Return the new name after OK was pressed. + * Unless OK was pressed, the old name is returned. + */ + public String getData() { + return data; + } + + /** + * Cleanup when dialog is closed. + */ + protected void dispose() { + message = null; + messageType = IMessageProvider.NONE; + errorMessage = null; + title = null; + defaultMessage = null; + defaultMessageType = IMessageProvider.NONE; + } + + /** + * Cleanup the Dialog and close it. + */ + @Override + public boolean close() { + dispose(); + return super.close(); + } + + /** + * Set the enabled state of the dialog button specified by the given id (@see IDialogConstants) + * to the given state. + * + * @param buttonId The button id for the button to change the enabled state for. + * @param enabled The new enabled state to set for the button. + */ + public void setButtonEnabled(int buttonId, boolean enabled) { + Button button = getButton(buttonId); + if (button != null) { + button.setEnabled(enabled); + } + } + + /** + * Sets the title for this dialog. + * + * @param title The title. + */ + public void setDialogTitle(String title) { + if (getShell() != null && !getShell().isDisposed()) { + getShell().setText(title); + } + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.TitleAreaDialog#setTitle(java.lang.String) + */ + @Override + public void setTitle(String newTitle) { + title = newTitle; + super.setTitle(newTitle); + } + + /** + * Set the default message. The default message is shown within the + * dialogs message area if no other message is set. + * + * @param message The default message or null. + * @param type The default message type. See {@link IMessageProvider}. + */ + public void setDefaultMessage(String message, int type) { + defaultMessage = message; + defaultMessageType = type; + // Push the default message to the dialog if no other message is set + if (!isMessageSet() && getContents() != null) { + super.setMessage(defaultMessage, defaultMessageType); + } + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.TitleAreaDialog#setMessage(java.lang.String, int) + */ + @Override + public void setMessage(String newMessage, int newType) { + // To be able to implement IMessageProvider, we have to remember the + // set message ourselfs. There is no access to these information by the + // base class. + message = newMessage; messageType = newType; + // Only pass on to super implementation if the control has been created yet + if (getContents() != null) { + super.setMessage(message != null ? message : defaultMessage, message != null ? messageType : defaultMessageType); + } + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.TitleAreaDialog#setErrorMessage(java.lang.String) + */ + @Override + public void setErrorMessage(String newErrorMessage) { + // See setMessage(...) + errorMessage = newErrorMessage; + super.setErrorMessage(newErrorMessage); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IMessageProvider#getMessage() + */ + @Override + public String getMessage() { + return errorMessage != null ? errorMessage : message; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IMessageProvider#getMessageType() + */ + @Override + public int getMessageType() { + return errorMessage != null ? IMessageProvider.ERROR : messageType; + } + + /** + * Returns if or if not an message is set to the dialog. + * + * @return True if a message has been set, false otherwise. + */ + public boolean isMessageSet() { + return errorMessage != null || message != null; + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/interfaces/ITraceIds.java b/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/interfaces/ITraceIds.java new file mode 100644 index 00000000000..9f0df469edc --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/interfaces/ITraceIds.java @@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.serial.interfaces; + +/** + * Trace slot identifiers. + */ +public interface ITraceIds { + + /** + * If activated, trace information about serial device discovery is printed out. + */ + public static final String TRACE_SERIAL_LINE_PANEL = "trace/serialLinePanel"; //$NON-NLS-1$ + +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/interfaces/IWireTypeSerial.java b/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/interfaces/IWireTypeSerial.java new file mode 100644 index 00000000000..a8da2a84fc5 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/interfaces/IWireTypeSerial.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.serial.interfaces; + +/** + * The properties specific to the wire type "serial". + */ +public interface IWireTypeSerial { + + /** + * The data container. + */ + public static String PROPERTY_CONTAINER_NAME = "serial"; //$NON-NLS-1$ + + /** + * The serial device name. + */ + public static final String PROPERTY_SERIAL_DEVICE = "device"; //$NON-NLS-1$ + + /** + * The baud rate. + */ + public static final String PROPERTY_SERIAL_BAUD_RATE = "baudrate"; //$NON-NLS-1$ + + /** + * The data bits + */ + public static final String PROPERTY_SERIAL_DATA_BITS = "databits"; //$NON-NLS-1$ + + /** + * The parity + */ + public static final String PROPERTY_SERIAL_PARITY = "parity"; //$NON-NLS-1$ + + /** + * The stop bits + */ + public static final String PROPERTY_SERIAL_STOP_BITS = "stopbits"; //$NON-NLS-1$ + + /** + * The flow control + */ + public static final String PROPERTY_SERIAL_FLOW_CONTROL = "flowcontrol"; //$NON-NLS-1$ +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/launcher/SerialLauncherDelegate.java b/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/launcher/SerialLauncherDelegate.java new file mode 100644 index 00000000000..1ad192c300c --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/launcher/SerialLauncherDelegate.java @@ -0,0 +1,155 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.serial.launcher; + +import java.text.DateFormat; +import java.util.Date; +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.osgi.util.NLS; +import org.eclipse.tcf.te.core.terminals.TerminalServiceFactory; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer; +import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler; +import org.eclipse.tcf.te.ui.terminals.internal.SettingsStore; +import org.eclipse.tcf.te.ui.terminals.launcher.AbstractLauncherDelegate; +import org.eclipse.tcf.te.ui.terminals.serial.controls.SerialConfigurationPanel; +import org.eclipse.tcf.te.ui.terminals.serial.nls.Messages; +import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore; +import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector; +import org.eclipse.tm.internal.terminal.provisional.api.TerminalConnectorExtension; +import org.eclipse.tm.internal.terminal.serial.SerialSettings; + +/** + * Serial launcher delegate implementation. + */ +@SuppressWarnings("restriction") +public class SerialLauncherDelegate extends AbstractLauncherDelegate { + // The serial terminal connection memento handler + private final IMementoHandler mementoHandler = new SerialMementoHandler(); + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#needsUserConfiguration() + */ + @Override + public boolean needsUserConfiguration() { + return true; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer) + */ + @Override + public IConfigurationPanel getPanel(IConfigurationPanelContainer container) { + return new SerialConfigurationPanel(container); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#execute(java.util.Map, org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done) + */ + @Override + public void execute(Map properties, Done done) { + Assert.isNotNull(properties); + + // Set the terminal tab title + String terminalTitle = getTerminalTitle(properties); + if (terminalTitle != null) { + properties.put(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle); + } + + // Get the terminal service + ITerminalService terminal = TerminalServiceFactory.getService(); + // If not available, we cannot fulfill this request + if (terminal != null) { + terminal.openConsole(properties, done); + } + } + + /** + * Returns the terminal title string. + *

+ * The default implementation constructs a title like "Serial <port> (Start time) ". + * + * @return The terminal title string or null. + */ + private String getTerminalTitle(Map properties) { + String device = (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE); + + if (device != null) { + DateFormat format = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); + String date = format.format(new Date(System.currentTimeMillis())); + return NLS.bind(Messages.SerialLauncherDelegate_terminalTitle, new String[]{device, date}); + } + return Messages.SerialLauncherDelegate_terminalTitle_default; + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class) + */ + @Override + public Object getAdapter(Class adapter) { + if (IMementoHandler.class.equals(adapter)) { + return mementoHandler; + } + return super.getAdapter(adapter); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#createTerminalConnector(java.util.Map) + */ + @Override + public ITerminalConnector createTerminalConnector(Map properties) { + Assert.isNotNull(properties); + + // Check for the terminal connector id + String connectorId = (String)properties.get(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID); + if (connectorId == null) connectorId = "org.eclipse.tm.internal.terminal.serial.SerialConnector"; //$NON-NLS-1$ + + String port = (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE); + String baud = (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE); + Object value = properties.get(ITerminalsConnectorConstants.PROP_TIMEOUT); + String timeout = value instanceof Integer ? ((Integer)value).toString() : null; + String databits = (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS); + String stopbits = (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS); + String parity = (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_PARITY); + String flowcontrol = (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL); + + // Construct the terminal settings store + ISettingsStore store = new SettingsStore(); + + // Construct the serial settings + SerialSettings serialSettings = new SerialSettings(); + serialSettings.setSerialPort(port); + serialSettings.setBaudRate(baud); + serialSettings.setTimeout(timeout); + serialSettings.setDataBits(databits); + serialSettings.setStopBits(stopbits); + serialSettings.setParity(parity); + serialSettings.setFlowControl(flowcontrol); + + // And save the settings to the store + serialSettings.save(store); + + // Construct the terminal connector instance + ITerminalConnector connector = TerminalConnectorExtension.makeTerminalConnector(connectorId); + if (connector != null) { + // Apply default settings + connector.makeSettingsPage(); + // And load the real settings + connector.load(store); + } + + return connector; + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/launcher/SerialMementoHandler.java b/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/launcher/SerialMementoHandler.java new file mode 100644 index 00000000000..47615d28886 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/launcher/SerialMementoHandler.java @@ -0,0 +1,64 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.serial.launcher; + +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler; +import org.eclipse.ui.IMemento; + +/** + * Serial terminal connection memento handler implementation. + */ +public class SerialMementoHandler implements IMementoHandler { + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#saveState(org.eclipse.ui.IMemento, java.util.Map) + */ + @Override + public void saveState(IMemento memento, Map properties) { + Assert.isNotNull(memento); + Assert.isNotNull(properties); + + // Do not write the terminal title to the memento -> needs to + // be recreated at the time of restoration. + memento.putString(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE, (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE)); + memento.putString(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE, (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE)); + memento.putString(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS, (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS)); + memento.putString(ITerminalsConnectorConstants.PROP_SERIAL_PARITY, (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_PARITY)); + memento.putString(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS, (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS)); + memento.putString(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL, (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL)); + Object value = properties.get(ITerminalsConnectorConstants.PROP_TIMEOUT); + memento.putInteger(ITerminalsConnectorConstants.PROP_TIMEOUT, value instanceof Integer ? ((Integer)value).intValue() : -1); + memento.putString(ITerminalsConnectorConstants.PROP_ENCODING, (String)properties.get(ITerminalsConnectorConstants.PROP_ENCODING)); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#restoreState(org.eclipse.ui.IMemento, java.util.Map) + */ + @Override + public void restoreState(IMemento memento, Map properties) { + Assert.isNotNull(memento); + Assert.isNotNull(properties); + + // Restore the terminal properties from the memento + properties.put(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE, memento.getString(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE)); + properties.put(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE, memento.getString(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE)); + properties.put(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS, memento.getString(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS)); + properties.put(ITerminalsConnectorConstants.PROP_SERIAL_PARITY, memento.getString(ITerminalsConnectorConstants.PROP_SERIAL_PARITY)); + properties.put(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS, memento.getString(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS)); + properties.put(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL, memento.getString(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL)); + Integer timeout = memento.getInteger(ITerminalsConnectorConstants.PROP_TIMEOUT); + if (timeout != null && timeout.intValue() != -1) properties.put(ITerminalsConnectorConstants.PROP_TIMEOUT, timeout); + properties.put(ITerminalsConnectorConstants.PROP_ENCODING, memento.getString(ITerminalsConnectorConstants.PROP_ENCODING)); + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/nls/Messages.java b/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/nls/Messages.java new file mode 100644 index 00000000000..530171509bf --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/nls/Messages.java @@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.serial.nls; + +import org.eclipse.osgi.util.NLS; + +/** + * Externalized strings management. + */ +public class Messages extends NLS { + + // The plug-in resource bundle name + private static final String BUNDLE_NAME = "org.eclipse.tcf.te.ui.terminals.serial.nls.Messages"; //$NON-NLS-1$ + + /** + * Static constructor. + */ + static { + // Load message values from bundle file + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + // **** Declare externalized string id's down here ***** + + public static String SerialLauncherDelegate_terminalTitle; + public static String SerialLauncherDelegate_terminalTitle_default; + + public static String SerialLinePanel_hostTTYDevice_label; + public static String SerialLinePanel_hostTTYSpeed_label; + public static String SerialLinePanel_hostTTYDatabits_label; + public static String SerialLinePanel_hostTTYParity_label; + public static String SerialLinePanel_hostTTYStopbits_label; + public static String SerialLinePanel_hostTTYFlowControl_label; + public static String SerialLinePanel_hostTTYTimeout_label; + public static String SerialLinePanel_customSerialBaudRate_title; + public static String SerialLinePanel_customSerialBaudRate_message; + public static String SerialLinePanel_error_invalidCharactes; + public static String SerialLinePanel_error_invalidCharactesBaudRate; + public static String SerialLinePanel_error_emptyHostTTYDevice; + public static String SerialLinePanel_error_emptyHostTTYSpeedRate; + public static String SerialLinePanel_error_emptyHostTTYDatabits; + public static String SerialLinePanel_error_emptyHostTTYParity; + public static String SerialLinePanel_error_emptyHostTTYStopbits; + public static String SerialLinePanel_error_emptyHostTTYFlowControl; + public static String SerialLinePanel_error_emptyHostTTYTimeout; + public static String SerialLinePanel_info_editableTTYDeviceSelected; + public static String SerialLinePanel_info_editableTTYBaudRateSelected; + public static String SerialLinePanel_warning_FailedToLoadSerialPorts; + + public static String SerialPortAddressDialog_dialogtitle; + public static String SerialPortAddressDialog_title; + public static String SerialPortAddressDialog_message; + public static String SerialPortAddressDialog_address; + public static String SerialPortAddressDialog_port; + public static String SerialPortAddressDialog_Information_MissingTargetNameAddress; + public static String SerialPortAddressDialog_Error_InvalidTargetNameAddress; + public static String SerialPortAddressDialog_Error_InvalidTargetIpAddress; + public static String SerialPortAddressDialog_Information_MissingPort; + public static String SerialPortAddressDialog_Error_InvalidPort; + public static String SerialPortAddressDialog_Error_InvalidPortRange; +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/nls/Messages.properties b/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/nls/Messages.properties new file mode 100644 index 00000000000..2b89c100940 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/nls/Messages.properties @@ -0,0 +1,46 @@ +############################################################################### +# Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +############################################################################### + +SerialLauncherDelegate_terminalTitle=Serial {0} ({1}) +SerialLauncherDelegate_terminalTitle_default=Serial Terminal + +SerialLinePanel_hostTTYDevice_label=Port: +SerialLinePanel_hostTTYSpeed_label=Baud Rate: +SerialLinePanel_hostTTYDatabits_label=Data Bits: +SerialLinePanel_hostTTYParity_label=Parity: +SerialLinePanel_hostTTYStopbits_label=Stop Bits: +SerialLinePanel_hostTTYFlowControl_label=Flow Control: +SerialLinePanel_hostTTYTimeout_label=Timeout (sec): +SerialLinePanel_customSerialBaudRate_title=Configure Custom Serial Baud Rate +SerialLinePanel_customSerialBaudRate_message=Please enter the custom serial baud rate: +SerialLinePanel_error_invalidCharactes=The device name you've entered contains invalid characters. +SerialLinePanel_error_invalidCharactesBaudRate=The baud rate you've entered contains invalid characters. +SerialLinePanel_error_emptyHostTTYDevice=Please select a valid host serial device. +SerialLinePanel_error_emptyHostTTYSpeedRate=Please select a valid serial device speed. +SerialLinePanel_error_emptyHostTTYDatabits=Please select a valid number of data bits. +SerialLinePanel_error_emptyHostTTYParity=Please select a valid parity. +SerialLinePanel_error_emptyHostTTYStopbits=Please select a valid number of stop bits. +SerialLinePanel_error_emptyHostTTYFlowControl=Please select a valid flow control. +SerialLinePanel_error_emptyHostTTYTimeout=Please select a valid timeout. +SerialLinePanel_info_editableTTYDeviceSelected=Please re-select ''Other...'' again to activate the custom serial device input dialog. +SerialLinePanel_info_editableTTYBaudRateSelected=Please re-select ''Other...'' again to activate the custom serial baud rate input dialog. +SerialLinePanel_warning_FailedToLoadSerialPorts=Failed to enumerate the systems serial ports. + +SerialPortAddressDialog_dialogtitle=Other... +SerialPortAddressDialog_title=Configure Custom Serial Device +SerialPortAddressDialog_message=Select the type of the custom serial device and configure the device properties. +SerialPortAddressDialog_address=Address: +SerialPortAddressDialog_port=Port: +SerialPortAddressDialog_Information_MissingTargetNameAddress=Please enter a valid target name or IP address. +SerialPortAddressDialog_Error_InvalidTargetNameAddress=Target name or IP address is not valid. +SerialPortAddressDialog_Error_InvalidTargetIpAddress=Target IP address is not valid. +SerialPortAddressDialog_Information_MissingPort=Please enter a valid port number. +SerialPortAddressDialog_Error_InvalidPort=Target port number must be a valid number in the range of 0 to 65535. +SerialPortAddressDialog_Error_InvalidPortRange=Target port number must be in the range of 0 to 65535. diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.classpath b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.classpath new file mode 100644 index 00000000000..ad32c83a788 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.options b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.options new file mode 100644 index 00000000000..910d2e57c84 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.options @@ -0,0 +1 @@ +org.eclipse.tcf.te.ui.terminals.ssh/debugmode = 0 diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.project b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.project new file mode 100644 index 00000000000..af2dbffa88e --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.project @@ -0,0 +1,39 @@ + + + org.eclipse.tcf.te.ui.terminals.ssh + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + + + 1329502091181 + + 10 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-target + + + + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..4754bba05f6 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,362 @@ +#Wed Oct 19 12:10:57 CEST 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=warning +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=0 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=0 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=100 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true +org.eclipse.jdt.core.formatter.lineSplit=100 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000000..88bb9570e83 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,56 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_Target Explorer Java STD +formatter_settings_version=12 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=false +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.settings/org.eclipse.pde.prefs b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.settings/org.eclipse.pde.prefs new file mode 100644 index 00000000000..cf80c8bc5b8 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/.settings/org.eclipse.pde.prefs @@ -0,0 +1,32 @@ +compilers.f.unresolved-features=1 +compilers.f.unresolved-plugins=1 +compilers.incompatible-environment=1 +compilers.p.build=1 +compilers.p.build.bin.includes=1 +compilers.p.build.encodings=2 +compilers.p.build.java.compiler=2 +compilers.p.build.java.compliance=1 +compilers.p.build.missing.output=2 +compilers.p.build.output.library=1 +compilers.p.build.source.library=1 +compilers.p.build.src.includes=1 +compilers.p.deprecated=1 +compilers.p.discouraged-class=1 +compilers.p.internal=1 +compilers.p.missing-packages=1 +compilers.p.missing-version-export-package=2 +compilers.p.missing-version-import-package=1 +compilers.p.missing-version-require-bundle=1 +compilers.p.no-required-att=0 +compilers.p.not-externalized-att=2 +compilers.p.unknown-attribute=1 +compilers.p.unknown-class=1 +compilers.p.unknown-element=1 +compilers.p.unknown-identifier=1 +compilers.p.unknown-resource=1 +compilers.p.unresolved-ex-points=0 +compilers.p.unresolved-import=0 +compilers.s.create-docs=false +compilers.s.doc-folder=doc +compilers.s.open-tags=1 +eclipse.preferences.version=1 diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.ssh/META-INF/MANIFEST.MF b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..63f461c8f60 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/META-INF/MANIFEST.MF @@ -0,0 +1,22 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.tcf.te.ui.terminals.ssh;singleton:=true +Bundle-Version: 1.3.0.qualifier +Bundle-Activator: org.eclipse.tcf.te.ui.terminals.ssh.activator.UIPlugin +Bundle-Vendor: %providerName +Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400", + org.eclipse.core.runtime;bundle-version="3.8.0", + org.eclipse.equinox.security;bundle-version="1.1.100", + org.eclipse.tcf.te.core.terminals;bundle-version="1.3.0", + org.eclipse.tcf.te.ui.terminals;bundle-version="1.3.0", + org.eclipse.tm.terminal;bundle-version="3.3.1", + org.eclipse.tm.terminal.ssh;bundle-version="2.1.400", + org.eclipse.ui;bundle-version="3.8.0" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Bundle-Localization: plugin +Export-Package: org.eclipse.tcf.te.ui.terminals.ssh.activator;x-internal:=true, + org.eclipse.tcf.te.ui.terminals.ssh.controls, + org.eclipse.tcf.te.ui.terminals.ssh.launcher, + org.eclipse.tcf.te.ui.terminals.ssh.nls;x-internal:=true diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.ssh/about.html b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/about.html new file mode 100644 index 00000000000..0f07cf034df --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

May 24, 2012

+

License

+ +

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 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +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 http://www.eclipse.org.

+ + + \ No newline at end of file diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.ssh/build.properties b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/build.properties new file mode 100644 index 00000000000..221a2d955c1 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/build.properties @@ -0,0 +1,16 @@ +############################################################################### +# Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +############################################################################### +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.properties,\ + plugin.xml,\ + about.html diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.ssh/plugin.properties b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/plugin.properties new file mode 100644 index 00000000000..60c9aebeb40 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/plugin.properties @@ -0,0 +1,20 @@ +################################################################################## +# Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +################################################################################## + +pluginName = Terminals SSH Extensions +providerName = Eclipse.org - Target Explorer + +# ----- Terminal Connector Types ----- + +SshConnectorType.label=SSH Connector Type + +# ----- Terminal Launcher Delegates ----- + +SshLauncherDelegate.label=SSH Terminal \ No newline at end of file diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.ssh/plugin.xml b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/plugin.xml new file mode 100644 index 00000000000..3af1ce7e8b4 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/plugin.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.ssh/pom.xml b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/pom.xml new file mode 100644 index 00000000000..4d8aa606121 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + + org.eclipse.tcf + org.eclipse.tcf.maven-build + 1.3.0-SNAPSHOT + ../../../admin/pom-build.xml + + + 1.3.0.qualifier + org.eclipse.tcf.te.ui.terminals.ssh + eclipse-plugin + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/activator/UIPlugin.java b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/activator/UIPlugin.java new file mode 100644 index 00000000000..8349dae57a3 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/activator/UIPlugin.java @@ -0,0 +1,111 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.ssh.activator; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.graphics.Image; +import org.eclipse.tcf.te.core.terminals.tracing.TraceHandler; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class UIPlugin extends AbstractUIPlugin { + // The shared instance + private static UIPlugin plugin; + // The trace handler instance + private static volatile TraceHandler traceHandler; + + /** + * The constructor + */ + public UIPlugin() { + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static UIPlugin getDefault() { + return plugin; + } + + /** + * Convenience method which returns the unique identifier of this plugin. + */ + public static String getUniqueIdentifier() { + if (getDefault() != null && getDefault().getBundle() != null) { + return getDefault().getBundle().getSymbolicName(); + } + return "org.eclipse.tcf.te.ui.terminals.ssh"; //$NON-NLS-1$ + } + + /** + * Returns the bundles trace handler. + * + * @return The bundles trace handler. + */ + public static TraceHandler getTraceHandler() { + if (traceHandler == null) { + traceHandler = new TraceHandler(getUniqueIdentifier()); + } + return traceHandler; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry) + */ + @Override + protected void initializeImageRegistry(ImageRegistry registry) { + } + + /** + * Loads the image registered under the specified key from the image + * registry and returns the 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/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/controls/SshWizardConfigurationPanel.java b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/controls/SshWizardConfigurationPanel.java new file mode 100644 index 00000000000..04d525860f1 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/controls/SshWizardConfigurationPanel.java @@ -0,0 +1,424 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + * Max Weninger (Wind River) - [361352] [TERMINALS][SSH] Add SSH terminal support + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.ssh.controls; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.equinox.security.storage.ISecurePreferences; +import org.eclipse.equinox.security.storage.SecurePreferencesFactory; +import org.eclipse.equinox.security.storage.StorageException; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.tcf.te.core.terminals.TerminalContextPropertiesProviderFactory; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalContextPropertiesProvider; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.IContextPropertiesConstants; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer; +import org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel; +import org.eclipse.tcf.te.ui.terminals.ssh.nls.Messages; +import org.eclipse.tm.internal.terminal.provisional.api.AbstractSettingsPage; +import org.eclipse.tm.internal.terminal.provisional.api.ISettingsPage; +import org.eclipse.tm.internal.terminal.ssh.SshConnector; +import org.eclipse.tm.internal.terminal.ssh.SshSettings; + +/** + * SSH wizard configuration panel implementation. + */ +@SuppressWarnings("restriction") +public class SshWizardConfigurationPanel extends AbstractExtendedConfigurationPanel { + + private static final String SAVE_USER = "saveUser"; //$NON-NLS-1$ + private static final String SAVE_PASSWORD = "savePassword"; //$NON-NLS-1$ + + private SshSettings sshSettings; + private ISettingsPage sshSettingsPage; + private Button userButton; + private Button passwordButton; + + /** + * Constructor. + * + * @param container The configuration panel container or null. + */ + public SshWizardConfigurationPanel(IConfigurationPanelContainer container) { + super(container); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#setupPanel(org.eclipse.swt.widgets.Composite) + */ + @Override + public void setupPanel(Composite parent) { + Composite panel = new Composite(parent, SWT.NONE); + panel.setLayout(new GridLayout()); + GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); + panel.setLayoutData(data); + + // Create the host selection combo + if (isWithoutSelection()) createHostsUI(panel, true); + + SshConnector conn = new SshConnector(); + sshSettings = (SshSettings) conn.getSshSettings(); + sshSettings.setHost(getSelectionHost()); + sshSettings.setUser(getDefaultUser()); + + sshSettingsPage = conn.makeSettingsPage(); + if (sshSettingsPage instanceof AbstractSettingsPage) { + ((AbstractSettingsPage)sshSettingsPage).setHasControlDecoration(true); + } + sshSettingsPage.createControl(panel); + + // Add the listener to the settings page + sshSettingsPage.addListener(new ISettingsPage.Listener() { + @Override + public void onSettingsPageChanged(Control control) { + if (getContainer() != null) getContainer().validate(); + } + }); + + // Create the encoding selection combo + createEncodingUI(panel, true); + + // if user and password for host should be saved or not + createSaveButtonsUI(panel, true); + + setControl(panel); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#setupData(java.util.Map) + */ + @Override + public void setupData(Map data) { + if (data == null || sshSettings == null || sshSettingsPage == null) return; + + String value = (String)data.get(ITerminalsConnectorConstants.PROP_IP_HOST); + if (value != null) sshSettings.setHost(value); + + Object v = data.get(ITerminalsConnectorConstants.PROP_IP_PORT); + value = v != null ? v.toString() : null; + if (value != null) sshSettings.setPort(value); + + v = data.get(ITerminalsConnectorConstants.PROP_TIMEOUT); + value = v != null ? v.toString() : null; + if (value != null) sshSettings.setTimeout(value); + + v = data.get(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE); + value = v != null ? v.toString() : null; + if (value != null) sshSettings.setKeepalive(value); + + value = (String)data.get(ITerminalsConnectorConstants.PROP_SSH_PASSWORD); + if (value != null) sshSettings.setPassword(value); + + value = (String)data.get(ITerminalsConnectorConstants.PROP_SSH_USER); + if (value != null) sshSettings.setUser(value); + + value = (String)data.get(ITerminalsConnectorConstants.PROP_ENCODING); + if (value != null) setEncoding(value); + + sshSettingsPage.loadSettings(); + } + + /** + * Returns the default user name. + * + * @return The default user name. + */ + private String getDefaultUser() { + ISelection selection = getSelection(); + if (selection instanceof IStructuredSelection && !selection.isEmpty()) { + Object element = ((IStructuredSelection) selection).getFirstElement(); + ITerminalContextPropertiesProvider provider = TerminalContextPropertiesProviderFactory.getProvider(element); + if (provider != null) { + Object user = provider.getProperty(element, IContextPropertiesConstants.PROP_DEFAULT_USER); + if (user instanceof String) return ((String) user).trim(); + } + } + + return System.getProperty("user.name"); //$NON-NLS-1$ + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#extractData(java.util.Map) + */ + @Override + public void extractData(Map data) { + if (data == null) return; + + // set the terminal connector id for ssh + data.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tm.internal.terminal.ssh.SshConnector"); //$NON-NLS-1$ + + sshSettingsPage.saveSettings(); + data.put(ITerminalsConnectorConstants.PROP_IP_HOST,sshSettings.getHost()); + data.put(ITerminalsConnectorConstants.PROP_IP_PORT, Integer.valueOf(sshSettings.getPort())); + data.put(ITerminalsConnectorConstants.PROP_TIMEOUT, Integer.valueOf(sshSettings.getTimeout())); + data.put(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE, Integer.valueOf(sshSettings.getKeepalive())); + data.put(ITerminalsConnectorConstants.PROP_SSH_PASSWORD, sshSettings.getPassword()); + data.put(ITerminalsConnectorConstants.PROP_SSH_USER, sshSettings.getUser()); + data.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding()); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#fillSettingsForHost(java.lang.String) + */ + @Override + protected void fillSettingsForHost(String host) { + boolean saveUser = true; + boolean savePassword = false; + if (host != null && host.length() != 0){ + if (hostSettingsMap.containsKey(host)){ + Map hostSettings = hostSettingsMap.get(host); + if (hostSettings.get(ITerminalsConnectorConstants.PROP_IP_HOST) != null) { + sshSettings.setHost(hostSettings.get(ITerminalsConnectorConstants.PROP_IP_HOST)); + } + if (hostSettings.get(ITerminalsConnectorConstants.PROP_IP_PORT) != null) { + sshSettings.setPort(hostSettings.get(ITerminalsConnectorConstants.PROP_IP_PORT)); + } + if (hostSettings.get(ITerminalsConnectorConstants.PROP_TIMEOUT) != null) { + sshSettings.setTimeout(hostSettings.get(ITerminalsConnectorConstants.PROP_TIMEOUT)); + } + if (hostSettings.get(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE) != null) { + sshSettings.setKeepalive(hostSettings.get(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE)); + } + if (hostSettings.get(ITerminalsConnectorConstants.PROP_SSH_USER) != null) { + sshSettings.setUser(hostSettings.get(ITerminalsConnectorConstants.PROP_SSH_USER)); + } + if (hostSettings.get(SAVE_PASSWORD) != null) { + savePassword = new Boolean(hostSettings.get(SAVE_PASSWORD)).booleanValue(); + } + if (!savePassword){ + sshSettings.setPassword(""); //$NON-NLS-1$ + } else { + String password = accessSecurePassword(sshSettings.getHost()); + if (password != null) { + sshSettings.setPassword(password); + } + } + + String encoding = hostSettings.get(ITerminalsConnectorConstants.PROP_ENCODING); + if (encoding == null || "null".equals(encoding)) { //$NON-NLS-1$ + String defaultEncoding = getSelectionEncoding(); + encoding = defaultEncoding != null && !"".equals(defaultEncoding.trim()) ? defaultEncoding.trim() : "ISO-8859-1"; //$NON-NLS-1$ //$NON-NLS-2$ + } + setEncoding(encoding); + } else { + sshSettings.setHost(getSelectionHost()); + sshSettings.setUser(getDefaultUser()); + saveUser = true; + savePassword = false; + } + // set settings in page + sshSettingsPage.loadSettings(); + userButton.setSelection(saveUser); + passwordButton.setSelection(savePassword); + } + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String) + */ + @Override + public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) { + saveSettingsForHost(true); + super.doSaveWidgetValues(settings, idPrefix); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#saveSettingsForHost(boolean) + */ + @Override + protected void saveSettingsForHost(boolean add) { + boolean saveUser = userButton.getSelection(); + boolean savePassword = passwordButton.getSelection(); + String host = getHostFromSettings(); + if (host != null && host.length() != 0) { + if (hostSettingsMap.containsKey(host)){ + Map hostSettings = hostSettingsMap.get(host); + hostSettings.put(ITerminalsConnectorConstants.PROP_IP_HOST, sshSettings.getHost()); + hostSettings.put(ITerminalsConnectorConstants.PROP_IP_PORT, Integer.toString(sshSettings.getPort())); + hostSettings.put(ITerminalsConnectorConstants.PROP_TIMEOUT, Integer.toString(sshSettings.getTimeout())); + hostSettings.put(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE, Integer.toString(sshSettings.getKeepalive())); + if (saveUser) { + String defaultUser = getDefaultUser(); + if (defaultUser == null || !defaultUser.equals(sshSettings.getUser())) { + hostSettings.put(ITerminalsConnectorConstants.PROP_SSH_USER, sshSettings.getUser()); + } else { + hostSettings.remove(ITerminalsConnectorConstants.PROP_SSH_USER); + } + } + else { + hostSettings.remove(ITerminalsConnectorConstants.PROP_SSH_USER); + } + + String encoding = getEncoding(); + if (encoding != null) { + String defaultEncoding = getSelectionEncoding(); + if (defaultEncoding != null && defaultEncoding.trim().equals(encoding)) { + encoding = null; + } + } + hostSettings.put(ITerminalsConnectorConstants.PROP_ENCODING, encoding); + hostSettings.put(SAVE_USER, Boolean.toString(saveUser)); + hostSettings.put(SAVE_PASSWORD, Boolean.toString(savePassword)); + + if (savePassword && sshSettings.getPassword() != null && sshSettings.getPassword().length() != 0){ + saveSecurePassword(host, sshSettings.getPassword()); + } + + // maybe unchecked the password button - so try to remove a saved password - if any + if (!savePassword) removeSecurePassword(host); + } else if (add) { + Map hostSettings = new HashMap(); + hostSettings.put(ITerminalsConnectorConstants.PROP_IP_HOST, sshSettings.getHost()); + hostSettings.put(ITerminalsConnectorConstants.PROP_IP_PORT, Integer.toString(sshSettings.getPort())); + hostSettings.put(ITerminalsConnectorConstants.PROP_TIMEOUT, Integer.toString(sshSettings.getTimeout())); + hostSettings.put(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE, Integer.toString(sshSettings.getKeepalive())); + if (saveUser) { + String defaultUser = getDefaultUser(); + if (defaultUser == null || !defaultUser.equals(sshSettings.getUser())) { + hostSettings.put(ITerminalsConnectorConstants.PROP_SSH_USER, sshSettings.getUser()); + } + } + hostSettings.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding()); + hostSettings.put(SAVE_USER, Boolean.toString(saveUser)); + hostSettings.put(SAVE_PASSWORD, Boolean.toString(savePassword)); + hostSettingsMap.put(host, hostSettings); + + if (savePassword && sshSettings.getPassword() != null && sshSettings.getPassword().length() != 0){ + saveSecurePassword(host, sshSettings.getPassword()); + } + } + } + } + + /** + * Save the password to the secure storage. + * + * @param host The host. Must not be null. + * @param password The password. Must not be null. + */ + private void saveSecurePassword(String host, String password) { + Assert.isNotNull(host); + Assert.isNotNull(password); + + // To access the secure storage, we need the preference instance + ISecurePreferences preferences = SecurePreferencesFactory.getDefault(); + if (preferences != null) { + // Construct the secure preferences node key + String nodeKey = "/Target Explorer SSH Password/" + host; //$NON-NLS-1$ + ISecurePreferences node = preferences.node(nodeKey); + if (node != null) { + try { + node.put("password", password, true); //$NON-NLS-1$ + } + catch (StorageException ex) { /* ignored on purpose */ } + } + } + } + + /** + * Reads the password from the secure storage. + * + * @param host The host. Must not be null. + * @return The password or null. + */ + private String accessSecurePassword(String host) { + Assert.isNotNull(host); + + // To access the secure storage, we need the preference instance + ISecurePreferences preferences = SecurePreferencesFactory.getDefault(); + if (preferences != null) { + // Construct the secure preferences node key + String nodeKey = "/Target Explorer SSH Password/" + host; //$NON-NLS-1$ + ISecurePreferences node = preferences.node(nodeKey); + if (node != null) { + String password = null; + try { + password = node.get("password", null); //$NON-NLS-1$ + } + catch (StorageException ex) { /* ignored on purpose */ } + + return password; + } + } + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#removeSecurePassword(java.lang.String) + */ + @Override + protected void removeSecurePassword(String host) { + Assert.isNotNull(host); + + // To access the secure storage, we need the preference instance + ISecurePreferences preferences = SecurePreferencesFactory.getDefault(); + if (preferences != null) { + // Construct the secure preferences node key + String nodeKey = "/Target Explorer SSH Password/" + host; //$NON-NLS-1$ + ISecurePreferences node = preferences.node(nodeKey); + if (node != null) { + node.remove("password"); //$NON-NLS-1$ + } + } + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel#isValid() + */ + @Override + public boolean isValid(){ + return isEncodingValid() && sshSettingsPage.validateSettings(); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#getHostFromSettings() + */ + @Override + protected String getHostFromSettings() { + sshSettingsPage.saveSettings(); + return sshSettings.getHost(); + } + + private void createSaveButtonsUI(final Composite parent, boolean separator) { + Assert.isNotNull(parent); + + if (separator) { + Label sep = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL); + sep.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + } + + Composite panel = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(2, false); + layout.marginHeight = 0; + layout.marginWidth = 0; + panel.setLayout(layout); + panel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + + userButton = new Button(panel, SWT.CHECK); + userButton.setLayoutData(new GridData(SWT.LEAD, SWT.CENTER, false, false)); + userButton.setText(Messages.SshWizardConfigurationPanel_saveUser); + + passwordButton = new Button(panel, SWT.CHECK); + passwordButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + passwordButton.setText(Messages.SshWizardConfigurationPanel_savePassword); + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/launcher/SshLauncherDelegate.java b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/launcher/SshLauncherDelegate.java new file mode 100644 index 00000000000..2faeb435c12 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/launcher/SshLauncherDelegate.java @@ -0,0 +1,176 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + * Max Weninger (Wind River) - [361352] [TERMINALS][SSH] Add SSH terminal support + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.ssh.launcher; + +import java.text.DateFormat; +import java.util.Date; +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.osgi.util.NLS; +import org.eclipse.tcf.te.core.terminals.TerminalServiceFactory; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer; +import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler; +import org.eclipse.tcf.te.ui.terminals.internal.SettingsStore; +import org.eclipse.tcf.te.ui.terminals.launcher.AbstractLauncherDelegate; +import org.eclipse.tcf.te.ui.terminals.ssh.controls.SshWizardConfigurationPanel; +import org.eclipse.tcf.te.ui.terminals.ssh.nls.Messages; +import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore; +import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector; +import org.eclipse.tm.internal.terminal.provisional.api.TerminalConnectorExtension; +import org.eclipse.tm.internal.terminal.ssh.SshSettings; + +/** + * SSH launcher delegate implementation. + */ +@SuppressWarnings("restriction") +public class SshLauncherDelegate extends AbstractLauncherDelegate { + // The SSH terminal connection memento handler + private final IMementoHandler mementoHandler = new SshMementoHandler(); + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#needsUserConfiguration() + */ + @Override + public boolean needsUserConfiguration() { + return true; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer) + */ + @Override + public IConfigurationPanel getPanel(IConfigurationPanelContainer container) { + return new SshWizardConfigurationPanel(container); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#execute(java.util.Map, org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done) + */ + @Override + public void execute(Map properties, Done done) { + Assert.isNotNull(properties); + + // Set the terminal tab title + String terminalTitle = getTerminalTitle(properties); + if (terminalTitle != null) { + properties.put(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle); + } + + // For SSH terminals, force a new terminal tab each time it is launched, + // if not set otherwise from outside + if (!properties.containsKey(ITerminalsConnectorConstants.PROP_FORCE_NEW)) { + properties.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, Boolean.TRUE); + } + + // Get the terminal service + ITerminalService terminal = TerminalServiceFactory.getService(); + // If not available, we cannot fulfill this request + if (terminal != null) { + terminal.openConsole(properties, done); + } + } + + /** + * Returns the terminal title string. + *

+ * The default implementation constructs a title like "SSH @ host (Start time) ". + * + * @return The terminal title string or null. + */ + private String getTerminalTitle(Map properties) { + String host = (String)properties.get(ITerminalsConnectorConstants.PROP_IP_HOST); + String user = (String)properties.get(ITerminalsConnectorConstants.PROP_SSH_USER); + + if (host != null && user!= null) { + DateFormat format = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); + String date = format.format(new Date(System.currentTimeMillis())); + return NLS.bind(Messages.SshLauncherDelegate_terminalTitle, new String[]{user, host, date}); + } + return Messages.SshLauncherDelegate_terminalTitle_default; + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class) + */ + @Override + public Object getAdapter(Class adapter) { + if (IMementoHandler.class.equals(adapter)) { + return mementoHandler; + } + return super.getAdapter(adapter); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#createTerminalConnector(java.util.Map) + */ + @Override + public ITerminalConnector createTerminalConnector(Map properties) { + Assert.isNotNull(properties); + + // Check for the terminal connector id + String connectorId = (String)properties.get(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID); + if (connectorId == null) connectorId = "org.eclipse.tm.internal.terminal.ssh.SshConnector"; //$NON-NLS-1$ + + // Extract the ssh properties + String host = (String)properties.get(ITerminalsConnectorConstants.PROP_IP_HOST); + Object value = properties.get(ITerminalsConnectorConstants.PROP_IP_PORT); + String port = value != null ? value.toString() : null; + value = properties.get(ITerminalsConnectorConstants.PROP_TIMEOUT); + String timeout = value != null ? value.toString() : null; + value = properties.get(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE); + String keepAlive = value != null ? value.toString() : null; + String password = (String)properties.get(ITerminalsConnectorConstants.PROP_SSH_PASSWORD); + String user = (String)properties.get(ITerminalsConnectorConstants.PROP_SSH_USER); + + int portOffset = 0; + if (properties.get(ITerminalsConnectorConstants.PROP_IP_PORT_OFFSET) instanceof Integer) { + portOffset = ((Integer)properties.get(ITerminalsConnectorConstants.PROP_IP_PORT_OFFSET)).intValue(); + if (portOffset < 0) portOffset = 0; + } + + // The real port to connect to is port + portOffset + port = Integer.toString(Integer.decode(port).intValue() + portOffset); + + // Construct the ssh settings store + ISettingsStore store = new SettingsStore(); + + // Construct the telnet settings + SshSettings sshSettings = new SshSettings(); + sshSettings.setHost(host); + sshSettings.setPort(port); + sshSettings.setTimeout(timeout); + sshSettings.setKeepalive(keepAlive); + sshSettings.setPassword(password); + sshSettings.setUser(user); + + // And save the settings to the store + sshSettings.save(store); + + // MWE TODO make sure this is NOT passed outside as this is plain text + store.put("Password", password); //$NON-NLS-1$ + + // Construct the terminal connector instance + ITerminalConnector connector = TerminalConnectorExtension.makeTerminalConnector(connectorId); + if (connector != null) { + // Apply default settings + connector.makeSettingsPage(); + // And load the real settings + connector.load(store); + } + + return connector; + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/launcher/SshMementoHandler.java b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/launcher/SshMementoHandler.java new file mode 100644 index 00000000000..f0ce4c2c045 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/launcher/SshMementoHandler.java @@ -0,0 +1,133 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.ssh.launcher; + +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.equinox.security.storage.ISecurePreferences; +import org.eclipse.equinox.security.storage.SecurePreferencesFactory; +import org.eclipse.equinox.security.storage.StorageException; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler; +import org.eclipse.ui.IMemento; + +/** + * SSH terminal connection memento handler implementation. + */ +public class SshMementoHandler implements IMementoHandler { + + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#saveState(org.eclipse.ui.IMemento, java.util.Map) + */ + @Override + public void saveState(IMemento memento, Map properties) { + Assert.isNotNull(memento); + Assert.isNotNull(properties); + + // Do not write the terminal title to the memento -> needs to + // be recreated at the time of restoration. + memento.putString(ITerminalsConnectorConstants.PROP_IP_HOST, (String)properties.get(ITerminalsConnectorConstants.PROP_IP_HOST)); + Object value = properties.get(ITerminalsConnectorConstants.PROP_IP_PORT); + memento.putInteger(ITerminalsConnectorConstants.PROP_IP_PORT, value instanceof Integer ? ((Integer)value).intValue() : -1); + value = properties.get(ITerminalsConnectorConstants.PROP_TIMEOUT); + memento.putInteger(ITerminalsConnectorConstants.PROP_TIMEOUT, value instanceof Integer ? ((Integer)value).intValue() : -1); + value = properties.get(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE); + memento.putInteger(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE, value instanceof Integer ? ((Integer)value).intValue() : -1); + memento.putString(ITerminalsConnectorConstants.PROP_SSH_USER, (String)properties.get(ITerminalsConnectorConstants.PROP_SSH_USER)); + memento.putString(ITerminalsConnectorConstants.PROP_ENCODING, (String)properties.get(ITerminalsConnectorConstants.PROP_ENCODING)); + + // The password is stored within the Eclipse secure preferences -> no need to store it to the memento + // + // If ever needed, this is an example on how to encrypt the password using 3DES. Do not remove! + + /* + String password = properties.getStringProperty(ITerminalsConnectorConstants.PROP_SSH_PASSWORD); + if (password != null) { + try { + // Generate a temporary key. In practice, you would save this key. + // See also Encrypting with DES Using a Pass Phrase. + // SecretKey key = KeyGenerator.getInstance("DESede").generateKey(); + + SecretKeyFactory factory = SecretKeyFactory.getInstance("DESede"); //$NON-NLS-1$ + SecretKey key = factory.generateSecret(new DESKeySpec((ITerminalsConnectorConstants.PROP_SSH_PASSWORD + ".SshMementoHandler").getBytes("UTF-8"))); //$NON-NLS-1$ //$NON-NLS-2$ + + Cipher cipher = Cipher.getInstance("DESede/CBC/PKCS5Padding"); //$NON-NLS-1$ + cipher.init(Cipher.ENCRYPT_MODE, key); + + String encrypedPwd = new String(Base64.encode(cipher.doFinal(password.getBytes("UTF-8")))); //$NON-NLS-1$ + memento.putString(ITerminalsConnectorConstants.PROP_SSH_PASSWORD, encrypedPwd); + } + catch (Exception e) { + if (Platform.inDebugMode()) e.printStackTrace(); + } + } + */ + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#restoreState(org.eclipse.ui.IMemento, java.util.Map) + */ + @Override + public void restoreState(IMemento memento, Map properties) { + Assert.isNotNull(memento); + Assert.isNotNull(properties); + + // Restore the terminal properties from the memento + properties.put(ITerminalsConnectorConstants.PROP_IP_HOST, memento.getString(ITerminalsConnectorConstants.PROP_IP_HOST)); + properties.put(ITerminalsConnectorConstants.PROP_IP_PORT, memento.getInteger(ITerminalsConnectorConstants.PROP_IP_PORT)); + properties.put(ITerminalsConnectorConstants.PROP_TIMEOUT, memento.getInteger(ITerminalsConnectorConstants.PROP_TIMEOUT)); + properties.put(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE, memento.getInteger(ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE)); + properties.put(ITerminalsConnectorConstants.PROP_SSH_USER, memento.getString(ITerminalsConnectorConstants.PROP_SSH_USER)); + properties.put(ITerminalsConnectorConstants.PROP_ENCODING, memento.getString(ITerminalsConnectorConstants.PROP_ENCODING)); + + // The password is stored within the Eclipse secure preferences -> restore it from there + // To access the secure storage, we need the preference instance + String password = null; + ISecurePreferences preferences = SecurePreferencesFactory.getDefault(); + if (preferences != null && (String)properties.get(ITerminalsConnectorConstants.PROP_IP_HOST) != null) { + // Construct the secure preferences node key + String nodeKey = "/Target Explorer SSH Password/" + (String)properties.get(ITerminalsConnectorConstants.PROP_IP_HOST); //$NON-NLS-1$ + ISecurePreferences node = preferences.node(nodeKey); + if (node != null) { + try { + password = node.get("password", null); //$NON-NLS-1$ + } + catch (StorageException ex) { /* ignored on purpose */ } + } + } + + // Example of restoring the password from an 3DES encrypted string. Do not remove! + /* + String encrypedPwd = memento.getString(ITerminalsConnectorConstants.PROP_SSH_PASSWORD); + if (encrypedPwd != null) { + try { + SecretKeyFactory factory = SecretKeyFactory.getInstance("DESede"); //$NON-NLS-1$ + SecretKey key = factory.generateSecret(new DESKeySpec((ITerminalsConnectorConstants.PROP_SSH_PASSWORD + ".SshMementoHandler").getBytes("UTF-8"))); //$NON-NLS-1$ //$NON-NLS-2$ + + Cipher cipher = Cipher.getInstance("DESede/CBC/PKCS5Padding"); //$NON-NLS-1$ + cipher.init(Cipher.DECRYPT_MODE, key); + + byte[] encBytes = Base64.decode(encrypedPwd.getBytes("UTF-8")); //$NON-NLS-1$ + byte[] decBytes = cipher.doFinal(encBytes); + + password = new String(decBytes); + } + catch (Exception e) { + if (Platform.inDebugMode()) e.printStackTrace(); + } + } + */ + + properties.put(ITerminalsConnectorConstants.PROP_SSH_PASSWORD, password); + } + +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/nls/Messages.java b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/nls/Messages.java new file mode 100644 index 00000000000..265c2e0d0bb --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/nls/Messages.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2011, 2014 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + * Max Weninger (Wind River) - [361352] [TERMINALS][SSH] Add SSH terminal support + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.ssh.nls; + +import org.eclipse.osgi.util.NLS; + +/** + * Target Explorer TCF terminals extensions UI plug-in externalized strings management. + */ +public class Messages extends NLS { + + // The plug-in resource bundle name + private static final String BUNDLE_NAME = "org.eclipse.tcf.te.ui.terminals.ssh.nls.Messages"; //$NON-NLS-1$ + + /** + * Static constructor. + */ + static { + // Load message values from bundle file + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + // **** Declare externalized string id's down here ***** + + public static String SshLauncherDelegate_terminalTitle; + public static String SshLauncherDelegate_terminalTitle_default; + public static String SshWizardConfigurationPanel_saveUser; + public static String SshWizardConfigurationPanel_savePassword; +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/nls/Messages.properties b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/nls/Messages.properties new file mode 100644 index 00000000000..ca27a39c18e --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.ssh/src/org/eclipse/tcf/te/ui/terminals/ssh/nls/Messages.properties @@ -0,0 +1,14 @@ +############################################################################### +# Copyright (c) 2012, 2014 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +############################################################################### + +SshLauncherDelegate_terminalTitle=SSH {0}@{1} ({2}) +SshLauncherDelegate_terminalTitle_default=SSH Terminal +SshWizardConfigurationPanel_saveUser=Save user +SshWizardConfigurationPanel_savePassword=Save password diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.classpath b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.classpath new file mode 100644 index 00000000000..ad32c83a788 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.options b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.options new file mode 100644 index 00000000000..47f69c8a6eb --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.options @@ -0,0 +1 @@ +org.eclipse.tcf.te.ui.terminals.telnet/debugmode = 0 diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.project b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.project new file mode 100644 index 00000000000..13db50347ae --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.project @@ -0,0 +1,39 @@ + + + org.eclipse.tcf.te.ui.terminals.telnet + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + + + 1329502098231 + + 10 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-target + + + + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..4754bba05f6 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,362 @@ +#Wed Oct 19 12:10:57 CEST 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=warning +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=0 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=0 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=100 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true +org.eclipse.jdt.core.formatter.lineSplit=100 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000000..88bb9570e83 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,56 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_Target Explorer Java STD +formatter_settings_version=12 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=false +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.settings/org.eclipse.pde.prefs b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.settings/org.eclipse.pde.prefs new file mode 100644 index 00000000000..cf80c8bc5b8 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/.settings/org.eclipse.pde.prefs @@ -0,0 +1,32 @@ +compilers.f.unresolved-features=1 +compilers.f.unresolved-plugins=1 +compilers.incompatible-environment=1 +compilers.p.build=1 +compilers.p.build.bin.includes=1 +compilers.p.build.encodings=2 +compilers.p.build.java.compiler=2 +compilers.p.build.java.compliance=1 +compilers.p.build.missing.output=2 +compilers.p.build.output.library=1 +compilers.p.build.source.library=1 +compilers.p.build.src.includes=1 +compilers.p.deprecated=1 +compilers.p.discouraged-class=1 +compilers.p.internal=1 +compilers.p.missing-packages=1 +compilers.p.missing-version-export-package=2 +compilers.p.missing-version-import-package=1 +compilers.p.missing-version-require-bundle=1 +compilers.p.no-required-att=0 +compilers.p.not-externalized-att=2 +compilers.p.unknown-attribute=1 +compilers.p.unknown-class=1 +compilers.p.unknown-element=1 +compilers.p.unknown-identifier=1 +compilers.p.unknown-resource=1 +compilers.p.unresolved-ex-points=0 +compilers.p.unresolved-import=0 +compilers.s.create-docs=false +compilers.s.doc-folder=doc +compilers.s.open-tags=1 +eclipse.preferences.version=1 diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.telnet/META-INF/MANIFEST.MF b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..6c7042e3328 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/META-INF/MANIFEST.MF @@ -0,0 +1,22 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.tcf.te.ui.terminals.telnet;singleton:=true +Bundle-Version: 1.3.0.qualifier +Bundle-Activator: org.eclipse.tcf.te.ui.terminals.telnet.activator.UIPlugin +Bundle-Vendor: %providerName +Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400", + org.eclipse.core.runtime;bundle-version="3.8.0", + org.eclipse.equinox.security;bundle-version="1.1.100", + org.eclipse.tcf.te.core.terminals;bundle-version="1.3.0", + org.eclipse.tcf.te.ui.terminals;bundle-version="1.3.0", + org.eclipse.tm.terminal;bundle-version="3.3.1", + org.eclipse.tm.terminal.telnet;bundle-version="2.1.400", + org.eclipse.ui;bundle-version="3.8.0" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Bundle-Localization: plugin +Export-Package: org.eclipse.tcf.te.ui.terminals.telnet.activator;x-internal:=true, + org.eclipse.tcf.te.ui.terminals.telnet.controls, + org.eclipse.tcf.te.ui.terminals.telnet.launcher, + org.eclipse.tcf.te.ui.terminals.telnet.nls;x-internal:=true diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.telnet/about.html b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/about.html new file mode 100644 index 00000000000..0f07cf034df --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

May 24, 2012

+

License

+ +

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 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +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 http://www.eclipse.org.

+ + + \ No newline at end of file diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.telnet/build.properties b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/build.properties new file mode 100644 index 00000000000..221a2d955c1 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/build.properties @@ -0,0 +1,16 @@ +############################################################################### +# Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +############################################################################### +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.properties,\ + plugin.xml,\ + about.html diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.telnet/plugin.properties b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/plugin.properties new file mode 100644 index 00000000000..ddd14ef4a19 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/plugin.properties @@ -0,0 +1,16 @@ +################################################################################## +# Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +################################################################################## + +pluginName = Terminals Telnet Extensions +providerName = Eclipse.org - Target Explorer + +# ----- Terminal Launcher Delegates ----- + +TelnetLauncherDelegate.label=Telnet Terminal diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.telnet/plugin.xml b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/plugin.xml new file mode 100644 index 00000000000..a2a34d7ea23 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/plugin.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.telnet/pom.xml b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/pom.xml new file mode 100644 index 00000000000..f3694ee3653 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + + org.eclipse.tcf + org.eclipse.tcf.maven-build + 1.3.0-SNAPSHOT + ../../../admin/pom-build.xml + + + 1.3.0.qualifier + org.eclipse.tcf.te.ui.terminals.telnet + eclipse-plugin + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/activator/UIPlugin.java b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/activator/UIPlugin.java new file mode 100644 index 00000000000..a6ce8753cea --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/activator/UIPlugin.java @@ -0,0 +1,112 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + * Max Weninger (Wind River) - [366374] [TERMINALS][TELNET] Add Telnet terminal support + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.telnet.activator; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.graphics.Image; +import org.eclipse.tcf.te.core.terminals.tracing.TraceHandler; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class UIPlugin extends AbstractUIPlugin { + // The shared instance + private static UIPlugin plugin; + // The trace handler instance + private static volatile TraceHandler traceHandler; + + /** + * The constructor + */ + public UIPlugin() { + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static UIPlugin getDefault() { + return plugin; + } + + /** + * Convenience method which returns the unique identifier of this plugin. + */ + public static String getUniqueIdentifier() { + if (getDefault() != null && getDefault().getBundle() != null) { + return getDefault().getBundle().getSymbolicName(); + } + return "org.eclipse.tcf.te.ui.terminals.telnet"; //$NON-NLS-1$ + } + + /** + * Returns the bundles trace handler. + * + * @return The bundles trace handler. + */ + public static TraceHandler getTraceHandler() { + if (traceHandler == null) { + traceHandler = new TraceHandler(getUniqueIdentifier()); + } + return traceHandler; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry) + */ + @Override + protected void initializeImageRegistry(ImageRegistry registry) { + } + + /** + * Loads the image registered under the specified key from the image + * registry and returns the 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/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/controls/TelnetWizardConfigurationPanel.java b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/controls/TelnetWizardConfigurationPanel.java new file mode 100644 index 00000000000..6d011eae71c --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/controls/TelnetWizardConfigurationPanel.java @@ -0,0 +1,213 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + * Max Weninger (Wind River) - [366374] [TERMINALS][TELNET] Add Telnet terminal support + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.telnet.controls; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer; +import org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel; +import org.eclipse.tm.internal.terminal.provisional.api.AbstractSettingsPage; +import org.eclipse.tm.internal.terminal.provisional.api.ISettingsPage; +import org.eclipse.tm.internal.terminal.telnet.NetworkPortMap; +import org.eclipse.tm.internal.terminal.telnet.TelnetConnector; +import org.eclipse.tm.internal.terminal.telnet.TelnetSettings; + +/** + * telnet wizard configuration panel implementation. + */ +@SuppressWarnings("restriction") +public class TelnetWizardConfigurationPanel extends AbstractExtendedConfigurationPanel { + + public TelnetSettings telnetSettings; + private ISettingsPage telnetSettingsPage; + + /** + * Constructor. + * + * @param container The configuration panel container or null. + */ + public TelnetWizardConfigurationPanel(IConfigurationPanelContainer container) { + super(container); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#setupPanel(org.eclipse.swt.widgets.Composite) + */ + @Override + public void setupPanel(Composite parent) { + Composite panel = new Composite(parent, SWT.NONE); + panel.setLayout(new GridLayout()); + GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); + panel.setLayoutData(data); + + // Create the host selection combo + if (isWithoutSelection()) createHostsUI(panel, true); + + TelnetConnector conn = new TelnetConnector(); + telnetSettings = (TelnetSettings) conn.getTelnetSettings(); + telnetSettings.setHost(getSelectionHost()); + // MWE otherwise we don't get a valid default selection of the combo + telnetSettings.setNetworkPort(NetworkPortMap.PROP_VALUETELNET); + + telnetSettingsPage = conn.makeSettingsPage(); + if (telnetSettingsPage instanceof AbstractSettingsPage) { + ((AbstractSettingsPage)telnetSettingsPage).setHasControlDecoration(true); + } + telnetSettingsPage.createControl(panel); + + // Add the listener to the settings page + telnetSettingsPage.addListener(new ISettingsPage.Listener() { + + @Override + public void onSettingsPageChanged(Control control) { + if (getContainer() != null) getContainer().validate(); + } + }); + + // Create the encoding selection combo + createEncodingUI(panel, true); + + setControl(panel); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#setupData(java.util.Map) + */ + @Override + public void setupData(Map data) { + if (data == null || telnetSettings == null || telnetSettingsPage == null) return; + + String value = (String)data.get(ITerminalsConnectorConstants.PROP_IP_HOST); + if (value != null) telnetSettings.setHost(value); + + Object v = data.get(ITerminalsConnectorConstants.PROP_IP_PORT); + value = v != null ? v.toString() : null; + if (value != null) telnetSettings.setNetworkPort(value); + + v = data.get(ITerminalsConnectorConstants.PROP_TIMEOUT); + value = v != null ? v.toString() : null; + if (value != null) telnetSettings.setTimeout(value); + + value = (String)data.get(ITerminalsConnectorConstants.PROP_ENCODING); + if (value != null) setEncoding(value); + + telnetSettingsPage.loadSettings(); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#extractData(java.util.Map) + */ + @Override + public void extractData(Map data) { + if (data == null) return; + + // set the terminal connector id for ssh + data.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tm.internal.terminal.telnet.TelnetConnector"); //$NON-NLS-1$ + + telnetSettingsPage.saveSettings(); + data.put(ITerminalsConnectorConstants.PROP_IP_HOST,telnetSettings.getHost()); + data.put(ITerminalsConnectorConstants.PROP_IP_PORT, Integer.valueOf(telnetSettings.getNetworkPort())); + data.put(ITerminalsConnectorConstants.PROP_TIMEOUT, Integer.valueOf(telnetSettings.getTimeout())); + data.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding()); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#fillSettingsForHost(java.lang.String) + */ + @Override + protected void fillSettingsForHost(String host){ + if (host != null && host.length() != 0){ + if (hostSettingsMap.containsKey(host)){ + Map hostSettings = hostSettingsMap.get(host); + if (hostSettings.get(ITerminalsConnectorConstants.PROP_IP_HOST) != null) { + telnetSettings.setHost(hostSettings.get(ITerminalsConnectorConstants.PROP_IP_HOST)); + } + if (hostSettings.get(ITerminalsConnectorConstants.PROP_IP_PORT) != null) { + telnetSettings.setNetworkPort(hostSettings.get(ITerminalsConnectorConstants.PROP_IP_PORT)); + } + if (hostSettings.get(ITerminalsConnectorConstants.PROP_TIMEOUT) != null) { + telnetSettings.setTimeout(hostSettings.get(ITerminalsConnectorConstants.PROP_TIMEOUT)); + } + if (hostSettings.get(ITerminalsConnectorConstants.PROP_ENCODING) != null) { + setEncoding(hostSettings.get(ITerminalsConnectorConstants.PROP_ENCODING)); + } + } else { + telnetSettings.setHost(getSelectionHost()); + // MWE otherwise we don't get a valid default selection of the combo + telnetSettings.setNetworkPort(NetworkPortMap.PROP_VALUETELNET); + } + // set settings in page + telnetSettingsPage.loadSettings(); + } + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#saveSettingsForHost(boolean) + */ + @Override + protected void saveSettingsForHost(boolean add){ + String host = getHostFromSettings(); + if(host != null && host.length() != 0) { + if (hostSettingsMap.containsKey(host)) { + Map hostSettings=hostSettingsMap.get(host); + hostSettings.put(ITerminalsConnectorConstants.PROP_IP_HOST, telnetSettings.getHost()); + hostSettings.put(ITerminalsConnectorConstants.PROP_IP_PORT, Integer.toString(telnetSettings.getNetworkPort())); + hostSettings.put(ITerminalsConnectorConstants.PROP_TIMEOUT, Integer.toString(telnetSettings.getTimeout())); + if (getEncoding() != null) { + hostSettings.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding()); + } + } else if (add) { + Map hostSettings=new HashMap(); + hostSettings.put(ITerminalsConnectorConstants.PROP_IP_HOST, telnetSettings.getHost()); + hostSettings.put(ITerminalsConnectorConstants.PROP_IP_PORT, Integer.toString(telnetSettings.getNetworkPort())); + hostSettings.put(ITerminalsConnectorConstants.PROP_TIMEOUT, Integer.toString(telnetSettings.getTimeout())); + if (getEncoding() != null) { + hostSettings.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding()); + } + hostSettingsMap.put(host, hostSettings); + } + } + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel#isValid() + */ + @Override + public boolean isValid(){ + return isEncodingValid() && telnetSettingsPage.validateSettings(); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String) + */ + @Override + public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) { + saveSettingsForHost(true); + super.doSaveWidgetValues(settings, idPrefix); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#getHostFromSettings() + */ + @Override + protected String getHostFromSettings() { + telnetSettingsPage.saveSettings(); + return telnetSettings.getHost(); + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/launcher/TelnetLauncherDelegate.java b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/launcher/TelnetLauncherDelegate.java new file mode 100644 index 00000000000..2f3c78e281a --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/launcher/TelnetLauncherDelegate.java @@ -0,0 +1,166 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + * Max Weninger (Wind River) - [366374] [TERMINALS][TELNET] Add Telnet terminal support + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.telnet.launcher; + +import java.text.DateFormat; +import java.util.Date; +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.osgi.util.NLS; +import org.eclipse.tcf.te.core.terminals.TerminalServiceFactory; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer; +import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler; +import org.eclipse.tcf.te.ui.terminals.internal.SettingsStore; +import org.eclipse.tcf.te.ui.terminals.launcher.AbstractLauncherDelegate; +import org.eclipse.tcf.te.ui.terminals.telnet.controls.TelnetWizardConfigurationPanel; +import org.eclipse.tcf.te.ui.terminals.telnet.nls.Messages; +import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore; +import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector; +import org.eclipse.tm.internal.terminal.provisional.api.TerminalConnectorExtension; +import org.eclipse.tm.internal.terminal.telnet.TelnetSettings; + +/** + * Telnet launcher delegate implementation. + */ +@SuppressWarnings("restriction") +public class TelnetLauncherDelegate extends AbstractLauncherDelegate { + // The Telnet terminal connection memento handler + private final IMementoHandler mementoHandler = new TelnetMementoHandler(); + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#needsUserConfiguration() + */ + @Override + public boolean needsUserConfiguration() { + return true; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer) + */ + @Override + public IConfigurationPanel getPanel(IConfigurationPanelContainer container) { + return new TelnetWizardConfigurationPanel(container); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#execute(java.util.Map, org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done) + */ + @Override + public void execute(Map properties, Done done) { + Assert.isNotNull(properties); + + // Set the terminal tab title + String terminalTitle = getTerminalTitle(properties); + if (terminalTitle != null) { + properties.put(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle); + } + + // For Telnet terminals, force a new terminal tab each time it is launched, + // if not set otherwise from outside + if (!properties.containsKey(ITerminalsConnectorConstants.PROP_FORCE_NEW)) { + properties.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, Boolean.TRUE); + } + + // Get the terminal service + ITerminalService terminal = TerminalServiceFactory.getService(); + // If not available, we cannot fulfill this request + if (terminal != null) { + terminal.openConsole(properties, done); + } + } + + /** + * Returns the terminal title string. + *

+ * The default implementation constructs a title like "SSH @ host (Start time) ". + * + * @return The terminal title string or null. + */ + private String getTerminalTitle(Map properties) { + String host = (String)properties.get(ITerminalsConnectorConstants.PROP_IP_HOST); + + if (host != null) { + DateFormat format = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); + String date = format.format(new Date(System.currentTimeMillis())); + return NLS.bind(Messages.TelnetLauncherDelegate_terminalTitle, new String[]{host, date}); + } + return Messages.TelnetLauncherDelegate_terminalTitle_default; + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class) + */ + @Override + public Object getAdapter(Class adapter) { + if (IMementoHandler.class.equals(adapter)) { + return mementoHandler; + } + return super.getAdapter(adapter); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#createTerminalConnector(java.util.Map) + */ + @Override + public ITerminalConnector createTerminalConnector(Map properties) { + Assert.isNotNull(properties); + + // Check for the terminal connector id + String connectorId = (String)properties.get(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID); + if (connectorId == null) connectorId = "org.eclipse.tm.internal.terminal.telnet.TelnetConnector"; //$NON-NLS-1$ + + // Extract the telnet properties + String host = (String)properties.get(ITerminalsConnectorConstants.PROP_IP_HOST); + Object value = properties.get(ITerminalsConnectorConstants.PROP_IP_PORT); + String port = value != null ? value.toString() : null; + value = properties.get(ITerminalsConnectorConstants.PROP_TIMEOUT); + String timeout = value != null ? value.toString() : null; + + int portOffset = 0; + if (properties.get(ITerminalsConnectorConstants.PROP_IP_PORT_OFFSET) instanceof Integer) { + portOffset = ((Integer)properties.get(ITerminalsConnectorConstants.PROP_IP_PORT_OFFSET)).intValue(); + if (portOffset < 0) portOffset = 0; + } + + // The real port to connect to is port + portOffset + port = Integer.toString(Integer.decode(port).intValue() + portOffset); + + // Construct the terminal settings store + ISettingsStore store = new SettingsStore(); + + // Construct the telnet settings + TelnetSettings telnetSettings = new TelnetSettings(); + telnetSettings.setHost(host); + telnetSettings.setNetworkPort(port); + if (timeout != null) { + telnetSettings.setTimeout(timeout); + } + // And save the settings to the store + telnetSettings.save(store); + + // Construct the terminal connector instance + ITerminalConnector connector = TerminalConnectorExtension.makeTerminalConnector(connectorId); + if (connector != null) { + // Apply default settings + connector.makeSettingsPage(); + // And load the real settings + connector.load(store); + } + + return connector; + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/launcher/TelnetMementoHandler.java b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/launcher/TelnetMementoHandler.java new file mode 100644 index 00000000000..eaa0c6bdefe --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/launcher/TelnetMementoHandler.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.telnet.launcher; + +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler; +import org.eclipse.ui.IMemento; + +/** + * Telnet terminal connection memento handler implementation. + */ +public class TelnetMementoHandler implements IMementoHandler { + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#saveState(org.eclipse.ui.IMemento, java.util.Map) + */ + @Override + public void saveState(IMemento memento, Map properties) { + Assert.isNotNull(memento); + Assert.isNotNull(properties); + + // Do not write the terminal title to the memento -> needs to + // be recreated at the time of restoration. + memento.putString(ITerminalsConnectorConstants.PROP_IP_HOST, (String)properties.get(ITerminalsConnectorConstants.PROP_IP_HOST)); + Object value = properties.get(ITerminalsConnectorConstants.PROP_IP_PORT); + memento.putInteger(ITerminalsConnectorConstants.PROP_IP_PORT, value instanceof Integer ? ((Integer)value).intValue() : -1); + value = properties.get(ITerminalsConnectorConstants.PROP_TIMEOUT); + memento.putInteger(ITerminalsConnectorConstants.PROP_TIMEOUT, value instanceof Integer ? ((Integer)value).intValue() : -1); + memento.putString(ITerminalsConnectorConstants.PROP_ENCODING, (String)properties.get(ITerminalsConnectorConstants.PROP_ENCODING)); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#restoreState(org.eclipse.ui.IMemento, java.util.Map) + */ + @Override + public void restoreState(IMemento memento, Map properties) { + Assert.isNotNull(memento); + Assert.isNotNull(properties); + + // Restore the terminal properties from the memento + properties.put(ITerminalsConnectorConstants.PROP_IP_HOST, memento.getString(ITerminalsConnectorConstants.PROP_IP_HOST)); + properties.put(ITerminalsConnectorConstants.PROP_IP_PORT, memento.getInteger(ITerminalsConnectorConstants.PROP_IP_PORT)); + properties.put(ITerminalsConnectorConstants.PROP_TIMEOUT, memento.getInteger(ITerminalsConnectorConstants.PROP_TIMEOUT)); + properties.put(ITerminalsConnectorConstants.PROP_ENCODING, memento.getString(ITerminalsConnectorConstants.PROP_ENCODING)); + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/nls/Messages.java b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/nls/Messages.java new file mode 100644 index 00000000000..b1f817b8691 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/nls/Messages.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + * Max Weninger (Wind River) - [366374] [TERMINALS][TELNET] Add Telnet terminal support + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.telnet.nls; + +import org.eclipse.osgi.util.NLS; + +/** + * Target Explorer TCF terminals extensions UI plug-in externalized strings management. + */ +public class Messages extends NLS { + + // The plug-in resource bundle name + private static final String BUNDLE_NAME = "org.eclipse.tcf.te.ui.terminals.telnet.nls.Messages"; //$NON-NLS-1$ + + /** + * Static constructor. + */ + static { + // Load message values from bundle file + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + // **** Declare externalized string id's down here ***** + + public static String TelnetLauncherDelegate_terminalTitle; + public static String TelnetLauncherDelegate_terminalTitle_default; +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/nls/Messages.properties b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/nls/Messages.properties new file mode 100644 index 00000000000..f00e9124398 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals.telnet/src/org/eclipse/tcf/te/ui/terminals/telnet/nls/Messages.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +############################################################################### + +TelnetLauncherDelegate_terminalTitle=Telnet {0} ({1}) +TelnetLauncherDelegate_terminalTitle_default=Telnet Terminal diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/.classpath b/plugins/org.eclipse.tcf.te.ui.terminals/.classpath new file mode 100644 index 00000000000..ad32c83a788 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/.options b/plugins/org.eclipse.tcf.te.ui.terminals/.options new file mode 100644 index 00000000000..cf7e9ecb799 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/.options @@ -0,0 +1,3 @@ +org.eclipse.tcf.te.ui.terminals/debugmode = 0 +org.eclipse.tcf.te.ui.terminals/trace/outputStreamMonitor = false +org.eclipse.tcf.te.ui.terminals/trace/launchTerminalCommandHandler = false diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/.project b/plugins/org.eclipse.tcf.te.ui.terminals/.project new file mode 100644 index 00000000000..94502bab4d6 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/.project @@ -0,0 +1,39 @@ + + + org.eclipse.tcf.te.ui.terminals + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + + + 1329502074611 + + 10 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-target + + + + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.tcf.te.ui.terminals/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..5cb95e247ec --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,362 @@ +#Fri Oct 07 16:14:53 CEST 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=warning +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=0 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=0 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=100 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true +org.eclipse.jdt.core.formatter.lineSplit=100 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.tcf.te.ui.terminals/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000000..88bb9570e83 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,56 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_Target Explorer Java STD +formatter_settings_version=12 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=false +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/.settings/org.eclipse.pde.prefs b/plugins/org.eclipse.tcf.te.ui.terminals/.settings/org.eclipse.pde.prefs new file mode 100644 index 00000000000..cf80c8bc5b8 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/.settings/org.eclipse.pde.prefs @@ -0,0 +1,32 @@ +compilers.f.unresolved-features=1 +compilers.f.unresolved-plugins=1 +compilers.incompatible-environment=1 +compilers.p.build=1 +compilers.p.build.bin.includes=1 +compilers.p.build.encodings=2 +compilers.p.build.java.compiler=2 +compilers.p.build.java.compliance=1 +compilers.p.build.missing.output=2 +compilers.p.build.output.library=1 +compilers.p.build.source.library=1 +compilers.p.build.src.includes=1 +compilers.p.deprecated=1 +compilers.p.discouraged-class=1 +compilers.p.internal=1 +compilers.p.missing-packages=1 +compilers.p.missing-version-export-package=2 +compilers.p.missing-version-import-package=1 +compilers.p.missing-version-require-bundle=1 +compilers.p.no-required-att=0 +compilers.p.not-externalized-att=2 +compilers.p.unknown-attribute=1 +compilers.p.unknown-class=1 +compilers.p.unknown-element=1 +compilers.p.unknown-identifier=1 +compilers.p.unknown-resource=1 +compilers.p.unresolved-ex-points=0 +compilers.p.unresolved-import=0 +compilers.s.create-docs=false +compilers.s.doc-folder=doc +compilers.s.open-tags=1 +eclipse.preferences.version=1 diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/META-INF/MANIFEST.MF b/plugins/org.eclipse.tcf.te.ui.terminals/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..c696e235b59 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/META-INF/MANIFEST.MF @@ -0,0 +1,34 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.tcf.te.ui.terminals;singleton:=true +Bundle-Version: 1.3.0.qualifier +Bundle-Activator: org.eclipse.tcf.te.ui.terminals.activator.UIPlugin +Bundle-Vendor: %providerName +Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400", + org.eclipse.core.runtime;bundle-version="3.8.0", + org.eclipse.core.resources;bundle-version="3.8.1";resolution:=optional, + org.eclipse.tcf.te.core.terminals;bundle-version="1.3.0", + org.eclipse.tm.terminal;bundle-version="3.3.1", + org.eclipse.ui;bundle-version="3.8.0" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Bundle-Localization: plugin +Export-Package: org.eclipse.tcf.te.ui.terminals.actions, + org.eclipse.tcf.te.ui.terminals.activator;x-internal:=true, + org.eclipse.tcf.te.ui.terminals.controls, + org.eclipse.tcf.te.ui.terminals.help, + org.eclipse.tcf.te.ui.terminals.interfaces, + org.eclipse.tcf.te.ui.terminals.interfaces.tracing;x-internal:=true, + org.eclipse.tcf.te.ui.terminals.internal;x-internal:=true, + org.eclipse.tcf.te.ui.terminals.internal.dialogs;x-internal:=true, + org.eclipse.tcf.te.ui.terminals.internal.handler;x-internal:=true, + org.eclipse.tcf.te.ui.terminals.launcher, + org.eclipse.tcf.te.ui.terminals.listeners, + org.eclipse.tcf.te.ui.terminals.manager, + org.eclipse.tcf.te.ui.terminals.nls;x-internal:=true, + org.eclipse.tcf.te.ui.terminals.panels, + org.eclipse.tcf.te.ui.terminals.services, + org.eclipse.tcf.te.ui.terminals.streams, + org.eclipse.tcf.te.ui.terminals.tabs, + org.eclipse.tcf.te.ui.terminals.view diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/about.html b/plugins/org.eclipse.tcf.te.ui.terminals/about.html new file mode 100644 index 00000000000..0f07cf034df --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

May 24, 2012

+

License

+ +

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 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +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 http://www.eclipse.org.

+ + + \ No newline at end of file diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/build.properties b/plugins/org.eclipse.tcf.te.ui.terminals/build.properties new file mode 100644 index 00000000000..e4c5fea5c10 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/build.properties @@ -0,0 +1,19 @@ +############################################################################### +# Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +############################################################################### +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.properties,\ + plugin.xml,\ + about.html,\ + icons/,\ + contexts.xml +src.includes = schema/ diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/contexts.xml b/plugins/org.eclipse.tcf.te.ui.terminals/contexts.xml new file mode 100644 index 00000000000..612cd7c14b1 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/contexts.xml @@ -0,0 +1,9 @@ + + + + Select the terminal type and specify the connections settings to connect a new terminal. + + + Select the new encoding for the active terminal. + + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/icons/clcl16/command_input_field.gif b/plugins/org.eclipse.tcf.te.ui.terminals/icons/clcl16/command_input_field.gif new file mode 100644 index 00000000000..9e3a547c145 Binary files /dev/null and b/plugins/org.eclipse.tcf.te.ui.terminals/icons/clcl16/command_input_field.gif differ diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/icons/dlcl16/command_input_field.gif b/plugins/org.eclipse.tcf.te.ui.terminals/icons/dlcl16/command_input_field.gif new file mode 100644 index 00000000000..f538ca707fc Binary files /dev/null and b/plugins/org.eclipse.tcf.te.ui.terminals/icons/dlcl16/command_input_field.gif differ diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/icons/dlcl16/disconnect.gif b/plugins/org.eclipse.tcf.te.ui.terminals/icons/dlcl16/disconnect.gif new file mode 100644 index 00000000000..1ca9213a43c Binary files /dev/null and b/plugins/org.eclipse.tcf.te.ui.terminals/icons/dlcl16/disconnect.gif differ diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/icons/elcl16/command_input_field.gif b/plugins/org.eclipse.tcf.te.ui.terminals/icons/elcl16/command_input_field.gif new file mode 100644 index 00000000000..f538ca707fc Binary files /dev/null and b/plugins/org.eclipse.tcf.te.ui.terminals/icons/elcl16/command_input_field.gif differ diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/icons/elcl16/disconnect.gif b/plugins/org.eclipse.tcf.te.ui.terminals/icons/elcl16/disconnect.gif new file mode 100644 index 00000000000..d61dd776e39 Binary files /dev/null and b/plugins/org.eclipse.tcf.te.ui.terminals/icons/elcl16/disconnect.gif differ diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/icons/eview16/terminal_view.gif b/plugins/org.eclipse.tcf.te.ui.terminals/icons/eview16/terminal_view.gif new file mode 100644 index 00000000000..bbb6a9e153e Binary files /dev/null and b/plugins/org.eclipse.tcf.te.ui.terminals/icons/eview16/terminal_view.gif differ diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/plugin.properties b/plugins/org.eclipse.tcf.te.ui.terminals/plugin.properties new file mode 100644 index 00000000000..00d63015ba0 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/plugin.properties @@ -0,0 +1,57 @@ +################################################################################## +# Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +################################################################################## + +pluginName = Terminals +providerName = Eclipse.org - Target Explorer + +# ----- Terminals View ----- + +ViewCategory.name=Terminals + +TerminalsView.name=Terminals +TerminalsView.context.name=In Terminals View +TerminalsView.context.description=Show modified keyboard shortcuts in context menu + +# ----- Terminal Connectors ----- + +TerminalConnector.streams=Streams Connector (hidden) + +# ----- Terminal Launcher Delegates ----- + +StreamsLauncherDelegate.label=Streams Terminal + +# ----- Commands and Menu contributions ----- +command.category.name=Terminals Commands + +toolbar.terminal.label=Terminals + +command.launch.selection.name=Open Terminal on Selection +command.launch.name=Open Terminal +command.launch.label=Open Terminal... +command.launch.tooltip=Open a Terminal + +command.disconnect.name=Disconnect Terminal +command.disconnect.label=Disconnect +command.disconnect.tooltip=Disconnect Terminal Connection + +menu.showIn.label = Show In +menu.showIn.mnemonic=I + +# ----- Extension Points ----- + +ExtensionPoint.launcherDelegates.name=Terminal Launcher Delegates + +# ----- Activity contributions ----- + +activities.category.terminals.name=Terminal +activities.category.terminals.description=Use the terminal to connect to remote hosts via telnet, ssh and others. + +activities.activity.terminals.views.name=Terminal Views +activities.activity.terminals.views.description=Terminal related views. diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/plugin.xml b/plugins/org.eclipse.tcf.te.ui.terminals/plugin.xml new file mode 100644 index 00000000000..17b90285ea1 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/plugin.xml @@ -0,0 +1,338 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/pom.xml b/plugins/org.eclipse.tcf.te.ui.terminals/pom.xml new file mode 100644 index 00000000000..8b5e73f93f0 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + + org.eclipse.tcf + org.eclipse.tcf.maven-build + 1.3.0-SNAPSHOT + ../../../admin/pom-build.xml + + + 1.3.0.qualifier + org.eclipse.tcf.te.ui.terminals + eclipse-plugin + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/schema/launcherDelegates.exsd b/plugins/org.eclipse.tcf.te.ui.terminals/schema/launcherDelegates.exsd new file mode 100644 index 00000000000..49c11e6eef4 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/schema/launcherDelegates.exsd @@ -0,0 +1,215 @@ + + + + + + + + + This extension point is used to contribute terminal launcher delegates. +<p> +Terminal launcher delegates contributes terminal settings widget to the <code>LaunchTerminalSettingsDialog</code> required to open a remote terminal through a specific communication channel, like TCF or SSH. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Declares a terminal launcher delegate contribution. + + + + + + + + + + + + The unique id of the terminal launcher delegate contribution. + + + + + + + The label representing the terminal launcher delegate within the UI. + + + + + + + The class that implements <code>org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate</code> or extends <code>org.eclipse.tcf.te.ui.terminals.launcher.AbstractLauncherDelegate</code>. +<p> +The terminal launcher delegate implementation class must be specified either by the class attribute or the class child element! + + + + + + + + + + If <code>true</code>, than the terminal launcher delegate is not visible in the UI, even if a possible <code>enablement</code> will evaluate to <code>true</code>. + + + + + + + + + + A short description of the terminal connector type to be presented in the UI. + + + + + + + + Used when creating an <code>IExecutableExtension</code> with a named parameter, or more than one. + + + + + + + + + + The class that implements <code>org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate</code> or extends <code>org.eclipse.tcf.te.ui.terminals.launcher.AbstractLauncherDelegate</code>. +<p> +The terminal launcher delegate implementation class must be specified either by the class attribute or the class child element! + + + + + + + + + + + + + A parameter for an <code>IExecutableExtension</code>. + + + + + + + <p>The parameter name.</p> + + + + + + + <p>The parameter value.</p> + + + + + + + + + + + + Target Explorer 1.0.0 + + + + + + + + + This is an example of the extension point usage: +<p> +<pre><code> + <extension point="org.eclipse.tcf.te.ui.terminals.launcherDelegates"> + <delegate + id="org.eclipse.tcf.te.ui.terminals.launcher.tcf" + class="org.eclipse.tcf.te.tcf.terminals.ui.internal.TerminalLauncherDelegate" + label="TCF Terminal"> + <enablement> + ... + </enablement> + </delegate> + </extension> +</code></pre> + + + + + + + + + The provider of a launcher delegate must implement <samp>org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate</samp>. + + + + + + + + + + Copyright (c) 2011 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. + + + + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/AbstractAction.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/AbstractAction.java new file mode 100644 index 00000000000..3ab4f8cef66 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/AbstractAction.java @@ -0,0 +1,189 @@ +/******************************************************************************* + * Copyright (c) 2011, 2013 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.actions; + +import org.eclipse.core.commands.Command; +import org.eclipse.core.commands.ParameterizedCommand; +import org.eclipse.core.expressions.EvaluationContext; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin; +import org.eclipse.tcf.te.ui.terminals.nls.Messages; +import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderManager; +import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderToolbarHandler; +import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; +import org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction; +import org.eclipse.ui.ISources; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.commands.ICommandService; +import org.eclipse.ui.handlers.IHandlerService; + +/** + * Abstract terminal action wrapper implementation. + */ +@SuppressWarnings("restriction") +public abstract class AbstractAction extends AbstractTerminalAction { + // Reference to the parent toolbar handler + private final TabFolderToolbarHandler parent; + + /** + * Constructor. + * + * @param parent + * The parent toolbar handler instance. Must not be + * null. + * @param id + * The terminal action id. Must not be null. + */ + public AbstractAction(TabFolderToolbarHandler parent, String id) { + super(id); + + Assert.isNotNull(parent); + this.parent = parent; + } + + /** + * Returns the parent toolbar handler. + * + * @return The parent toolbar handler. + */ + protected final TabFolderToolbarHandler getParent() { + return parent; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#getTarget() + */ + @Override + protected ITerminalViewControl getTarget() { + return getParent().getActiveTerminalViewControl(); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#run() + */ + @Override + public void run() { + // Get the active tab item from the tab folder manager + TabFolderManager manager = (TabFolderManager)getParent().getAdapter(TabFolderManager.class); + if (manager != null) { + // If we have the active tab item, we can get the active terminal control + CTabItem activeTabItem = manager.getActiveTabItem(); + if (activeTabItem != null) { + // And execute the command + executeCommand(activeTabItem.getData("customData")); //$NON-NLS-1$ + } + } + } + + /** + * Executes the command for the given data node as current and active menu selection. + *

+ * Node: If the provided data node is null, the method will trigger + * the command with an empty selection. + * + * @param data The terminal custom data node or null. + */ + protected void executeCommand(Object data) { + // Get the command service from the workbench + ICommandService service = (ICommandService)PlatformUI.getWorkbench().getAdapter(ICommandService.class); + if (service != null && getCommandId() != null) { + // Get the command + final Command command = service.getCommand(getCommandId()); + if (command != null && command.isDefined()) { + IHandlerService handlerSvc = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class); + Assert.isNotNull(handlerSvc); + + // Construct a selection element + IStructuredSelection selection = data != null ? new StructuredSelection(data) : new StructuredSelection(); + // Construct the application context + EvaluationContext context = new EvaluationContext(handlerSvc.getCurrentState(), selection); + // Apply the selection to the "activeMenuSelection" and "selection" variable too + context.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, selection); + context.addVariable(ISources.ACTIVE_MENU_SELECTION_NAME, selection); + // Allow plugin activation + context.setAllowPluginActivation(true); + // And execute the event + try { + ParameterizedCommand pCmd = ParameterizedCommand.generateCommand(command, null); + Assert.isNotNull(pCmd); + + handlerSvc.executeCommandInContext(pCmd, null, context); + } catch (Exception e) { + IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), + NLS.bind(Messages.AbstractAction_error_commandExecutionFailed, getCommandId(), e.getLocalizedMessage()), + e); + UIPlugin.getDefault().getLog().log(status); + } + } + } + } + + /** + * Returns the command id of the command to execute. + * + * @return The command id. Must be never null. + */ + protected abstract String getCommandId(); + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#updateAction(boolean) + */ + @Override + public void updateAction(boolean aboutToShow) { + // Ignore the flag given from outside. We have to decide ourself + // what the enabled state of the action is + boolean enabled = getTarget() != null; + + // If a target terminal control is available, we need to find the corresponding + // VLM target object which we need to trigger the handler + if (enabled) { + // The action will be enabled if we can determine the VLM target object + enabled = false; + // Get the active tab item from the tab folder manager + TabFolderManager manager = (TabFolderManager)getParent().getAdapter(TabFolderManager.class); + if (manager != null) { + // If we have the active tab item, we can get the active terminal control + CTabItem activeTabItem = manager.getActiveTabItem(); + if (activeTabItem != null) { + enabled = checkEnableAction(activeTabItem.getData("customData")); //$NON-NLS-1$ + } + } + } + + setEnabled(enabled); + } + + /** + * Checks if the action should be enabled based on the given terminal data object. + * + * @param data The terminal data node or null. + * @return True to enable the action, false otherwise. + */ + protected boolean checkEnableAction(Object data) { + return data != null; + } + + /** + * Returns if the action is a separator. Returning true here + * means that an additional separator toolbar element is added right or + * above of the action. + * + * @return True if the action is separating the parent contribution manager, false otherwise. + */ + public boolean isSeparator() { + return false; + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/PinTerminalAction.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/PinTerminalAction.java new file mode 100644 index 00000000000..f152023c581 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/PinTerminalAction.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2011, 2014 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.actions; + +import org.eclipse.jface.action.IAction; +import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin; +import org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView; +import org.eclipse.tcf.te.ui.terminals.interfaces.ImageConsts; +import org.eclipse.tcf.te.ui.terminals.nls.Messages; +import org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction; + +/** + * Pins the currently visible terminal view. + */ +@SuppressWarnings("restriction") +public class PinTerminalAction extends AbstractTerminalAction { + + private ITerminalsView view = null; + + /** + * Constructor. + */ + public PinTerminalAction(ITerminalsView view) { + super(null, PinTerminalAction.class.getName(), IAction.AS_CHECK_BOX); + + this.view = view; + setupAction(Messages.PinTerminalAction_menu, Messages.PinTerminalAction_toolTip, + UIPlugin.getImageDescriptor(ImageConsts.ACTION_PinTerminal_Hover), + UIPlugin.getImageDescriptor(ImageConsts.ACTION_PinTerminal_Enabled), + UIPlugin.getImageDescriptor(ImageConsts.ACTION_PinTerminal_Disabled), true); + setChecked(view.isPinned()); + setEnabled(true); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.action.IAction#run() + */ + @Override + public void run() { + view.setPinned(isChecked()); + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/SelectEncodingAction.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/SelectEncodingAction.java new file mode 100644 index 00000000000..d1d5672119f --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/SelectEncodingAction.java @@ -0,0 +1,80 @@ +/******************************************************************************* + * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.actions; + +import java.io.UnsupportedEncodingException; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.window.Window; +import org.eclipse.tcf.te.ui.terminals.internal.dialogs.EncodingSelectionDialog; +import org.eclipse.tcf.te.ui.terminals.nls.Messages; +import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderManager; +import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; +import org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction; +import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; + +/** + * Terminal control select encoding action implementation. + */ +@SuppressWarnings("restriction") +public class SelectEncodingAction extends AbstractTerminalAction { + // Reference to the parent tab folder manager + private final TabFolderManager tabFolderManager; + + /** + * Constructor. + * + * @param tabFolderManager The parent tab folder manager. Must not be null. + */ + public SelectEncodingAction(TabFolderManager tabFolderManager) { + super(null, SelectEncodingAction.class.getName(), IAction.AS_PUSH_BUTTON); + + Assert.isNotNull(tabFolderManager); + this.tabFolderManager = tabFolderManager; + + setupAction(Messages.SelectEncodingAction_menu, + Messages.SelectEncodingAction_tooltip, + (ImageDescriptor)null, + (ImageDescriptor)null, + (ImageDescriptor)null, + true); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#run() + */ + @Override + public void run() { + ITerminalViewControl target = getTarget(); + if (target == null) return; + + EncodingSelectionDialog dialog = new EncodingSelectionDialog(null); + dialog.setEncoding(target.getEncoding()); + if (dialog.open() == Window.OK) { + try { + target.setEncoding(dialog.getEncoding()); + tabFolderManager.updateStatusLine(); + } + catch (UnsupportedEncodingException e) { e.printStackTrace(); } + } + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#updateAction(boolean) + */ + @Override + public void updateAction(boolean aboutToShow) { + setEnabled(aboutToShow + && getTarget() != null && getTarget().getState() == TerminalState.CONNECTED); + } + +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/TabScrollLockAction.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/TabScrollLockAction.java new file mode 100644 index 00000000000..571eb8da35c --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/TabScrollLockAction.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.actions; + +import org.eclipse.jface.action.IAction; +import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin; +import org.eclipse.tcf.te.ui.terminals.interfaces.ImageConsts; +import org.eclipse.tcf.te.ui.terminals.nls.Messages; +import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; +import org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction; +import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; + +/** + * Terminal console tab scroll lock action. + */ +@SuppressWarnings("restriction") +public class TabScrollLockAction extends AbstractTerminalAction { + + /** + * Constructor. + */ + public TabScrollLockAction() { + super(null, TabScrollLockAction.class.getName(), IAction.AS_RADIO_BUTTON); + + setupAction(Messages.TabScrollLockAction_text, + Messages.TabScrollLockAction_tooltip, + UIPlugin.getImageDescriptor(ImageConsts.ACTION_ScrollLock_Hover), + UIPlugin.getImageDescriptor(ImageConsts.ACTION_ScrollLock_Enabled), + UIPlugin.getImageDescriptor(ImageConsts.ACTION_ScrollLock_Disabled), + true); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#run() + */ + @Override + public void run() { + ITerminalViewControl target = getTarget(); + if (target != null) { + target.setScrollLock(!target.isScrollLock()); + setChecked(target.isScrollLock()); + } + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#updateAction(boolean) + */ + @Override + public void updateAction(boolean aboutToShow) { + setEnabled(aboutToShow && getTarget() != null && getTarget().getState() == TerminalState.CONNECTED); + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/ToggleCommandFieldAction.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/ToggleCommandFieldAction.java new file mode 100644 index 00000000000..d2eb36b2cfb --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/actions/ToggleCommandFieldAction.java @@ -0,0 +1,85 @@ +/******************************************************************************* + * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.actions; + +import org.eclipse.jface.action.IAction; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin; +import org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView; +import org.eclipse.tcf.te.ui.terminals.interfaces.ImageConsts; +import org.eclipse.tcf.te.ui.terminals.nls.Messages; +import org.eclipse.tcf.te.ui.terminals.tabs.TabCommandFieldHandler; +import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderManager; +import org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction; +import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; + +/** + * Toggle command input field. + */ +@SuppressWarnings("restriction") +public class ToggleCommandFieldAction extends AbstractTerminalAction { + private ITerminalsView view = null; + + /** + * Constructor. + */ + public ToggleCommandFieldAction(ITerminalsView view) { + super(null, ToggleCommandFieldAction.class.getName(), IAction.AS_CHECK_BOX); + + this.view = view; + setupAction(Messages.ToggleCommandFieldAction_menu, Messages.ToggleCommandFieldAction_toolTip, + UIPlugin.getImageDescriptor(ImageConsts.ACTION_ToggleCommandField_Hover), + UIPlugin.getImageDescriptor(ImageConsts.ACTION_ToggleCommandField_Enabled), + UIPlugin.getImageDescriptor(ImageConsts.ACTION_ToggleCommandField_Disabled), true); + + TabCommandFieldHandler handler = getCommandFieldHandler(); + setChecked(handler != null && handler.hasCommandInputField()); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.action.IAction#run() + */ + @Override + public void run() { + TabCommandFieldHandler handler = getCommandFieldHandler(); + if (handler != null) { + handler.setCommandInputField(!handler.hasCommandInputField()); + } + setChecked(handler != null && handler.hasCommandInputField()); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#updateAction(boolean) + */ + @Override + public void updateAction(boolean aboutToShow) { + setEnabled(aboutToShow && getCommandFieldHandler() != null + && getTarget() != null && getTarget().getState() == TerminalState.CONNECTED); + } + + /** + * Returns the command input field handler for the active tab. + * + * @return The command input field handler or null. + */ + protected TabCommandFieldHandler getCommandFieldHandler() { + TabCommandFieldHandler handler = null; + // Get the active tab item from the tab folder manager + TabFolderManager manager = (TabFolderManager)view.getAdapter(TabFolderManager.class); + if (manager != null) { + // If we have the active tab item, we can get the active terminal control + CTabItem activeTabItem = manager.getActiveTabItem(); + if (activeTabItem != null && !activeTabItem.isDisposed()) { + handler = manager.getTabCommandFieldHandler(activeTabItem); + } + } + return handler; + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/activator/UIPlugin.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/activator/UIPlugin.java new file mode 100644 index 00000000000..f12b8ee35be --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/activator/UIPlugin.java @@ -0,0 +1,265 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + * Max Weninger (Wind River) - [361363] [TERMINALS] Implement "Pin&Clone" for the "Terminals" view + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.activator; + +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.tcf.te.core.terminals.preferences.ScopedEclipsePreferences; +import org.eclipse.tcf.te.core.terminals.tracing.TraceHandler; +import org.eclipse.tcf.te.ui.terminals.interfaces.ImageConsts; +import org.eclipse.tcf.te.ui.terminals.listeners.WorkbenchWindowListener; +import org.eclipse.tcf.te.ui.terminals.view.TerminalsView; +import org.eclipse.tcf.te.ui.terminals.view.TerminalsViewMementoHandler; +import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; +import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IViewReference; +import org.eclipse.ui.IWindowListener; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchListener; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +@SuppressWarnings("restriction") +public class UIPlugin extends AbstractUIPlugin { + // The shared instance + private static UIPlugin plugin; + // The scoped preferences instance + private static volatile ScopedEclipsePreferences scopedPreferences; + // The trace handler instance + private static volatile TraceHandler traceHandler; + // The workbench listener instance + private IWorkbenchListener listener; + // The global window listener instance + private IWindowListener windowListener; + + /** + * The constructor + */ + public UIPlugin() { + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static UIPlugin getDefault() { + return plugin; + } + + /** + * Convenience method which returns the unique identifier of this plug-in. + */ + public static String getUniqueIdentifier() { + if (getDefault() != null && getDefault().getBundle() != null) { + return getDefault().getBundle().getSymbolicName(); + } + return "org.eclipse.tcf.te.ui.terminals"; //$NON-NLS-1$ + } + + /** + * Return the scoped preferences for this plug-in. + */ + public static ScopedEclipsePreferences getScopedPreferences() { + if (scopedPreferences == null) { + scopedPreferences = new ScopedEclipsePreferences(getUniqueIdentifier()); + } + return scopedPreferences; + } + + /** + * Returns the bundles trace handler. + * + * @return The bundles trace handler. + */ + public static TraceHandler getTraceHandler() { + if (traceHandler == null) { + traceHandler = new TraceHandler(getUniqueIdentifier()); + } + return traceHandler; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + + // Create and register the workbench listener instance + listener = new IWorkbenchListener() { + + @Override + public boolean preShutdown(IWorkbench workbench, boolean forced) { + if (workbench != null && workbench.getActiveWorkbenchWindow() != null && workbench.getActiveWorkbenchWindow().getActivePage() != null) { + // Find all "Terminals" views + IViewReference[] refs = workbench.getActiveWorkbenchWindow().getActivePage().getViewReferences(); + for (IViewReference ref : refs) { + IViewPart part = ref.getView(false); + if (part instanceof TerminalsView) { + /* + * The terminal tabs to save to the views memento on shutdown can + * be determined only _before_ the saveState(memento) method of the + * view is called. Within saveState, it is already to late and the + * terminals might be in CLOSED state already. This depends on the + * terminal type and the corresponding connector implementation. + * + * To be safe, we determine the still opened terminals on shutdown + * separately here in the preShutdown. + */ + final List saveables = new ArrayList(); + + // Get the tab folder + CTabFolder tabFolder = (CTabFolder)((TerminalsView)part).getAdapter(CTabFolder.class); + if (tabFolder != null && !tabFolder.isDisposed()) { + // Get the list of tab items + CTabItem[] items = tabFolder.getItems(); + // Loop the tab items and find the still connected ones + for (CTabItem item : items) { + // Ignore disposed items + if (item.isDisposed()) continue; + // Get the terminal view control + ITerminalViewControl terminal = (ITerminalViewControl)item.getData(); + if (terminal == null || terminal.getState() != TerminalState.CONNECTED) { + continue; + } + // Still connected -> Add to the list + saveables.add(item); + } + } + + // Push the determined saveable items to the memento handler + TerminalsViewMementoHandler mementoHandler = (TerminalsViewMementoHandler)((TerminalsView)part).getAdapter(TerminalsViewMementoHandler.class); + if (mementoHandler != null) mementoHandler.setSaveables(saveables); + } + } + } + + return true; + } + + @Override + public void postShutdown(IWorkbench workbench) { + } + }; + PlatformUI.getWorkbench().addWorkbenchListener(listener); + + if (windowListener == null && PlatformUI.getWorkbench() != null) { + windowListener = new WorkbenchWindowListener(); + PlatformUI.getWorkbench().addWindowListener(windowListener); + activateContexts(); + } + } + + void activateContexts() { + if (Display.getCurrent() != null) { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (window != null && windowListener != null) windowListener.windowOpened(window); + } + else { + PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable(){ + @Override + public void run() { + activateContexts(); + }}); + } + } + + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + if (windowListener != null && PlatformUI.getWorkbench() != null) { + PlatformUI.getWorkbench().removeWindowListener(windowListener); + windowListener = null; + } + + plugin = null; + scopedPreferences = null; + traceHandler = null; + if (listener != null) { PlatformUI.getWorkbench().removeWorkbenchListener(listener); listener = null; } + super.stop(context); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry) + */ + @Override + protected void initializeImageRegistry(ImageRegistry registry) { + Bundle bundle = Platform.getBundle("org.eclipse.ui.console"); //$NON-NLS-1$ + if (bundle != null) { + URL url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + "full/" + ImageConsts.IMAGE_DIR_EVIEW + "console_view.gif"); //$NON-NLS-1$ //$NON-NLS-2$ + registry.put(ImageConsts.VIEW_Terminals, ImageDescriptor.createFromURL(url)); + + url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + "full/" + ImageConsts.IMAGE_DIR_CLCL + "lock_co.gif"); //$NON-NLS-1$ //$NON-NLS-2$ + registry.put(ImageConsts.ACTION_ScrollLock_Hover, ImageDescriptor.createFromURL(url)); + url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + "full/" + ImageConsts.IMAGE_DIR_ELCL + "lock_co.gif"); //$NON-NLS-1$ //$NON-NLS-2$ + registry.put(ImageConsts.ACTION_ScrollLock_Enabled, ImageDescriptor.createFromURL(url)); + url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + "full/" + ImageConsts.IMAGE_DIR_DLCL + "lock_co.gif"); //$NON-NLS-1$ //$NON-NLS-2$ + registry.put(ImageConsts.ACTION_ScrollLock_Disabled, ImageDescriptor.createFromURL(url)); + + url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + "full/" + ImageConsts.IMAGE_DIR_CLCL + "pin.gif"); //$NON-NLS-1$ //$NON-NLS-2$ + registry.put(ImageConsts.ACTION_PinTerminal_Hover, ImageDescriptor.createFromURL(url)); + url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + "full/" + ImageConsts.IMAGE_DIR_ELCL + "pin.gif"); //$NON-NLS-1$ //$NON-NLS-2$ + registry.put(ImageConsts.ACTION_PinTerminal_Enabled, ImageDescriptor.createFromURL(url)); + url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + "full/" + ImageConsts.IMAGE_DIR_DLCL + "pin.gif"); //$NON-NLS-1$ //$NON-NLS-2$ + registry.put(ImageConsts.ACTION_PinTerminal_Disabled, ImageDescriptor.createFromURL(url)); + } + + bundle = getBundle(); + URL url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_CLCL + "command_input_field.gif"); //$NON-NLS-1$ + registry.put(ImageConsts.ACTION_ToggleCommandField_Hover, ImageDescriptor.createFromURL(url)); + url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_ELCL + "command_input_field.gif"); //$NON-NLS-1$ + registry.put(ImageConsts.ACTION_ToggleCommandField_Enabled, ImageDescriptor.createFromURL(url)); + url = bundle.getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_DLCL + "command_input_field.gif"); //$NON-NLS-1$ + registry.put(ImageConsts.ACTION_ToggleCommandField_Disabled, ImageDescriptor.createFromURL(url)); + } + + /** + * Loads the image registered under the specified key from the image + * registry and returns the 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/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/controls/ConfigurationPanelControl.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/controls/ConfigurationPanelControl.java new file mode 100644 index 00000000000..75de4de716c --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/controls/ConfigurationPanelControl.java @@ -0,0 +1,421 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.controls; + +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.dialogs.IMessageProvider; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer; +import org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel; + +/** + * Base control to deal with wizard or property page controls + * which should share the same UI space. + */ +public class ConfigurationPanelControl implements IConfigurationPanelContainer, IMessageProvider { + private final Map configurationPanels = new Hashtable(); + + private String message = null; + private int messageType = IMessageProvider.NONE; + + private boolean isGroup; + + private Composite panel; + private StackLayout panelLayout; + + private String activeConfigurationPanelKey = null; + private IConfigurationPanel activeConfigurationPanel = null; + + private final AbstractConfigurationPanel EMPTY_PANEL; + + /** + * An empty configuration panel implementation. + */ + private static final class EmptySettingsPanel extends AbstractConfigurationPanel { + + /** + * Constructor. + * + * @param container The configuration panel container or null. + */ + public EmptySettingsPanel(IConfigurationPanelContainer container) { + super(container); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#setupPanel(org.eclipse.swt.widgets.Composite) + */ + @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)); + + panel.setBackground(parent.getBackground()); + + setControl(panel); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#isValid() + */ + @Override + public boolean isValid() { + return false; + } + } + + /** + * Cleanup all resources the control might have been created. + */ + public void dispose() { + EMPTY_PANEL.dispose(); + } + + /** + * Constructor. + */ + public ConfigurationPanelControl() { + EMPTY_PANEL = new EmptySettingsPanel(this); + clear(); + setPanelIsGroup(false); + } + + /** + * Sets if or if not the controls panel is a Group. + * + * @param isGroup True if the controls panel is a group, false otherwise. + */ + public void setPanelIsGroup(boolean isGroup) { + this.isGroup = isGroup; + } + + /** + * Returns if or if not the controls panel is a Group. + * + * @return True if the controls panel is a group, false otherwise. + */ + public boolean isPanelIsGroup() { + return isGroup; + } + + /** + * Returns the controls panel. + * + * @return The controls panel or null. + */ + public Composite getPanel() { + return panel; + } + + /** + * Returns the label text to set for the group (if the panel is a group). + * + * @return The label text to apply or null. + */ + public String getGroupLabel() { + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer#validate() + */ + @Override + public void validate() { + } + + /** + * To be called from the embedding control to setup the controls UI elements. + * + * @param parent The parent control. Must not be null! + */ + public void setupPanel(Composite parent, String[] configurationPanelKeys) { + Assert.isNotNull(parent); + + if (isPanelIsGroup()) { + panel = new Group(parent, SWT.NONE); + if (getGroupLabel() != null) ((Group)panel).setText(getGroupLabel()); + } else { + panel = new Composite(parent, SWT.NONE); + } + Assert.isNotNull(panel); + panel.setFont(parent.getFont()); + panel.setBackground(parent.getBackground()); + + panelLayout = new StackLayout(); + panel.setLayout(panelLayout); + + setupConfigurationPanels(panel, configurationPanelKeys); + EMPTY_PANEL.setupPanel(panel); + } + + /** + * Removes all configuration panels. + */ + public void clear() { + configurationPanels.clear(); + } + + /** + * Returns a unsorted list of all registered configuration panel id's. + * + * @return A list of registered configuration panel id's. + */ + public String[] getConfigurationPanelIds() { + return configurationPanels.keySet().toArray(new String[configurationPanels.keySet().size()]); + } + + /** + * Returns the configuration panel instance registered for the given configuration panel key. + * + * @param key The key to get the configuration panel for. Must not be null! + * @return The configuration panel instance or an empty configuration panel if the key is unknown. + */ + public IConfigurationPanel getConfigurationPanel(String key) { + IConfigurationPanel panel = key != null ? configurationPanels.get(key) : null; + return panel != null ? panel : EMPTY_PANEL; + } + + /** + * Returns if or if not the given configuration panel is equal to the + * empty configuration panel. + * + * @param panel The configuration panel or null. + * @return True if the configuration panel is equal to the empty configuration panel. + */ + public final boolean isEmptyConfigurationPanel(IConfigurationPanel panel) { + return EMPTY_PANEL == panel; + } + + /** + * Adds the given configuration panel under the given configuration panel key to the + * list of known panels. If the given configuration panel is null, any + * configuration panel stored under the given key is removed from the list of known panels. + * + * @param key The key to get the configuration panel for. Must not be null! + * @param panel The configuration panel instance or null. + */ + public void addConfigurationPanel(String key, IConfigurationPanel panel) { + if (key == null) return; + if (panel != null) { + configurationPanels.put(key, panel); + } else { + configurationPanels.remove(key); + } + } + + /** + * Setup the configuration panels for being presented to the user. This method is called by the + * controls doSetupPanel(...) and initialize all possible configuration panels to show. + * The default implementation iterates over the given list of configuration panel keys and calls + * setupPanel(...) for each of them. + * + * @param parent The parent composite to use for the configuration panels. Must not be null! + * @param configurationPanelKeys The list of configuration panels to initialize. Might be null or empty! + */ + public void setupConfigurationPanels(Composite parent, String[] configurationPanelKeys) { + Assert.isNotNull(parent); + + if (configurationPanelKeys != null) { + for (int i = 0; i < configurationPanelKeys.length; i++) { + IConfigurationPanel configPanel = getConfigurationPanel(configurationPanelKeys[i]); + Assert.isNotNull(configPanel); + configPanel.setupPanel(parent); + } + } + } + + /** + * Make the wizard configuration panel registered under the given configuration panel key the + * most top configuration panel. If no configuration panel is registered under the given key, + * nothing will happen. + * + * @param key The key to get the wizard configuration panel for. Must not be null! + */ + public void showConfigurationPanel(String key) { + String activeKey = getActiveConfigurationPanelKey(); + if (key != null && key.equals(activeKey) && activeConfigurationPanel != null) { + return; + } + IConfigurationPanel configPanel = getActiveConfigurationPanel(); + Map data = new HashMap(); + if (configPanel != null) configPanel.extractData(data); + configPanel = getConfigurationPanel(key); + Assert.isNotNull(configPanel); + if (configPanel.getControl() != null) { + activeConfigurationPanel = configPanel; + activeConfigurationPanelKey = key; + panelLayout.topControl = configPanel.getControl(); + panel.layout(); + if (!data.isEmpty()) configPanel.updateData(data); + configPanel.activate(); + } + else { + activeConfigurationPanelKey = key; + } + } + + /** + * Returns the currently active configuration panel. + * + * @return The active configuration panel or null. + */ + public IConfigurationPanel getActiveConfigurationPanel() { + return activeConfigurationPanel; + } + + /** + * Returns the currently active configuration panel key. + * + * @return The active configuration panel key or null. + */ + public String getActiveConfigurationPanelKey() { + return activeConfigurationPanelKey; + } + + /** + * Returns the dialog settings to use to save and restore control specific + * widget values. + * + * @param settings The parent dialog settings. Must not be null. + * @return The dialog settings to use. + */ + public final IDialogSettings getDialogSettings(IDialogSettings settings) { + Assert.isNotNull(settings); + + // Store the settings of the control within it's own section. + String sectionName = this.getClass().getSimpleName(); + Assert.isNotNull(sectionName); + + IDialogSettings section = settings.getSection(sectionName); + if (section == null) { + section = settings.addNewSection(sectionName); + } + + return section; + } + + /** + * Restore the widget values from the dialog settings store to recreate the control history. + *

+ * Note: + * The control is saving the widget values into a section equal to the class name {@link Class#getName()}. + * After the sections has been created, the method calls doRestoreWidgetValues for restoring + * the single properties from the dialog settings. Subclasses may override doRestoreWidgetValues + * only to deal with the single properties only or restoreWidgetValues when to override the + * creation of the subsections. + * + * @param settings The dialog settings object instance to restore the widget values from. Must not be null! + * @param idPrefix The prefix to use for every dialog settings slot keys. If null, the dialog settings slot keys are not to prefix. + */ + public final void restoreWidgetValues(IDialogSettings settings, String idPrefix) { + Assert.isNotNull(settings); + + // now, call the hook for actually reading the single properties from the dialog settings. + doRestoreWidgetValues(getDialogSettings(settings), idPrefix); + } + + /** + * Hook to restore the widget values finally plain from the given dialog settings. This method should + * not fragment the given dialog settings any further. + * + * @param settings The dialog settings to restore the widget values from. Must not be null! + * @param idPrefix The prefix to use for every dialog settings slot keys. If null, the dialog settings slot keys are not to prefix. + */ + public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) { + Assert.isNotNull(settings); + + for (String panelKey : configurationPanels.keySet()) { + IConfigurationPanel configPanel = getConfigurationPanel(panelKey); + if (configPanel != null && !isEmptyConfigurationPanel(configPanel)) { + IDialogSettings configPanelSettings = settings.getSection(panelKey); + if (configPanelSettings == null) configPanelSettings = settings.addNewSection(panelKey); + configPanel.doRestoreWidgetValues(configPanelSettings, idPrefix); + } + } + } + + /** + * Saves the widget values to the dialog settings store for remembering the history. The control might + * be embedded within multiple pages multiple times handling different properties. Because the single + * controls should not mix up the history, we create subsections within the given dialog settings if + * they do not already exist. After the sections has been created, the method calls doSaveWidgetValues + * for saving the single properties to the dialog settings. Subclasses may override doSaveWidgetValues + * only to deal with the single properties only or saveWidgetValues when to override the + * creation of the subsections. + * + * @param settings The dialog settings object instance to save the widget values to. Must not be null! + * @param idPrefix The prefix to use for every dialog settings slot keys. If null, the dialog settings slot keys are not to prefix. + */ + public final void saveWidgetValues(IDialogSettings settings, String idPrefix) { + Assert.isNotNull(settings); + + // now, call the hook for actually writing the single properties to the dialog settings. + doSaveWidgetValues(getDialogSettings(settings), idPrefix); + } + + /** + * Hook to save the widget values finally plain to the given dialog settings. This method should + * not fragment the given dialog settings any further. + * + * @param settings The dialog settings to save the widget values to. Must not be null! + * @param idPrefix The prefix to use for every dialog settings slot keys. If null, the dialog settings slot keys are not to prefix. + */ + public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) { + Assert.isNotNull(settings); + + IConfigurationPanel configPanel = getActiveConfigurationPanel(); + if (configPanel != null && !isEmptyConfigurationPanel(configPanel)) { + String key = getActiveConfigurationPanelKey(); + IDialogSettings configPanelSettings = settings.getSection(key); + if (configPanelSettings == null) configPanelSettings = settings.addNewSection(key); + configPanel.doSaveWidgetValues(configPanelSettings, idPrefix); + } + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IMessageProvider#getMessage() + */ + @Override + public final String getMessage() { + return message; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IMessageProvider#getMessageType() + */ + @Override + public final int getMessageType() { + return messageType; + } + + /** + * Set the message and the message type to display. + * + * @param message The message or null. + * @param messageType The message type or IMessageProvider.NONE. + */ + @Override + public final void setMessage(String message, int messageType) { + this.message = message; + this.messageType = messageType; + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/controls/NoteCompositeHelper.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/controls/NoteCompositeHelper.java new file mode 100644 index 00000000000..eb998da2797 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/controls/NoteCompositeHelper.java @@ -0,0 +1,173 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.controls; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.tcf.te.ui.terminals.nls.Messages; + +/** + * A helper class to create a composite with a highlighted note + * entry and a message text. + */ +public class NoteCompositeHelper { + + /** + * The common label text to show on a note. Defaults to "Note:". + */ + public static final String NOTE_LABEL = Messages.NoteCompositeHelper_note_label; + + private static class NoteComposite extends Composite { + + public NoteComposite(Composite parent, int style) { + super(parent, style); + } + + @Override + public void setEnabled(boolean enabled) { + super.setEnabled(enabled); + Control[] childs = getChildren(); + for (int iChild = 0; iChild < childs.length; iChild++) { + Control child = childs[iChild]; + child.setEnabled(enabled); + } + } + } + + /** + * Creates a composite with a highlighted Note entry and a message text. + * This is designed to take up the full width of the page. + * + * @see PreferencePage#createNoteComposite, this is a plain copy of that! + * @param font + * the font to use + * @param composite + * the parent composite + * @param title + * the title of the note + * @param message + * the message for the note + * + * @return the composite for the note + */ + public static Composite createNoteComposite(Font font, Composite composite, String title, String message) { + return createNoteComposite(font, composite, title, message, SWT.DEFAULT); + } + + /** + * Creates a composite with a highlighted Note entry and a message text. + * This is designed to take up the full width of the page. + * + * @see PreferencePage#createNoteComposite, this is a plain copy of that! + * @param font + * the font to use + * @param composite + * the parent composite + * @param title + * the title of the note + * @param message + * the message for the note + * @param minCharsPerLine + * the minimum number of characters per line. Defaults to '65' if less than '20'. + * + * @return the composite for the note + */ + public static Composite createNoteComposite(Font font, Composite composite, String title, String message, int minCharsPerLine) { + final GC gc = new GC(composite); + gc.setFont(font); + + Composite messageComposite = new NoteComposite(composite, SWT.NONE); + + GridLayout messageLayout = new GridLayout(); + messageLayout.numColumns = 2; + messageLayout.marginWidth = 0; + messageLayout.marginHeight = 0; + messageComposite.setLayout(messageLayout); + + GridData layoutData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); + if (composite.getLayout() instanceof GridLayout) { + layoutData.horizontalSpan = ((GridLayout) composite.getLayout()).numColumns; + } + messageComposite.setLayoutData(layoutData); + messageComposite.setFont(font); + + final Label noteLabel = new Label(messageComposite, SWT.BOLD); + noteLabel.setText(title); + noteLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); + noteLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + final IPropertyChangeListener fontListener = new IPropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent event) { + // Note: This is actually wrong but the same as in platforms + // PreferencePage + if (JFaceResources.BANNER_FONT.equals(event.getProperty())) { + noteLabel.setFont(JFaceResources.getFont(JFaceResources.BANNER_FONT)); + } + } + }; + JFaceResources.getFontRegistry().addListener(fontListener); + noteLabel.addDisposeListener(new DisposeListener() { + @Override + public void widgetDisposed(DisposeEvent event) { + JFaceResources.getFontRegistry().removeListener(fontListener); + } + }); + + Label messageLabel = new Label(messageComposite, SWT.WRAP); + messageLabel.setText(message); + messageLabel.setFont(font); + + /** + * Set the controls style to FILL_HORIZONTAL making it multi-line if + * needed + */ + layoutData = new GridData(GridData.FILL_HORIZONTAL); + layoutData.widthHint = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), minCharsPerLine >= 20 ? minCharsPerLine : 65); + messageLabel.setLayoutData(layoutData); + + gc.dispose(); + + return messageComposite; + } + + /** + * change the text of the second label + * + * @param messageComposite + * the NoteComposite that gets returned from createNoteComposite + * @param msg + * the new text + */ + public static void setMessage(Composite messageComposite, String msg) { + if (messageComposite instanceof NoteComposite) { + Control[] children = messageComposite.getChildren(); + if (children.length == 2) { + Control c = children[1]; + if (c instanceof Label) { + ((Label) c).setText(msg); + messageComposite.pack(); + } + } + } + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/help/IContextHelpIds.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/help/IContextHelpIds.java new file mode 100644 index 00000000000..650f8306566 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/help/IContextHelpIds.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2011, 2014 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.help; + +import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin; + + +/** + * UI Context help id definitions. + */ +public interface IContextHelpIds { + + /** + * UI plug-in common context help id prefix. + */ + public final static String PREFIX = UIPlugin.getUniqueIdentifier() + "."; //$NON-NLS-1$ + + /** + * Launch terminal settings dialog. + */ + public final static String LAUNCH_TERMINAL_SETTINGS_DIALOG = PREFIX + "LaunchTerminalSettingsDialog"; //$NON-NLS-1$ + + /** + * Terminal control encoding selection dialog. + */ + public final static String ENCODING_SELECTION_DIALOG = PREFIX + "EncodingSelectionDialog"; //$NON-NLS-1$ +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConfigurationPanel.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConfigurationPanel.java new file mode 100644 index 00000000000..a39ad7ade42 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConfigurationPanel.java @@ -0,0 +1,139 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.interfaces; + +import java.util.Map; + +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.dialogs.IMessageProvider; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.swt.widgets.Composite; + +/** + * Terminal launcher configuration panel. + */ +public interface IConfigurationPanel extends IMessageProvider { + + /** + * Returns the configuration panel container. + * + * @return The configuration panel container or null. + */ + public IConfigurationPanelContainer getContainer(); + + /** + * Creates the terminal launcher configuration panel UI elements within the + * given parent composite. Terminal launcher configuration panels should always + * create another composite within the given composite, which is the panel top + * control. The top control is queried later from the stack layout to show the + * different panels if the selected terminal launcher changed. + * + * @param parent The parent composite to create the UI elements in. Must not be null. + */ + public void setupPanel(Composite parent); + + /** + * Cleanup all resources the wizard configuration panel might have been created. + */ + public void dispose(); + + /** + * Returns the terminal launcher configuration panels top control, typically a + * composite control. This control is requested every time the stack layout is + * required to set a new top control because the selected terminal launcher changed. + * + * @return The top control or null if the configuration panel has been not setup yet. + */ + public Composite getControl(); + + /** + * Validates the control and sets the message text and type so the parent + * page or control is able to display validation result informations. + * The default implementation of this method does nothing. + * + * @return Result of validation. + */ + public boolean isValid(); + + /** + * Restore the widget values plain from the given dialog settings. This method should + * not fragment the given dialog settings any further. + * + * @param settings The dialog settings to restore the widget values from. Must not be null! + * @param idPrefix The prefix to use for every dialog settings slot keys. If null, the dialog settings slot keys are not to prefix. + */ + public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix); + + /** + * Save the widget values plain to the given dialog settings. This method should + * not fragment the given dialog settings any further. + * + * @param settings The dialog settings to save the widget values to. Must not be null! + * @param idPrefix The prefix to use for every dialog settings slot keys. If null, the dialog settings slot keys are not to prefix. + */ + public void doSaveWidgetValues(IDialogSettings settings, String idPrefix); + + /** + * Enables or disables all UI elements belonging to the wizard configuration panel. + * + * @param enabled True to enable the UI elements, false otherwise. + */ + public void setEnabled(boolean enabled); + + /** + * Called when the panel gets the active panel. + */ + public void activate(); + + /** + * Initialize the widgets based of the data from the given map. + *

+ * This method may called multiple times during the lifetime of the panel and the given + * map might be even null. + * + * @param data The map or null. + */ + public void setupData(Map data); + + /** + * Extract the data from the widgets and write it back to the given map. + *

+ * This method may called multiple times during the lifetime of the panel and the given + * map might be even null. + * + * @param data The map or null. + */ + public void extractData(Map data); + + /** + * Update the data from the given properties container which contains the current + * working data. + *

+ * This method may called multiple times during the lifetime of the panel and the given + * map might be even null. + * + * @param data The map or null. + */ + public void updateData(Map data); + + /** + * Set the selection to the terminal launcher configuration panel. + * + * @param selection The selection or null. + */ + public void setSelection(ISelection selection); + + /** + * Returns the selection associated with the terminal launcher configuration panel. + * + * @return The selection or null. + */ + public ISelection getSelection(); +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConfigurationPanelContainer.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConfigurationPanelContainer.java new file mode 100644 index 00000000000..03d3f41eec2 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IConfigurationPanelContainer.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.interfaces; + + + +/** + * A container to deal with configuration panels. + */ +public interface IConfigurationPanelContainer { + + /** + * Validates the container status. + *

+ * If necessary, set the corresponding messages and message types to signal when some sub + * elements of the container needs user attention. + */ + public void validate(); + + /** + * Set the message and the message type to display. + * + * @param message The message or null. + * @param messageType The message type or IMessageProvider.NONE. + */ + public void setMessage(String message, int messageType); + +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ILauncherDelegate.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ILauncherDelegate.java new file mode 100644 index 00000000000..bf3f717ef35 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ILauncherDelegate.java @@ -0,0 +1,93 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.interfaces; + +import java.util.Map; + +import org.eclipse.core.expressions.Expression; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IExecutableExtension; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService; +import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector; + +/** + * Terminal launcher delegate. + */ +@SuppressWarnings("restriction") +public interface ILauncherDelegate extends IExecutableExtension, IAdaptable { + + /** + * Returns the unique id of the launcher delegate. The returned + * id must be never null or an empty string. + * + * @return The unique id. + */ + public String getId(); + + /** + * Returns the label or UI name of the launcher delegate. + * + * @return The label or UI name. An empty string if not set. + */ + public String getLabel(); + + /** + * Returns if or if not the launcher delegate is hidden for the user. + * + * @return True if the launcher delegate is hidden, false otherwise. + */ + public boolean isHidden(); + + /** + * Returns the enablement expression. + * + * @return The enablement expression or null. + */ + public Expression getEnablement(); + + /** + * Returns if or if not the user needs to set configuration details for this launcher to work. + * The settings to configure are provided to the user through the configuration panel returned + * by {@link #getPanel(BaseDialogPageControl)}. + * + * @return True if a user configuration is required, false otherwise. + */ + public boolean needsUserConfiguration(); + + /** + * Returns the configuration panel instance to present to the user. The instance must be always + * the same on subsequent calls until disposed. + *

+ * The method may return null if the launcher does not provide any user + * configurable settings. In this case, {@link #needsUserConfiguration()} should return + * false. + * + * @param container The configuration panel container or null. + * @return The configuration panel instance or null + */ + public IConfigurationPanel getPanel(IConfigurationPanelContainer container); + + /** + * Execute the terminal launch. + * + * @param properties The properties. Must not be null. + * @param done The callback or null. + */ + public void execute(Map properties, ITerminalService.Done done); + + /** + * Creates the terminal connector for this launcher delegate based on + * the given properties. + * + * @param properties The terminal properties. Must not be null. + * @return The terminal connector or null. + */ + public ITerminalConnector createTerminalConnector(Map properties); +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IMementoHandler.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IMementoHandler.java new file mode 100644 index 00000000000..d6ae8e6d9d7 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IMementoHandler.java @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.interfaces; + +import java.util.Map; + +import org.eclipse.ui.IMemento; + +/** + * Terminal properties memento handler. + */ +public interface IMementoHandler { + + /** + * Saves the terminal properties in the given memento. + * + * @param memento The memento. Must not be null. + * @param properties The map containing the terminal properties to save. Must not be null. + */ + public void saveState(IMemento memento, Map properties); + + /** + * Restore the terminal properties from the given memento. + * + * @param memento The memento. Must not be null. + * @param properties The map receiving the restored terminal properties. Must not be null. + */ + public void restoreState(IMemento memento, Map properties); +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IPreferenceKeys.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IPreferenceKeys.java new file mode 100644 index 00000000000..905b568aa25 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IPreferenceKeys.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.interfaces; + +/** + * Terminals plug-in preference key definitions. + */ +public interface IPreferenceKeys { + /** + * Preference keys family prefix. + */ + public final String PREF_TERMINAL = "terminals"; //$NON-NLS-1$ + + /** + * Preference key: Remove terminated terminals when a new terminal is created. + */ + public final String PREF_REMOVE_TERMINATED_TERMINALS = PREF_TERMINAL + ".removeTerminatedTerminals"; //$NON-NLS-1$ +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ITerminalsView.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ITerminalsView.java new file mode 100644 index 00000000000..fcad401755e --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ITerminalsView.java @@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + * Max Weninger (Wind River) - [361363] [TERMINALS] Implement "Pin&Clone" for the "Terminals" view + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.interfaces; + +import org.eclipse.ui.IViewPart; + +/** + * Terminals view public interface. + */ +public interface ITerminalsView extends IViewPart { + + /** + * Switch to the empty page control. + */ + public void switchToEmptyPageControl(); + + /** + * Switch to the tab folder control. + */ + public void switchToTabFolderControl(); + + /** + * Returns the context help id associated with the terminal + * console view instance. + * + * @return The context help id or null if none is associated. + */ + public String getContextHelpId(); + + /** + * Set the state of the view to be pinned, which means a new terminal tab will be created + * in a new view instance. + * + * @param pin True to set the view state to pinned, false otherwise. + */ + public void setPinned(boolean pin); + + /** + * Return the pin state of the terminal view + * + * @return True if the view instance is pinned, false if not. + */ + public boolean isPinned(); +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IUIConstants.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IUIConstants.java new file mode 100644 index 00000000000..7c733a0e6bd --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/IUIConstants.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.interfaces; + +/** + * Terminals common UI constants. + */ +public interface IUIConstants { + /** + * The view id of the terminals view. + */ + public static final String ID = "org.eclipse.tcf.te.ui.terminals.TerminalsView"; //$NON-NLS-1$ + +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ImageConsts.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ImageConsts.java new file mode 100644 index 00000000000..ec47afc8642 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/ImageConsts.java @@ -0,0 +1,96 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + * Max Weninger (Wind River) - [361363] [TERMINALS] Implement "Pin&Clone" for the "Terminals" view + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.interfaces; + +/** + * Image registry constants. + */ +public interface ImageConsts { + /** + * The root directory where to load the images from, relative to + * the bundle directory. + */ + public final static String IMAGE_DIR_ROOT = "icons/"; //$NON-NLS-1$ + + /** + * The directory where to load colored local toolbar images from, + * relative to the image root directory. + */ + public final static String IMAGE_DIR_CLCL = "clcl16/"; //$NON-NLS-1$ + + /** + * The directory where to load disabled local toolbar images from, + * relative to the image root directory. + */ + public final static String IMAGE_DIR_DLCL = "dlcl16/"; //$NON-NLS-1$ + + /** + * The directory where to load enabled local toolbar images from, + * relative to the image root directory. + */ + public final static String IMAGE_DIR_ELCL = "elcl16/"; //$NON-NLS-1$ + + /** + * The directory where to load view related images from, relative to + * the image root directory. + */ + public final static String IMAGE_DIR_EVIEW = "eview16/"; //$NON-NLS-1$ + + /** + * The key to access the terminals console view image. + */ + public static final String VIEW_Terminals = "TerminalsView"; //$NON-NLS-1$ + + /** + * The key to access the scroll lock action image (enabled). + */ + public static final String ACTION_ScrollLock_Enabled = "ScrollLockAction_enabled"; //$NON-NLS-1$ + + /** + * The key to access the scroll lock action image (disabled). + */ + public static final String ACTION_ScrollLock_Disabled = "ScrollLockAction_disabled"; //$NON-NLS-1$ + + /** + * The key to access the scroll lock action image (hover). + */ + public static final String ACTION_ScrollLock_Hover = "ScrollLockAction_hover"; //$NON-NLS-1$ + + /** + * The key to access the pin terminal action image (enabled). + */ + public static final String ACTION_PinTerminal_Enabled = "PinTerminalAction_enabled"; //$NON-NLS-1$ + + /** + * The key to access the pin terminal action image (disabled). + */ + public static final String ACTION_PinTerminal_Disabled = "PinTerminalAction_disabled"; //$NON-NLS-1$ + + /** + * The key to access the pin terminal action image (hover). + */ + public static final String ACTION_PinTerminal_Hover = "PinTerminalAction_hover"; //$NON-NLS-1$ + + /** + * The key to access the toggle command field action image (enabled). + */ + public static final String ACTION_ToggleCommandField_Enabled = "ToggleCommandField_enabled"; //$NON-NLS-1$ + + /** + * The key to access the toggle command field action image (disabled). + */ + public static final String ACTION_ToggleCommandField_Disabled = "ToggleCommandField_disabled"; //$NON-NLS-1$ + + /** + * The key to access the toggle command field action image (hover). + */ + public static final String ACTION_ToggleCommandField_Hover = "ToggleCommandField_hover"; //$NON-NLS-1$ +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/tracing/ITraceIds.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/tracing/ITraceIds.java new file mode 100644 index 00000000000..1ed32c06c75 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/interfaces/tracing/ITraceIds.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.interfaces.tracing; + +/** + * Core plug-in trace slot identifiers. + */ +public interface ITraceIds { + + /** + * If activated, tracing information about the terminals output stream monitor is printed out. + */ + public static final String TRACE_OUTPUT_STREAM_MONITOR = "trace/outputStreamMonitor"; //$NON-NLS-1$ + + /** + * If activated, tracing information about the launch terminal command handler is printed out. + */ + public static final String TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER = "trace/launchTerminalCommandHandler"; //$NON-NLS-1$ +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/PreferencesInitializer.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/PreferencesInitializer.java new file mode 100644 index 00000000000..b6b6a6fa434 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/PreferencesInitializer.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.internal; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.tcf.te.core.terminals.preferences.ScopedEclipsePreferences; +import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin; +import org.eclipse.tcf.te.ui.terminals.interfaces.IPreferenceKeys; + +/** + * Terminals default preferences initializer. + */ +public class PreferencesInitializer extends AbstractPreferenceInitializer { + + /** + * Constructor. + */ + public PreferencesInitializer() { + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() + */ + @Override + public void initializeDefaultPreferences() { + ScopedEclipsePreferences prefs = UIPlugin.getScopedPreferences(); + + prefs.putDefaultBoolean(IPreferenceKeys.PREF_REMOVE_TERMINATED_TERMINALS, true); + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/PropertyTester.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/PropertyTester.java new file mode 100644 index 00000000000..1a98d00b8b6 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/PropertyTester.java @@ -0,0 +1,57 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.internal; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView; +import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager; +import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderManager; +import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; +import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; + + +/** + * Terminals property tester implementation. + */ +@SuppressWarnings("restriction") +public class PropertyTester extends org.eclipse.core.expressions.PropertyTester { + + /* (non-Javadoc) + * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object) + */ + @Override + public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { + if ("hasApplicableLauncherDelegates".equals(property)) { //$NON-NLS-1$ + ISelection selection = receiver instanceof ISelection ? (ISelection)receiver : new StructuredSelection(receiver); + return expectedValue.equals(Boolean.valueOf(LauncherDelegateManager.getInstance().getApplicableLauncherDelegates(selection).length > 0)); + } + + if ("canDisconnect".equals(property) && receiver instanceof ITerminalsView) { //$NON-NLS-1$ + CTabItem tabItem = null; + + TabFolderManager manager = (TabFolderManager) ((ITerminalsView)receiver).getAdapter(TabFolderManager.class); + if (manager != null) { + tabItem = manager.getActiveTabItem(); + } + + if (tabItem != null && !tabItem.isDisposed() && tabItem.getData() instanceof ITerminalViewControl) { + ITerminalViewControl terminal = (ITerminalViewControl)tabItem.getData(); + TerminalState state = terminal.getState(); + return expectedValue.equals(Boolean.valueOf(state != TerminalState.CLOSED)); + } + return false; + } + + return false; + } + +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/SettingsStore.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/SettingsStore.java new file mode 100644 index 00000000000..31635db6d95 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/SettingsStore.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.internal; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore; + +/** + * Simple default Terminal settings store implementation keeping the settings + * within memory. + */ +@SuppressWarnings("restriction") +public class SettingsStore implements ISettingsStore { + private final Map settings = new HashMap(); + + /** + * Constructor. + */ + public SettingsStore() { + } + + /** + * Returns the map containing the settings. + * + * @return The map containing the settings. + */ + public final Map getSettings() { + return settings; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.provisional.api.ISettingsStore#get(java.lang.String, java.lang.String) + */ + @Override + public final String get(String key, String defaultValue) { + Assert.isNotNull(key); + String value = settings.get(key) instanceof String ? (String) settings.get(key) : null; + return value != null ? value : defaultValue; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.provisional.api.ISettingsStore#get(java.lang.String) + */ + @Override + public final String get(String key) { + Assert.isNotNull(key); + return settings.get(key) instanceof String ? (String) settings.get(key) : null; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.provisional.api.ISettingsStore#put(java.lang.String, java.lang.String) + */ + @Override + public final void put(String key, String value) { + Assert.isNotNull(key); + if (value == null) settings.remove(key); + else settings.put(key, value); + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/EncodingSelectionDialog.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/EncodingSelectionDialog.java new file mode 100644 index 00000000000..dc49648bd26 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/EncodingSelectionDialog.java @@ -0,0 +1,230 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.internal.dialogs; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.dialogs.TrayDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.tcf.te.ui.terminals.help.IContextHelpIds; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer; +import org.eclipse.tcf.te.ui.terminals.nls.Messages; +import org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel; +import org.eclipse.ui.PlatformUI; + +/** + * Encoding selection dialog implementation. + */ +public class EncodingSelectionDialog extends TrayDialog { + private String contextHelpId = null; + + // The selected encoding or null + /* default */ String encoding = null; + + // Reference to the encodings panel + private EncodingPanel encodingPanel = null; + + /** + * Encodings panel implementation + */ + protected class EncodingPanel extends AbstractExtendedConfigurationPanel { + + /** + * Constructor + * + * @param container The configuration panel container or null. + */ + public EncodingPanel(IConfigurationPanelContainer container) { + super(container); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#setupPanel(org.eclipse.swt.widgets.Composite) + */ + @Override + public void setupPanel(Composite parent) { + Composite panel = new Composite(parent, SWT.NONE); + panel.setLayout(new GridLayout()); + GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); + panel.setLayoutData(data); + + // Create the encoding selection combo + createEncodingUI(panel, false); + if (EncodingSelectionDialog.this.encoding != null) { + setEncoding(EncodingSelectionDialog.this.encoding); + } + + setControl(panel); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#saveSettingsForHost(boolean) + */ + @Override + protected void saveSettingsForHost(boolean add) { + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#fillSettingsForHost(java.lang.String) + */ + @Override + protected void fillSettingsForHost(String host) { + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#getHostFromSettings() + */ + @Override + protected String getHostFromSettings() { + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#getEncoding() + */ + @Override + public String getEncoding() { + return super.getEncoding(); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#setEncoding(java.lang.String) + */ + @Override + public void setEncoding(String encoding) { + super.setEncoding(encoding); + } + } + + /** + * Constructor. + * + * @param shell The parent shell or null. + */ + public EncodingSelectionDialog(Shell shell) { + super(shell); + + this.contextHelpId = IContextHelpIds.ENCODING_SELECTION_DIALOG; + setHelpAvailable(true); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) + */ + @Override + protected final Control createDialogArea(Composite parent) { + if (contextHelpId != null) { + PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, contextHelpId); + } + + // Let the super implementation create the dialog area control + Control control = super.createDialogArea(parent); + // Setup the inner panel as scrollable composite + if (control instanceof Composite) { + ScrolledComposite sc = new ScrolledComposite((Composite)control, SWT.V_SCROLL); + + GridLayout layout = new GridLayout(1, true); + layout.marginHeight = 0; layout.marginWidth = 0; + layout.verticalSpacing = 0; layout.horizontalSpacing = 0; + + sc.setLayout(layout); + sc.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL)); + + sc.setExpandHorizontal(true); + sc.setExpandVertical(true); + + Composite composite = new Composite(sc, SWT.NONE); + composite.setLayout(new GridLayout()); + + // Setup the dialog area content + createDialogAreaContent(composite); + + sc.setContent(composite); + sc.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + + // Return the scrolled composite as new dialog area control + control = sc; + } + + return control; + } + + /** + * Creates the dialog area content. + * + * @param parent The parent composite. Must not be null. + */ + protected void createDialogAreaContent(Composite parent) { + Assert.isNotNull(parent); + + setDialogTitle(Messages.EncodingSelectionDialog_title); + + Composite panel = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(2, false); + layout.marginHeight = 0; layout.marginWidth = 0; + panel.setLayout(layout); + panel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true)); + + encodingPanel = new EncodingPanel(null); + encodingPanel.setupPanel(panel); + + applyDialogFont(panel); + } + + /** + * Sets the title for this dialog. + * + * @param title The title. + */ + public void setDialogTitle(String title) { + if (getShell() != null && !getShell().isDisposed()) { + getShell().setText(title); + } + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTrayDialog#okPressed() + */ + @Override + protected void okPressed() { + // Save the selected encoding + if (encodingPanel != null) encoding = encodingPanel.getEncoding(); + super.okPressed(); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#cancelPressed() + */ + @Override + protected void cancelPressed() { + // Reset the encoding + encoding = null; + super.cancelPressed(); + } + + /** + * Set the encoding to default to on creating the dialog. + */ + public final void setEncoding(String encoding) { + this.encoding = encoding; + } + + /** + * Returns the selected encoding or null. + */ + public final String getEncoding() { + return encoding; + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java new file mode 100644 index 00000000000..cc9ae1b8fb2 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/dialogs/LaunchTerminalSettingsDialog.java @@ -0,0 +1,565 @@ +/******************************************************************************* + * Copyright (c) 2011 - 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + * Max Weninger (Wind River) - [361352] [TERMINALS][SSH] Add SSH terminal support + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.internal.dialogs; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.dialogs.TrayDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ScrolledComposite; +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.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.MessageBox; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin; +import org.eclipse.tcf.te.ui.terminals.controls.ConfigurationPanelControl; +import org.eclipse.tcf.te.ui.terminals.help.IContextHelpIds; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel; +import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate; +import org.eclipse.tcf.te.ui.terminals.interfaces.tracing.ITraceIds; +import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager; +import org.eclipse.tcf.te.ui.terminals.nls.Messages; +import org.eclipse.ui.PlatformUI; + +/** + * Launch terminal settings dialog implementation. + */ +public class LaunchTerminalSettingsDialog extends TrayDialog { + private String contextHelpId = null; + + // The parent selection + private ISelection selection = null; + + // The sub controls + /* default */ Combo terminals; + /* default */ SettingsPanelControl settings; + + // Map the label added to the combo box to the corresponding launcher delegate. + /* default */ final Map label2delegate = new HashMap(); + + // The data object containing the currently selected settings + private Map data = null; + + // The dialog settings storage + private IDialogSettings dialogSettings; + + /** + * The control managing the terminal setting panels. + */ + protected class SettingsPanelControl extends ConfigurationPanelControl { + + /** + * Constructor. + */ + public SettingsPanelControl() { + setPanelIsGroup(true); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.controls.BaseWizardConfigurationPanelControl#getGroupLabel() + */ + @Override + public String getGroupLabel() { + return Messages.LaunchTerminalSettingsDialog_group_label; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.controls.BaseWizardConfigurationPanelControl#showConfigurationPanel(java.lang.String) + */ + @Override + public void showConfigurationPanel(String key) { + // Check if we have to create the panel first + IConfigurationPanel configPanel = getConfigurationPanel(key); + if (isEmptyConfigurationPanel(configPanel)) { + // Get the corresponding delegate + ILauncherDelegate delegate = label2delegate.get(key); + Assert.isNotNull(delegate); + // Create the wizard configuration panel instance + configPanel = delegate.getPanel(this); + if (configPanel != null) { + // Add it to the settings panel control + settings.addConfigurationPanel(key, configPanel); + // Push the selection to the configuration panel + configPanel.setSelection(getSelection()); + // Create the panel controls + configPanel.setupPanel(getPanel()); + // Restore widget values + IDialogSettings dialogSettings = LaunchTerminalSettingsDialog.this.settings.getDialogSettings(LaunchTerminalSettingsDialog.this.getDialogSettings()); + IDialogSettings configPanelSettings = dialogSettings != null ? dialogSettings.getSection(key) : null; + if (configPanelSettings != null) configPanel.doRestoreWidgetValues(configPanelSettings, null); + } + } + + super.showConfigurationPanel(key); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer#validate() + */ + @Override + public void validate() { + LaunchTerminalSettingsDialog.this.validate(); + } + } + + /** + * Constructor. + * + * @param shell The parent shell or null. + */ + public LaunchTerminalSettingsDialog(Shell shell) { + this(shell, 0); + } + + private long start = 0; + + /** + * Constructor. + * + * @param shell The parent shell or null. + */ + public LaunchTerminalSettingsDialog(Shell shell, long start) { + super(shell); + this.start = start; + + initializeDialogSettings(); + + this.contextHelpId = IContextHelpIds.LAUNCH_TERMINAL_SETTINGS_DIALOG; + setHelpAvailable(true); + } + + /** + * Sets the parent selection. + * + * @param selection The parent selection or null. + */ + public void setSelection(ISelection selection) { + this.selection = selection; + } + + /** + * Returns the parent selection. + * + * @return The parent selection or null. + */ + public ISelection getSelection() { + return selection; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#close() + */ + @Override + public boolean close() { + dispose(); + return super.close(); + } + + /** + * Dispose the dialog resources. + */ + protected void dispose() { + if (settings != null) { settings.dispose(); settings = null; } + dialogSettings = null; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#isResizable() + */ + @Override + protected boolean isResizable() { + return true; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#createContents(org.eclipse.swt.widgets.Composite) + */ + @Override + protected Control createContents(Composite parent) { + Control composite = super.createContents(parent); + + // Validate the dialog after having created all the content + validate(); + + return composite; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) + */ + @Override + protected final Control createDialogArea(Composite parent) { + if (contextHelpId != null) { + PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, contextHelpId); + } + + // Let the super implementation create the dialog area control + Control control = super.createDialogArea(parent); + // Setup the inner panel as scrollable composite + if (control instanceof Composite) { + ScrolledComposite sc = new ScrolledComposite((Composite)control, SWT.V_SCROLL); + + GridLayout layout = new GridLayout(1, true); + layout.marginHeight = 0; layout.marginWidth = 0; + layout.verticalSpacing = 0; layout.horizontalSpacing = 0; + + sc.setLayout(layout); + sc.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL)); + + sc.setExpandHorizontal(true); + sc.setExpandVertical(true); + + Composite composite = new Composite(sc, SWT.NONE); + composite.setLayout(new GridLayout()); + + // Setup the dialog area content + createDialogAreaContent(composite); + + sc.setContent(composite); + sc.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + + // Return the scrolled composite as new dialog area control + control = sc; + } + + return control; + } + + /** + * Sets the title for this dialog. + * + * @param title The title. + */ + public void setDialogTitle(String title) { + if (getShell() != null && !getShell().isDisposed()) { + getShell().setText(title); + } + } + + /** + * Creates the dialog area content. + * + * @param parent The parent composite. Must not be null. + */ + protected void createDialogAreaContent(Composite parent) { + Assert.isNotNull(parent); + + if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) { + UIPlugin.getTraceHandler().trace("Creating dialog area after " + (System.currentTimeMillis() - start) + " ms.", //$NON-NLS-1$ //$NON-NLS-2$ + ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalSettingsDialog.this); + } + + setDialogTitle(Messages.LaunchTerminalSettingsDialog_title); + + Composite panel = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(2, false); + layout.marginHeight = 0; layout.marginWidth = 0; + panel.setLayout(layout); + panel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true)); + + Label label = new Label(panel, SWT.HORIZONTAL); + label.setText(Messages.LaunchTerminalSettingsDialog_combo_label); + + terminals = new Combo(panel, SWT.READ_ONLY); + terminals.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + terminals.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + // Get the old panel + IConfigurationPanel oldPanel = settings.getActiveConfigurationPanel(); + // Extract the current settings in an special properties container + Map data = new HashMap(); + if (oldPanel != null) oldPanel.extractData(data); + // Clean out settings which are never passed between the panels + data.remove(ITerminalsConnectorConstants.PROP_IP_PORT); + data.remove(ITerminalsConnectorConstants.PROP_TIMEOUT); + data.remove(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID); + data.remove(ITerminalsConnectorConstants.PROP_ENCODING); + // Switch to the new panel + settings.showConfigurationPanel(terminals.getText()); + // Get the new panel + IConfigurationPanel newPanel = settings.getActiveConfigurationPanel(); + // Re-setup the relevant data + if (newPanel != null) newPanel.setupData(data); + + // resize the dialog if needed to show the complete panel + getShell().pack(); + // validate the settings dialog + validate(); + } + }); + + // fill the combo with content + fillCombo(terminals); + + // Create the settings panel control + settings = new SettingsPanelControl(); + + // Create, initialize and add the first visible panel. All + // other panels are created on demand only. + String terminalLabel = terminals.getItem(0); + if (terminalLabel != null) { + // Get the corresponding delegate + ILauncherDelegate delegate = label2delegate.get(terminalLabel); + Assert.isNotNull(delegate); + // Create the wizard configuration panel instance + IConfigurationPanel configPanel = delegate.getPanel(settings); + if (configPanel != null) { + // Add it to the settings panel control + settings.addConfigurationPanel(terminalLabel, configPanel); + // Push the selection to the configuration panel + configPanel.setSelection(getSelection()); + } + } + + // Setup the panel control + settings.setupPanel(panel, terminals.getItems()); + GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true); + layoutData.horizontalSpan = 2; + settings.getPanel().setLayoutData(layoutData); + + // Preselect the first terminal launcher + terminals.select(0); + settings.showConfigurationPanel(terminals.getText()); + + terminals.setEnabled(terminals.getItemCount() > 1); + + restoreWidgetValues(); + + applyDialogFont(panel); + + if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) { + UIPlugin.getTraceHandler().trace("Created dialog area after " + (System.currentTimeMillis() - start) + " ms.", //$NON-NLS-1$ //$NON-NLS-2$ + ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalSettingsDialog.this); + } + } + + /** + * Fill the given combo with content. The content are the terminal + * launcher delegate labels. + * + * @param combo The combo. Must not be null. + */ + protected void fillCombo(Combo combo) { + Assert.isNotNull(combo); + + if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) { + UIPlugin.getTraceHandler().trace("Filling combo after " + (System.currentTimeMillis() - start) + " ms.", //$NON-NLS-1$ //$NON-NLS-2$ + ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalSettingsDialog.this); + } + + List items = new ArrayList(); + + if(selection==null || selection.isEmpty()){ + if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) { + UIPlugin.getTraceHandler().trace("Getting launcher delegates after " + (System.currentTimeMillis() - start) + " ms.", //$NON-NLS-1$ //$NON-NLS-2$ + ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalSettingsDialog.this); + } + + ILauncherDelegate[] delegates = LauncherDelegateManager.getInstance().getLauncherDelegates(false); + + if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) { + UIPlugin.getTraceHandler().trace("Got launcher delegates after " + (System.currentTimeMillis() - start) + " ms.", //$NON-NLS-1$ //$NON-NLS-2$ + ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalSettingsDialog.this); + } + + for (ILauncherDelegate delegate : delegates) { + if (delegate.isHidden() || isFiltered(selection, delegate)) continue; + String label = delegate.getLabel(); + if (label == null || "".equals(label.trim())) label = delegate.getId(); //$NON-NLS-1$ + label2delegate.put(label, delegate); + items.add(label); + } + } else { + if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) { + UIPlugin.getTraceHandler().trace("Getting applicable launcher delegates after " + (System.currentTimeMillis() - start) + " ms.", //$NON-NLS-1$ //$NON-NLS-2$ + ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalSettingsDialog.this); + } + + ILauncherDelegate[] delegates = LauncherDelegateManager.getInstance().getApplicableLauncherDelegates(selection); + + if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) { + UIPlugin.getTraceHandler().trace("Got applicable launcher delegates after " + (System.currentTimeMillis() - start) + " ms.", //$NON-NLS-1$ //$NON-NLS-2$ + ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalSettingsDialog.this); + } + + for (ILauncherDelegate delegate : delegates) { + if (delegate.isHidden() || isFiltered(selection, delegate)) continue; + String label = delegate.getLabel(); + if (label == null || "".equals(label.trim())) label = delegate.getId(); //$NON-NLS-1$ + label2delegate.put(label, delegate); + items.add(label); + } + } + Collections.sort(items); + combo.setItems(items.toArray(new String[items.size()])); + } + + /** + * Hook to allow additional filtering of the applicable launcher delegates. + *

+ * Note: The default implementation always returns false. + * + * @param selection The selection or null. + * @param delegate The launcher delegate. Must not be null. + * + * @return True if the launcher delegate is filtered based on the given selection, false otherwise. + */ + protected boolean isFiltered(ISelection selection, ILauncherDelegate delegate) { + return false; + } + + /** + * Validate the dialog. + */ + public void validate() { + IConfigurationPanel panel = this.settings.getActiveConfigurationPanel(); + Button okButton = getButton(IDialogConstants.OK_ID); + if (okButton != null) okButton.setEnabled(panel.isValid()); + } + + /** + * Set the given message and message type. + * + * @param message The message or null. + * @param messageType The message type or IMessageProvider.NONE. + */ + public void setMessage(String message, int messageType) { + if (settings != null) { + settings.setMessage(message, messageType); + } + } + + /** + * Save the dialog's widget values. + */ + protected void saveWidgetValues() { + IDialogSettings settings = getDialogSettings(); + if (settings != null && terminals != null) { + settings.put("terminalLabel", terminals.getText()); //$NON-NLS-1$ + this.settings.saveWidgetValues(settings, null); + } + } + + /** + * Restore the dialog's widget values. + */ + protected void restoreWidgetValues() { + IDialogSettings settings = getDialogSettings(); + if (settings != null) { + String terminalLabel = settings.get("terminalLabel"); //$NON-NLS-1$ + int index = terminalLabel != null ? Arrays.asList(terminals.getItems()).indexOf(terminalLabel) : -1; + if (index != -1) { + terminals.select(index); + this.settings.showConfigurationPanel(terminals.getText()); + } + + this.settings.restoreWidgetValues(settings, null); + } + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#okPressed() + */ + @Override + protected void okPressed() { + IConfigurationPanel panel = this.settings.getActiveConfigurationPanel(); + Assert.isNotNull(panel); + + if (!panel.isValid()) { + MessageBox mb = new MessageBox(getShell(), SWT.ICON_ERROR | SWT.OK); + mb.setText(Messages.LaunchTerminalSettingsDialog_error_title); + mb.setMessage(NLS.bind(Messages.LaunchTerminalSettingsDialog_error_invalidSettings, panel.getMessage() != null ? panel.getMessage() : Messages.LaunchTerminalSettingsDialog_error_unknownReason)); + mb.open(); + return; + } + data = new HashMap(); + + // Store the id of the selected delegate + data.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, label2delegate.get(terminals.getText()).getId()); + // Store the selection + data.put(ITerminalsConnectorConstants.PROP_SELECTION, selection); + + // Store the delegate specific settings + panel.extractData(data); + + // Save the current widget values + saveWidgetValues(); + + super.okPressed(); + } + + /** + * Returns the configured terminal launcher settings. + *

+ * The settings are extracted from the UI widgets once + * OK got pressed. + * + * @return The configured terminal launcher settings or null. + */ + public Map getSettings() { + return data; + } + + /** + * Initialize the dialog settings storage. + */ + protected void initializeDialogSettings() { + IDialogSettings settings = UIPlugin.getDefault().getDialogSettings(); + Assert.isNotNull(settings); + IDialogSettings section = settings.getSection(getClass().getSimpleName()); + if (section == null) { + section = settings.addNewSection(getClass().getSimpleName()); + } + setDialogSettings(section); + } + + /** + * Returns the associated dialog settings storage. + * + * @return The dialog settings storage. + */ + public IDialogSettings getDialogSettings() { + // The dialog settings may not been initialized here. Initialize first in this case + // to be sure that we do have always the correct dialog settings. + if (dialogSettings == null) { + initializeDialogSettings(); + } + return dialogSettings; + } + + /** + * Sets the associated dialog settings storage. + * + * @return The dialog settings storage. + */ + public void setDialogSettings(IDialogSettings dialogSettings) { + this.dialogSettings = dialogSettings; + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/AbstractTriggerCommandHandler.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/AbstractTriggerCommandHandler.java new file mode 100644 index 00000000000..da9dde56e48 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/AbstractTriggerCommandHandler.java @@ -0,0 +1,67 @@ +/******************************************************************************* + * Copyright (c) 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.internal.handler; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.Command; +import org.eclipse.core.commands.ParameterizedCommand; +import org.eclipse.core.expressions.EvaluationContext; +import org.eclipse.core.expressions.IEvaluationContext; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin; +import org.eclipse.tcf.te.ui.terminals.nls.Messages; +import org.eclipse.ui.ISources; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.commands.ICommandService; +import org.eclipse.ui.handlers.IHandlerService; + +/** + * Abstract command handler triggering a command to be executed. + */ +public abstract class AbstractTriggerCommandHandler extends AbstractHandler { + + /** + * Trigger a command to be executed. + * + * @param commandId The command id. Must not be null. + * @param selection The selection to pass on to the command or null. + */ + protected void triggerCommand(String commandId, ISelection selection) { + Assert.isNotNull(commandId); + + ICommandService service = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class); + Command command = service != null ? service.getCommand(commandId) : null; + if (command != null && command.isDefined() && command.isEnabled()) { + try { + ParameterizedCommand pCmd = ParameterizedCommand.generateCommand(command, null); + Assert.isNotNull(pCmd); + IHandlerService handlerSvc = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class); + Assert.isNotNull(handlerSvc); + IEvaluationContext ctx = handlerSvc.getCurrentState(); + if (selection != null) { + ctx = new EvaluationContext(ctx, selection); + ctx.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, selection); + } + handlerSvc.executeCommandInContext(pCmd, null, ctx); + } catch (Exception e) { + // If the platform is in debug mode, we print the exception to the log view + if (Platform.inDebugMode()) { + IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), + Messages.AbstractTriggerCommandHandler_error_executionFailed, e); + UIPlugin.getDefault().getLog().log(status); + } + } + } + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/DisconnectTerminalCommandHandler.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/DisconnectTerminalCommandHandler.java new file mode 100644 index 00000000000..7858bf9a7bf --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/DisconnectTerminalCommandHandler.java @@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.internal.handler; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView; +import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderManager; +import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * Disconnect terminal connection command handler implementation. + */ +@SuppressWarnings("restriction") +public class DisconnectTerminalCommandHandler extends AbstractHandler { + + /* (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + CTabItem item = null; + + ISelection selection = HandlerUtil.getCurrentSelection(event); + if (selection instanceof IStructuredSelection && !selection.isEmpty()) { + Object element = ((IStructuredSelection)selection).getFirstElement(); + if (element instanceof CTabItem && ((CTabItem)element).getData() instanceof ITerminalViewControl) { + item = (CTabItem)element; + } + } + + if (item == null && HandlerUtil.getActivePart(event) instanceof ITerminalsView) { + ITerminalsView view = (ITerminalsView)HandlerUtil.getActivePart(event); + TabFolderManager mgr = (TabFolderManager)view.getAdapter(TabFolderManager.class); + if (mgr != null && mgr.getActiveTabItem() != null) { + item = mgr.getActiveTabItem(); + } + } + + if (item != null && item.getData() instanceof ITerminalViewControl) { + ITerminalViewControl terminal = (ITerminalViewControl)item.getData(); + if (terminal != null && !terminal.isDisposed()) { + terminal.disconnectTerminal(); + } + } + + return null; + } + +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/LaunchTerminalCommandHandler.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/LaunchTerminalCommandHandler.java new file mode 100644 index 00000000000..e87f96ce0d8 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/LaunchTerminalCommandHandler.java @@ -0,0 +1,157 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.internal.handler; + +import java.text.DateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.tcf.te.core.terminals.TerminalContextPropertiesProviderFactory; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalContextPropertiesProvider; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.IContextPropertiesConstants; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin; +import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate; +import org.eclipse.tcf.te.ui.terminals.interfaces.tracing.ITraceIds; +import org.eclipse.tcf.te.ui.terminals.internal.dialogs.LaunchTerminalSettingsDialog; +import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * Launch terminal command handler implementation. + */ +public class LaunchTerminalCommandHandler extends AbstractHandler { + + /* + * (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + String commandId = event.getCommand().getId(); + // "org.eclipse.tcf.te.ui.terminals.command.launchToolbar" + // "org.eclipse.tcf.te.ui.terminals.command.launch" + + long start = System.currentTimeMillis(); + + if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) { + DateFormat format = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); + String date = format.format(new Date(start)); + + UIPlugin.getTraceHandler().trace("Started at " + date + " (" + start + ")", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalCommandHandler.this); + } + + // Get the active shell + Shell shell = HandlerUtil.getActiveShell(event); + // Get the current selection + ISelection selection = HandlerUtil.getCurrentSelection(event); + + if (commandId.equals("org.eclipse.tcf.te.ui.terminals.command.launchToolbar")) { //$NON-NLS-1$ + if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) { + UIPlugin.getTraceHandler().trace("(a) Attempt to open launch terminal settings dialog after " + (System.currentTimeMillis() - start) + " ms.", //$NON-NLS-1$ //$NON-NLS-2$ + ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalCommandHandler.this); + } + + LaunchTerminalSettingsDialog dialog = new LaunchTerminalSettingsDialog(shell, start); + + if(isValidSelection(selection)){ + dialog.setSelection(selection); + } + if (dialog.open() == Window.OK) { + // Get the terminal settings from the dialog + Map properties = dialog.getSettings(); + if (properties != null) { + String delegateId = (String)properties.get(ITerminalsConnectorConstants.PROP_DELEGATE_ID); + Assert.isNotNull(delegateId); + ILauncherDelegate delegate = LauncherDelegateManager.getInstance().getLauncherDelegate(delegateId, false); + Assert.isNotNull(delegateId); + delegate.execute(properties, null); + } + } + } + else { + if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) { + UIPlugin.getTraceHandler().trace("Getting applicable launcher delegates after " + (System.currentTimeMillis() - start) + " ms.", //$NON-NLS-1$ //$NON-NLS-2$ + ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalCommandHandler.this); + } + + // Check if the dialog needs to be shown at all + ILauncherDelegate[] delegates = LauncherDelegateManager.getInstance().getApplicableLauncherDelegates(selection); + + if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) { + UIPlugin.getTraceHandler().trace("Got applicable launcher delegates after " + (System.currentTimeMillis() - start) + " ms.", //$NON-NLS-1$ //$NON-NLS-2$ + ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalCommandHandler.this); + } + + if (delegates.length > 1 || (delegates.length == 1 && delegates[0].needsUserConfiguration())) { + if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER)) { + UIPlugin.getTraceHandler().trace("(b) Attempt to open launch terminal settings dialog after " + (System.currentTimeMillis() - start) + " ms.", //$NON-NLS-1$ //$NON-NLS-2$ + ITraceIds.TRACE_LAUNCH_TERMINAL_COMMAND_HANDLER, LaunchTerminalCommandHandler.this); + } + + // Create the launch terminal settings dialog + LaunchTerminalSettingsDialog dialog = new LaunchTerminalSettingsDialog(shell, start); + if(isValidSelection(selection)){ + dialog.setSelection(selection); + } + if (dialog.open() == Window.OK) { + // Get the terminal settings from the dialog + Map properties = dialog.getSettings(); + if (properties != null) { + String delegateId = (String)properties.get(ITerminalsConnectorConstants.PROP_DELEGATE_ID); + Assert.isNotNull(delegateId); + ILauncherDelegate delegate = LauncherDelegateManager.getInstance().getLauncherDelegate(delegateId, false); + Assert.isNotNull(delegateId); + delegate.execute(properties, null); + } + } + } + else if (delegates.length == 1) { + ILauncherDelegate delegate = delegates[0]; + Map properties = new HashMap(); + + // Store the id of the selected delegate + properties.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegate.getId()); + // Store the selection + properties.put(ITerminalsConnectorConstants.PROP_SELECTION, selection); + + // Execute + delegate.execute(properties, null); + } + } + + return null; + } + + private boolean isValidSelection(ISelection selection) { + if (selection instanceof IStructuredSelection && !selection.isEmpty()) { + Object element = ((IStructuredSelection) selection).getFirstElement(); + ITerminalContextPropertiesProvider provider = TerminalContextPropertiesProviderFactory.getProvider(element); + if (provider != null) { + Map props = provider.getTargetAddress(element); + if (props != null && props.containsKey(IContextPropertiesConstants.PROP_ADDRESS)) { + return true; + } + } + } + + return false; + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/MaximizeViewHandler.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/MaximizeViewHandler.java new file mode 100644 index 00000000000..a95424d3728 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/MaximizeViewHandler.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2014, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.internal.handler; + +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +/** + * Maximize view handler implementation. + */ +public class MaximizeViewHandler extends AbstractTriggerCommandHandler { + + /* (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + triggerCommand("org.eclipse.ui.window.maximizePart", null); //$NON-NLS-1$ + return null; + } + +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/QuickAccessHandler.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/QuickAccessHandler.java new file mode 100644 index 00000000000..24401827b8c --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/internal/handler/QuickAccessHandler.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2014, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.internal.handler; + +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +/** + * Quick access handler implementation. + */ +public class QuickAccessHandler extends AbstractTriggerCommandHandler { + + /* (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + triggerCommand("org.eclipse.ui.window.quickAccess", null); //$NON-NLS-1$ + return null; + } + +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/AbstractLauncherDelegate.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/AbstractLauncherDelegate.java new file mode 100644 index 00000000000..1b868c4385d --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/AbstractLauncherDelegate.java @@ -0,0 +1,143 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.launcher; + +import org.eclipse.core.expressions.Expression; +import org.eclipse.core.expressions.ExpressionConverter; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.PlatformObject; +import org.eclipse.core.runtime.Status; +import org.eclipse.osgi.util.NLS; +import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin; +import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate; +import org.eclipse.tcf.te.ui.terminals.nls.Messages; + +/** + * Abstract launcher delegate implementation. + */ +public abstract class AbstractLauncherDelegate extends PlatformObject implements ILauncherDelegate { + // The mandatory id of the extension + private String id = null; + // The label of the extension + private String label = null; + // The converted expression + private Expression expression; + // The hidden attribute + private boolean hidden; + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object) + */ + @Override + public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { + if (config == null) return; + + // Initialize the id field by reading the extension attribute. + // Throws an exception if the id is empty or null. + id = config.getAttribute("id"); //$NON-NLS-1$ + if (id == null || "".equals(id.trim())) { //$NON-NLS-1$ + throw createMissingMandatoryAttributeException("id", config.getContributor().getName()); //$NON-NLS-1$ + } + + // Try the "label" attribute first + label = config.getAttribute("label"); //$NON-NLS-1$ + // If "label" is not found or empty, try the "name" attribute as fallback + if (label == null || "".equals(label.trim())) { //$NON-NLS-1$ + label = config.getAttribute("name"); //$NON-NLS-1$ + } + + // Read the sub elements of the extension + IConfigurationElement[] children = config.getChildren(); + // The "enablement" element is the only expected one + if (children != null && children.length > 0) { + expression = ExpressionConverter.getDefault().perform(children[0]); + } + + // Read "hidden" attribute + String value = config.getAttribute("hidden"); //$NON-NLS-1$ + if (value != null && !"".equals(value.trim())) { //$NON-NLS-1$ + hidden = Boolean.parseBoolean(value); + } + } + + /** + * Creates a new {@link CoreException} to be thrown if a mandatory extension attribute + * is missing. + * + * @param attributeName The attribute name. Must not be null. + * @param extensionId The extension id. Must not be null. + * + * @return The {@link CoreException} instance. + */ + protected CoreException createMissingMandatoryAttributeException(String attributeName, String extensionId) { + Assert.isNotNull(attributeName); + Assert.isNotNull(extensionId); + + return new CoreException(new Status(IStatus.ERROR, + UIPlugin.getUniqueIdentifier(), + 0, + NLS.bind(Messages.Extension_error_missingRequiredAttribute, attributeName, extensionId), + null)); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getId() + */ + @Override + public String getId() { + return id; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getLabel() + */ + @Override + public String getLabel() { + return label != null ? label.trim() : ""; //$NON-NLS-1$ + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getEnablement() + */ + @Override + public Expression getEnablement() { + return expression; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#isHidden() + */ + @Override + public boolean isHidden() { + return hidden; + } + + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) { + if (obj instanceof AbstractLauncherDelegate) { + return id.equals(((AbstractLauncherDelegate)obj).id); + } + return super.equals(obj); + } + + /* (non-Javadoc) + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + return id.hashCode(); + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/LauncherDelegateManager.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/LauncherDelegateManager.java new file mode 100644 index 00000000000..1b99f4389a2 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/launcher/LauncherDelegateManager.java @@ -0,0 +1,421 @@ +/******************************************************************************* + * Copyright (c) 2011 - 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.launcher; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.expressions.EvaluationContext; +import org.eclipse.core.expressions.EvaluationResult; +import org.eclipse.core.expressions.Expression; +import org.eclipse.core.expressions.IEvaluationContext; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.osgi.util.NLS; +import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin; +import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate; +import org.eclipse.tcf.te.ui.terminals.nls.Messages; +import org.eclipse.ui.ISources; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.IHandlerService; + +/** + * Terminal launcher delegate manager implementation. + */ +public class LauncherDelegateManager { + // Flag to mark the extension point manager initialized (extensions loaded). + private boolean initialized = false; + + // The map containing all loaded contributions + private final Map extensionsMap = new HashMap(); + + // The extension point comparator + private ExtensionPointComparator comparator = null; + + /** + * Executable extension proxy implementation. + */ + /* default */ static class Proxy { + // The extension instance. Created on first access + private ILauncherDelegate instance; + // The configuration element + private final IConfigurationElement element; + // The unique id of the extension. + private String id; + + /** + * Constructor. + * + * @param element The configuration element. Must not be null. + * @throws CoreException In case the configuration element attribute id is null or empty. + */ + public Proxy(IConfigurationElement element) throws CoreException { + Assert.isNotNull(element); + this.element = element; + + // Extract the extension attributes + id = element.getAttribute("id"); //$NON-NLS-1$ + if (id == null || id.trim().length() == 0) { + throw new CoreException(new Status(IStatus.ERROR, + UIPlugin.getUniqueIdentifier(), + 0, + NLS.bind(Messages.Extension_error_missingRequiredAttribute, "id", element.getContributor().getName()), //$NON-NLS-1$ + null)); + } + + instance = null; + } + + /** + * Returns the extensions unique id. + * + * @return The unique id. + */ + public String getId() { + return id; + } + + /** + * Returns the configuration element for this extension. + * + * @return The configuration element. + */ + public IConfigurationElement getConfigurationElement() { + return element; + } + + /** + * Returns the extension class instance. The contributing + * plug-in will be activated if not yet activated anyway. + * + * @return The extension class instance or null if the instantiation fails. + */ + public ILauncherDelegate getInstance() { + if (instance == null) instance = newInstance(); + return instance; + } + + /** + * Returns always a new extension class instance which is different + * to what {@link #getInstance()} would return. + * + * @return A new extension class instance or null if the instantiation fails. + */ + public ILauncherDelegate newInstance() { + IConfigurationElement element = getConfigurationElement(); + Assert.isNotNull(element); + + // The "class" to load can be specified either as attribute or as child element + if (element.getAttribute("class") != null || element.getChildren("class").length > 0) { //$NON-NLS-1$ //$NON-NLS-2$ + try { + return (ILauncherDelegate)element.createExecutableExtension("class"); //$NON-NLS-1$ + } catch (Exception e) { + // Possible exceptions: CoreException, ClassCastException. + Platform.getLog(UIPlugin.getDefault().getBundle()).log(new Status(IStatus.ERROR, + UIPlugin.getUniqueIdentifier(), + NLS.bind(Messages.Extension_error_invalidExtensionPoint, element.getDeclaringExtension().getUniqueIdentifier()), e)); + } + } + return null; + } + + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) { + // Proxies are equal if they have encapsulate an element + // with the same unique id + if (obj instanceof Proxy) { + return getId().equals(((Proxy)obj).getId()); + } + return super.equals(obj); + } + + /* (non-Javadoc) + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + // The hash code of a proxy is the one from the id + return getId().hashCode(); + } + } + + /** + * Extension point comparator implementation. + *

+ * The comparator assure that extension are read in a predictable order. + *

+ * The order of the extensions is defined as following:
+ *

  • Extensions contributed by our own plug-ins (org.eclipse.tcf.te.*) + * in ascending alphabetic order and
  • + *
  • Extensions contributed by any other plug-in in ascending alphabetic order.
  • + *
  • Extensions contributed by the same plug-in in ascending alphabetic order by the + * extensions unique id
  • + */ + /* default */ static class ExtensionPointComparator implements Comparator { + private final static String OWN_PLUGINS_PATTERN = "org.eclipse.tcf.te."; //$NON-NLS-1$ + + /* (non-Javadoc) + * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) + */ + @Override + public int compare(IExtension o1, IExtension o2) { + // We ignore any comparisation with null and + if (o1 == null || o2 == null) return 0; + // Check if it is the exact same element + if (o1 == o2) return 0; + + // The extensions are compared by the unique id of the contributing plug-in first + String contributor1 = o1.getContributor().getName(); + String contributor2 = o2.getContributor().getName(); + + // Contributions from our own plug-ins comes before 3rdParty plug-ins + if (contributor1.startsWith(OWN_PLUGINS_PATTERN) && !contributor2.startsWith(OWN_PLUGINS_PATTERN)) + return -1; + if (!contributor1.startsWith(OWN_PLUGINS_PATTERN) && contributor2.startsWith(OWN_PLUGINS_PATTERN)) + return 1; + if (contributor1.startsWith(OWN_PLUGINS_PATTERN) && contributor2.startsWith(OWN_PLUGINS_PATTERN)) { + int value = contributor1.compareTo(contributor2); + // Within the same plug-in, the extension are sorted by their unique id (if available) + if (value == 0 && o1.getUniqueIdentifier() != null && o2.getUniqueIdentifier() != null) + return o1.getUniqueIdentifier().compareTo(o2.getUniqueIdentifier()); + // Otherwise, just return the comparisation result from the contributors + return value; + } + + // Contributions from all other plug-ins are sorted alphabetical + int value = contributor1.compareTo(contributor2); + // Within the same plug-in, the extension are sorted by their unique id (if available) + if (value == 0 && o1.getUniqueIdentifier() != null && o2.getUniqueIdentifier() != null) + return o1.getUniqueIdentifier().compareTo(o2.getUniqueIdentifier()); + // Otherwise, just return the comparisation result from the contributors + return value; + } + + } + + /* + * Thread save singleton instance creation. + */ + private static class LazyInstanceHolder { + public static LauncherDelegateManager instance = new LauncherDelegateManager(); + } + + /** + * Returns the singleton instance. + */ + public static LauncherDelegateManager getInstance() { + return LazyInstanceHolder.instance; + } + + /** + * Constructor. + */ + LauncherDelegateManager() { + super(); + } + + /** + * Returns the list of all contributed terminal launcher delegates. + * + * @param unique If true, the method returns new instances for each + * contributed terminal launcher delegate. + * + * @return The list of contributed terminal launcher delegates, or an empty array. + */ + public ILauncherDelegate[] getLauncherDelegates(boolean unique) { + List contributions = new ArrayList(); + for (Proxy launcherDelegate : getExtensions().values()) { + ILauncherDelegate instance = unique ? launcherDelegate.newInstance() : launcherDelegate.getInstance(); + if (instance != null && !contributions.contains(instance)) { + contributions.add(instance); + } + } + + return contributions.toArray(new ILauncherDelegate[contributions.size()]); + } + + /** + * Returns the terminal launcher delegate identified by its unique id. If no terminal + * launcher delegate with the specified id is registered, null is returned. + * + * @param id The unique id of the terminal launcher delegate or null + * @param unique If true, the method returns new instances of the terminal launcher delegate contribution. + * + * @return The terminal launcher delegate instance or null. + */ + public ILauncherDelegate getLauncherDelegate(String id, boolean unique) { + ILauncherDelegate contribution = null; + Map extensions = getExtensions(); + if (extensions.containsKey(id)) { + Proxy proxy = extensions.get(id); + // Get the extension instance + contribution = unique ? proxy.newInstance() : proxy.getInstance(); + } + + return contribution; + } + + /** + * Returns the applicable terminal launcher delegates for the given selection. + * + * @param selection The selection or null. + * @return The list of applicable terminal launcher delegates or an empty array. + */ + public ILauncherDelegate[] getApplicableLauncherDelegates(ISelection selection) { + List applicable = new ArrayList(); + + for (ILauncherDelegate delegate : getLauncherDelegates(false)) { + Expression enablement = delegate.getEnablement(); + + // The launcher delegate is applicable by default if + // no expression is specified. + boolean isApplicable = enablement == null; + + if (enablement != null) { + if (selection != null) { + // Set the default variable to selection. + IEvaluationContext currentState = ((IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class)).getCurrentState(); + EvaluationContext context = new EvaluationContext(currentState, selection); + // Set the "selection" variable to the selection. + context.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, selection); + // Allow plug-in activation + context.setAllowPluginActivation(true); + // Evaluate the expression + try { + isApplicable = enablement.evaluate(context).equals(EvaluationResult.TRUE); + } catch (CoreException e) { + IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), e.getLocalizedMessage(), e); + UIPlugin.getDefault().getLog().log(status); + } + } else { + // The enablement is false by definition if + // there is no selection. + isApplicable = false; + } + } + + // Add the page if applicable + if (isApplicable) applicable.add(delegate); + } + + return applicable.toArray(new ILauncherDelegate[applicable.size()]); + } + + /** + * Returns the map of managed extensions. If not loaded before, + * this methods trigger the loading of the extensions to the managed + * extension point. + * + * @return The map of extensions. + */ + protected Map getExtensions() { + // Load and store the extensions thread-safe! + synchronized (extensionsMap) { + if (!initialized) { loadExtensions(); initialized = true; } + } + return extensionsMap; + } + + /** + * Returns the extension point comparator instance. If not available, + * {@link #doCreateExtensionPointComparator()} is called to create a new instance. + * + * @return The extension point comparator or null if the instance creation fails. + */ + protected final ExtensionPointComparator getExtensionPointComparator() { + if (comparator == null) { + comparator = new ExtensionPointComparator(); + } + return comparator; + } + + /** + * Returns the extensions of the specified extension point sorted. + *

    + * For the order of the extensions, see {@link ExtensionPointComparator}. + * + * @param point The extension point. Must not be null. + * @return The extensions in sorted order or an empty array if the extension point has no extensions. + */ + protected IExtension[] getExtensionsSorted(IExtensionPoint point) { + Assert.isNotNull(point); + + List extensions = new ArrayList(Arrays.asList(point.getExtensions())); + if (extensions.size() > 0) { + Collections.sort(extensions, getExtensionPointComparator()); + } + + return extensions.toArray(new IExtension[extensions.size()]); + } + + /** + * Loads the extensions for the managed extension point. + */ + protected void loadExtensions() { + // If already initialized, this method will do nothing. + if (initialized) return; + + IExtensionRegistry registry = Platform.getExtensionRegistry(); + IExtensionPoint point = registry.getExtensionPoint("org.eclipse.tcf.te.ui.terminals.launcherDelegates"); //$NON-NLS-1$ + if (point != null) { + IExtension[] extensions = getExtensionsSorted(point); + for (IExtension extension : extensions) { + IConfigurationElement[] elements = extension.getConfigurationElements(); + for (IConfigurationElement element : elements) { + if ("delegate".equals(element.getName())) { //$NON-NLS-1$ + try { + Proxy candidate = new Proxy(element); + if (candidate.getId() != null) { + // If no extension with this id had been registered before, register now. + if (!extensionsMap.containsKey(candidate.getId())) { + extensionsMap.put(candidate.getId(), candidate); + } + else { + throw new CoreException(new Status(IStatus.ERROR, + UIPlugin.getUniqueIdentifier(), + 0, + NLS.bind(Messages.Extension_error_duplicateExtension, candidate.getId(), element.getContributor().getName()), + null)); + } + } else { + throw new CoreException(new Status(IStatus.ERROR, + UIPlugin.getUniqueIdentifier(), + 0, + NLS.bind(Messages.Extension_error_missingRequiredAttribute, "id", element.getAttribute("label")), //$NON-NLS-1$ //$NON-NLS-2$ + null)); + } + } catch (CoreException e) { + Platform.getLog(UIPlugin.getDefault().getBundle()).log(new Status(IStatus.ERROR, + UIPlugin.getUniqueIdentifier(), + NLS.bind(Messages.Extension_error_invalidExtensionPoint, element.getDeclaringExtension().getUniqueIdentifier()), e)); + } + } + } + } + } + } + +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/listeners/AbstractWindowListener.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/listeners/AbstractWindowListener.java new file mode 100644 index 00000000000..d5752bf4e3a --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/listeners/AbstractWindowListener.java @@ -0,0 +1,130 @@ +/******************************************************************************* + * Copyright (c) 2013, 2014 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.listeners; + +import org.eclipse.ui.IPartListener2; +import org.eclipse.ui.IPartService; +import org.eclipse.ui.IPerspectiveListener; +import org.eclipse.ui.IWindowListener; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPartReference; +import org.eclipse.ui.IWorkbenchWindow; + +/** + * Abstract window listener implementation. + */ +public abstract class AbstractWindowListener implements IWindowListener { + // The part listener instance + protected final IPartListener2 partListener; + // The perspective listener instance + protected final IPerspectiveListener perspectiveListener; + + // Flag to remember if the initialization is done or not + private boolean initialized = false; + + /** + * Constructor + */ + public AbstractWindowListener() { + // Create the part listener instance + partListener = createPartListener(); + // Create the perspective listener instance + perspectiveListener = createPerspectiveListener(); + } + + /** + * Creates a new part listener instance. + *

    + * Note: The default implementation returns null. + * + * @return The part listener instance or null. + */ + protected IPartListener2 createPartListener() { + return null; + } + + /** + * Creates a new perspective listener instance. + *

    + * Note: The default implementation returns null. + * + * @return The perspective listener instance or null. + */ + protected IPerspectiveListener createPerspectiveListener() { + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IWindowListener#windowActivated(org.eclipse.ui.IWorkbenchWindow) + */ + @Override + public void windowActivated(IWorkbenchWindow window) { + if (!initialized && window != null) { + windowOpened(window); + } + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IWindowListener#windowDeactivated(org.eclipse.ui.IWorkbenchWindow) + */ + @Override + public void windowDeactivated(IWorkbenchWindow window) { + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IWindowListener#windowClosed(org.eclipse.ui.IWorkbenchWindow) + */ + @Override + public void windowClosed(IWorkbenchWindow window) { + // On close, remove the listeners from the window + if (window != null) { + if (window.getPartService() != null && partListener != null) { + window.getPartService().removePartListener(partListener); + } + + if (perspectiveListener != null) window.removePerspectiveListener(perspectiveListener); + } + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IWindowListener#windowOpened(org.eclipse.ui.IWorkbenchWindow) + */ + @Override + public void windowOpened(IWorkbenchWindow window) { + if (window != null) { + // On open, register the part listener to the window + if (window.getPartService() != null && partListener != null) { + // Get the part service + IPartService service = window.getPartService(); + // Unregister the part listener, just in case + service.removePartListener(partListener); + // Register the part listener + service.addPartListener(partListener); + // Signal the active part to the part listener after registration + IWorkbenchPage page = window.getActivePage(); + if (page != null) { + IWorkbenchPartReference partRef = page.getActivePartReference(); + if (partRef != null) partListener.partActivated(partRef); + } + } + + // Register the perspective listener + if (perspectiveListener != null) { + window.addPerspectiveListener(perspectiveListener); + // Signal the active perspective to the perspective listener after registration + if (window.getActivePage() != null) { + perspectiveListener.perspectiveActivated(window.getActivePage(), window.getActivePage().getPerspective()); + } + } + + initialized = true; + } + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/listeners/WorkbenchPartListener.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/listeners/WorkbenchPartListener.java new file mode 100644 index 00000000000..017b19271f2 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/listeners/WorkbenchPartListener.java @@ -0,0 +1,112 @@ +/******************************************************************************* + * Copyright (c) 2011, 2014 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.listeners; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.ui.IPartListener2; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchPartReference; +import org.eclipse.ui.contexts.IContextActivation; +import org.eclipse.ui.contexts.IContextService; + +/** + * The part listener implementation. Takes care of + * activation and deactivation of key binding contexts. + */ +public class WorkbenchPartListener implements IPartListener2 { + + // The context activations per workbench part reference + private final Map activations = new HashMap(); + + /* (non-Javadoc) + * @see org.eclipse.ui.IPartListener2#partBroughtToTop(org.eclipse.ui.IWorkbenchPartReference) + */ + @Override + public void partBroughtToTop(IWorkbenchPartReference partRef) { + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IPartListener2#partOpened(org.eclipse.ui.IWorkbenchPartReference) + */ + @Override + public void partOpened(IWorkbenchPartReference partRef) { + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IPartListener2#partClosed(org.eclipse.ui.IWorkbenchPartReference) + */ + @Override + public void partClosed(IWorkbenchPartReference partRef) { + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IPartListener2#partVisible(org.eclipse.ui.IWorkbenchPartReference) + */ + @Override + public void partVisible(IWorkbenchPartReference partRef) { + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IPartListener2#partHidden(org.eclipse.ui.IWorkbenchPartReference) + */ + @Override + public void partHidden(IWorkbenchPartReference partRef) { + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IPartListener2#partActivated(org.eclipse.ui.IWorkbenchPartReference) + */ + @Override + public void partActivated(IWorkbenchPartReference partRef) { + if ("org.eclipse.tcf.te.ui.terminals.TerminalsView".equals(partRef.getId())) { //$NON-NLS-1$ + IWorkbenchPart part = partRef.getPart(false); + if (part != null && part.getSite() != null) { + IContextService service = (IContextService)part.getSite().getService(IContextService.class); + if (service != null) { + IContextActivation activation = service.activateContext(partRef.getId()); + if (activation != null) { + activations.put(partRef, activation); + } else { + activations.remove(partRef); + } + } + } + } + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IPartListener2#partDeactivated(org.eclipse.ui.IWorkbenchPartReference) + */ + @Override + public void partDeactivated(IWorkbenchPartReference partRef) { + if ("org.eclipse.tcf.te.ui.terminals.TerminalsView".equals(partRef.getId())) { //$NON-NLS-1$ + IWorkbenchPart part = partRef.getPart(false); + if (part != null && part.getSite() != null) { + IContextService service = (IContextService)part.getSite().getService(IContextService.class); + if (service != null) { + IContextActivation activation = activations.remove(partRef); + if (activation != null) { + service.deactivateContext(activation); + } + } + } + } + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IPartListener2#partInputChanged(org.eclipse.ui.IWorkbenchPartReference) + */ + @Override + public void partInputChanged(IWorkbenchPartReference partRef) { + } + +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/listeners/WorkbenchWindowListener.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/listeners/WorkbenchWindowListener.java new file mode 100644 index 00000000000..21349a95494 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/listeners/WorkbenchWindowListener.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.listeners; + +import org.eclipse.ui.IPartListener2; + +/** + * The window listener implementation. Takes care of the + * management of the global listeners per workbench window. + */ +public class WorkbenchWindowListener extends AbstractWindowListener { + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.views.listeners.AbstractWindowListener#createPartListener() + */ + @Override + protected IPartListener2 createPartListener() { + return new WorkbenchPartListener(); + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/manager/ConsoleManager.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/manager/ConsoleManager.java new file mode 100644 index 00000000000..e716c623756 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/manager/ConsoleManager.java @@ -0,0 +1,641 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + * Max Weninger (Wind River) - [361363] [TERMINALS] Implement "Pin&Clone" for the "Terminals" view + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.manager; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.swt.widgets.Display; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin; +import org.eclipse.tcf.te.ui.terminals.interfaces.IPreferenceKeys; +import org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView; +import org.eclipse.tcf.te.ui.terminals.interfaces.IUIConstants; +import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderManager; +import org.eclipse.tcf.te.ui.terminals.view.TerminalsView; +import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; +import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector; +import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl; +import org.eclipse.ui.IPerspectiveDescriptor; +import org.eclipse.ui.IPerspectiveListener; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IViewReference; +import org.eclipse.ui.IViewSite; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PerspectiveAdapter; +import org.eclipse.ui.PlatformUI; + +/** + * Terminals console manager. + */ +@SuppressWarnings("restriction") +public class ConsoleManager { + + // Constant to indicate any secondary id is acceptable + private final static String ANY_SECONDARY_ID = new String("*"); //$NON-NLS-1$ + + // Reference to the perspective listener instance + private final IPerspectiveListener perspectiveListener; + + // Internal perspective listener implementation + static class ConsoleManagerPerspectiveListener extends PerspectiveAdapter { + private final List references = new ArrayList(); + + /* (non-Javadoc) + * @see org.eclipse.ui.PerspectiveAdapter#perspectiveActivated(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IPerspectiveDescriptor) + */ + @Override + public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) { + // If the old references list is empty, just return + if (references.isEmpty()) return; + // Create a copy of the old view references list + List oldReferences = new ArrayList(references); + + // Get the current list of view references + List references = new ArrayList(Arrays.asList(page.getViewReferences())); + for (IViewReference reference : oldReferences) { + if (references.contains(reference)) continue; + // Previous visible terminals console view reference, make visible again + try { + page.showView(reference.getId(), reference.getSecondaryId(), IWorkbenchPage.VIEW_VISIBLE); + } catch (PartInitException e) { /* Failure on part instantiation is ignored */ } + } + + } + + /* (non-Javadoc) + * @see org.eclipse.ui.PerspectiveAdapter#perspectivePreDeactivate(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IPerspectiveDescriptor) + */ + @Override + public void perspectivePreDeactivate(IWorkbenchPage page, IPerspectiveDescriptor perspective) { + references.clear(); + for (IViewReference reference : page.getViewReferences()) { + IViewPart part = reference.getView(false); + if (part instanceof TerminalsView && !references.contains(reference)) { + references.add(reference); + } + } + } + } + + /* + * Thread save singleton instance creation. + */ + private static class LazyInstanceHolder { + public static ConsoleManager fInstance = new ConsoleManager(); + } + + /** + * Returns the singleton instance for the console manager. + */ + public static ConsoleManager getInstance() { + return LazyInstanceHolder.fInstance; + } + + /** + * Constructor. + */ + ConsoleManager() { + super(); + + // Attach the perspective listener + perspectiveListener = new ConsoleManagerPerspectiveListener(); + if (PlatformUI.isWorkbenchRunning() && PlatformUI.getWorkbench() != null && PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null) { + PlatformUI.getWorkbench().getActiveWorkbenchWindow().addPerspectiveListener(perspectiveListener); + } + } + + /** + * Returns the active workbench window page if the workbench is still running. + * + * @return The active workbench window page or null + */ + private final IWorkbenchPage getActiveWorkbenchPage() { + // To lookup the console view, the workbench must be still running + if (PlatformUI.isWorkbenchRunning() && PlatformUI.getWorkbench() != null && PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null) { + return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + } + return null; + } + + /** + * Returns the console view if available within the active workbench window page. + *

    + * Note: The method must be called within the UI thread. + * + * @param id The terminals console view id or null to show the default terminals console view. + * @param secondaryId The terminals console view secondary id or null. + * + * @return The console view instance if available or null otherwise. + */ + public ITerminalsView findConsoleView(String id, String secondaryId) { + Assert.isNotNull(Display.findDisplay(Thread.currentThread())); + + ITerminalsView view = null; + + // Get the active workbench page + IWorkbenchPage page = getActiveWorkbenchPage(); + if (page != null) { + // Look for the view + IViewPart part = getTerminalsViewWithSecondaryId(id != null ? id : IUIConstants.ID, secondaryId); + // Check the interface + if (part instanceof ITerminalsView) { + view = (ITerminalsView)part; + } + } + + return view; + } + + /** + * Search and return a terminal view with a specific secondary id + * + * @param id The terminals console view id. Must not be null. + * @param secondaryId The terminals console view secondary id or null. + * + * @return The terminals console view instance or null if not found. + */ + private IViewPart getTerminalsViewWithSecondaryId(String id, String secondaryId) { + Assert.isNotNull(id); + + IWorkbenchPage page = getActiveWorkbenchPage(); + + IViewReference[] refs = page.getViewReferences(); + for (int i = 0; i < refs.length; i++) { + IViewReference ref = refs[i]; + if (ref.getId().equals(id)) { + IViewPart part = ref.getView(true); + if (part instanceof ITerminalsView) { + String secId = ((IViewSite) part.getSite()).getSecondaryId(); + if (secId != null && secId.equals(secondaryId) || secId == null && secondaryId == null) { + return part; + } + } + } + } + return null; + } + + /** + * Search and return a terminal view that is NOT pinned + * + * @param id The terminals console view id. Must not be null. + * @return The terminals console view instance or null if not found. + */ + private IViewPart getFirstNotPinnedTerminalsView(String id) { + Assert.isNotNull(id); + + IWorkbenchPage page = getActiveWorkbenchPage(); + + IViewReference[] refs = page.getViewReferences(); + for (int i = 0; i < refs.length; i++) { + IViewReference ref = refs[i]; + if (ref.getId().equals(id)) { + IViewPart part = ref.getView(true); + if (part instanceof ITerminalsView) { + if (!((ITerminalsView) part).isPinned()) { + return part; + } + } + } + } + return null; + } + + /** + * Search and return the first available terminal view. + * + * @param id The terminals console view id. Must not be null. + * @param secondaryId The terminals console view secondary id or null. + * @param useActive - return only an active terminal view. + * + * @return The terminals console view instance or null if not found. + */ + private IViewPart getFirstTerminalsView(String id, String secondaryId, boolean useActive) { + Assert.isNotNull(id); + + IWorkbenchPage page = getActiveWorkbenchPage(); + + IViewReference[] refs = page.getViewReferences(); + for (int i = 0; i < refs.length; i++) { + IViewReference ref = refs[i]; + if (ref.getId().equals(id)) { + if (secondaryId == ANY_SECONDARY_ID + || secondaryId == null && ref.getSecondaryId() == null + || secondaryId != null && secondaryId.equals(ref.getSecondaryId())) { + IViewPart part = ref.getView(true); + if (useActive) { + if (page.isPartVisible(part)) { + return part; + } + } + else { + return part; + } + } + } + } + return null; + } + + /** + * Return a new secondary id to use, based on the number of open terminal views. + * + * @param id The terminals console view id. Must not be null. + * @return The next secondary id, or null if it is the first one + */ + private String getNextTerminalSecondaryId(String id) { + Assert.isNotNull(id); + + IWorkbenchPage page = getActiveWorkbenchPage(); + Map terminalViews = new HashMap(); + + int maxNumber = 0; + IViewReference[] refs = page.getViewReferences(); + for (int i = 0; i < refs.length; i++) { + IViewReference ref = refs[i]; + if (ref.getId().equals(id)) { + if (ref.getSecondaryId() != null) { + terminalViews.put(ref.getSecondaryId(), ref); + int scondaryIdInt = Integer.parseInt(ref.getSecondaryId()); + if (scondaryIdInt > maxNumber) { + maxNumber = scondaryIdInt; + } + } + else { + // add the one with secondaryId == null with 0 by default + terminalViews.put(Integer.toString(0), ref); + } + } + } + if (terminalViews.size() == 0) { + return null; + } + + int i = 0; + for (; i < maxNumber; i++) { + String secondaryIdStr = Integer.toString(i); + if (!terminalViews.keySet().contains(secondaryIdStr)) { + // found a free slot + if (i == 0) + return null; + return Integer.toString(i); + } + } + // add a new one + return Integer.toString(i + 1); + } + + /** + * Show the terminals console view specified by the given id. + *

    + * Note: The method must be called within the UI thread. + * + * @param id The terminals console view id or null to show the default terminals console view. + */ + public IViewPart showConsoleView(String id, String secondaryId) { + Assert.isNotNull(Display.findDisplay(Thread.currentThread())); + + // Get the active workbench page + IWorkbenchPage page = getActiveWorkbenchPage(); + if (page != null) { + try { + // show the view + IViewPart part = page.showView(id != null ? id : IUIConstants.ID, secondaryId, IWorkbenchPage.VIEW_ACTIVATE); + // and force the view to the foreground + page.bringToTop(part); + return part; + } + catch (PartInitException e) { + IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), e.getLocalizedMessage(), e); + UIPlugin.getDefault().getLog().log(status); + } + } + return null; + } + + /** + * Bring the terminals console view, specified by the given id, to the top of the view stack. + * + * @param id The terminals console view id or null to show the default terminals console view. + * @param secondaryId The terminals console view secondary id or null. + * @param activate If true activate the console view. + */ + private IViewPart bringToTop(String id, String secondaryId, boolean activate) { + // Get the active workbench page + IWorkbenchPage page = getActiveWorkbenchPage(); + if (page != null) { + // Look for any terminal view + IViewPart anyTerminal = getFirstTerminalsView(id != null ? id : IUIConstants.ID, secondaryId, false); + // there is at least one terminal available + if (anyTerminal != null) { + // is there an active terminal view + IViewPart activePart = getFirstTerminalsView(id != null ? id : IUIConstants.ID, secondaryId, true); + // no terminal view active + if (activePart == null) { + // use the first not pinned + IViewPart notPinnedPart = getFirstNotPinnedTerminalsView(id != null ? id : IUIConstants.ID); + if (notPinnedPart != null) { + if (activate) { + page.activate(notPinnedPart); + } + else { + page.bringToTop(notPinnedPart); + } + return notPinnedPart; + } + // else we need to create a new one + IViewPart newPart = showConsoleView(id != null ? id : IUIConstants.ID, getNextTerminalSecondaryId(id != null ? id : IUIConstants.ID)); + return newPart; + } + // we found a active terminal page + // if it is pinned search for a non pinned (not active) + if (((ITerminalsView) activePart).isPinned() && secondaryId == ANY_SECONDARY_ID) { + // we found one so use it + IViewPart notPinnedPart = getFirstNotPinnedTerminalsView(id != null ? id : IUIConstants.ID); + if (notPinnedPart != null) { + if (activate) { + page.activate(notPinnedPart); + } + else { + page.bringToTop(notPinnedPart); + } + return notPinnedPart; + } + // else we need to create a new one + IViewPart newPart = showConsoleView(id != null ? id : IUIConstants.ID, getNextTerminalSecondaryId(id != null ? id : IUIConstants.ID)); + return newPart; + } + // else return the active one + return activePart; + } + // create first new terminal + if (activate) { + IViewPart newPart = showConsoleView(id != null ? id : IUIConstants.ID, getNextTerminalSecondaryId(id != null ? id : IUIConstants.ID)); + return newPart; + } + } + return null; + } + + /** + * Opens the console with the given title and connector. + *

    + * Note: The method must be called within the UI thread. + * + * @param id The terminals console view id or null to show the default terminals console view. + * @param title The console title. Must not be null. + * @param encoding The terminal encoding or null. + * @param connector The terminal connector. Must not be null. + * @param data The custom terminal data node or null. + * @param flags The flags controlling how the console is opened or null to use defaults. + */ + public CTabItem openConsole(String id, String title, String encoding, ITerminalConnector connector, Object data, Map flags) { + return openConsole(id, ANY_SECONDARY_ID, title, encoding, connector, data, flags); + } + + /** + * Opens the console with the given title and connector. + *

    + * Note: The method must be called within the UI thread. + * + * @param id The terminals console view id or null to show the default terminals console view. + * @param secondaryId The terminals console view secondary id or null. + * @param title The console title. Must not be null. + * @param encoding The terminal encoding or null. + * @param connector The terminal connector. Must not be null. + * @param data The custom terminal data node or null. + * @param flags The flags controlling how the console is opened or null to use defaults. + */ + public CTabItem openConsole(String id, String secondaryId, String title, String encoding, ITerminalConnector connector, Object data, Map flags) { + Assert.isNotNull(title); + Assert.isNotNull(connector); + Assert.isNotNull(Display.findDisplay(Thread.currentThread())); + + // Get the flags handled by the openConsole method itself + boolean activate = flags != null && flags.containsKey("activate") ? flags.get("activate").booleanValue() : false; //$NON-NLS-1$ //$NON-NLS-2$ + boolean forceNew = flags != null && flags.containsKey(ITerminalsConnectorConstants.PROP_FORCE_NEW) ? flags.get(ITerminalsConnectorConstants.PROP_FORCE_NEW).booleanValue() : false; + + // Make the consoles view visible + IViewPart part = bringToTop(id, secondaryId, activate); + if (!(part instanceof ITerminalsView)) return null; + // Cast to the correct type + ITerminalsView view = (ITerminalsView)part; + + // Get the tab folder manager associated with the view + TabFolderManager manager = (TabFolderManager)view.getAdapter(TabFolderManager.class); + if (manager == null) return null; + + // Lookup an existing console first + String secId = ((IViewSite)part.getSite()).getSecondaryId(); + CTabItem item = findConsole(id, secId, title, connector, data); + + // Switch to the tab folder page _before_ calling TabFolderManager#createItem(...). + // The createItem(...) method invokes the corresponding connect and this may take + // a while if connecting to a remote host. To allow a "Connecting..." decoration, + // the tab folder page needs to be visible. + view.switchToTabFolderControl(); + + // If no existing console exist or forced -> Create the tab item + if (item == null || forceNew) { + // If configured, check all existing tab items if they are associated + // with terminated consoles + if (UIPlugin.getScopedPreferences().getBoolean(IPreferenceKeys.PREF_REMOVE_TERMINATED_TERMINALS)) { + // Remote all terminated tab items. This will invoke the + // tab's dispose listener. + manager.removeTerminatedItems(); + // Switch back to the tab folder control as removeTerminatedItems() + // may have triggered the switch to the empty space control. + view.switchToTabFolderControl(); + } + + // Create a new tab item + item = manager.createTabItem(title, encoding, connector, data, flags); + } + // If still null, something went wrong + if (item == null) return null; + + // Make the item the active console + manager.bringToTop(item); + + // Make sure the terminals view has the focus after opening a new terminal + view.setFocus(); + + // Return the tab item of the opened console + return item; + } + + /** + * Lookup a console with the given title and the given terminal connector. + *

    + * Note: The method must be called within the UI thread. + * Note: The method will handle unified console titles itself. + * + * @param id The terminals console view id or null to show the default terminals console view. + * @param secondaryId The terminals console view secondary id or null. + * @param title The console title. Must not be null. + * @param connector The terminal connector. Must not be null. + * @param data The custom terminal data node or null. + * + * @return The corresponding console tab item or null. + */ + public CTabItem findConsole(String id, String secondaryId, String title, ITerminalConnector connector, Object data) { + Assert.isNotNull(title); + Assert.isNotNull(connector); + Assert.isNotNull(Display.findDisplay(Thread.currentThread())); + + // Get the console view + ITerminalsView view = findConsoleView(id, secondaryId); + if (view == null) return null; + + // Get the tab folder manager associated with the view + TabFolderManager manager = (TabFolderManager)view.getAdapter(TabFolderManager.class); + if (manager == null) return null; + + return manager.findTabItem(title, connector, data); + } + + /** + * Lookup a console which is assigned with the given terminal control. + *

    + * Note: The method must be called within the UI thread. + * + * @param control The terminal control. Must not be null. + * @return The corresponding console tab item or null. + */ + public CTabItem findConsole(ITerminalControl control) { + Assert.isNotNull(control); + + CTabItem item = null; + + IWorkbenchPage page = getActiveWorkbenchPage(); + if (page != null) { + IViewReference[] refs = page.getViewReferences(); + for (int i = 0; i < refs.length; i++) { + IViewReference ref = refs[i]; + IViewPart part = ref != null ? ref.getView(false) : null; + if (part instanceof ITerminalsView) { + CTabFolder tabFolder = (CTabFolder) part.getAdapter(CTabFolder.class); + if (tabFolder == null) continue; + CTabItem[] candidates = tabFolder.getItems(); + for (CTabItem candidate : candidates) { + Object data = candidate.getData(); + if (data instanceof ITerminalControl && control.equals(data)) { + item = candidate; + break; + } + } + } + if (item != null) break; + } + } + + return item; + } + + /** + * Search all console views for the one that contains a specific connector. + *

    + * Note: The method will handle unified console titles itself. + * + * @param id The terminals console view id or null to show the default terminals console view. + * @param title The console title. Must not be null. + * @param connector The terminal connector. Must not be null. + * @param data The custom terminal data node or null. + * + * @return The corresponding console tab item or null. + */ + private CTabItem findConsoleForTerminalConnector(String id, String title, ITerminalConnector connector, Object data) { + Assert.isNotNull(title); + Assert.isNotNull(connector); + + IWorkbenchPage page = getActiveWorkbenchPage(); + if (page != null) { + IViewReference[] refs = page.getViewReferences(); + for (int i = 0; i < refs.length; i++) { + IViewReference ref = refs[i]; + if (ref.getId().equals(id)) { + IViewPart part = ref.getView(true); + if (part instanceof ITerminalsView) { + // Get the tab folder manager associated with the view + TabFolderManager manager = (TabFolderManager) part.getAdapter(TabFolderManager.class); + if (manager == null) { + continue; + } + CTabItem item = manager.findTabItem(title, connector, data); + if (item != null) { + return item; + } + } + } + } + } + return null; + } + + /** + * Close the console with the given title and the given terminal connector. + *

    + * Note: The method must be called within the UI thread. + * Note: The method will handle unified console titles itself. + * + * @param title The console title. Must not be null. + * @param connector The terminal connector. Must not be null. + * @param data The custom terminal data node or null. + */ + public void closeConsole(String id, String title, ITerminalConnector connector, Object data) { + Assert.isNotNull(title); + Assert.isNotNull(connector); + Assert.isNotNull(Display.findDisplay(Thread.currentThread())); + + // Lookup the console with this connector + CTabItem console = findConsoleForTerminalConnector(id, title, connector, data); + // If found, dispose the console + if (console != null) { + console.dispose(); + } + } + + /** + * Terminate (disconnect) the console with the given title and the given terminal connector. + *

    + * Note: The method must be called within the UI thread. + * Note: The method will handle unified console titles itself. + * + * @param title The console title. Must not be null. + * @param connector The terminal connector. Must not be null. + * @param data The custom terminal data node or null. + */ + public void terminateConsole(String id, String title, ITerminalConnector connector, Object data) { + Assert.isNotNull(title); + Assert.isNotNull(connector); + Assert.isNotNull(Display.findDisplay(Thread.currentThread())); + + // Lookup the console + CTabItem console = findConsoleForTerminalConnector(id, title, connector, data); + // If found, disconnect the console + if (console != null && !console.isDisposed()) { + ITerminalViewControl terminal = (ITerminalViewControl)console.getData(); + if (terminal != null && !terminal.isDisposed()) { + terminal.disconnectTerminal(); + } + } + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.java new file mode 100644 index 00000000000..0d47192ebb7 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.java @@ -0,0 +1,115 @@ +/******************************************************************************* + * Copyright (c) 2011 - 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + * Max Weninger (Wind River) - [361363] [TERMINALS] Implement "Pin&Clone" for the "Terminals" view + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.nls; + +import java.lang.reflect.Field; + +import org.eclipse.osgi.util.NLS; + +/** + * Terminals plug-in externalized strings management. + */ +public class Messages extends NLS { + + // The plug-in resource bundle name + private static final String BUNDLE_NAME = "org.eclipse.tcf.te.ui.terminals.nls.Messages"; //$NON-NLS-1$ + + /** + * Static constructor. + */ + static { + // Load message values from bundle file + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + /** + * Returns the corresponding string for the given externalized strings + * key or null if the key does not exist. + * + * @param key The externalized strings key or null. + * @return The corresponding string or null. + */ + public static String getString(String key) { + if (key != null) { + try { + Field field = Messages.class.getDeclaredField(key); + return (String)field.get(null); + } catch (Exception e) { /* ignored on purpose */ } + } + + return null; + } + + // **** Declare externalized string id's down here ***** + + public static String Extension_error_missingRequiredAttribute; + public static String Extension_error_duplicateExtension; + public static String Extension_error_invalidExtensionPoint; + + public static String AbstractTriggerCommandHandler_error_executionFailed; + + public static String AbstractAction_error_commandExecutionFailed; + + public static String AbstractConfigurationPanel_delete; + public static String AbstractConfigurationPanel_deleteButtonTooltip; + public static String AbstractConfigurationPanel_hosts; + public static String AbstractConfigurationPanel_encoding; + public static String AbstractConfigurationPanel_encoding_custom; + public static String AbstractConfigurationPanel_encoding_custom_title; + public static String AbstractConfigurationPanel_encoding_custom_message; + public static String AbstractConfigurationPanel_encoding_custom_error; + + public static String TabTerminalListener_consoleClosed; + public static String TabTerminalListener_consoleConnecting; + + public static String PinTerminalAction_menu; + public static String PinTerminalAction_toolTip; + + public static String ToggleCommandFieldAction_menu; + public static String ToggleCommandFieldAction_toolTip; + + public static String SelectEncodingAction_menu; + public static String SelectEncodingAction_tooltip; + + public static String ProcessSettingsPage_dialogTitle; + public static String ProcessSettingsPage_processImagePathSelectorControl_label; + public static String ProcessSettingsPage_processImagePathSelectorControl_button; + public static String ProcessSettingsPage_processArgumentsControl_label; + public static String ProcessSettingsPage_processWorkingDirControl_label; + public static String ProcessSettingsPage_localEchoSelectorControl_label; + + public static String OutputStreamMonitor_error_readingFromStream; + + public static String InputStreamMonitor_error_writingToStream; + + public static String TerminalService_error_cannotCreateConnector; + public static String TerminalService_defaultTitle; + + public static String LaunchTerminalSettingsDialog_title; + public static String LaunchTerminalSettingsDialog_combo_label; + public static String LaunchTerminalSettingsDialog_group_label; + + public static String TabScrollLockAction_text; + public static String TabScrollLockAction_tooltip; + + public static String LaunchTerminalSettingsDialog_error_title; + public static String LaunchTerminalSettingsDialog_error_invalidSettings; + public static String LaunchTerminalSettingsDialog_error_unknownReason; + + public static String EncodingSelectionDialog_title; + + public static String TabFolderManager_encoding; + public static String TabFolderManager_state_connected; + public static String TabFolderManager_state_connecting; + public static String TabFolderManager_state_closed; + + public static String NoteCompositeHelper_note_label; +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.properties b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.properties new file mode 100644 index 00000000000..f7a77a435dc --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/nls/Messages.properties @@ -0,0 +1,75 @@ +############################################################################### +# Copyright (c) 2012 - 2015 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +############################################################################### + +Extension_error_missingRequiredAttribute=Required attribute "{0}" missing for extension "{1}"! +Extension_error_duplicateExtension=Duplicate extension with id ''{0}''. Ignoring duplicated contribution from contributor ''{1}''! +Extension_error_invalidExtensionPoint=Failed to instantiate the executable extension from extension point ''{0}''. + +AbstractTriggerCommandHandler_error_executionFailed=Failed to execute command {0}. + +AbstractAction_error_commandExecutionFailed="Failed to execute command (id = {0}). Possibly caused by: {1} + +AbstractConfigurationPanel_delete=Delete +AbstractConfigurationPanel_deleteButtonTooltip=Delete terminal settings for host +AbstractConfigurationPanel_hosts=Hosts: +AbstractConfigurationPanel_encoding=Encoding: +AbstractConfigurationPanel_encoding_custom=Other... +AbstractConfigurationPanel_encoding_custom_title=Other... +AbstractConfigurationPanel_encoding_custom_message=Please enter the name of the encoding to use for the terminal. +AbstractConfigurationPanel_encoding_custom_error=Unsupported encoding. Please enter the name of a supported encoding. + +TabTerminalListener_consoleClosed=<{1}> {0} +TabTerminalListener_consoleConnecting={0} : {1}... + +PinTerminalAction_menu=Pin +PinTerminalAction_toolTip=Pin the Terminal View + +ToggleCommandFieldAction_menu=Toggle Command Input Field +ToggleCommandFieldAction_toolTip=Toggle Command Input Field + +SelectEncodingAction_menu=Switch Encoding... +SelectEncodingAction_tooltip=Switch the Encoding of the active Terminal + +ProcessSettingsPage_dialogTitle=Select Process Image +ProcessSettingsPage_processImagePathSelectorControl_label=Image Path: +ProcessSettingsPage_processImagePathSelectorControl_button=Browse +ProcessSettingsPage_processArgumentsControl_label=Arguments: +ProcessSettingsPage_processWorkingDirControl_label=Working Dir: +ProcessSettingsPage_localEchoSelectorControl_label=Local Echo + +OutputStreamMonitor_error_readingFromStream=Exception when reading from stream. Possibly caused by: {0} + +InputStreamMonitor_error_writingToStream=Exception when writing to stream. Possibly caused by: {0} + +TerminalService_error_cannotCreateConnector=Cannot create a valid terminal connector instance from the provided terminal properties. +TerminalService_defaultTitle=Console + +LaunchTerminalSettingsDialog_title=Launch Terminal +LaunchTerminalSettingsDialog_combo_label=Choose terminal: +LaunchTerminalSettingsDialog_group_label=Settings + +TabScrollLockAction_text=Scroll &Lock +TabScrollLockAction_tooltip=Scroll Lock + +LaunchTerminalSettingsDialog_error_title=Terminal Settings +LaunchTerminalSettingsDialog_error_invalidSettings=The specified settings are invalid\n\n\ +{0}\n\n\ +Please review and specify valid settings. Or cancel the settings dialog to abort. +LaunchTerminalSettingsDialog_error_unknownReason=Cannot determine specifically which setting is invalid. + +EncodingSelectionDialog_title=Encoding + +TabFolderManager_encoding=Encoding: {0} +TabFolderManager_state_connected=Connected +TabFolderManager_state_connecting=Connecting +TabFolderManager_state_closed=Closed + +NoteCompositeHelper_note_label=Note: + diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractConfigurationPanel.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractConfigurationPanel.java new file mode 100644 index 00000000000..8ee9b25067d --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractConfigurationPanel.java @@ -0,0 +1,202 @@ +/******************************************************************************* + * Copyright (c) 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.panels; + +import java.util.Map; + +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.dialogs.IMessageProvider; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer; + +/** + * Abstract terminal launcher configuration panel implementation. + */ +public abstract class AbstractConfigurationPanel implements IConfigurationPanel { + private final IConfigurationPanelContainer container; + + private Composite topControl = null; + + // The selection + private ISelection selection; + + private String message = null; + private int messageType = IMessageProvider.NONE; + + private boolean enabled = true; + + /** + * Constructor. + * + * @param container The configuration panel container or null. + */ + public AbstractConfigurationPanel(IConfigurationPanelContainer container) { + super(); + this.container = container; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#getContainer() + */ + @Override + public IConfigurationPanelContainer getContainer() { + return container; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IMessageProvider#getMessage() + */ + @Override + public final String getMessage() { + return message; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IMessageProvider#getMessageType() + */ + @Override + public final int getMessageType() { + return messageType; + } + + /** + * Set the message and the message type to display. + * + * @param message The message or null. + * @param messageType The message type or IMessageProvider.NONE. + */ + protected final void setMessage(String message, int messageType) { + this.message = message; + this.messageType = messageType; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#dispose() + */ + @Override + public void dispose() { + } + + /** + * Sets the top control. + * + * @param topControl The top control or null. + */ + protected void setControl(Composite topControl) { + this.topControl = topControl; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#getControl() + */ + @Override + public Composite getControl() { + return topControl; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#setSelection(org.eclipse.jface.viewers.ISelection) + */ + @Override + public void setSelection(ISelection selection) { + this.selection = selection; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#getSelection() + */ + @Override + public ISelection getSelection() { + return selection; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String) + */ + @Override + public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) { + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String) + */ + @Override + public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) { + } + + /** + * Returns the correctly prefixed dialog settings slot id. In case the given id + * suffix is null or empty, id is returned as is. + * + * @param settingsSlotId The dialog settings slot id to prefix. + * @param prefix The prefix. + * @return The correctly prefixed dialog settings slot id. + */ + public final String prefixDialogSettingsSlotId(String settingsSlotId, String prefix) { + if (settingsSlotId != null && prefix != null && prefix.trim().length() > 0) { + settingsSlotId = prefix + "." + settingsSlotId; //$NON-NLS-1$ + } + return settingsSlotId; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#setEnabled(boolean) + */ + @Override + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + /** + * @return Returns the enabled state. + */ + public boolean isEnabled() { + return enabled; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#isValid() + */ + @Override + public boolean isValid() { + setMessage(null, NONE); + return true; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#activate() + */ + @Override + public void activate() { + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#extractData(java.util.Map) + */ + @Override + public void extractData(Map data) { + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#setupData(java.util.Map) + */ + @Override + public void setupData(Map data) { + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#updateData(java.util.Map) + */ + @Override + public void updateData(Map data) { + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractExtendedConfigurationPanel.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractExtendedConfigurationPanel.java new file mode 100644 index 00000000000..6277dc6c3d8 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractExtendedConfigurationPanel.java @@ -0,0 +1,615 @@ +/******************************************************************************* + * Copyright (c) 2014, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.panels; + +import java.nio.charset.Charset; +import java.nio.charset.IllegalCharsetNameException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.dialogs.IInputValidator; +import org.eclipse.jface.dialogs.InputDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.tcf.te.core.terminals.TerminalContextPropertiesProviderFactory; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalContextPropertiesProvider; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.IContextPropertiesConstants; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer; +import org.eclipse.tcf.te.ui.terminals.nls.Messages; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.WorkbenchEncoding; +import org.osgi.framework.Bundle; + +/** + * Abstract terminal configuration panel implementation. + */ +public abstract class AbstractExtendedConfigurationPanel extends AbstractConfigurationPanel { + private static final String LAST_HOST_TAG = "lastHost";//$NON-NLS-1$ + private static final String HOSTS_TAG = "hosts";//$NON-NLS-1$ + private static final String ENCODINGS_TAG = "encodings"; //$NON-NLS-1$ + + // The sub-controls + /* default */ Combo hostCombo; + private Button deleteHostButton; + /* default */ Combo encodingCombo; + + // The last selected encoding + /* default */ String lastSelectedEncoding; + // The last entered custom encodings + /* default */ final List encodingHistory = new ArrayList(); + + // A map containing the settings per host + protected final Map> hostSettingsMap = new HashMap>(); + + /** + * Constructor. + * + * @param container The configuration panel container or null. + */ + public AbstractExtendedConfigurationPanel(IConfigurationPanelContainer container) { + super(container); + } + + /** + * Returns the host name or IP from the current selection. + * + * @return The host name or IP, or null. + */ + public String getSelectionHost() { + ISelection selection = getSelection(); + if (selection instanceof IStructuredSelection && !selection.isEmpty()) { + Object element = ((IStructuredSelection) selection).getFirstElement(); + ITerminalContextPropertiesProvider provider = TerminalContextPropertiesProviderFactory.getProvider(element); + if (provider != null) { + Map props = provider.getTargetAddress(element); + if (props != null && props.containsKey(IContextPropertiesConstants.PROP_ADDRESS)) { + return props.get(IContextPropertiesConstants.PROP_ADDRESS); + } + } + } + + return null; + } + + /** + * Returns the default encoding based on the current selection. + * + * @return The default encoding or null. + */ + public String getSelectionEncoding() { + ISelection selection = getSelection(); + if (selection instanceof IStructuredSelection && !selection.isEmpty()) { + Object element = ((IStructuredSelection) selection).getFirstElement(); + ITerminalContextPropertiesProvider provider = TerminalContextPropertiesProviderFactory.getProvider(element); + if (provider != null) { + Object encoding = provider.getProperty(element, IContextPropertiesConstants.PROP_DEFAULT_ENCODING); + if (encoding instanceof String) return ((String) encoding).trim(); + } + } + + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String) + */ + @Override + public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) { + Assert.isNotNull(settings); + + String[] hosts = settings.getArray(HOSTS_TAG); + if (hosts != null) { + for (int i = 0; i < hosts.length; i++) { + String hostEntry = hosts[i]; + String[] hostString = hostEntry.split("\\|");//$NON-NLS-1$ + String hostName = hostString[0]; + if (hostString.length == 2) { + HashMap attr = deSerialize(hostString[1]); + hostSettingsMap.put(hostName, attr); + } + else { + hostSettingsMap.put(hostName, new HashMap()); + } + } + } + + if (!isWithoutSelection()) { + String host = getSelectionHost(); + if (host != null) { + fillSettingsForHost(host); + } + } + else { + if (hostCombo != null) { + fillHostCombo(); + String lastHost = settings.get(LAST_HOST_TAG); + if (lastHost != null) { + int index = hostCombo.indexOf(lastHost); + if (index != -1) { + hostCombo.select(index); + } + else { + hostCombo.select(0); + } + } + else { + hostCombo.select(0); + } + fillSettingsForHost(hostCombo.getText()); + } + } + + encodingHistory.clear(); + String[] encodings = settings.getArray(ENCODINGS_TAG); + if (encodings != null && encodings.length > 0) { + encodingHistory.addAll(Arrays.asList(encodings)); + for (String encoding : encodingHistory) { + encodingCombo.add(encoding, encodingCombo.getItemCount() - 1); + } + } + } + + /** + * Restore the encodings widget values. + * + * @param settings The dialog settings. Must not be null. + * @param idPrefix The prefix or null. + */ + protected void doRestoreEncodingsWidgetValues(IDialogSettings settings, String idPrefix) { + Assert.isNotNull(settings); + + String encoding = settings.get(prefixDialogSettingsSlotId(ITerminalsConnectorConstants.PROP_ENCODING, idPrefix)); + if (encoding != null && encoding.trim().length() > 0) { + setEncoding(encoding); + } + } + + /** + * Decode the host settings from the given string. + * + * @param hostString The encoded host settings. Must not be null. + * @return The decoded host settings. + */ + private HashMap deSerialize(String hostString) { + Assert.isNotNull(hostString); + HashMap attr = new HashMap(); + + if (hostString.length() != 0) { + String[] hostAttrs = hostString.split("\\:");//$NON-NLS-1$ + for (int j = 0; j < hostAttrs.length-1; j = j + 2) { + String key = hostAttrs[j]; + String value = hostAttrs[j + 1]; + attr.put(key, value); + } + } + return attr; + } + + /** + * Encode the host settings to a string. + * + * @param hostEntry The host settings. Must not be null. + * @param hostString The host string to encode to. Must not be null. + */ + private void serialize(Map hostEntry, StringBuilder hostString) { + Assert.isNotNull(hostEntry); + Assert.isNotNull(hostString); + + if (hostEntry.keySet().size() != 0) { + Iterator> nextHostAttr = hostEntry.entrySet().iterator(); + while (nextHostAttr.hasNext()) { + Entry entry = nextHostAttr.next(); + String attrKey = entry.getKey(); + String attrValue = entry.getValue(); + hostString.append(attrKey + ":" + attrValue + ":");//$NON-NLS-1$ //$NON-NLS-2$ + } + hostString.deleteCharAt(hostString.length() - 1); + } + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String) + */ + @Override + public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) { + Iterator nextHost = hostSettingsMap.keySet().iterator(); + String[] hosts = new String[hostSettingsMap.keySet().size()]; + int i = 0; + while (nextHost.hasNext()) { + StringBuilder hostString = new StringBuilder(); + String host = nextHost.next(); + hostString.append(host + "|");//$NON-NLS-1$ + Map hostEntry = hostSettingsMap.get(host); + serialize(hostEntry, hostString); + hosts[i] = hostString.toString(); + i = i + 1; + } + settings.put(HOSTS_TAG, hosts); + if (isWithoutSelection()) { + if (hostCombo != null) { + String host = getHostFromSettings(); + if (host != null) settings.put(LAST_HOST_TAG, host); + } + } + + if (!encodingHistory.isEmpty()) { + settings.put(ENCODINGS_TAG, encodingHistory.toArray(new String[encodingHistory.size()])); + } + } + + /** + * Save the encodings widget values. + * + * @param settings The dialog settings. Must not be null. + * @param idPrefix The prefix or null. + */ + protected void doSaveEncodingsWidgetValues(IDialogSettings settings, String idPrefix) { + Assert.isNotNull(settings); + + String encoding = getEncoding(); + if (encoding != null) { + settings.put(prefixDialogSettingsSlotId(ITerminalsConnectorConstants.PROP_ENCODING, idPrefix), encoding); + } + } + + protected abstract void saveSettingsForHost(boolean add); + + protected abstract void fillSettingsForHost(String host); + + protected abstract String getHostFromSettings(); + + protected void removeSecurePassword(String host) { + // noop by default + } + + /** + * Returns the selected host from the hosts combo widget. + * + * @return The selected host or null. + */ + protected final String getHostFromCombo() { + return hostCombo != null && !hostCombo.isDisposed() ? hostCombo.getText() : null; + } + + protected void removeSettingsForHost(String host) { + if (hostSettingsMap.containsKey(host)) { + hostSettingsMap.remove(host); + } + } + + /** + * Returns the list of host names of the persisted hosts. + * + * @return The list of host names. + */ + private List getHostList() { + List hostList = new ArrayList(); + hostList.addAll(hostSettingsMap.keySet()); + return hostList; + } + + /** + * Fill the host combo with the stored per host setting names. + */ + protected void fillHostCombo() { + if (hostCombo != null) { + hostCombo.removeAll(); + List hostList = getHostList(); + Collections.sort(hostList); + Iterator nextHost = hostList.iterator(); + while (nextHost.hasNext()) { + String host = nextHost.next(); + hostCombo.add(host); + } + if (hostList.size() <= 1) { + hostCombo.setEnabled(false); + } + else { + hostCombo.setEnabled(true); + + } + if (deleteHostButton != null) { + if (hostList.size() == 0) { + deleteHostButton.setEnabled(false); + } + else { + deleteHostButton.setEnabled(true); + } + } + } + } + + public boolean isWithoutSelection() { + ISelection selection = getSelection(); + if (selection == null) { + return true; + } + if (selection instanceof IStructuredSelection && selection.isEmpty()) { + return true; + } + return false; + } + + public boolean isWithHostList() { + return true; + } + + /** + * Create the host selection combo. + * + * @param parent The parent composite. Must not be null. + * @param separator If true, a separator will be added after the controls. + */ + protected void createHostsUI(Composite parent, boolean separator) { + Assert.isNotNull(parent); + + if (isWithoutSelection() && isWithHostList()) { + Composite comboComposite = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(3, false); + layout.marginHeight = 0; + layout.marginWidth = 0; + comboComposite.setLayout(layout); + comboComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + + Label label = new Label(comboComposite, SWT.HORIZONTAL); + label.setText(Messages.AbstractConfigurationPanel_hosts); + + hostCombo = new Combo(comboComposite, SWT.READ_ONLY); + hostCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + hostCombo.addSelectionListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + String host = hostCombo.getText(); + fillSettingsForHost(host); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + widgetSelected(e); + } + }); + + deleteHostButton = new Button(comboComposite, SWT.NONE); + // deleteHostButton.setText(Messages.AbstractConfigurationPanel_delete); + + ISharedImages workbenchImages = UIPlugin.getDefault().getWorkbench().getSharedImages(); + deleteHostButton.setImage(workbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE).createImage()); + + deleteHostButton.setToolTipText(Messages.AbstractConfigurationPanel_deleteButtonTooltip); + deleteHostButton.addSelectionListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + String host = getHostFromCombo(); + if (host != null && host.length() != 0) { + removeSettingsForHost(host); + removeSecurePassword(host); + fillHostCombo(); + hostCombo.select(0); + host = getHostFromCombo(); + if (host != null && host.length() != 0) { + fillSettingsForHost(host); + } + } + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + widgetSelected(e); + } + }); + + if (separator) { + Label sep = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL); + sep.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + } + } + } + + /** + * Create the encoding selection combo. + * + * @param parent The parent composite. Must not be null. + * @param separator If true, a separator will be added before the controls. + */ + protected void createEncodingUI(final Composite parent, boolean separator) { + Assert.isNotNull(parent); + + if (separator) { + Label sep = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL); + sep.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + } + + Composite panel = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(2, false); + layout.marginHeight = 0; layout.marginWidth = 0; + panel.setLayout(layout); + panel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + + Label label = new Label(panel, SWT.HORIZONTAL); + label.setText(Messages.AbstractConfigurationPanel_encoding); + + encodingCombo = new Combo(panel, SWT.READ_ONLY); + encodingCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + encodingCombo.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (Messages.AbstractConfigurationPanel_encoding_custom.equals(encodingCombo.getText())) { + InputDialog dialog = new InputDialog(parent.getShell(), + Messages.AbstractConfigurationPanel_encoding_custom_title, + Messages.AbstractConfigurationPanel_encoding_custom_message, + null, + new IInputValidator() { + @Override + public String isValid(String newText) { + boolean valid = false; + try { + if (newText != null && !"".equals(newText)) { //$NON-NLS-1$ + valid = Charset.isSupported(newText); + } + } catch (IllegalCharsetNameException e) { /* ignored on purpose */ } + + if (!valid) { + return newText != null && !"".equals(newText) ? Messages.AbstractConfigurationPanel_encoding_custom_error : ""; //$NON-NLS-1$ //$NON-NLS-2$ + } + return null; + } + }); + if (dialog.open() == Window.OK) { + String encoding = dialog.getValue(); + encodingCombo.add(encoding, encodingCombo.getItemCount() - 1); + encodingCombo.select(encodingCombo.indexOf(encoding)); + lastSelectedEncoding = encodingCombo.getText(); + + // Remember the last 5 custom encodings entered + if (!encodingHistory.contains(encoding)) { + if (encodingHistory.size() == 5) encodingHistory.remove(4); + encodingHistory.add(encoding); + } + + } else { + encodingCombo.select(encodingCombo.indexOf(lastSelectedEncoding)); + } + } + } + }); + + fillEncodingCombo(); + + // Apply any default encoding derived from the current selection + String defaultEncoding = getSelectionEncoding(); + if (defaultEncoding != null && !"".equals(defaultEncoding)) { //$NON-NLS-1$ + setEncoding(defaultEncoding); + } + } + + /** + * Fill the encoding combo. + */ + protected void fillEncodingCombo() { + if (encodingCombo != null) { + List encodings = new ArrayList(); + + // Some hard-coded encodings + encodings.add("Default (ISO-8859-1)"); //$NON-NLS-1$ + encodings.add("UTF-8"); //$NON-NLS-1$ + + // The currently selected IDE encoding from the preferences + String ideEncoding = getResourceEncoding(); + if (ideEncoding != null && !encodings.contains(ideEncoding)) encodings.add(ideEncoding); + + // The default Eclipse Workbench encoding (configured in the preferences) + String eclipseEncoding = WorkbenchEncoding.getWorkbenchDefaultEncoding(); + if (eclipseEncoding != null && !encodings.contains(eclipseEncoding)) encodings.add(eclipseEncoding); + + // The default host (Java VM) encoding + // + // Note: We do not use Charset.defaultCharset().displayName() here as it returns the bit + // unusual name "windows-1252" on Windows. As there is no access to the "historical" + // name "Cp1252" stored in MS1252.class, stick to the older way of retrieving an encoding. + String hostEncoding = new java.io.InputStreamReader(new java.io.ByteArrayInputStream(new byte[0])).getEncoding(); + if (!encodings.contains(hostEncoding)) encodings.add(hostEncoding); + + // The "Other..." encoding + encodings.add(Messages.AbstractConfigurationPanel_encoding_custom); + + encodingCombo.setItems(encodings.toArray(new String[encodings.size()])); + encodingCombo.select(0); + + lastSelectedEncoding = encodingCombo.getText(); + } + } + + /** + * Get the current value of the encoding preference. If the value is not set + * return null. + *

    + * Note: Copied from org.eclipse.ui.ide.IDEEncoding. + * + * @return String + */ + @SuppressWarnings("deprecation") + private String getResourceEncoding() { + String preference = null; + Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$ + if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) { + preference = org.eclipse.core.resources.ResourcesPlugin.getPlugin().getPluginPreferences().getString(org.eclipse.core.resources.ResourcesPlugin.PREF_ENCODING); + } + + return preference != null && preference.length() > 0 ? preference : null; + } + + /** + * Select the encoding. + * + * @param encoding The encoding. Must not be null. + */ + protected void setEncoding(String encoding) { + Assert.isNotNull(encoding); + + if (encodingCombo != null && !encodingCombo.isDisposed()) { + int index = encodingCombo.indexOf("ISO-8859-1".equals(encoding) ? "Default (ISO-8859-1)" : encoding); //$NON-NLS-1$ //$NON-NLS-2$ + if (index != -1) encodingCombo.select(index); + else { + encodingCombo.add(encoding, encodingCombo.getItemCount() - 1); + encodingCombo.select(encodingCombo.indexOf(encoding)); + } + + lastSelectedEncoding = encodingCombo.getText(); + } + } + + /** + * Returns the selected encoding. + * + * @return The selected encoding or null. + */ + protected String getEncoding() { + String encoding = encodingCombo != null && !encodingCombo.isDisposed() ? encodingCombo.getText() : null; + return encoding != null && encoding.startsWith("Default") ? null : encoding; //$NON-NLS-1$ + } + + /** + * Returns if or if not the selected encoding is supported. + * + * @return True if the selected encoding is supported. + */ + protected boolean isEncodingValid() { + try { + String encoding = getEncoding(); + return Charset.isSupported(encoding != null ? encoding : "ISO-8859-1"); //$NON-NLS-1$ + } catch (IllegalCharsetNameException e) { + return false; + } + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/services/TerminalService.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/services/TerminalService.java new file mode 100644 index 00000000000..e06206e2a20 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/services/TerminalService.java @@ -0,0 +1,359 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.services; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.ISafeRunnable; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.ListenerList; +import org.eclipse.core.runtime.SafeRunner; +import org.eclipse.core.runtime.Status; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.swt.widgets.Display; +import org.eclipse.tcf.te.core.terminals.activator.CoreBundleActivator; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalTabListener; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate; +import org.eclipse.tcf.te.ui.terminals.interfaces.IUIConstants; +import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager; +import org.eclipse.tcf.te.ui.terminals.manager.ConsoleManager; +import org.eclipse.tcf.te.ui.terminals.nls.Messages; +import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector; +import org.eclipse.ui.PlatformUI; + +/** + * Terminal service implementation. + */ +@SuppressWarnings("restriction") +public class TerminalService implements ITerminalService { + /** + * The registered terminal tab dispose listeners. + */ + private final ListenerList terminalTabListeners = new ListenerList(); + + // Flag to remember if the terminal view has been restored or not. + private boolean fRestoringView; + + // Terminal tab events + + /** + * A terminal tab got disposed. + */ + public static final int TAB_DISPOSED = 1; + + /** + * Common terminal service runnable implementation. + */ + protected static abstract class TerminalServiceRunnable { + + /** + * Invoked to execute the terminal service runnable. + * + * @param id The terminals view id or null. + * @param secondaryId The terminals view secondary id or null. + * @param title The terminal tab title. Must not be null. + * @param connector The terminal connector. Must not be null. + * @param data The custom terminal data node or null. + * @param done The callback to invoke if the operation finished or null. + */ + public abstract void run(String id, String secondaryId, String title, ITerminalConnector connector, Object data, Done done); + + /** + * Returns if or if not to execute the runnable asynchronously. + *

    + * The method returns per default true. Overwrite to + * modify the behavior. + * + * @return True to execute the runnable asynchronously, false otherwise. + */ + public boolean isExecuteAsync() { return true; } + } + + /** + * Constructor + */ + public TerminalService() { + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService#addTerminalTabListener(org.eclipse.tcf.te.core.terminals.interfaces.ITerminalTabListener) + */ + @Override + public final void addTerminalTabListener(ITerminalTabListener listener) { + Assert.isNotNull(listener); + terminalTabListeners.add(listener); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService#removeTerminalTabListener(org.eclipse.tcf.te.core.terminals.interfaces.ITerminalTabListener) + */ + @Override + public final void removeTerminalTabListener(ITerminalTabListener listener) { + Assert.isNotNull(listener); + terminalTabListeners.remove(listener); + } + + /** + * Convenience method for notifying the registered terminal tab listeners. + * + * @param event The terminal tab event. + * @param source The disposed tab item. Must not be null. + * @param data The custom data object associated with the disposed tab item or null. + */ + public final void fireTerminalTabEvent(final int event, final Object source, final Object data) { + Assert.isNotNull(source); + + // If no listener is registered, we are done here + if (terminalTabListeners.isEmpty()) return; + + // Get the list or currently registered listeners + Object[] l = terminalTabListeners.getListeners(); + // Loop the registered terminal tab listeners and invoke the proper method + for (int i = 0; i < l.length; i++) { + final ITerminalTabListener listener = (ITerminalTabListener) l[i]; + ISafeRunnable job = new ISafeRunnable() { + @Override + public void handleException(Throwable exception) { + // already logged in Platform#run() + } + + @Override + public void run() throws Exception { + switch (event) { + case TAB_DISPOSED: + listener.terminalTabDisposed(source, data); + break; + default: + } + } + }; + SafeRunner.run(job); + } + } + + /** + * Executes the given runnable operation and invokes the given callback, if any, + * after the operation finished. + * + * @param properties The terminal properties. Must not be null. + * @param runnable The terminal service runnable. Must not be null. + * @param done The callback to invoke if the operation has been finished or null. + */ + protected final void executeServiceOperation(final Map properties, final TerminalServiceRunnable runnable, final Done done) { + Assert.isNotNull(properties); + Assert.isNotNull(runnable); + + // Extract the properties + String id = (String)properties.get(ITerminalsConnectorConstants.PROP_ID); + String secondaryId = (String)properties.get(ITerminalsConnectorConstants.PROP_SECONDARY_ID); + String title = (String)properties.get(ITerminalsConnectorConstants.PROP_TITLE); + Object data = properties.get(ITerminalsConnectorConstants.PROP_DATA); + + // Normalize the terminals console view id + id = normalizeId(id, data); + // Normalize the terminal console tab title + title = normalizeTitle(title, data); + + // Create the terminal connector instance + final ITerminalConnector connector = createTerminalConnector(properties); + if (connector == null) { + // Properties contain invalid connector arguments + if (done != null) { + Exception e = new IllegalArgumentException(Messages.TerminalService_error_cannotCreateConnector); + done.done(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), e.getLocalizedMessage(), e)); + } + return; + } + + // Finalize the used variables + final String finId = id; + final String finSecondaryId = secondaryId; + final String finTitle = title; + final Object finData = data; + + // Execute the operation + if (!runnable.isExecuteAsync()) { + runnable.run(finId, finSecondaryId, finTitle, connector, finData, done); + } + else { + try { + Display display = PlatformUI.getWorkbench().getDisplay(); + display.asyncExec(new Runnable() { + @Override + public void run() { + runnable.run(finId, finSecondaryId, finTitle, connector, finData, done); + } + }); + } + catch (Exception e) { + // if display is disposed, silently ignore. + } + } + } + + /** + * Normalize the terminals view id. + * + * @param id The terminals view id or null. + * @param data The custom data object or null. + * + * @return The normalized terminals console view id. + */ + protected String normalizeId(String id, Object data) { + return id != null ? id : IUIConstants.ID; + } + + /** + * Normalize the terminal tab title. + * + * @param title The terminal tab title or null. + * @param data The custom data object or null. + * + * @return The normalized terminal tab title. + */ + protected String normalizeTitle(String title, Object data) { + // If the title is explicitly specified, return as is + if (title != null) return title; + + // Return the default console title in all other cases + return Messages.TerminalService_defaultTitle; + } + + /** + * Creates the terminal connector configured within the given properties. + * + * @param properties The terminal console properties. Must not be null. + * @return The terminal connector or null. + */ + protected ITerminalConnector createTerminalConnector(Map properties) { + Assert.isNotNull(properties); + + // The terminal connector result object + ITerminalConnector connector = null; + + // Get the launcher delegate id from the properties + String delegateId = (String)properties.get(ITerminalsConnectorConstants.PROP_DELEGATE_ID); + if (delegateId != null) { + // Get the launcher delegate + ILauncherDelegate delegate = LauncherDelegateManager.getInstance().getLauncherDelegate(delegateId, false); + if (delegate != null) { + // Create the terminal connector + connector = delegate.createTerminalConnector(properties); + } + } + + return connector; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService#openConsole(java.util.Map, org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done) + */ + @Override + public void openConsole(final Map properties, final Done done) { + Assert.isNotNull(properties); + final boolean restoringView = fRestoringView; + + executeServiceOperation(properties, new TerminalServiceRunnable() { + @Override + @SuppressWarnings("synthetic-access") + public void run(final String id, final String secondaryId, final String title, + final ITerminalConnector connector, final Object data, final Done done) { + if (restoringView) { + doRun(id, secondaryId, title, connector, data, done); + } else { + // First, restore the view. This opens consoles from the memento + fRestoringView = true; + ConsoleManager.getInstance().showConsoleView(id, secondaryId); + fRestoringView = false; + + // After that schedule opening the requested console + try { + Display display = PlatformUI.getWorkbench().getDisplay(); + display.asyncExec(new Runnable() { + @Override + public void run() { + doRun(id, secondaryId, title, connector, data, done); + } + }); + } + catch (Exception e) { + // if display is disposed, silently ignore. + } + } + } + + public void doRun(String id, String secondaryId, String title, ITerminalConnector connector, Object data, Done done) { + // Determine the terminal encoding + String encoding = (String)properties.get(ITerminalsConnectorConstants.PROP_ENCODING); + // Create the flags to pass on to openConsole + Map flags = new HashMap(); + flags.put("activate", Boolean.TRUE); //$NON-NLS-1$ + if (properties.get(ITerminalsConnectorConstants.PROP_FORCE_NEW) instanceof Boolean) { + flags.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, (Boolean)properties.get(ITerminalsConnectorConstants.PROP_FORCE_NEW)); + } + if (properties.get(ITerminalsConnectorConstants.PROP_DATA_NO_RECONNECT) instanceof Boolean) { + flags.put(ITerminalsConnectorConstants.PROP_DATA_NO_RECONNECT, (Boolean)properties.get(ITerminalsConnectorConstants.PROP_DATA_NO_RECONNECT)); + } + // Open the new console + CTabItem item; + if (secondaryId != null) + item = ConsoleManager.getInstance().openConsole(id, secondaryId, title, encoding, connector, data, flags); + else + item = ConsoleManager.getInstance().openConsole(id, title, encoding, connector, data, flags); + // Associate the original terminal properties with the tab item. + // This makes it easier to persist the connection data within the memento handler + if (item != null && !item.isDisposed()) item.setData("properties", properties); //$NON-NLS-1$ + + // Invoke the callback + if (done != null) done.done(Status.OK_STATUS); + } + }, done); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService#closeConsole(java.util.Map, org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done) + */ + @Override + public void closeConsole(final Map properties, final Done done) { + Assert.isNotNull(properties); + + executeServiceOperation(properties, new TerminalServiceRunnable() { + @Override + public void run(String id, String secondaryId, String title, ITerminalConnector connector, Object data, Done done) { + // Close the console + ConsoleManager.getInstance().closeConsole(id, title, connector, data); + // Invoke the callback + if (done != null) done.done(Status.OK_STATUS); + } + }, done); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService#terminateConsole(java.util.Map, org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done) + */ + @Override + public void terminateConsole(Map properties, Done done) { + Assert.isNotNull(properties); + + executeServiceOperation(properties, new TerminalServiceRunnable() { + @Override + public void run(String id, String secondaryId, String title, ITerminalConnector connector, Object data, Done done) { + // Close the console + ConsoleManager.getInstance().terminateConsole(id, title, connector, data); + // Invoke the callback + if (done != null) done.done(Status.OK_STATUS); + } + }, done); + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/AbstractStreamsConnector.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/AbstractStreamsConnector.java new file mode 100644 index 00000000000..51496bcbf2a --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/AbstractStreamsConnector.java @@ -0,0 +1,174 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.streams; + +import java.io.InputStream; +import java.io.OutputStream; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalServiceOutputStreamMonitorListener; +import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl; +import org.eclipse.tm.internal.terminal.provisional.api.provider.TerminalConnectorImpl; +import org.eclipse.ui.services.IDisposable; + +/** + * Streams connector implementation. + */ +@SuppressWarnings("restriction") +public abstract class AbstractStreamsConnector extends TerminalConnectorImpl { + // Reference to the stdin monitor + private InputStreamMonitor stdInMonitor; + // Reference to the stdout monitor + private OutputStreamMonitor stdOutMonitor; + // Reference to the stderr monitor + private OutputStreamMonitor stdErrMonitor; + + // Reference to the list of stdout output listeners + private ITerminalServiceOutputStreamMonitorListener[] stdoutListeners = null; + // Reference to the list of stderr output listeners + private ITerminalServiceOutputStreamMonitorListener[] stderrListeners = null; + + /** + * Set the list of stdout listeners. + * + * @param listeners The list of stdout listeners or null. + */ + protected final void setStdoutListeners(ITerminalServiceOutputStreamMonitorListener[] listeners) { + this.stdoutListeners = listeners; + } + + /** + * Set the list of stderr listeners. + * + * @param listeners The list of stderr listeners or null. + */ + protected final void setStderrListeners(ITerminalServiceOutputStreamMonitorListener[] listeners) { + this.stderrListeners = listeners; + } + + /** + * Connect the given streams. The streams connector will wrap each stream + * with a corresponding terminal stream monitor. + * + * @param terminalControl The terminal control. Must not be null. + * @param stdin The stdin stream or null. + * @param stdout The stdout stream or null. + * @param stderr The stderr stream or null. + * @param localEcho Local echo on or off. + * @param lineSeparator The line separator used by the stream. + */ + protected void connectStreams(ITerminalControl terminalControl, OutputStream stdin, InputStream stdout, InputStream stderr, boolean localEcho, String lineSeparator) { + Assert.isNotNull(terminalControl); + + // Create the input stream monitor + if (stdin != null) { + stdInMonitor = createStdInMonitor(terminalControl, stdin, localEcho, lineSeparator); + // Register the connector if it implements IDisposable and stdout/stderr are not monitored + if (stdout == null && stderr == null && this instanceof IDisposable) stdInMonitor.addDisposable((IDisposable)this); + // Start the monitoring + stdInMonitor.startMonitoring(); + } + + // Create the output stream monitor + if (stdout != null) { + stdOutMonitor = createStdOutMonitor(terminalControl, stdout, lineSeparator); + // Register the connector if it implements IDisposable + if (this instanceof IDisposable) stdOutMonitor.addDisposable((IDisposable)this); + // Register the listeners + if (stdoutListeners != null) { + for (ITerminalServiceOutputStreamMonitorListener l : stdoutListeners) { + stdOutMonitor.addListener(l); + } + } + // Start the monitoring + stdOutMonitor.startMonitoring(); + } + + // Create the error stream monitor + if (stderr != null) { + stdErrMonitor = createStdErrMonitor(terminalControl, stderr, lineSeparator); + // Register the connector if it implements IDisposable and stdout is not monitored + if (stdout == null && this instanceof IDisposable) stdErrMonitor.addDisposable((IDisposable)this); + // Register the listeners + if (stderrListeners != null) { + for (ITerminalServiceOutputStreamMonitorListener l : stderrListeners) { + stdErrMonitor.addListener(l); + } + } + // Start the monitoring + stdErrMonitor.startMonitoring(); + } + } + + /** + * Creates an stdin monitor for the given terminal control and stdin stream. + * Subclasses may override to create a specialized stream monitor. + * + * @param terminalControl The terminal control. Must not be null. + * @param stdin The stdin stream or null. + * @param localEcho Local echo on or off. + * @param lineSeparator The line separator used by the stream. + * + * @return input stream monitor + */ + protected InputStreamMonitor createStdInMonitor(ITerminalControl terminalControl, OutputStream stdin, boolean localEcho, String lineSeparator) { + return new InputStreamMonitor(terminalControl, stdin, localEcho, lineSeparator); + } + + /** + * Creates an stdout monitor for the given terminal control and stdout stream. + * Subclasses may override to create a specialized stream monitor. + * + * @param terminalControl The terminal control. Must not be null. + * @param stdout The stdout stream or null. + * @param lineSeparator The line separator used by the stream. + * + * @return output stream monitor + */ + protected OutputStreamMonitor createStdOutMonitor(ITerminalControl terminalControl, InputStream stdout, String lineSeparator) { + return new OutputStreamMonitor(terminalControl, stdout, lineSeparator); + } + + /** + * Creates an stderr monitor for the given terminal control and stderr stream. + * Subclasses may override to create a specialized stream monitor. + * + * @param terminalControl The terminal control. Must not be null. + * @param stderr The stderr stream or null. + * @param lineSeparator The line separator used by the stream. + * + * @return output stream monitor + */ + protected OutputStreamMonitor createStdErrMonitor(ITerminalControl terminalControl, InputStream stderr, String lineSeparator) { + return new OutputStreamMonitor(terminalControl, stderr, lineSeparator); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#doDisconnect() + */ + @Override + protected void doDisconnect() { + // Dispose the streams + if (stdInMonitor != null) { stdInMonitor.dispose(); stdInMonitor = null; } + if (stdOutMonitor != null) { stdOutMonitor.dispose(); stdOutMonitor = null; } + if (stdErrMonitor != null) { stdErrMonitor.dispose(); stdErrMonitor = null; } + + super.doDisconnect(); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#getTerminalToRemoteStream() + */ + @Override + public OutputStream getTerminalToRemoteStream() { + return stdInMonitor; + } + +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/InputStreamMonitor.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/InputStreamMonitor.java new file mode 100644 index 00000000000..486c7dfede1 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/InputStreamMonitor.java @@ -0,0 +1,368 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.streams; + +import java.io.IOException; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.osgi.util.NLS; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ILineSeparatorConstants; +import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin; +import org.eclipse.tcf.te.ui.terminals.nls.Messages; +import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl; +import org.eclipse.ui.services.IDisposable; + +/** + * Input stream monitor implementation. + *

    + * Note: The input is coming from the terminal. Therefore, the input + * stream monitor is attached to the stdin stream of the monitored (remote) process. + */ +@SuppressWarnings("restriction") +public class InputStreamMonitor extends OutputStream implements IDisposable { + // Reference to the parent terminal control + private final ITerminalControl terminalControl; + + // Reference to the monitored (output) stream + private final OutputStream stream; + + // Reference to the thread writing the stream + private volatile Thread thread; + + // Flag to mark the monitor disposed. When disposed, + // no further data is written from the monitored stream. + private volatile boolean disposed; + + // A list of object to dispose if this monitor is disposed + private final List disposables = new ArrayList(); + + // Queue to buffer the data to write to the output stream + private final Queue queue = new LinkedList(); + + // ***** Line separator replacement logic ***** + // ***** Adapted from org.eclipse.tcf.internal.terminal.local.LocalTerminalOutputStream ***** + + private final static int TERMINAL_SENDS_CR = 0; + private final static int TERMINAL_SENDS_CRLF = 1; + private final static int PROGRAM_EXPECTS_LF = 0; + private final static int PROGRAM_EXPECTS_CRLF = 1; + private final static int PROGRAM_EXPECTS_CR = 2; + private final static int NO_CHANGE = 0; + private final static int CHANGE_CR_TO_LF = 1; + private final static int INSERT_LF_AFTER_CR = 2; + private final static int REMOVE_CR = 3; + private final static int REMOVE_LF = 4; + + // CRLF conversion table: + // + // Expected line separator --> | LF | CRLF | CR | + // ------------------------------------+-----------------+--------------------+----------------+ + // Local echo off - control sends CR | change CR to LF | insert LF after CR | no change | + // ------------------------------------+-----------------+--------------------+----------------+ + // Local echo on - control sends CRLF | remove CR | no change | remove LF | + // + private final static int[][] CRLF_REPLACEMENT = { + + {CHANGE_CR_TO_LF, INSERT_LF_AFTER_CR, NO_CHANGE}, + {REMOVE_CR, NO_CHANGE, REMOVE_LF} + }; + + private int replacement; + + /** + * Constructor. + * + * @param terminalControl The parent terminal control. Must not be null. + * @param stream The stream. Must not be null. + * @param localEcho Local echo on or off. + * @param lineSeparator The line separator used by the stream. + */ + public InputStreamMonitor(ITerminalControl terminalControl, OutputStream stream, boolean localEcho, String lineSeparator) { + super(); + + Assert.isNotNull(terminalControl); + this.terminalControl = terminalControl; + Assert.isNotNull(stream); + this.stream = stream; + + // Determine the line separator replacement setting + int terminalSends = localEcho ? TERMINAL_SENDS_CRLF : TERMINAL_SENDS_CR; + if (lineSeparator == null) { + replacement = NO_CHANGE; + } else { + int programExpects; + if (lineSeparator.equals(ILineSeparatorConstants.LINE_SEPARATOR_LF)) { + programExpects = PROGRAM_EXPECTS_LF; + } + else if (lineSeparator.equals(ILineSeparatorConstants.LINE_SEPARATOR_CR)) { + programExpects = PROGRAM_EXPECTS_CR; + } + else { + programExpects = PROGRAM_EXPECTS_CRLF; + } + replacement = CRLF_REPLACEMENT[terminalSends][programExpects]; + } + + } + + /** + * Returns the associated terminal control. + * + * @return The associated terminal control. + */ + protected final ITerminalControl getTerminalControl() { + return terminalControl; + } + + /** + * Adds the given disposable object to the list. The method will do nothing + * if either the disposable object is already part of the list or the monitor + * is disposed. + * + * @param disposable The disposable object. Must not be null. + */ + public final void addDisposable(IDisposable disposable) { + Assert.isNotNull(disposable); + if (!disposed && !disposables.contains(disposable)) disposables.add(disposable); + } + + /** + * Removes the disposable object from the list. + * + * @param disposable The disposable object. Must not be null. + */ + public final void removeDisposable(IDisposable disposable) { + Assert.isNotNull(disposable); + disposables.remove(disposable); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.services.IDisposable#dispose() + */ + @Override + public void dispose() { + // If already disposed --> return immediately + if (disposed) return; + + // Mark the monitor disposed + disposed = true; + + // Close the stream (ignore exceptions on close) + try { stream.close(); } catch (IOException e) { /* ignored on purpose */ } + // And interrupt the thread + close(); + + // Dispose all registered disposable objects + for (IDisposable disposable : disposables) disposable.dispose(); + // Clear the list + disposables.clear(); + } + + /** + * Close the terminal input stream monitor. + */ + @Override + public void close() { + // Not initialized -> return immediately + if (thread == null) return; + + // Copy the reference + final Thread oldThread = thread; + // Unlink the monitor from the thread + thread = null; + // And interrupt the writer thread + oldThread.interrupt(); + } + + /** + * Starts the terminal output stream monitor. + */ + public void startMonitoring() { + // If already initialized -> return immediately + if (thread != null) return; + + // Create a new runnable which is constantly reading from the stream + Runnable runnable = new Runnable() { + @Override + public void run() { + writeStream(); + } + }; + + // Create the writer thread + thread = new Thread(runnable, "Terminal Input Stream Monitor Thread"); //$NON-NLS-1$ + + // Configure the writer thread + thread.setDaemon(true); + + // Start the processing + thread.start(); + } + + + /** + * Reads from the queue and writes the read content to the stream. + */ + protected void writeStream() { + // Read from the queue and write to the stream until disposed + outer: while (thread != null && !disposed) { + byte[] data; + // If the queue is empty, wait until notified + synchronized(queue) { + while (queue.isEmpty()) { + if (disposed) break outer; + try { + queue.wait(); + } catch (InterruptedException e) { + break outer; + } + } + // Retrieves the queue head (is null if queue is empty (should never happen)) + data = queue.poll(); + } + if (data != null) { + try { + // Break up writes into max 1000 byte junks to avoid console input buffer overflows on Windows + int written = 0; + byte[] buf = new byte[1000]; + while (written < data.length) { + int len = Math.min(buf.length, data.length - written); + System.arraycopy(data, written, buf, 0, len); + // Write the data to the stream + stream.write(buf, 0, len); + written += len; + // Flush the stream immediately + stream.flush(); + // Wait a little between writes to allow input being processed + if (written < data.length) + Thread.sleep(100); + } + } catch (IOException e) { + // IOException received. If this is happening when already disposed -> ignore + if (!disposed) { + IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), + NLS.bind(Messages.InputStreamMonitor_error_writingToStream, e.getLocalizedMessage()), e); + UIPlugin.getDefault().getLog().log(status); + } + } + catch (InterruptedException e) { + break; + } + } + } + + // Dispose the stream + dispose(); + } + + /* (non-Javadoc) + * @see java.io.OutputStream#write(int) + */ + @Override + public void write(int b) throws IOException { + synchronized(queue) { + queue.add(new byte[] { (byte)b }); + queue.notifyAll(); + } + } + + /* (non-Javadoc) + * @see java.io.OutputStream#write(byte[], int, int) + */ + @Override + public void write(byte[] b, int off, int len) throws IOException { + // Write the whole block to the queue to avoid synchronization + // to happen for every byte. To do so, we have to avoid calling + // the super method. Therefore we have to do the same checking + // here as the base class does. + + // Null check. See the implementation in OutputStream. + if (b == null) throw new NullPointerException(); + + // Boundary check. See the implementation in OutputStream. + if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0)) { + throw new IndexOutOfBoundsException(); + } + else if (len == 0) { + return; + } + + // Make sure that the written block is not interlaced with other input. + synchronized(queue) { + // Preprocess the block to be written + byte[] processedBytes = onWriteContentToStream(b, off, len); + // If the returned array is not the original one, adjust offset and length + if (processedBytes != b) { + off = 0; len = processedBytes.length; b = processedBytes; + } + + // Get the content from the byte buffer specified by offset and length + byte[] bytes = new byte[len]; + int j = 0; + for (int i = 0 ; i < len ; i++) { + bytes[j++] = b[off + i]; + } + + queue.add(bytes); + queue.notifyAll(); + } + } + + /** + * Allow for processing of data from byte stream from the terminal before + * it is written to the output stream. If the returned byte array is different + * than the one that was passed in with the bytes argument, then the + * length value will be adapted. + * + * @param bytes The byte stream. Must not be null. + * @param off The offset. + * @param len the length. + * + * @return The processed byte stream. + * + */ + protected byte[] onWriteContentToStream(byte[] bytes, int off, int len) { + Assert.isNotNull(bytes); + + if (replacement != NO_CHANGE && len > 0) { + String origText = new String(bytes, off, len); + String text = null; + // + // TODO: check whether this is correct! new String(byte[], int, int) always uses the default + // encoding! + + if (replacement == CHANGE_CR_TO_LF) { + text = origText.replace('\r', '\n'); + } + else if (replacement == INSERT_LF_AFTER_CR) { + text = origText.replaceAll("\r\n|\r", "\r\n"); //$NON-NLS-1$ //$NON-NLS-2$ + } + else if (replacement == REMOVE_CR) { + text = origText.replaceAll(ILineSeparatorConstants.LINE_SEPARATOR_CR, ""); //$NON-NLS-1$ + } + else if (replacement == REMOVE_LF) { + text = origText.replaceAll(ILineSeparatorConstants.LINE_SEPARATOR_LF, ""); //$NON-NLS-1$ + } + + if (text != null && !origText.equals(text)) { + bytes = text.getBytes(); + } + } + + return bytes; + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/OutputStreamMonitor.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/OutputStreamMonitor.java new file mode 100644 index 00000000000..ddfbba64424 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/OutputStreamMonitor.java @@ -0,0 +1,319 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.streams; + +import java.io.BufferedInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.ListenerList; +import org.eclipse.core.runtime.Status; +import org.eclipse.osgi.util.NLS; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalServiceOutputStreamMonitorListener; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ILineSeparatorConstants; +import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin; +import org.eclipse.tcf.te.ui.terminals.interfaces.tracing.ITraceIds; +import org.eclipse.tcf.te.ui.terminals.nls.Messages; +import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl; +import org.eclipse.ui.services.IDisposable; + +/** + * Output stream monitor implementation. + *

    + * Note: The output is going to the terminal. Therefore, the output + * stream monitor is attached to the stdout and/or stderr stream of the monitored + * (remote) process. + */ +@SuppressWarnings("restriction") +public class OutputStreamMonitor implements IDisposable { + // The default buffer size to use + private static final int BUFFER_SIZE = 8192; + + // Reference to the parent terminal control + private final ITerminalControl terminalControl; + + // Reference to the monitored (input) stream + private final InputStream stream; + + // The line separator used by the monitored (input) stream + private final String lineSeparator; + + // Reference to the thread reading the stream + private Thread thread; + + // Flag to mark the monitor disposed. When disposed, + // no further data is read from the monitored stream. + private boolean disposed; + + // A list of object to dispose if this monitor is disposed + private final List disposables = new ArrayList(); + + // The list of registered listener + private final ListenerList listeners; + + /** + * Constructor. + * + * @param terminalControl The parent terminal control. Must not be null. + * @param stream The stream. Must not be null. + * @param lineSeparator The line separator used by the stream. + */ + public OutputStreamMonitor(ITerminalControl terminalControl, InputStream stream, String lineSeparator) { + super(); + + Assert.isNotNull(terminalControl); + this.terminalControl = terminalControl; + Assert.isNotNull(stream); + this.stream = new BufferedInputStream(stream, BUFFER_SIZE); + + this.lineSeparator = lineSeparator; + + this.listeners = new ListenerList(); + } + + /** + * Register a streams data receiver listener. + * + * @param listener The listener. Must not be null. + */ + public final void addListener(ITerminalServiceOutputStreamMonitorListener listener) { + Assert.isNotNull(listener); + listeners.add(listener); + } + + /** + * Unregister a streams data receiver listener. + * + * @param listener The listener. Must not be null. + */ + public final void removeListener(ITerminalServiceOutputStreamMonitorListener listener) { + Assert.isNotNull(listener); + listeners.remove(listener); + } + + /** + * Adds the given disposable object to the list. The method will do nothing + * if either the disposable object is already part of the list or the monitor + * is disposed. + * + * @param disposable The disposable object. Must not be null. + */ + public final void addDisposable(IDisposable disposable) { + Assert.isNotNull(disposable); + if (!disposed && !disposables.contains(disposable)) disposables.add(disposable); + } + + /** + * Removes the disposable object from the list. + * + * @param disposable The disposable object. Must not be null. + */ + public final void removeDisposable(IDisposable disposable) { + Assert.isNotNull(disposable); + disposables.remove(disposable); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.services.IDisposable#dispose() + */ + @Override + public void dispose() { + // If already disposed --> return immediately + if (disposed) return; + + // Mark the monitor disposed + disposed = true; + + // Close the stream (ignore exceptions on close) + try { stream.close(); } catch (IOException e) { /* ignored on purpose */ } + + // Dispose all registered disposable objects + for (IDisposable disposable : disposables) disposable.dispose(); + // Clear the list + disposables.clear(); + } + + /** + * Starts the terminal output stream monitor. + */ + protected void startMonitoring() { + // If already initialized -> return immediately + if (thread != null) return; + + // Create a new runnable which is constantly reading from the stream + Runnable runnable = new Runnable() { + @Override + public void run() { + readStream(); + } + }; + + // Create the reader thread + thread = new Thread(runnable, "Terminal Output Stream Monitor Thread"); //$NON-NLS-1$ + + // Configure the reader thread + thread.setDaemon(true); + thread.setPriority(Thread.MIN_PRIORITY); + + // Start the processing + thread.start(); + } + + /** + * Returns the terminal control that this stream monitor is associated with. + */ + protected ITerminalControl getTerminalControl() { + return terminalControl; + } + + /** + * Reads from the output stream and write the read content + * to the terminal control output stream. + */ + void readStream() { + // Creates the read buffer + byte[] readBuffer = new byte[BUFFER_SIZE]; + + // We need to maintain UI responsiveness but still stream the content + // to the terminal control fast. Put the thread to a short sleep each second. + long sleepMarker = System.currentTimeMillis(); + + // Read from the stream until EOS is reached or the + // monitor is marked disposed. + int read = 0; + while (read >= 0 && !disposed) { + try { + // Read from the stream + read = stream.read(readBuffer); + // If some data has been read, append to the terminal + // control output stream + if (read > 0) { + // Allow for post processing the read content before appending + byte[] processedReadBuffer = onContentReadFromStream(readBuffer, read); + if (processedReadBuffer != readBuffer) { + read = processedReadBuffer.length; + } + terminalControl.getRemoteToTerminalOutputStream().write(processedReadBuffer, 0, read); + } + } catch (IOException e) { + // IOException received. If this is happening when already disposed -> ignore + if (!disposed) { + IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), + NLS.bind(Messages.OutputStreamMonitor_error_readingFromStream, e.getLocalizedMessage()), e); + UIPlugin.getDefault().getLog().log(status); + } + break; + } catch (NullPointerException e) { + // killing the stream monitor while reading can cause an NPE + // when reading from the stream + if (!disposed && thread != null) { + IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), + NLS.bind(Messages.OutputStreamMonitor_error_readingFromStream, e.getLocalizedMessage()), e); + UIPlugin.getDefault().getLog().log(status); + } + break; + } + + // See above -> Thread will go to sleep each second + if (System.currentTimeMillis() - sleepMarker > 1000) { + sleepMarker = System.currentTimeMillis(); + try { Thread.sleep(1); } catch (InterruptedException e) { /* ignored on purpose */ } + } + } + + // Dispose ourself + dispose(); + } + + /** + * Allow for processing of data from byte stream after it is read from + * client but before it is appended to the terminal. If the returned byte + * array is different than the one that was passed in with the byteBuffer + * argument, then the bytesRead value will be ignored and the full + * returned array will be written out. + * + * @param byteBuffer The byte stream. Must not be null. + * @param bytesRead The number of bytes that were read into the read buffer. + * @return The processed byte stream. + * + */ + protected byte[] onContentReadFromStream(byte[] byteBuffer, int bytesRead) { + Assert.isNotNull(byteBuffer); + + // If tracing is enabled, print out the decimal byte values read + if (UIPlugin.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_OUTPUT_STREAM_MONITOR)) { + StringBuilder debug = new StringBuilder("byteBuffer [decimal, " + bytesRead + " bytes] : "); //$NON-NLS-1$ //$NON-NLS-2$ + for (int i = 0; i < bytesRead; i++) { + debug.append(Byte.valueOf(byteBuffer[i]).intValue()); + debug.append(' '); + } + System.out.println(debug.toString()); + } + + // Remember if the text got changed. + boolean changed = false; + + // How can me make sure that we don't mess with the encoding here? + String text = new String(byteBuffer, 0, bytesRead); + + // Shift-In (14) and Shift-Out(15) confuses the terminal widget + if (text.indexOf(14) != -1 || text.indexOf(15) != -1) { + text = text.replaceAll("\\x0e", "").replaceAll("\\x0f", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + changed = true; + } + + // Check on the line separator setting + if (lineSeparator != null + && !ILineSeparatorConstants.LINE_SEPARATOR_CRLF.equals(lineSeparator)) { + String separator = ILineSeparatorConstants.LINE_SEPARATOR_LF.equals(lineSeparator) ? "\n" : "\r"; //$NON-NLS-1$ //$NON-NLS-2$ + String separator2 = ILineSeparatorConstants.LINE_SEPARATOR_LF.equals(lineSeparator) ? "\r" : "\n"; //$NON-NLS-1$ //$NON-NLS-2$ + + if (text.indexOf(separator) != -1) { + String[] fragments = text.split(separator); + StringBuilder b = new StringBuilder(); + for (int i = 0; i < fragments.length; i++) { + String fragment = fragments[i]; + String nextFragment = i + 1 < fragments.length ? fragments[i + 1] : null; + b.append(fragment); + if (fragment.endsWith(separator2) || (nextFragment != null && nextFragment.startsWith(separator2))) { + // Both separators are found, just add the original separator + b.append(separator); + } else { + b.append("\n\r"); //$NON-NLS-1$ + } + } + if (!text.equals(b.toString())) { + text = b.toString(); + changed = true; + } + } + } + + // If changed, get the new bytes array + if (changed) { + byteBuffer = text.getBytes(); + bytesRead = byteBuffer.length; + } + + // If listeners are registered, invoke the listeners now. + if (listeners.size() > 0) { + for (Object candidate : listeners.getListeners()) { + if (!(candidate instanceof ITerminalServiceOutputStreamMonitorListener)) continue; + ((ITerminalServiceOutputStreamMonitorListener)candidate).onContentReadFromStream(byteBuffer, bytesRead); + } + } + + return byteBuffer; + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsConnector.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsConnector.java new file mode 100644 index 00000000000..e9bddcba853 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsConnector.java @@ -0,0 +1,117 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.streams; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore; +import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl; +import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; +import org.eclipse.ui.services.IDisposable; + +/** + * Streams connector implementation. + */ +@SuppressWarnings("restriction") +public class StreamsConnector extends AbstractStreamsConnector implements IDisposable { + // Reference to the streams settings + private final StreamsSettings settings; + + /** + * Constructor. + */ + public StreamsConnector() { + this(new StreamsSettings()); + } + + /** + * Constructor. + * + * @param settings The streams settings. Must not be null + */ + public StreamsConnector(StreamsSettings settings) { + super(); + + Assert.isNotNull(settings); + this.settings = settings; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#connect(org.eclipse.tcf.internal.terminal.provisional.api.ITerminalControl) + */ + @Override + public void connect(ITerminalControl control) { + Assert.isNotNull(control); + super.connect(control); + + // Setup the listeners + setStdoutListeners(settings.getStdOutListeners()); + setStderrListeners(settings.getStdErrListeners()); + + // connect the streams + connectStreams(control, settings.getStdinStream(), settings.getStdoutStream(), settings.getStderrStream(), settings.isLocalEcho(), settings.getLineSeparator()); + + // Set the terminal control state to CONNECTED + control.setState(TerminalState.CONNECTED); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#isLocalEcho() + */ + @Override + public boolean isLocalEcho() { + return settings.isLocalEcho(); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.services.IDisposable#dispose() + */ + @Override + public void dispose() { + disconnect(); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#doDisconnect() + */ + @Override + public void doDisconnect() { + // Dispose the streams + super.doDisconnect(); + + // Set the terminal control state to CLOSED. + fControl.setState(TerminalState.CLOSED); + } + + // ***** Process Connector settings handling ***** + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#getSettingsSummary() + */ + @Override + public String getSettingsSummary() { + return ""; //$NON-NLS-1$ + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#load(org.eclipse.tcf.internal.terminal.provisional.api.ISettingsStore) + */ + @Override + public void load(ISettingsStore store) { + settings.load(store); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#save(org.eclipse.tcf.internal.terminal.provisional.api.ISettingsStore) + */ + @Override + public void save(ISettingsStore store) { + settings.save(store); + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsLauncherDelegate.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsLauncherDelegate.java new file mode 100644 index 00000000000..6d492e7ba86 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsLauncherDelegate.java @@ -0,0 +1,115 @@ +/******************************************************************************* + * Copyright (c) 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.streams; + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.tcf.te.core.terminals.TerminalServiceFactory; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalServiceOutputStreamMonitorListener; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer; +import org.eclipse.tcf.te.ui.terminals.internal.SettingsStore; +import org.eclipse.tcf.te.ui.terminals.launcher.AbstractLauncherDelegate; +import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore; +import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector; +import org.eclipse.tm.internal.terminal.provisional.api.TerminalConnectorExtension; + +/** + * Streams launcher delegate implementation. + */ +@SuppressWarnings("restriction") +public class StreamsLauncherDelegate extends AbstractLauncherDelegate { + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#needsUserConfiguration() + */ + @Override + public boolean needsUserConfiguration() { + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer) + */ + @Override + public IConfigurationPanel getPanel(IConfigurationPanelContainer container) { + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#execute(java.util.Map, org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done) + */ + @Override + public void execute(Map properties, Done done) { + Assert.isNotNull(properties); + + // Get the terminal service + ITerminalService terminal = TerminalServiceFactory.getService(); + // If not available, we cannot fulfill this request + if (terminal != null) { + terminal.openConsole(properties, done); + } + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#createTerminalConnector(java.util.Map) + */ + @Override + public ITerminalConnector createTerminalConnector(Map properties) { + Assert.isNotNull(properties); + + // Check for the terminal connector id + String connectorId = (String)properties.get(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID); + if (connectorId == null) connectorId = "org.eclipse.tcf.te.ui.terminals.StreamsConnector"; //$NON-NLS-1$ + + // Extract the streams properties + OutputStream stdin = (OutputStream)properties.get(ITerminalsConnectorConstants.PROP_STREAMS_STDIN); + InputStream stdout = (InputStream)properties.get(ITerminalsConnectorConstants.PROP_STREAMS_STDOUT); + InputStream stderr = (InputStream)properties.get(ITerminalsConnectorConstants.PROP_STREAMS_STDERR); + Object value = properties.get(ITerminalsConnectorConstants.PROP_LOCAL_ECHO); + boolean localEcho = value instanceof Boolean ? ((Boolean)value).booleanValue() : false; + String lineSeparator = (String)properties.get(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR); + ITerminalServiceOutputStreamMonitorListener[] stdoutListeners = (ITerminalServiceOutputStreamMonitorListener[])properties.get(ITerminalsConnectorConstants.PROP_STDOUT_LISTENERS); + ITerminalServiceOutputStreamMonitorListener[] stderrListeners = (ITerminalServiceOutputStreamMonitorListener[])properties.get(ITerminalsConnectorConstants.PROP_STDERR_LISTENERS); + + // Construct the terminal settings store + ISettingsStore store = new SettingsStore(); + + // Construct the streams settings + StreamsSettings streamsSettings = new StreamsSettings(); + streamsSettings.setStdinStream(stdin); + streamsSettings.setStdoutStream(stdout); + streamsSettings.setStderrStream(stderr); + streamsSettings.setLocalEcho(localEcho); + streamsSettings.setLineSeparator(lineSeparator); + streamsSettings.setStdOutListeners(stdoutListeners); + streamsSettings.setStdErrListeners(stderrListeners); + // And save the settings to the store + streamsSettings.save(store); + + // Construct the terminal connector instance + ITerminalConnector connector = TerminalConnectorExtension.makeTerminalConnector(connectorId); + if (connector != null) { + // Apply default settings + connector.makeSettingsPage(); + // And load the real settings + connector.load(store); + } + + return connector; + } + +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsSettings.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsSettings.java new file mode 100644 index 00000000000..dcaaac457ed --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/streams/StreamsSettings.java @@ -0,0 +1,202 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.streams; + +import java.io.InputStream; +import java.io.OutputStream; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalServiceOutputStreamMonitorListener; +import org.eclipse.tcf.te.ui.terminals.internal.SettingsStore; +import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore; + +/** + * Streams connector settings implementation. + */ +@SuppressWarnings("restriction") +public class StreamsSettings { + // Reference to the stdin stream + private OutputStream stdin; + // Reference to the stdout stream + private InputStream stdout; + // Reference to the stderr stream + private InputStream stderr; + // Flag to control the local echo + private boolean localEcho = true; + // The line separator setting + private String lineSeparator = null; + // The list of stdout output listeners + private ITerminalServiceOutputStreamMonitorListener[] stdoutListeners = null; + // The list of stderr output listeners + private ITerminalServiceOutputStreamMonitorListener[] stderrListeners = null; + + /** + * Sets the stdin stream instance. + * + * @param stdin The stream instance or null. + */ + public void setStdinStream(OutputStream stdin) { + this.stdin = stdin; + } + + /** + * Returns the stdin stream instance. + * + * @return The stream instance or null. + */ + public OutputStream getStdinStream() { + return stdin; + } + + /** + * Sets the stdout stream instance. + * + * @param stdout The stream instance or null. + */ + public void setStdoutStream(InputStream stdout) { + this.stdout = stdout; + } + + /** + * Returns the stdout stream instance. + * + * @return The stream instance or null. + */ + public InputStream getStdoutStream() { + return stdout; + } + + /** + * Sets the stderr stream instance. + * + * @param stderr The stream instance or null. + */ + public void setStderrStream(InputStream stderr) { + this.stderr = stderr; + } + + /** + * Returns the stderr stream instance. + * + * @return The stream instance or null. + */ + public InputStream getStderrStream() { + return stderr; + } + + /** + * Sets if the process requires a local echo from the terminal widget. + * + * @param value Specify true to enable the local echo, false otherwise. + */ + public void setLocalEcho(boolean value) { + this.localEcho = value; + } + + /** + * Returns true if the process requires a local echo + * from the terminal widget. + * + * @return True if local echo is enabled, false otherwise. + */ + public boolean isLocalEcho() { + return localEcho; + } + + /** + * Sets the stream line separator. + * + * @param separator The stream line separator null. + */ + public void setLineSeparator(String separator) { + this.lineSeparator = separator; + } + + /** + * Returns the stream line separator. + * + * @return The stream line separator or null. + */ + public String getLineSeparator() { + return lineSeparator; + } + + /** + * Sets the list of stdout listeners. + * + * @param listeners The list of stdout listeners or null. + */ + public void setStdOutListeners(ITerminalServiceOutputStreamMonitorListener[] listeners) { + this.stdoutListeners = listeners; + } + + /** + * Returns the list of stdout listeners. + * + * @return The list of stdout listeners or null. + */ + public ITerminalServiceOutputStreamMonitorListener[] getStdOutListeners() { + return stdoutListeners; + } + + /** + * Sets the list of stderr listeners. + * + * @param listeners The list of stderr listeners or null. + */ + public void setStdErrListeners(ITerminalServiceOutputStreamMonitorListener[] listeners) { + this.stderrListeners = listeners; + } + + /** + * Returns the list of stderr listeners. + * + * @return The list of stderr listeners or null. + */ + public ITerminalServiceOutputStreamMonitorListener[] getStdErrListeners() { + return stderrListeners; + } + + /** + * Loads the streams settings from the given settings store. + * + * @param store The settings store. Must not be null. + */ + public void load(ISettingsStore store) { + Assert.isNotNull(store); + localEcho = Boolean.parseBoolean(store.get("LocalEcho", Boolean.FALSE.toString())); //$NON-NLS-1$ + lineSeparator = store.get("LineSeparator", null); //$NON-NLS-1$ + if (store instanceof SettingsStore) { + stdin = (OutputStream)((SettingsStore)store).getSettings().get("stdin"); //$NON-NLS-1$ + stdout = (InputStream)((SettingsStore)store).getSettings().get("stdout"); //$NON-NLS-1$ + stderr = (InputStream)((SettingsStore)store).getSettings().get("stderr"); //$NON-NLS-1$ + stdoutListeners = (ITerminalServiceOutputStreamMonitorListener[])((SettingsStore)store).getSettings().get("StdOutListeners"); //$NON-NLS-1$ + stderrListeners = (ITerminalServiceOutputStreamMonitorListener[])((SettingsStore)store).getSettings().get("StdErrListeners"); //$NON-NLS-1$ + } + } + + /** + * Saves the process settings to the given settings store. + * + * @param store The settings store. Must not be null. + */ + public void save(ISettingsStore store) { + Assert.isNotNull(store); + store.put("LocalEcho", Boolean.toString(localEcho)); //$NON-NLS-1$ + store.put("LineSeparator", lineSeparator); //$NON-NLS-1$ + if (store instanceof SettingsStore) { + ((SettingsStore)store).getSettings().put("stdin", stdin); //$NON-NLS-1$ + ((SettingsStore)store).getSettings().put("stdout", stdout); //$NON-NLS-1$ + ((SettingsStore)store).getSettings().put("stderr", stderr); //$NON-NLS-1$ + ((SettingsStore)store).getSettings().put("StdOutListeners", stdoutListeners); //$NON-NLS-1$ + ((SettingsStore)store).getSettings().put("StdErrListeners", stderrListeners); //$NON-NLS-1$ + } + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabCommandFieldHandler.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabCommandFieldHandler.java new file mode 100644 index 00000000000..c6f5e814da7 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabCommandFieldHandler.java @@ -0,0 +1,102 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.tabs; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.tm.internal.terminal.control.CommandInputFieldWithHistory; +import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; +import org.eclipse.ui.services.IDisposable; + +/** + * Tab command input field handler implementation. + */ +@SuppressWarnings("restriction") +public class TabCommandFieldHandler implements IDisposable, IAdaptable { + // Reference to the parent tab folder manager + private final TabFolderManager tabFolderManager; + // Reference to the associated tab + private final CTabItem item; + + // Reference to the command input field + private CommandInputFieldWithHistory field; + // The command field history + private String history; + + /** + * Constructor. + * + * @param tabFolderManager The parent tab folder manager. Must not be null + * @param item The associated tab item. Must not be null. + */ + public TabCommandFieldHandler(TabFolderManager tabFolderManager, CTabItem item) { + Assert.isNotNull(tabFolderManager); + this.tabFolderManager = tabFolderManager; + Assert.isNotNull(item); + this.item = item; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.services.IDisposable#dispose() + */ + @Override + public void dispose() { + field = null; + history = null; + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) + */ + @Override + public Object getAdapter(Class adapter) { + if (TabFolderManager.class.equals(adapter)) { + return tabFolderManager; + } + if (CTabItem.class.equals(adapter)) { + return item; + } + return null; + } + + /** + * Returns if or if not the associated tab item has the command input field enabled. + * + * @return True if the command input field is enabled, false otherwise. + */ + public boolean hasCommandInputField() { + return field != null; + } + + /** + * Set the command input field on or off. + * + * @param on True for on, false for off. + */ + public void setCommandInputField(boolean on) { + // save the old history + if (field != null) { + history = field.getHistory(); + field = null; + } + + if (on) { + field = new CommandInputFieldWithHistory(100); + field.setHistory(history); + } + + // Apply to the terminal control + Assert.isTrue(!item.isDisposed()); + ITerminalViewControl terminal = (ITerminalViewControl)item.getData(); + if (terminal != null) terminal.setCommandInputField(field); + } + +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabDisposeListener.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabDisposeListener.java new file mode 100644 index 00000000000..c4f08d92b96 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabDisposeListener.java @@ -0,0 +1,82 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.tabs; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.widgets.Control; +import org.eclipse.tcf.te.core.terminals.TerminalServiceFactory; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService; +import org.eclipse.tcf.te.ui.terminals.services.TerminalService; +import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; + +/** + * Terminals tab default dispose listener implementation. + */ +@SuppressWarnings("restriction") +public class TabDisposeListener implements DisposeListener { + private final TabFolderManager parentTabFolderManager; + + /** + * Constructor. + * + * @param parentTabFolderManager The parent tab folder manager. Must not be null + */ + public TabDisposeListener(TabFolderManager parentTabFolderManager) { + Assert.isNotNull(parentTabFolderManager); + this.parentTabFolderManager = parentTabFolderManager; + } + + /** + * Returns the parent terminal console tab folder manager instance. + * + * @return The parent terminal console tab folder manager instance. + */ + protected final TabFolderManager getParentTabFolderManager() { + return parentTabFolderManager; + } + + /* (non-Javadoc) + * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent) + */ + @Override + public void widgetDisposed(DisposeEvent e) { + // If a tab item gets disposed, we have to dispose the terminal as well + if (e.getSource() instanceof CTabItem) { + // Get the terminal control (if any) from the tab item + Object candidate = ((CTabItem)e.getSource()).getData(); + if (candidate instanceof ITerminalViewControl) { + ITerminalViewControl terminal = (ITerminalViewControl)candidate; + // Keep the context menu from being disposed + terminal.getControl().setMenu(null); + terminal.disposeTerminal(); + } + // Dispose the command input field handler + parentTabFolderManager.disposeTabCommandFieldHandler((CTabItem)e.getSource()); + // Dispose the tab item control + Control control = ((CTabItem) e.getSource()).getControl(); + if (control != null) control.dispose(); + + // If all items got removed, we have to switch back to the empty page control + if (parentTabFolderManager.getTabFolder() != null && parentTabFolderManager.getTabFolder().getItemCount() == 0) { + parentTabFolderManager.getParentView().switchToEmptyPageControl(); + } + // Fire selection changed event + parentTabFolderManager.fireSelectionChanged(); + // Fire the terminal console disposed event + ITerminalService service = TerminalServiceFactory.getService(); + if (service instanceof TerminalService) { + ((TerminalService)service).fireTerminalTabEvent(TerminalService.TAB_DISPOSED, e.getSource(), ((CTabItem)e.getSource()).getData("customData")); //$NON-NLS-1$ + } + } + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderManager.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderManager.java new file mode 100644 index 00000000000..9e4c96a0c86 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderManager.java @@ -0,0 +1,825 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.tabs; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.PlatformObject; +import org.eclipse.jface.action.IStatusLineManager; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.MouseListener; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin; +import org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView; +import org.eclipse.tcf.te.ui.terminals.interfaces.ImageConsts; +import org.eclipse.tcf.te.ui.terminals.nls.Messages; +import org.eclipse.tm.internal.terminal.control.ITerminalListener; +import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; +import org.eclipse.tm.internal.terminal.control.TerminalViewControlFactory; +import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector; +import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl; +import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; +import org.eclipse.ui.PlatformUI; + +/** + * Terminals tab folder manager. + */ +@SuppressWarnings({ "restriction" }) +public class TabFolderManager extends PlatformObject implements ISelectionProvider { + // Reference to the parent terminal consoles view + private final ITerminalsView parentView; + // Reference to the selection listener instance + private final SelectionListener selectionListener; + + /** + * List of selection changed listeners. + */ + private final List selectionChangedListeners = new ArrayList(); + + /** + * Map of tab command input field handler per tab item + */ + private final Map commandFieldHandler = new HashMap(); + + /** + * The terminal control selection listener implementation. + */ + private class TerminalControlSelectionListener implements DisposeListener, MouseListener { + private final ITerminalViewControl terminal; + private boolean selectMode; + + /** + * Constructor. + * + * @param terminal The terminal control. Must not be null. + */ + public TerminalControlSelectionListener(ITerminalViewControl terminal) { + Assert.isNotNull(terminal); + this.terminal = terminal; + + // Register ourself as the required listener + terminal.getControl().addDisposeListener(this); + terminal.getControl().addMouseListener(this); + } + + /** + * Returns the associated terminal view control. + * + * @return The terminal view control. + */ + protected final ITerminalViewControl getTerminal() { + return terminal; + } + + /* (non-Javadoc) + * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent) + */ + @Override + public void widgetDisposed(DisposeEvent e) { + // Widget got disposed, check if it is ours + // If a tab item gets disposed, we have to dispose the terminal as well + if (e.getSource().equals(terminal.getControl())) { + // Remove as listener + getTerminal().getControl().removeDisposeListener(this); + getTerminal().getControl().removeMouseListener(this); + } + } + + /* (non-Javadoc) + * @see org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events.MouseEvent) + */ + @Override + public void mouseDown(MouseEvent e) { + // Left button down -> select mode starts + if (e.button == 1) selectMode = true; + } + + /* (non-Javadoc) + * @see org.eclipse.swt.events.MouseListener#mouseUp(org.eclipse.swt.events.MouseEvent) + */ + @Override + public void mouseUp(MouseEvent e) { + if (e.button == 1 && selectMode) { + selectMode = false; + // Fire a selection changed event with the terminal controls selection + try { + Display display = PlatformUI.getWorkbench().getDisplay(); + display.asyncExec(new Runnable() { + @Override + public void run() { + fireSelectionChanged(new StructuredSelection(getTerminal().getSelection())); + } + }); + } + catch (Exception ex) { + // if display is disposed, silently ignore. + } + } + } + + /* (non-Javadoc) + * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt.events.MouseEvent) + */ + @Override + public void mouseDoubleClick(MouseEvent e) { + } + } + + /** + * Constructor. + * + * @param parentView The parent terminals console view. Must not be null. + */ + public TabFolderManager(ITerminalsView parentView) { + super(); + Assert.isNotNull(parentView); + this.parentView = parentView; + + // Attach a selection listener to the tab folder + selectionListener = doCreateTabFolderSelectionListener(this); + if (getTabFolder() != null) getTabFolder().addSelectionListener(selectionListener); + } + + /** + * Creates the terminal console tab folder selection listener instance. + * + * @param parent The parent terminal console tab folder manager. Must not be null. + * @return The selection listener instance. + */ + protected TabFolderSelectionListener doCreateTabFolderSelectionListener(TabFolderManager parent) { + Assert.isNotNull(parent); + return new TabFolderSelectionListener(parent); + } + + /** + * Returns the parent terminal consoles view. + * + * @return The terminal consoles view instance. + */ + protected final ITerminalsView getParentView() { + return parentView; + } + + /** + * Returns the tab folder associated with the parent view. + * + * @return The tab folder or null. + */ + protected final CTabFolder getTabFolder() { + return (CTabFolder)getParentView().getAdapter(CTabFolder.class); + } + + /** + * Returns the selection changed listeners currently registered. + * + * @return The registered selection changed listeners or an empty array. + */ + protected final ISelectionChangedListener[] getSelectionChangedListeners() { + return selectionChangedListeners.toArray(new ISelectionChangedListener[selectionChangedListeners.size()]); + } + + /** + * Dispose the tab folder manager instance. + */ + public void dispose() { + // Dispose the selection listener + if (getTabFolder() != null && !getTabFolder().isDisposed()) getTabFolder().removeSelectionListener(selectionListener); + // Dispose the tab command field handler + for (TabCommandFieldHandler handler : commandFieldHandler.values()) { + handler.dispose(); + } + commandFieldHandler.clear(); + } + + /** + * Creates a new tab item with the given title and connector. + * + * @param title The tab title. Must not be null. + * @param encoding The terminal encoding or null. + * @param connector The terminal connector. Must not be null. + * @param data The custom terminal data node or null. + * @param flags The flags controlling how the console is opened or null to use defaults. + * + * @return The created tab item or null if failed. + */ + @SuppressWarnings("unused") + public CTabItem createTabItem(String title, String encoding, ITerminalConnector connector, Object data, Map flags) { + Assert.isNotNull(title); + Assert.isNotNull(connector); + + // The result tab item + CTabItem item = null; + + // Get the tab folder from the parent viewer + CTabFolder tabFolder = getTabFolder(); + if (tabFolder != null) { + // Generate a unique title string for the new tab item (must be called before creating the item itself) + title = makeUniqueTitle(title, tabFolder); + // Create the tab item + item = new CTabItem(tabFolder, SWT.CLOSE); + // Set the tab item title + item.setText(title); + // Set the tab icon + Image image = getTabItemImage(connector, data); + if (image != null) item.setImage(image); + + // Setup the tab item listeners + setupTerminalTabListeners(item); + + // Create the composite to create the terminal control within + Composite composite = new Composite(tabFolder, SWT.NONE); + composite.setLayout(new FillLayout()); + // Associate the composite with the tab item + item.setControl(composite); + + // Refresh the layout + tabFolder.getParent().layout(true); + + // Create the terminal control + ITerminalViewControl terminal = TerminalViewControlFactory.makeControl(doCreateTerminalTabTerminalListener(this, item), composite, new ITerminalConnector[] { connector }, true); + if (terminal instanceof ITerminalControl) { + Object value = flags != null ? flags.get(ITerminalsConnectorConstants.PROP_DATA_NO_RECONNECT) : null; + boolean noReconnect = value instanceof Boolean ? ((Boolean)value).booleanValue() : false; + ((ITerminalControl)terminal).setConnectOnEnterIfClosed(!noReconnect); + } + + // Add middle mouse button paste support + addMiddleMouseButtonPasteSupport(terminal); + // Add the "selection" listener to the terminal control + new TerminalControlSelectionListener(terminal); + // Configure the terminal encoding + try { terminal.setEncoding(encoding); } catch (UnsupportedEncodingException e) { /* ignored on purpose */ } + // Associated the terminal with the tab item + item.setData(terminal); + // Associated the custom data node with the tab item (if any) + if (data != null) item.setData("customData", data); //$NON-NLS-1$ + + // Overwrite the text canvas help id + String contextHelpId = getParentView().getContextHelpId(); + if (contextHelpId != null) { + PlatformUI.getWorkbench().getHelpSystem().setHelp(terminal.getControl(), contextHelpId); + } + + // Set the context menu + TabFolderMenuHandler menuHandler = (TabFolderMenuHandler)getParentView().getAdapter(TabFolderMenuHandler.class); + if (menuHandler != null) { + Menu menu = (Menu)menuHandler.getAdapter(Menu.class); + if (menu != null) { + // One weird occurrence of IllegalArgumentException: Widget has wrong parent. + // Inspecting the code, this seem extremely unlikely. The terminal is created + // from a composite parent, the composite parent from the tab folder and the menu + // from the tab folder. Means, at the end all should have the same menu shell, shouldn't they? + try { + terminal.getControl().setMenu(menu); + } catch (IllegalArgumentException e) { + // Log exception only if debug mode is set to 1. + if (UIPlugin.getTraceHandler().isSlotEnabled(1, null)) { + e.printStackTrace(); + } + } + } + } + + // Select the created item within the tab folder + tabFolder.setSelection(item); + + // Set the connector + terminal.setConnector(connector); + + // And connect the terminal + terminal.connectTerminal(); + + // Fire selection changed event + fireSelectionChanged(); + } + + // Return the create tab item finally. + return item; + } + + /** + * Used for DnD of terminal tab items between terminal views + *

    + * Create a new tab item in the "dropped" terminal view using the + * information stored in the given item. + * + * @param oldItem The old dragged tab item. Must not be null. + * @return The new dropped tab item. + */ + @SuppressWarnings("unchecked") + public CTabItem cloneTabItemAfterDrop(CTabItem oldItem) { + Assert.isNotNull(oldItem); + + ITerminalViewControl terminal = (ITerminalViewControl)oldItem.getData(); + ITerminalConnector connector = terminal.getTerminalConnector(); + Object data = oldItem.getData("customData"); //$NON-NLS-1$ + Map properties = (Map)oldItem.getData("properties"); //$NON-NLS-1$ + String title = oldItem.getText(); + + // The result tab item + CTabItem item = null; + + // Get the tab folder from the parent viewer + CTabFolder tabFolder = getTabFolder(); + if (tabFolder != null) { + // Generate a unique title string for the new tab item (must be called before creating the item itself) + title = makeUniqueTitle(title, tabFolder); + // Create the tab item + item = new CTabItem(tabFolder, SWT.CLOSE); + // Set the tab item title + item.setText(title); + // Set the tab icon + Image image = getTabItemImage(connector, data); + if (image != null) item.setImage(image); + + // Setup the tab item listeners + setupTerminalTabListeners(item); + // Move the terminal listener to the new item + TabTerminalListener.move(oldItem, item); + + // Create the composite to create the terminal control within + Composite composite = new Composite(tabFolder, SWT.NONE); + composite.setLayout(new FillLayout()); + // Associate the composite with the tab item + item.setControl(composite); + + // Refresh the layout + tabFolder.getParent().layout(true); + + // Remember terminal state + TerminalState oldState = terminal.getState(); + + // Keep the context menu from being disposed + terminal.getControl().setMenu(null); + + // change the "parent". + Assert.isTrue(terminal instanceof ITerminalControl); + ((ITerminalControl)terminal).setupTerminal(composite); + + // Add middle mouse button paste support + addMiddleMouseButtonPasteSupport(terminal); + + item.setData(terminal); + + // Associate the custom data node with the tab item (if any) + if (data != null) item.setData("customData", data); //$NON-NLS-1$ + // Associate the properties with the tab item (if any) + if (properties != null) item.setData("properties", properties); //$NON-NLS-1$ + + // Overwrite the text canvas help id + String contextHelpId = getParentView().getContextHelpId(); + if (contextHelpId != null) { + PlatformUI.getWorkbench().getHelpSystem().setHelp(terminal.getControl(), contextHelpId); + } + + // Set the context menu + TabFolderMenuHandler menuHandler = (TabFolderMenuHandler)getParentView().getAdapter(TabFolderMenuHandler.class); + if (menuHandler != null) { + Menu menu = (Menu)menuHandler.getAdapter(Menu.class); + if (menu != null) { + // One weird occurrence of IllegalArgumentException: Widget has wrong parent. + // Inspecting the code, this seem extremely unlikely. The terminal is created + // from a composite parent, the composite parent from the tab folder and the menu + // from the tab folder. Means, at the end all should have the same menu shell, shouldn't they? + try { + terminal.getControl().setMenu(menu); + } catch (IllegalArgumentException e) { + // Log exception only if debug mode is set to 1. + if (UIPlugin.getTraceHandler().isSlotEnabled(1, null)) { + e.printStackTrace(); + } + } + } + } + + // Select the created item within the tab folder + tabFolder.setSelection(item); + + // Set the connector + terminal.setConnector(connector); + + // needed to get the focus and cursor + Assert.isTrue(terminal instanceof ITerminalControl); + ((ITerminalControl)terminal).setState(oldState); + + // Fire selection changed event + fireSelectionChanged(); + } + + // Return the create tab item finally. + return item; + } + + + protected void addMiddleMouseButtonPasteSupport(final ITerminalViewControl terminal) { + terminal.getControl().addMouseListener(new MouseAdapter(){ + @Override + public void mouseDown(MouseEvent e) { + // paste when the middle button is clicked + if (e.button == 2) { + Clipboard clipboard = terminal.getClipboard(); + if (clipboard.isDisposed()) return; + int clipboardType = DND.SELECTION_CLIPBOARD; + if (clipboard.getAvailableTypes(clipboardType).length == 0) + // use normal clipboard if selection clipboard is not available + clipboardType = DND.CLIPBOARD; + String text = (String) clipboard.getContents(TextTransfer.getInstance(), clipboardType); + if (text != null && text.length() > 0) + terminal.pasteString(text); + } + } + }); + } + + /** + * Generate a unique title string based on the given proposal. + * + * @param proposal The proposal. Must not be null. + * @return The unique title string. + */ + protected String makeUniqueTitle(String proposal, CTabFolder tabFolder) { + Assert.isNotNull(proposal); + Assert.isNotNull(tabFolder); + + String title = proposal; + int index = 0; + + // Loop all existing tab items and check the titles. We have to remember + // all found titles as modifying the proposal might in turn conflict again + // with the title of a tab already checked. + List titles = new ArrayList(); + for (CTabItem item : tabFolder.getItems()) { + // Get the tab item title + titles.add(item.getText()); + } + // Make the proposal unique be appending () against all known titles. + while (titles.contains(title)) title = proposal + " (" + ++index + ")"; //$NON-NLS-1$ //$NON-NLS-2$ + + return title; + } + + /** + * Setup the terminal console tab item listeners. + * + * @param item The tab item. Must not be null. + */ + protected void setupTerminalTabListeners(final CTabItem item) { + Assert.isNotNull(item); + + // Create and associate the disposal listener + DisposeListener disposeListener = doCreateTerminalTabDisposeListener(this); + + // store the listener to make access easier e.g. needed in DnD + item.setData("disposeListener", disposeListener); //$NON-NLS-1$ + item.addDisposeListener(disposeListener); + } + + /** + * Creates a new terminal console tab terminal listener instance. + * + * @param tabFolderManager The tab folder manager. Must not be null. + * @param item The tab item. Must not be null. + * + * @return The terminal listener instance. + */ + protected ITerminalListener doCreateTerminalTabTerminalListener(TabFolderManager tabFolderManager, CTabItem item) { + Assert.isNotNull(item); + return new TabTerminalListener(tabFolderManager, item); + } + + /** + * Creates a new terminal console tab dispose listener instance. + * + * @param parent The parent terminal console tab folder manager. Must not be null. + * @return The dispose listener instance. + */ + protected DisposeListener doCreateTerminalTabDisposeListener(TabFolderManager parent) { + Assert.isNotNull(parent); + return new TabDisposeListener(parent); + } + + /** + * Returns the tab item image. + * + * @param connector The terminal connector. Must not be null. + * @param data The custom terminal data node or null. + * + * @return The tab item image or null. + */ + protected Image getTabItemImage(ITerminalConnector connector, Object data) { + Assert.isNotNull(connector); + return UIPlugin.getImage(ImageConsts.VIEW_Terminals); + } + + /** + * Lookup a tab item with the given title and the given terminal connector. + *

    + * Note: The method will handle unified tab item titles itself. + * + * @param title The tab item title. Must not be null. + * @param connector The terminal connector. Must not be null. + * @param data The custom terminal data node or null. + * + * @return The corresponding tab item or null. + */ + public CTabItem findTabItem(String title, ITerminalConnector connector, Object data) { + Assert.isNotNull(title); + Assert.isNotNull(connector); + + // Get the tab folder + CTabFolder tabFolder = getTabFolder(); + if (tabFolder == null) return null; + + // Loop all existing tab items and try to find a matching title + for (CTabItem item : tabFolder.getItems()) { + // Disposed items cannot be matched + if (item.isDisposed()) continue; + // Get the title from the current tab item + String itemTitle = item.getText(); + // The terminal console state might be signaled to the user via the + // terminal console tab title. Filter out any prefix "<.*>\s*". + itemTitle = itemTitle.replaceFirst("^<.*>\\s*", ""); //$NON-NLS-1$ //$NON-NLS-2$ + if (itemTitle.startsWith(title)) { + // The title string matches -> double check with the terminal connector + ITerminalViewControl terminal = (ITerminalViewControl)item.getData(); + ITerminalConnector connector2 = terminal.getTerminalConnector(); + // If the connector id and name matches -> check on the settings + if (connector.getId().equals(connector2.getId()) && connector.getName().equals(connector2.getName())) { + if (!connector.isInitialized()) { + // an uninitialized connector does not yield a sensible summary + return item; + } + String summary = connector.getSettingsSummary(); + String summary2 = connector2.getSettingsSummary(); + // If we have matching settings -> we've found the matching item + if (summary.equals(summary2)) return item; + } + } + } + + return null; + } + + /** + * Make the given tab item the active tab and bring the tab to the top. + * + * @param item The tab item. Must not be null. + */ + public void bringToTop(CTabItem item) { + Assert.isNotNull(item); + + // Get the tab folder + CTabFolder tabFolder = getTabFolder(); + if (tabFolder == null) return; + + // Set the given tab item as selection to the tab folder + tabFolder.setSelection(item); + // Fire selection changed event + fireSelectionChanged(); + } + + /** + * Returns the currently active tab. + * + * @return The active tab item or null if none. + */ + public CTabItem getActiveTabItem() { + // Get the tab folder + CTabFolder tabFolder = getTabFolder(); + if (tabFolder == null) return null; + + return tabFolder.getSelection(); + } + + /** + * Remove all terminated tab items. + */ + public void removeTerminatedItems() { + // Get the tab folder + CTabFolder tabFolder = getTabFolder(); + if (tabFolder == null) return; + + // Loop the items and check for terminated status + for (CTabItem item: tabFolder.getItems()) { + // Disposed items cannot be matched + if (item.isDisposed()) continue; + // Check if the item is terminated + if (isTerminatedTabItem(item)) { + // item is terminated -> dispose + item.dispose(); + } + } + } + + /** + * Checks if the given tab item represents a terminated console. Subclasses may + * overwrite this method to extend the definition of terminated. + * + * @param item The tab item or null. + * @return True if the tab item represents a terminated console, false otherwise. + */ + protected boolean isTerminatedTabItem(CTabItem item) { + // Null items or disposed items cannot be matched + if (item == null || item.isDisposed()) return false; + + // First, match the item title. If it contains "", the item can be removed + String itemTitle = item.getText(); + if (itemTitle != null && itemTitle.contains("")) { //$NON-NLS-1$ + return true; + } + // Second, check if the associated terminal control is closed + // The title string matches -> double check with the terminal connector + ITerminalViewControl terminal = (ITerminalViewControl)item.getData(); + if (terminal != null && terminal.getState() == TerminalState.CLOSED) { + return true; + } + + return false; + } + + /** + * Returns the command input field handler for the given tab item. + * + * @param item The tab item or null. + * @return The command input field handler or null. + */ + public final TabCommandFieldHandler getTabCommandFieldHandler(CTabItem item) { + // Null items or disposed items cannot be matched + if (item == null || item.isDisposed()) return null; + + TabCommandFieldHandler handler = commandFieldHandler.get(item); + if (handler == null) { + handler = new TabCommandFieldHandler(this, item); + commandFieldHandler.put(item, handler); + } + return handler; + } + + /** + * Dispose the command input field handler for the given tab item. + * + * @param item The tab item or null. + */ + protected void disposeTabCommandFieldHandler(CTabItem item) { + // Null items or disposed items cannot be matched + if (item == null || item.isDisposed()) return; + + TabCommandFieldHandler handler = commandFieldHandler.remove(item); + if (handler != null) handler.dispose(); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) + */ + @Override + public void addSelectionChangedListener(ISelectionChangedListener listener) { + if (listener != null && !selectionChangedListeners.contains(listener)) selectionChangedListeners.add(listener); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) + */ + @Override + public void removeSelectionChangedListener(ISelectionChangedListener listener) { + if (listener != null) selectionChangedListeners.remove(listener); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection() + */ + @Override + public ISelection getSelection() { + CTabItem activeTabItem = getActiveTabItem(); + return activeTabItem != null ? new StructuredSelection(activeTabItem) : new StructuredSelection(); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection) + */ + @Override + public void setSelection(ISelection selection) { + if (selection instanceof IStructuredSelection && !selection.isEmpty()) { + // The first selection element which is a CTabItem will become the active item + Iterator iterator = ((IStructuredSelection)selection).iterator(); + while (iterator.hasNext()) { + Object candidate = iterator.next(); + if (candidate instanceof CTabItem) { bringToTop((CTabItem)candidate); return; } + } + } + // fire a changed event in any case + fireSelectionChanged(selection); + } + + /** + * Fire the selection changed event to the registered listeners. + */ + protected void fireSelectionChanged() { + updateStatusLine(); + fireSelectionChanged(getSelection()); + } + + /** + * Fire the selection changed event to the registered listeners. + */ + protected final void fireSelectionChanged(ISelection selection) { + // Create the selection changed event + SelectionChangedEvent event = new SelectionChangedEvent(TabFolderManager.this, selection); + + // First, invoke the registered listeners and let them do their job + for (ISelectionChangedListener listener : selectionChangedListeners) { + listener.selectionChanged(event); + } + } + + /** + * Update the parent view status line. + */ + public final void updateStatusLine() { + String message = null; + IStatusLineManager manager = parentView.getViewSite().getActionBars().getStatusLineManager(); + + CTabItem item = getActiveTabItem(); + if (item != null && !item.isDisposed()) { + ITerminalViewControl terminal = (ITerminalViewControl)item.getData(); + if (terminal != null && !terminal.isDisposed()) { + StringBuilder buffer = new StringBuilder(); + + buffer.append(state2msg(item, terminal.getState())); + buffer.append(" - "); //$NON-NLS-1$ + + String encoding = terminal.getEncoding(); + if (encoding == null || "ISO-8859-1".equals(encoding)) { //$NON-NLS-1$ + encoding = "Default (ISO-8859-1)"; //$NON-NLS-1$ + } + buffer.append(NLS.bind(Messages.TabFolderManager_encoding, encoding)); + + message = buffer.toString(); + } + } + + manager.setMessage(message); + } + + /** + * Returns the string representation of the given terminal state. + * + * @param item The tab folder item. Must not be null. + * @param state The terminal state. Must not be null. + * + * @return The string representation. + */ + @SuppressWarnings("unchecked") + protected String state2msg(CTabItem item, TerminalState state) { + Assert.isNotNull(item); + Assert.isNotNull(state); + + // Determine the terminal properties of the tab folder + Map properties = (Map)item.getData("properties"); //$NON-NLS-1$ + + // Get he current terminal state as string + String stateStr = state.toString(); + // Lookup a matching text representation of the state + String key = "TabFolderManager_state_" + stateStr.replaceAll("\\.", " ").trim().toLowerCase(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + String stateMsg = null; + if (properties != null) stateMsg = properties.get(key) instanceof String ? (String) properties.get(key) : null; + if (stateMsg == null) stateMsg = Messages.getString(key); + if (stateMsg == null) stateMsg = stateStr; + + return stateMsg; + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderMenuHandler.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderMenuHandler.java new file mode 100644 index 00000000000..f04d9a3d1b5 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderMenuHandler.java @@ -0,0 +1,389 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.tabs; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.PlatformObject; +import org.eclipse.jface.action.IContributionItem; +import org.eclipse.jface.action.IMenuListener2; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.actions.SelectEncodingAction; +import org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView; +import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; +import org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction; +import org.eclipse.tm.internal.terminal.control.actions.TerminalActionClearAll; +import org.eclipse.tm.internal.terminal.control.actions.TerminalActionCopy; +import org.eclipse.tm.internal.terminal.control.actions.TerminalActionPaste; +import org.eclipse.tm.internal.terminal.control.actions.TerminalActionSelectAll; +import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; +import org.eclipse.ui.IWorkbenchActionConstants; + +/** + * Terminals tab folder menu handler. + */ +@SuppressWarnings("restriction") +public class TabFolderMenuHandler extends PlatformObject { + // Reference to the parent terminals console view + private final ITerminalsView parentView; + // Reference to the tab folder context menu manager + private MenuManager contextMenuManager; + // Reference to the tab folder context menu + private Menu contextMenu; + // The list of actions available within the context menu + private final List contextMenuActions = new ArrayList(); + + // The list of invalid context menu contributions "startsWith" expressions + /* default */ static final String[] INVALID_CONTRIBUTIONS_STARTS_WITH = { + "org.eclipse.cdt", "org.eclipse.ui.edit" //$NON-NLS-1$ //$NON-NLS-2$ + }; + + /** + * Default menu listener implementation. + */ + protected class MenuListener implements IMenuListener2 { + + /* (non-Javadoc) + * @see org.eclipse.jface.action.IMenuListener2#menuAboutToHide(org.eclipse.jface.action.IMenuManager) + */ + @Override + public void menuAboutToHide(IMenuManager manager) { + // CQ:WIND00192293 and CQ:WIND194204 - don't update actions on menuAboutToHide + // See also http://bugs.eclipse.org/296212 + // updateMenuItems(false); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.action.IMenuListener#menuAboutToShow(org.eclipse.jface.action.IMenuManager) + */ + @Override + public void menuAboutToShow(IMenuManager manager) { + removeInvalidContributions(manager); + updateMenuItems(true); + } + + /** + * Bug 392249: Remove contributions that appear in the context in Eclipse 4.x which are + * not visible in Eclipse 3.8.x. Re-evaluate from time to time! + * + * @param manager The menu manager or null + */ + private void removeInvalidContributions(IMenuManager manager) { + if (manager == null) return; + + IContributionItem[] items = manager.getItems(); + for (IContributionItem item : items) { + String id = item.getId(); + if (id != null) { + for (String prefix : INVALID_CONTRIBUTIONS_STARTS_WITH) { + if (id.startsWith(prefix)) { + manager.remove(item); + break; + } + } + } + } + } + } + + /** + * Constructor. + * + * @param parentView The parent terminals console view. Must not be null. + */ + public TabFolderMenuHandler(ITerminalsView parentView) { + super(); + Assert.isNotNull(parentView); + this.parentView = parentView; + } + + /** + * Returns the parent terminals console view. + * + * @return The parent terminals console view instance. + */ + protected final ITerminalsView getParentView() { + return parentView; + } + + /** + * Returns the tab folder associated with the parent view. + * + * @return The tab folder or null. + */ + protected final CTabFolder getTabFolder() { + return (CTabFolder)getParentView().getAdapter(CTabFolder.class); + } + + /** + * Dispose the tab folder menu handler instance. + */ + public void dispose() { + // Dispose the context menu + if (contextMenu != null) { contextMenu.dispose(); contextMenu = null; } + // Dispose the context menu manager + if (contextMenuManager != null) { contextMenuManager.dispose(); contextMenuManager = null; } + // Clear all actions + contextMenuActions.clear(); + } + + /** + * Setup the context menu for the tab folder. The method will return + * immediately if the menu handler had been initialized before. + * + * @param tabFolder The tab folder control. Must not be null. + */ + public void initialize() { + // Return immediately if the menu manager and menu got initialized already + if (contextMenuManager != null && contextMenu != null) { + return; + } + + // Get the tab folder + CTabFolder tabFolder = getTabFolder(); + if (tabFolder == null) { + return; + } + + // Create the menu manager if not done before + contextMenuManager = new MenuManager("#PopupMenu"); //$NON-NLS-1$ + + // Bug 392249: Register our menu listener after registering the context menu + // for contributions. That way we can use our menu listener to get + // rid of unwanted/misguided contributions. At least until this is + // fixed in the Eclipse 4.x platform. + + // Create the context menu + contextMenu = contextMenuManager.createContextMenu(tabFolder); + + // Create the context menu action instances + doCreateContextMenuActions(); + + // Fill the context menu + doFillContextMenu(contextMenuManager); + + // Register to the view site to open the menu for contributions + getParentView().getSite().registerContextMenu(contextMenuManager, getParentView().getSite().getSelectionProvider()); + + // Create and associated the menu listener + contextMenuManager.addMenuListener(new MenuListener()); + } + + /** + * Adds the given action to the context menu actions list. + * + * @param action The action instance. Must not be null. + */ + protected final void add(AbstractTerminalAction action) { + Assert.isNotNull(action); + contextMenuActions.add(action); + } + + /** + * Create the context menu actions. + */ + protected void doCreateContextMenuActions() { + // Create and add the copy action + add(new TerminalActionCopy() { + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#getTarget() + */ + @Override + protected ITerminalViewControl getTarget() { + return getActiveTerminalViewControl(); + } + }); + + // Create and add the paste action + add(new TerminalActionPaste() { + @SuppressWarnings("unchecked") + @Override + public void run() { + // Determine if pasting to the active tab require backslash translation + boolean needsTranslation = false; + + TabFolderManager manager = (TabFolderManager)getParentView().getAdapter(TabFolderManager.class); + if (manager != null) { + // If we have the active tab item, we can get the active terminal control + CTabItem activeTabItem = manager.getActiveTabItem(); + if (activeTabItem != null) { + Map properties = (Map)activeTabItem.getData("properties"); //$NON-NLS-1$ + if (properties != null && properties.containsKey(ITerminalsConnectorConstants.PROP_TRANSLATE_BACKSLASHES_ON_PASTE)) { + Object value = properties.get(ITerminalsConnectorConstants.PROP_TRANSLATE_BACKSLASHES_ON_PASTE); + needsTranslation = value instanceof Boolean ? ((Boolean)value).booleanValue() : false; + } + } + } + + if (needsTranslation) { + ITerminalViewControl target = getTarget(); + if (target != null && target.getClipboard() != null && !target.getClipboard().isDisposed()) { + String text = (String) target.getClipboard().getContents(TextTransfer.getInstance()); + if (text != null) { + text = text.replace('\\', '/'); + + Object[] data = new Object[] { text }; + Transfer[] types = new Transfer[] { TextTransfer.getInstance() }; + target.getClipboard().setContents(data, types, DND.CLIPBOARD); + } + } + } + + super.run(); + } + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#getTarget() + */ + @Override + protected ITerminalViewControl getTarget() { + return getActiveTerminalViewControl(); + } + }); + + // Create and add the clear all action + add(new TerminalActionClearAll() { + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#getTarget() + */ + @Override + protected ITerminalViewControl getTarget() { + return getActiveTerminalViewControl(); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.control.actions.TerminalActionPaste#updateAction(boolean) + */ + @Override + public void updateAction(boolean aboutToShow) { + super.updateAction(aboutToShow); + if (getTarget() != null && getTarget().getState() != TerminalState.CONNECTED) { + setEnabled(false); + } + } + }); + + // Create and add the select all action + add(new TerminalActionSelectAll() { + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#getTarget() + */ + @Override + protected ITerminalViewControl getTarget() { + return getActiveTerminalViewControl(); + } + }); + + // Create and add the select encoding action + add (new SelectEncodingAction((TabFolderManager)getParentView().getAdapter(TabFolderManager.class)) { + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#getTarget() + */ + @Override + protected ITerminalViewControl getTarget() { + return getActiveTerminalViewControl(); + } + }); + } + + /** + * Returns the currently active terminal control. + * + * @return The currently active terminal control or null. + */ + protected ITerminalViewControl getActiveTerminalViewControl() { + ITerminalViewControl terminal = null; + + // Get the active tab item from the tab folder manager + TabFolderManager manager = (TabFolderManager)getParentView().getAdapter(TabFolderManager.class); + if (manager != null) { + // If we have the active tab item, we can get the active terminal control + CTabItem activeTabItem = manager.getActiveTabItem(); + if (activeTabItem != null) { + terminal = (ITerminalViewControl)activeTabItem.getData(); + } + } + + return terminal; + } + + /** + * Fill in the context menu content within the given manager. + * + * @param manager The menu manager. Must not be null. + */ + protected void doFillContextMenu(MenuManager manager) { + Assert.isNotNull(manager); + + // Loop all actions and add them to the menu manager + for (AbstractTerminalAction action : contextMenuActions) { + manager.add(action); + // Add a separator after the paste action + if (action instanceof TerminalActionPaste) { + manager.add(new Separator()); + } + // Add a separator after the select all action + if (action instanceof TerminalActionSelectAll) { + manager.add(new Separator()); + } + } + + // Menu contributions will end up here + manager.add(new Separator()); + manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); + } + + /** + * Update the context menu items on showing or hiding the context menu. + * + * @param aboutToShow True if the menu is about to show, false otherwise. + */ + protected void updateMenuItems(boolean aboutToShow) { + // Loop all actions and update the status + for (AbstractTerminalAction action : contextMenuActions) { + action.updateAction(aboutToShow); + } + } + + /* (non-Javadoc) + * @see org.eclipse.ui.part.WorkbenchPart#getAdapter(java.lang.Class) + */ + @Override + public Object getAdapter(Class adapter) { + if (MenuManager.class.isAssignableFrom(adapter)) { + return contextMenuManager; + } else if (Menu.class.isAssignableFrom(adapter)) { + if (contextMenu != null && contextMenu.isDisposed()) { + // menu got disposed (should not happen) + contextMenu = contextMenuManager.createContextMenu(getTabFolder()); + } + return contextMenu; + } + + // Try the parent view + Object adapted = getParentView().getAdapter(adapter); + if (adapted != null) { + return adapted; + } + + return super.getAdapter(adapter); + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderSelectionListener.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderSelectionListener.java new file mode 100644 index 00000000000..37e4110cba7 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderSelectionListener.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.tabs; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; + +/** + * Terminals tab folder default selection listener implementation. + */ +public class TabFolderSelectionListener implements SelectionListener { + private final TabFolderManager parentTabFolderManager; + + /** + * Constructor. + * + * @param parentTabFolderManager The parent tab folder manager. Must not be null + */ + public TabFolderSelectionListener(TabFolderManager parentTabFolderManager) { + Assert.isNotNull(parentTabFolderManager); + this.parentTabFolderManager = parentTabFolderManager; + } + + /** + * Returns the parent terminal console tab folder manager instance. + * + * @return The parent terminal console tab folder manager instance. + */ + protected final TabFolderManager getParentTabFolderManager() { + return parentTabFolderManager; + } + + /* (non-Javadoc) + * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) + */ + @Override + public void widgetDefaultSelected(SelectionEvent e) { + } + + /* (non-Javadoc) + * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) + */ + @Override + public void widgetSelected(SelectionEvent e) { + parentTabFolderManager.fireSelectionChanged(); + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderToolbarHandler.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderToolbarHandler.java new file mode 100644 index 00000000000..07d1a78684f --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderToolbarHandler.java @@ -0,0 +1,371 @@ +/******************************************************************************* + * Copyright (c) 2011, 2014 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + * Max Weninger (Wind River) - [361363] [TERMINALS] Implement "Pin&Clone" for the "Terminals" view + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.tabs; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.PlatformObject; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.tcf.te.ui.terminals.actions.AbstractAction; +import org.eclipse.tcf.te.ui.terminals.actions.PinTerminalAction; +import org.eclipse.tcf.te.ui.terminals.actions.TabScrollLockAction; +import org.eclipse.tcf.te.ui.terminals.actions.ToggleCommandFieldAction; +import org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView; +import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; +import org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction; +import org.eclipse.tm.internal.terminal.control.actions.TerminalActionClearAll; +import org.eclipse.tm.internal.terminal.control.actions.TerminalActionCopy; +import org.eclipse.tm.internal.terminal.control.actions.TerminalActionPaste; +import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IWorkbenchActionConstants; + + +/** + * Terminals tab folder toolbar handler. + */ +@SuppressWarnings("restriction") +public class TabFolderToolbarHandler extends PlatformObject { + // Reference to the parent terminals console view + private final ITerminalsView parentView; + // Reference to the toolbar manager + private IToolBarManager toolbarManager; + // Reference to the selection listener + private ToolbarSelectionChangedListener selectionChangedListener; + // The list of actions available within the toolbar + private final List toolbarActions = new ArrayList(); + + /** + * Default selection listener implementation. + */ + protected class ToolbarSelectionChangedListener implements ISelectionChangedListener { + + /* (non-Javadoc) + * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) + */ + @Override + public void selectionChanged(SelectionChangedEvent event) { + boolean enable = event != null; + + // The VlmConsoleTabFolderManager is listening to the selection changes of the + // TabFolder and fires selection changed events. + if (enable && event.getSource() instanceof TabFolderManager) { + enable = event.getSelection() instanceof StructuredSelection + && !event.getSelection().isEmpty() + && (((StructuredSelection)event.getSelection()).getFirstElement() instanceof CTabItem + || ((StructuredSelection)event.getSelection()).getFirstElement() instanceof String); + } + + updateToolbarItems(enable); + } + } + + /** + * Constructor. + * + * @param parentView The parent terminals console view. Must not be null. + */ + public TabFolderToolbarHandler(ITerminalsView parentView) { + super(); + Assert.isNotNull(parentView); + this.parentView = parentView; + } + + /** + * Returns the parent terminals console view. + * + * @return The terminals console view instance. + */ + protected final ITerminalsView getParentView() { + return parentView; + } + + /** + * Returns the tab folder associated with the parent view. + * + * @return The tab folder or null. + */ + protected final CTabFolder getTabFolder() { + return (CTabFolder)getParentView().getAdapter(CTabFolder.class); + } + + /** + * Returns the currently active terminal control. + * + * @return The currently active terminal control or null. + */ + public ITerminalViewControl getActiveTerminalViewControl() { + ITerminalViewControl terminal = null; + + // Get the active tab item from the tab folder manager + TabFolderManager manager = (TabFolderManager)getParentView().getAdapter(TabFolderManager.class); + if (manager != null) { + // If we have the active tab item, we can get the active terminal control + CTabItem activeTabItem = manager.getActiveTabItem(); + if (activeTabItem != null && !activeTabItem.isDisposed()) { + terminal = (ITerminalViewControl)activeTabItem.getData(); + } + } + + return terminal; + } + + /** + * Dispose the tab folder menu handler instance. + */ + public void dispose() { + // Dispose the selection changed listener + if (selectionChangedListener != null) { + getParentView().getViewSite().getSelectionProvider().removeSelectionChangedListener(selectionChangedListener); + selectionChangedListener = null; + } + + // Clear all actions + toolbarActions.clear(); + } + + /** + * Setup the context menu for the tab folder. The method will return + * immediately if the toolbar handler had been initialized before. + * + * @param tabFolder The tab folder control. Must not be null. + */ + public void initialize() { + // Return immediately if the toolbar manager got initialized already + if (toolbarManager != null) { + return; + } + + // Register ourself as selection listener to the tab folder + selectionChangedListener = doCreateSelectionChangedListener(); + Assert.isNotNull(selectionChangedListener); + getParentView().getViewSite().getSelectionProvider().addSelectionChangedListener(selectionChangedListener); + + // Get the parent view action bars + IActionBars bars = getParentView().getViewSite().getActionBars(); + + // From the action bars, get the toolbar manager + toolbarManager = bars.getToolBarManager(); + + // Create the toolbar action instances + doCreateToolbarActions(); + + // Fill the toolbar + doFillToolbar(toolbarManager); + + // Update actions + updateToolbarItems(false); + } + + /** + * Creates a new selection changed listener instance. + * + * @return The new selection changed listener instance. + */ + protected ToolbarSelectionChangedListener doCreateSelectionChangedListener() { + return new ToolbarSelectionChangedListener(); + } + + /** + * Adds the given action to the toolbar actions list. + * + * @param action The action instance. Must not be null. + */ + protected final void add(AbstractTerminalAction action) { + Assert.isNotNull(action); + toolbarActions.add(action); + } + + /** + * Removes the given action from the toolbar actions list. + * + * @param action The action instance. Must not be null. + */ + protected final void remove(AbstractTerminalAction action) { + Assert.isNotNull(action); + toolbarActions.remove(action); + } + + /** + * Create the toolbar actions. + */ + protected void doCreateToolbarActions() { + // Create and add the paste action + add(new TerminalActionPaste() { + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#getTarget() + */ + @Override + protected ITerminalViewControl getTarget() { + return getActiveTerminalViewControl(); + } + }); + + // Create and add the copy action + add(new TerminalActionCopy() { + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#getTarget() + */ + @Override + protected ITerminalViewControl getTarget() { + return getActiveTerminalViewControl(); + } + }); + + // Create and add the scroll lock action + add (new TabScrollLockAction() { + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#getTarget() + */ + @Override + protected ITerminalViewControl getTarget() { + return getActiveTerminalViewControl(); + } + }); + + // Create and add the clear all action + add(new TerminalActionClearAll() { + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.control.actions.AbstractTerminalAction#getTarget() + */ + @Override + protected ITerminalViewControl getTarget() { + return getActiveTerminalViewControl(); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.control.actions.TerminalActionPaste#updateAction(boolean) + */ + @Override + public void updateAction(boolean aboutToShow) { + super.updateAction(aboutToShow); + if (getTarget() != null && getTarget().getState() != TerminalState.CONNECTED) { + setEnabled(false); + } + } + }); + + // Create and add the toggle command input field action + add (new ToggleCommandFieldAction(getParentView()) { + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#getTarget() + */ + @Override + protected ITerminalViewControl getTarget() { + return getActiveTerminalViewControl(); + } + }); + + // Create and add the pin view action + add (new PinTerminalAction(getParentView()) { + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction#getTarget() + */ + @Override + protected ITerminalViewControl getTarget() { + return getActiveTerminalViewControl(); + } + }); + } + + /** + * Fill in the context menu content within the given manager. + * + * @param manager The menu manager. Must not be null. + */ + protected void doFillToolbar(IToolBarManager manager) { + Assert.isNotNull(manager); + + // Note: For the toolbar, the actions are added from left to right! + // So we start with the additions marker here which is the most + // left contribution item. + manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); + manager.add(new Separator("anchor")); //$NON-NLS-1$ + + // we want that at the end + PinTerminalAction pinAction=null; + + // Loop all actions and add them to the menu manager + for (AbstractTerminalAction action : toolbarActions) { + // Add a separator before the clear all action or if the action is a separator + if (action instanceof TabScrollLockAction + || (action instanceof AbstractAction && ((AbstractAction)action).isSeparator())) { + manager.insertAfter("anchor", new Separator()); //$NON-NLS-1$ + } + // skip pin action for now + if(action instanceof PinTerminalAction){ + pinAction=(PinTerminalAction)action; + continue; + } + // Add the action itself + manager.insertAfter("anchor", action); //$NON-NLS-1$ + } + // now add pin at the end + if(pinAction!=null){ + manager.add(pinAction); + } + } + + /** + * Update the toolbar items. + * + * @param enabled True if the items shall be enabled, false otherwise. + */ + protected void updateToolbarItems(boolean enabled) { + // Determine the currently active terminal control + ITerminalViewControl control = getActiveTerminalViewControl(); + // Loop all actions and update the status + for (AbstractTerminalAction action : toolbarActions) { + // If the terminal control is not available, the updateAction + // method of certain actions enable the action (bugzilla #260372). + // Workaround by forcing the action to get disabled with setEnabled. + if (control == null && !(action instanceof PinTerminalAction)) { + action.setEnabled(false); + } + else { + action.updateAction(enabled); + } + } + } + + /* (non-Javadoc) + * @see org.eclipse.ui.part.WorkbenchPart#getAdapter(java.lang.Class) + */ + @Override + public Object getAdapter(Class adapter) { + if (IToolBarManager.class.isAssignableFrom(adapter)) { + return toolbarManager; + } + + // Try the toolbar actions + for (AbstractTerminalAction action : toolbarActions) { + if (adapter.isAssignableFrom(action.getClass())) { + return action; + } + } + + // Try the parent view + Object adapted = getParentView().getAdapter(adapter); + if (adapted != null) { + return adapted; + } + + return super.getAdapter(adapter); + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabTerminalListener.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabTerminalListener.java new file mode 100644 index 00000000000..f482d58572b --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabTerminalListener.java @@ -0,0 +1,152 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.tabs; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.swt.widgets.Display; +import org.eclipse.tcf.te.ui.terminals.nls.Messages; +import org.eclipse.tm.internal.terminal.control.ITerminalListener; +import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; + +/** + * Terminals tab default terminal listener implementation. + */ +@SuppressWarnings("restriction") +public class TabTerminalListener implements ITerminalListener { + private static final String TAB_TERMINAL_LISTENER = "TabTerminalListener"; //$NON-NLS-1$ + /* default */ final TabFolderManager tabFolderManager; + private CTabItem tabItem; + private final String tabItemTitle; + + /** + * Move a TabTerminalListener instance to another item (for DnD). + * + * @param fromItem item to detach the listener from + * @param toItem item to attach listener to + */ + static void move(CTabItem fromItem, CTabItem toItem) { + TabTerminalListener listener = (TabTerminalListener) fromItem.getData(TAB_TERMINAL_LISTENER); + if (listener != null) { + listener.attachTo(toItem); + } + } + + /** + * Constructor. + * + * @param tabFolderManager The parent tab folder manager. Must not be null. + * @param tabItem The parent tab item. Must not be null. + */ + public TabTerminalListener(TabFolderManager tabFolderManager, CTabItem tabItem) { + super(); + Assert.isNotNull(tabFolderManager); + Assert.isNotNull(tabItem); + this.tabFolderManager = tabFolderManager; + // Remember the original tab item title + tabItemTitle = tabItem.getText(); + + attachTo(tabItem); + } + + private void attachTo(CTabItem item) { + if (tabItem != null) tabItem.setData(TAB_TERMINAL_LISTENER, null); + item.setData(TAB_TERMINAL_LISTENER, this); + tabItem = item; + } + + /** + * Returns the associated parent tab item. + * + * @return The parent tab item. + */ + protected final CTabItem getTabItem() { + return tabItem; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.control.ITerminalListener#setState(org.eclipse.tcf.internal.terminal.provisional.api.TerminalState) + */ + @Override + public void setState(final TerminalState state) { + // The tab item must have been not yet disposed + final CTabItem item = getTabItem(); + if (item == null || item.isDisposed()) return; + + // Run asynchronously in the display thread + item.getDisplay().asyncExec(new Runnable() { + @Override + public void run() { + // Update the tab item title + String newTitle = getTerminalConsoleTabTitle(state); + if (newTitle != null) item.setText(newTitle); + + // Turn off the command field (if necessary) + TabCommandFieldHandler handler = tabFolderManager.getTabCommandFieldHandler(item); + if (TerminalState.CLOSED.equals(state) && handler != null && handler.hasCommandInputField()) { + handler.setCommandInputField(false); + // Trigger a selection changed event to update the action enablements + // and the status line + ISelectionProvider provider = tabFolderManager.getParentView().getViewSite().getSelectionProvider(); + Assert.isNotNull(provider); + provider.setSelection(provider.getSelection()); + } else { + // Update the status line + tabFolderManager.updateStatusLine(); + } + } + }); + } + + /** + * Returns the title to set to the terminal console tab for the given state. + *

    + * Note: This method is called from {@link #setState(TerminalState)} and + * is expected to by called within the UI thread. + * + * @param state The terminal state. Must not be null. + * @return The terminal console tab title to set or null to leave the title unchanged. + */ + protected String getTerminalConsoleTabTitle(TerminalState state) { + Assert.isNotNull(state); + Assert.isNotNull(Display.findDisplay(Thread.currentThread())); + + // The tab item must have been not yet disposed + CTabItem item = getTabItem(); + if (item == null || item.isDisposed()) return null; + + // Get the current tab title + String oldTitle = item.getText(); + + // Construct the new title + String newTitle = null; + + if (TerminalState.CLOSED.equals(state)) { + newTitle = NLS.bind(Messages.TabTerminalListener_consoleClosed, tabItemTitle, tabFolderManager.state2msg(item, state)); + } + else if (TerminalState.CONNECTING.equals(state)) { + newTitle = NLS.bind(Messages.TabTerminalListener_consoleConnecting, tabItemTitle, tabFolderManager.state2msg(item, state)); + } + else if (TerminalState.CONNECTED.equals(state)) { + newTitle = tabItemTitle; + } + + return newTitle != null && !newTitle.equals(oldTitle) ? newTitle : null; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.terminal.control.ITerminalListener#setTerminalTitle(java.lang.String) + */ + @Override + public void setTerminalTitle(String title) { + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsView.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsView.java new file mode 100644 index 00000000000..cc4bbf576a9 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsView.java @@ -0,0 +1,725 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + * Max Weninger (Wind River) - [361363] [TERMINALS] Implement "Pin&Clone" for the "Terminals" view + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.view; + +import java.util.Iterator; +import java.util.UUID; + +import org.eclipse.core.commands.Command; +import org.eclipse.core.commands.ParameterizedCommand; +import org.eclipse.core.expressions.EvaluationContext; +import org.eclipse.core.expressions.IEvaluationContext; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.swt.dnd.ByteArrayTransfer; +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.DragSource; +import org.eclipse.swt.dnd.DragSourceEvent; +import org.eclipse.swt.dnd.DragSourceListener; +import org.eclipse.swt.dnd.DropTarget; +import org.eclipse.swt.dnd.DropTargetEvent; +import org.eclipse.swt.dnd.DropTargetListener; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.dnd.TransferData; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.tcf.te.ui.terminals.activator.UIPlugin; +import org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView; +import org.eclipse.tcf.te.ui.terminals.nls.Messages; +import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderManager; +import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderMenuHandler; +import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderToolbarHandler; +import org.eclipse.ui.IMemento; +import org.eclipse.ui.ISources; +import org.eclipse.ui.IViewSite; +import org.eclipse.ui.IWorkbenchPreferenceConstants; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.commands.ICommandService; +import org.eclipse.ui.handlers.IHandlerService; +import org.eclipse.ui.part.IShowInTarget; +import org.eclipse.ui.part.PageBook; +import org.eclipse.ui.part.ShowInContext; +import org.eclipse.ui.part.ViewPart; +import org.osgi.framework.Bundle; + +/** + * Terminals view. + */ +public class TerminalsView extends ViewPart implements ITerminalsView, IShowInTarget { + + // Reference to the main page book control + private PageBook pageBookControl; + // Reference to the tab folder maintaining the consoles + /* default */ CTabFolder tabFolderControl; + // Reference to the tab folder manager + /* default */ TabFolderManager tabFolderManager; + // Reference to the tab folder menu handler + private TabFolderMenuHandler tabFolderMenuHandler; + // Reference to the tab folder toolbar handler + private TabFolderToolbarHandler tabFolderToolbarHandler; + // Reference to the empty page control (to be show if no console is open) + private Control emptyPageControl; + // Whether this terminal is pinned. + private boolean pinned = false; + // The view's memento handler + private final TerminalsViewMementoHandler mementoHandler = new TerminalsViewMementoHandler(); + + /** + * "dummy" transfer just to store the information needed for the DnD + * + */ + private static class TerminalTransfer extends ByteArrayTransfer { + // The static terminal transfer type name. Unique per terminals view instance. + private static final String TYPE_NAME = "terminal-transfer-format:" + UUID.randomUUID().toString(); //$NON-NLS-1$ + // Register the type name and remember the associated unique type id. + private static final int TYPEID = registerType(TYPE_NAME); + + private CTabItem draggedFolderItem; + private TabFolderManager draggedTabFolderManager; + + /* + * Thread save singleton instance creation. + */ + private static class LazyInstanceHolder { + public static TerminalTransfer instance = new TerminalTransfer(); + } + + /** + * Constructor. + */ + TerminalTransfer() { + } + + /** + * Returns the singleton terminal transfer instance. + * @return + */ + public static TerminalTransfer getInstance() { + return LazyInstanceHolder.instance; + } + + /** + * Sets the dragged folder item. + * + * @param tabFolderItem The dragged folder item or null. + */ + public void setDraggedFolderItem(CTabItem tabFolderItem) { + draggedFolderItem = tabFolderItem; + } + + /** + * Returns the dragged folder item. + * + * @return The dragged folder item or null. + */ + public CTabItem getDraggedFolderItem() { + return draggedFolderItem; + } + + /** + * Sets the tab folder manager the associated folder item is dragged from. + * + * @param tabFolderManager The tab folder manager or null. + */ + public void setTabFolderManager(TabFolderManager tabFolderManager) { + draggedTabFolderManager = tabFolderManager; + } + + /** + * Returns the tab folder manager the associated folder item is dragged from. + * + * @return The tab folder manager or null. + */ + public TabFolderManager getTabFolderManager() { + return draggedTabFolderManager; + } + + /* (non-Javadoc) + * @see org.eclipse.swt.dnd.Transfer#getTypeIds() + */ + @Override + protected int[] getTypeIds() { + return new int[] { TYPEID }; + } + + /* (non-Javadoc) + * @see org.eclipse.swt.dnd.Transfer#getTypeNames() + */ + @Override + protected String[] getTypeNames() { + return new String[] { TYPE_NAME }; + } + + /* (non-Javadoc) + * @see org.eclipse.swt.dnd.ByteArrayTransfer#javaToNative(java.lang.Object, org.eclipse.swt.dnd.TransferData) + */ + @Override + public void javaToNative(Object data, TransferData transferData) { + } + + /* (non-Javadoc) + * @see org.eclipse.swt.dnd.ByteArrayTransfer#nativeToJava(org.eclipse.swt.dnd.TransferData) + */ + @Override + public Object nativeToJava(TransferData transferData) { + return null; + } + } + + /** + * Constructor. + */ + public TerminalsView() { + super(); + } + + /** + * Initialize the drag support. + */ + private void addDragSupport() { + // The event listener is registered as filter. It will receive events from all widgets. + PlatformUI.getWorkbench().getDisplay().addFilter(SWT.DragDetect, new Listener() { + /* (non-Javadoc) + * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event) + */ + @Override + public void handleEvent(Event event) { + // Only handle events where a CTabFolder is the source + if (!(event.widget instanceof CTabFolder)) return; + // TabFolderManager must be created + if (tabFolderManager == null) return; + + // only for own tab folders + if (event.widget != tabFolderControl) return; + + // Skip drag if DnD is still ongoing (bug 443787) + if (tabFolderControl.getData(DND.DRAG_SOURCE_KEY) != null) return; + + final CTabFolder draggedFolder = (CTabFolder) event.widget; + + int operations = DND.DROP_MOVE | DND.DROP_DEFAULT; + final DragSource dragSource = new DragSource(draggedFolder, operations); + + // Initialize the terminal transfer type data + TerminalTransfer.getInstance().setDraggedFolderItem(tabFolderManager.getActiveTabItem()); + TerminalTransfer.getInstance().setTabFolderManager(tabFolderManager); + + Transfer[] transferTypes = new Transfer[] { TerminalTransfer.getInstance() }; + dragSource.setTransfer(transferTypes); + + // Add a drag source listener to cleanup after the drag operation finished + dragSource.addDragListener(new DragSourceListener() { + @Override + public void dragStart(DragSourceEvent event) { + } + + @Override + public void dragSetData(DragSourceEvent event) { + } + + @Override + public void dragFinished(DragSourceEvent event) { + // dispose this drag-source-listener by disposing its drag-source + dragSource.dispose(); + + // Inhibit the action of CTabFolder's default DragDetect-listeners, + // fire a mouse-click event on the widget that was dragged. + draggedFolder.notifyListeners(SWT.MouseUp, null); + } + }); + } + }); + } + + /** + * Initialize the drop support on the terminals page book control. + */ + private void addDropSupport() { + int operations = DND.DROP_MOVE | DND.DROP_DEFAULT; + final DropTarget target = new DropTarget(pageBookControl, operations); + + Transfer[] transferTypes = new Transfer[] { TerminalTransfer.getInstance() }; + target.setTransfer(transferTypes); + + target.addDropListener(new DropTargetListener() { + @Override + public void dragEnter(DropTargetEvent event) { + // only if the drop target is different then the drag source + if (TerminalTransfer.getInstance().getTabFolderManager() == tabFolderManager) { + event.detail = DND.DROP_NONE; + } + else { + event.detail = DND.DROP_MOVE; + } + } + + @Override + public void dragOver(DropTargetEvent event) { + } + + @Override + public void dragOperationChanged(DropTargetEvent event) { + } + + @Override + public void dragLeave(DropTargetEvent event) { + } + + @Override + public void dropAccept(DropTargetEvent event) { + } + + @Override + public void drop(DropTargetEvent event) { + if (TerminalTransfer.getInstance().getDraggedFolderItem() != null && tabFolderManager != null) { + CTabItem draggedItem = TerminalTransfer.getInstance().getDraggedFolderItem(); + + CTabItem item = tabFolderManager.cloneTabItemAfterDrop(draggedItem); + tabFolderManager.bringToTop(item); + switchToTabFolderControl(); + + // dispose tab item control + final Control control = draggedItem.getControl(); + draggedItem.setControl(null); + if (control != null) control.dispose(); + + // need to remove the dispose listener first + DisposeListener disposeListener = (DisposeListener) draggedItem.getData("disposeListener"); //$NON-NLS-1$ + draggedItem.removeDisposeListener(disposeListener); + draggedItem.dispose(); + + // make sure the "new" terminals view has the focus after dragging a terminal + setFocus(); + } + } + }); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.part.WorkbenchPart#dispose() + */ + @Override + public void dispose() { + // Dispose the tab folder manager + if (tabFolderManager != null) { + tabFolderManager.dispose(); + tabFolderManager = null; + } + // Dispose the tab folder menu handler + if (tabFolderMenuHandler != null) { + tabFolderMenuHandler.dispose(); + tabFolderMenuHandler = null; + } + // Dispose the tab folder toolbar handler + if (tabFolderToolbarHandler != null) { + tabFolderToolbarHandler.dispose(); + tabFolderToolbarHandler = null; + } + + super.dispose(); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.part.ViewPart#init(org.eclipse.ui.IViewSite, org.eclipse.ui.IMemento) + */ + @Override + public void init(IViewSite site, IMemento memento) throws PartInitException { + super.init(site, memento); + restoreState(memento); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) + */ + @Override + public void createPartControl(Composite parent) { + // Create the page book control + pageBookControl = doCreatePageBookControl(parent); + Assert.isNotNull(pageBookControl); + // Configure the page book control + doConfigurePageBookControl(pageBookControl); + + // Create the empty page control + emptyPageControl = doCreateEmptyPageControl(pageBookControl); + Assert.isNotNull(emptyPageControl); + // Configure the empty page control + doConfigureEmptyPageControl(emptyPageControl); + + // Create the tab folder control (empty) + tabFolderControl = doCreateTabFolderControl(pageBookControl); + Assert.isNotNull(tabFolderControl); + // Configure the tab folder control + doConfigureTabFolderControl(tabFolderControl); + + // Create the tab folder manager + tabFolderManager = doCreateTabFolderManager(this); + Assert.isNotNull(tabFolderManager); + // Set the tab folder manager as the selection provider + getSite().setSelectionProvider(tabFolderManager); + + // Setup the tab folder menu handler + tabFolderMenuHandler = doCreateTabFolderMenuHandler(this); + Assert.isNotNull(tabFolderMenuHandler); + doConfigureTabFolderMenuHandler(tabFolderMenuHandler); + + // Setup the tab folder toolbar handler + tabFolderToolbarHandler = doCreateTabFolderToolbarHandler(this); + Assert.isNotNull(tabFolderToolbarHandler); + doConfigureTabFolderToolbarHandler(tabFolderToolbarHandler); + + // Show the empty page control by default + switchToEmptyPageControl(); + + String secondaryId = ((IViewSite) getSite()).getSecondaryId(); + if (secondaryId != null) { + String defaultTitle = getPartName(); + // set title + setPartName(defaultTitle + " " + secondaryId); //$NON-NLS-1$ + } + + // Initialize DnD support + addDragSupport(); + addDropSupport(); + } + + /** + * Creates the {@link PageBook} instance. + * + * @param parent The parent composite. Must not be null. + * @return The page book instance. Must never be null. + */ + protected PageBook doCreatePageBookControl(Composite parent) { + return new PageBook(parent, SWT.NONE); + } + + /** + * Configure the given page book control. + * + * @param pagebook The page book control. Must not be null. + */ + protected void doConfigurePageBookControl(PageBook pagebook) { + Assert.isNotNull(pagebook); + + if (getContextHelpId() != null) PlatformUI.getWorkbench().getHelpSystem().setHelp(pagebook, getContextHelpId()); + } + + /** + * Returns the context help id associated with the terminals console view instance. + *

    + * Note: The default implementation returns the view id as context help id. + * + * @return The context help id or null if none is associated. + */ + @Override + public String getContextHelpId() { + return getViewSite().getId(); + } + + /** + * Creates the empty page control instance. + * + * @param parent The parent composite. Must not be null. + * @return The empty page control instance. Must never be null. + */ + protected Control doCreateEmptyPageControl(Composite parent) { + Composite composite = new Composite(parent, SWT.NONE); + composite.setLayout(new GridLayout()); + composite.setLayoutData(new GridData(GridData.FILL_BOTH)); + return composite; + } + + /** + * Configures the empty page control. + * + * @param control The empty page control. Must not be null. + */ + protected void doConfigureEmptyPageControl(Control control) { + Assert.isNotNull(control); + } + + /** + * Creates the tab folder control instance. + * + * @param parent The parent composite. Must not be null. + * @return The tab folder control instance. Must never be null. + */ + protected CTabFolder doCreateTabFolderControl(Composite parent) { + return new CTabFolder(parent, SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM | SWT.FLAT | SWT.BORDER); + } + + /** + * Configures the tab folder control. + * + * @param tabFolder The tab folder control. Must not be null. + */ + protected void doConfigureTabFolderControl(final CTabFolder tabFolder) { + Assert.isNotNull(tabFolder); + + // Set the layout data + tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH)); + + // Set the tab gradient coloring from the global preferences + if (useGradientTabBackgroundColor()) { + tabFolder.setSelectionBackground(new Color[] { + JFaceResources.getColorRegistry().get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_START"), //$NON-NLS-1$ + JFaceResources.getColorRegistry().get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_END") //$NON-NLS-1$ + }, new int[] { 100 }, true); + } + // Apply the tab folder selection foreground color + tabFolder.setSelectionForeground(JFaceResources.getColorRegistry().get("org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR")); //$NON-NLS-1$ + + // Set the tab style from the global preferences + tabFolder.setSimple(PlatformUI.getPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS)); + + // Attach the mouse listener + tabFolder.addMouseListener(new MouseAdapter() { + @Override + public void mouseDown(MouseEvent e) { + if (e.button == 2) { + // middle mouse button click - close tab + CTabItem item = tabFolder.getItem(new Point(e.x, e.y)); + if (item != null) item.dispose(); + } + } + }); + } + + /** + * If True is returned, the inner tabs are colored with gradient coloring set in + * the Eclipse workbench color settings. + * + * @return True to use gradient tab colors, false otherwise. + */ + protected boolean useGradientTabBackgroundColor() { + return false; + } + + /** + * Creates the tab folder manager. + * + * @param parentView The parent view instance. Must not be null. + * @return The tab folder manager. Must never be null. + */ + protected TabFolderManager doCreateTabFolderManager(ITerminalsView parentView) { + Assert.isNotNull(parentView); + return new TabFolderManager(parentView); + } + + /** + * Creates the tab folder menu handler. + * + * @param parentView The parent view instance. Must not be null. + * @return The tab folder menu handler. Must never be null. + */ + protected TabFolderMenuHandler doCreateTabFolderMenuHandler(ITerminalsView parentView) { + Assert.isNotNull(parentView); + return new TabFolderMenuHandler(parentView); + } + + /** + * Configure the tab folder menu handler + * + * @param menuHandler The tab folder menu handler. Must not be null. + */ + protected void doConfigureTabFolderMenuHandler(TabFolderMenuHandler menuHandler) { + Assert.isNotNull(menuHandler); + menuHandler.initialize(); + } + + /** + * Creates the tab folder toolbar handler. + * + * @param parentView The parent view instance. Must not be null. + * @return The tab folder toolbar handler. Must never be null. + */ + protected TabFolderToolbarHandler doCreateTabFolderToolbarHandler(ITerminalsView parentView) { + Assert.isNotNull(parentView); + return new TabFolderToolbarHandler(parentView); + } + + /** + * Configure the tab folder toolbar handler + * + * @param toolbarHandler The tab folder toolbar handler. Must not be null. + */ + protected void doConfigureTabFolderToolbarHandler(TabFolderToolbarHandler toolbarHandler) { + Assert.isNotNull(toolbarHandler); + toolbarHandler.initialize(); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.part.WorkbenchPart#setFocus() + */ + @Override + public void setFocus() { + if (pageBookControl != null) pageBookControl.setFocus(); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView#switchToEmptyPageControl() + */ + @Override + public void switchToEmptyPageControl() { + if (pageBookControl != null && !pageBookControl.isDisposed() + && emptyPageControl != null && !emptyPageControl.isDisposed()) { + pageBookControl.showPage(emptyPageControl); + } + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView#switchToTabFolderControl() + */ + @Override + public void switchToTabFolderControl() { + if (pageBookControl != null && !pageBookControl.isDisposed() + && tabFolderControl != null && !tabFolderControl.isDisposed()) { + pageBookControl.showPage(tabFolderControl); + } + } + + /* (non-Javadoc) + * @see org.eclipse.ui.part.WorkbenchPart#getAdapter(java.lang.Class) + */ + @Override + public Object getAdapter(Class adapter) { + if (CTabFolder.class.isAssignableFrom(adapter)) { + return tabFolderControl; + } + if (TabFolderManager.class.isAssignableFrom(adapter)) { + return tabFolderManager; + } + if (TabFolderMenuHandler.class.isAssignableFrom(adapter)) { + return tabFolderMenuHandler; + } + if (TabFolderToolbarHandler.class.isAssignableFrom(adapter)) { + return tabFolderToolbarHandler; + } + if (TerminalsViewMementoHandler.class.isAssignableFrom(adapter)) { + return mementoHandler; + } + + return super.getAdapter(adapter); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView#setPinned(boolean) + */ + @Override + public void setPinned(boolean pin) { + this.pinned = pin; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView#isPinned() + */ + @Override + public boolean isPinned() { + return pinned; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.part.ViewPart#saveState(org.eclipse.ui.IMemento) + */ + @Override + public void saveState(IMemento memento) { + super.saveState(memento); + if (memento == null) return; + mementoHandler.saveState(this, memento); + } + + /** + * Restore the view state from the given memento. + * + * @param memento The memento or null. + */ + public void restoreState(IMemento memento) { + if (memento == null) return; + mementoHandler.restoreState(this, memento); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.part.IShowInTarget#show(org.eclipse.ui.part.ShowInContext) + */ + @Override + public boolean show(ShowInContext context) { + if (context != null) { + // Get the selection from the context + ISelection selection = context.getSelection(); + // The selection must contain elements that can be adapted to IResource + if (selection instanceof IStructuredSelection && !selection.isEmpty()) { + boolean isValid = true; + + Iterator iterator = ((IStructuredSelection)selection).iterator(); + while (iterator.hasNext() && isValid) { + Object element = iterator.next(); + Object adapted = null; + + Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$ + if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) { + if (element instanceof org.eclipse.core.resources.IResource) continue; + + adapted = element instanceof IAdaptable ? ((IAdaptable)element).getAdapter(org.eclipse.core.resources.IResource.class) : null; + if (adapted == null) adapted = Platform.getAdapterManager().getAdapter(element, org.eclipse.core.resources.IResource.class); + if (adapted == null) adapted = Platform.getAdapterManager().loadAdapter(element, org.eclipse.core.resources.IResource.class.getName()); + } + + isValid = adapted != null; + } + + // If the selection is valid, fire the command to open the local terminal + if (isValid) { + ICommandService service = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class); + Command command = service != null ? service.getCommand("org.eclipse.tcf.te.ui.terminals.local.command.launch") : null; //$NON-NLS-1$ + if (command != null && command.isDefined() && command.isEnabled()) { + try { + ParameterizedCommand pCmd = ParameterizedCommand.generateCommand(command, null); + Assert.isNotNull(pCmd); + IHandlerService handlerSvc = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class); + Assert.isNotNull(handlerSvc); + IEvaluationContext ctx = handlerSvc.getCurrentState(); + ctx = new EvaluationContext(ctx, selection); + ctx.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, selection); + handlerSvc.executeCommandInContext(pCmd, null, ctx); + } catch (Exception e) { + // If the platform is in debug mode, we print the exception to the log view + if (Platform.inDebugMode()) { + IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), + Messages.AbstractTriggerCommandHandler_error_executionFailed, e); + UIPlugin.getDefault().getLog().log(status); + } + } + } + return true; + } + } + } + return false; + } +} diff --git a/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsViewMementoHandler.java b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsViewMementoHandler.java new file mode 100644 index 00000000000..c4d419fb065 --- /dev/null +++ b/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsViewMementoHandler.java @@ -0,0 +1,225 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.view; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicBoolean; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.actions.PinTerminalAction; +import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate; +import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler; +import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager; +import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderToolbarHandler; +import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; +import org.eclipse.ui.IMemento; +import org.eclipse.ui.PlatformUI; + +/** + * Take care of the persisted state handling of the "Terminals" view. + */ +@SuppressWarnings("restriction") +public class TerminalsViewMementoHandler { + // The list of items to save. See the workbench listener implementation + // in o.e.tcf.te.ui.terminals.activator.UIPlugin. + private final List saveables = new ArrayList(); + + /** + * Sets the list of saveable items. + * + * @param saveables The list of saveable items. Must not be null. + */ + public void setSaveables(List saveables) { + Assert.isNotNull(saveables); + this.saveables.clear(); + this.saveables.addAll(saveables); + } + + /** + * Saves the view state in the given memento. + * + * @param view The terminals view. Must not be null. + * @param memento The memento. Must not be null. + */ + @SuppressWarnings("unchecked") + public void saveState(TerminalsView view, IMemento memento) { + Assert.isNotNull(view); + Assert.isNotNull(memento); + + // Create a child element within the memento holding the + // connection info of the open, non-terminated tab items + memento = memento.createChild("terminalConnections"); //$NON-NLS-1$ + Assert.isNotNull(memento); + + // Write the view id and secondary id + memento.putString("id", view.getViewSite().getId()); //$NON-NLS-1$ + memento.putString("secondaryId", view.getViewSite().getSecondaryId()); //$NON-NLS-1$ + + // Save the pinned state + memento.putBoolean("pinned", view.isPinned()); //$NON-NLS-1$ + + // Loop the saveable items and store the connection data of each + // item to the memento + for (CTabItem item : saveables) { + // Ignore disposed items + if (item.isDisposed()) continue; + + // Get the original terminal properties associated with the tab item + Map properties = (Map)item.getData("properties"); //$NON-NLS-1$ + if (properties == null) continue; + + // Get the terminal launcher delegate + String delegateId = (String)properties.get(ITerminalsConnectorConstants.PROP_DELEGATE_ID); + ILauncherDelegate delegate = delegateId != null ? LauncherDelegateManager.getInstance().getLauncherDelegate(delegateId, false) : null; + IMementoHandler mementoHandler = delegate != null ? (IMementoHandler)delegate.getAdapter(IMementoHandler.class) : null; + if (mementoHandler != null) { + // Create terminal connection child memento + IMemento connectionMemento = memento.createChild("connection"); //$NON-NLS-1$ + Assert.isNotNull(connectionMemento); + // Store the common attributes + connectionMemento.putString(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegateId); + + String terminalConnectorId = (String)properties.get(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID); + if (terminalConnectorId != null) { + connectionMemento.putString(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, terminalConnectorId); + } + + if (properties.get(ITerminalsConnectorConstants.PROP_FORCE_NEW) instanceof Boolean) { + connectionMemento.putBoolean(ITerminalsConnectorConstants.PROP_FORCE_NEW, ((Boolean)properties.get(ITerminalsConnectorConstants.PROP_FORCE_NEW)).booleanValue()); + } + + // Store the current encoding + ITerminalViewControl terminal = (ITerminalViewControl)item.getData(); + String encoding = terminal != null ? terminal.getEncoding() : null; + if (encoding == null || "".equals(encoding)) encoding = (String)properties.get(ITerminalsConnectorConstants.PROP_ENCODING); //$NON-NLS-1$ + if (encoding != null && !"".equals(encoding)) { //$NON-NLS-1$ + connectionMemento.putString(ITerminalsConnectorConstants.PROP_ENCODING, encoding); + } + + // Pass on to the memento handler + mementoHandler.saveState(connectionMemento, properties); + } + } + } + + /** + * Restore the view state from the given memento. + * + * @param view The terminals view. Must not be null. + * @param memento The memento. Must not be null. + */ + protected void restoreState(final TerminalsView view, IMemento memento) { + Assert.isNotNull(view); + Assert.isNotNull(memento); + + // Get the "terminalConnections" memento + memento = memento.getChild("terminalConnections"); //$NON-NLS-1$ + if (memento != null) { + // Read view id and secondary id + String id = memento.getString("id"); //$NON-NLS-1$ + String secondaryId = memento.getString("secondaryId"); //$NON-NLS-1$ + if ("null".equals(secondaryId)) secondaryId = null; //$NON-NLS-1$ + + final IMemento finMemento = memento; + // Restore the pinned state of the after all connections completed + final Runnable runnable = new Runnable() { + @Override + public void run() { + if (finMemento.getBoolean("pinned") != null) { //$NON-NLS-1$ + asyncExec(new Runnable() { + @Override + public void run() { + view.setPinned(finMemento.getBoolean("pinned").booleanValue()); //$NON-NLS-1$ + + TabFolderToolbarHandler toolbarHandler = (TabFolderToolbarHandler)view.getAdapter(TabFolderToolbarHandler.class); + if (toolbarHandler != null) { + PinTerminalAction action = (PinTerminalAction)toolbarHandler.getAdapter(PinTerminalAction.class); + if (action != null) action.setChecked(view.isPinned()); + } + } + }); + } + } + }; + + final AtomicBoolean allProcessed = new AtomicBoolean(false); + final List callbacks = new ArrayList(); + + // Get all the "connection" memento's. + IMemento[] connections = memento.getChildren("connection"); //$NON-NLS-1$ + for (IMemento connection : connections) { + // Create the properties container that holds the terminal properties + Map properties = new HashMap(); + + // Set the view id attributes + properties.put(ITerminalsConnectorConstants.PROP_ID, id); + properties.put(ITerminalsConnectorConstants.PROP_SECONDARY_ID, secondaryId); + + // Restore the common attributes + properties.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, connection.getString(ITerminalsConnectorConstants.PROP_DELEGATE_ID)); + properties.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, connection.getString(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID)); + if (connection.getBoolean(ITerminalsConnectorConstants.PROP_FORCE_NEW) != null) { + properties.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, connection.getBoolean(ITerminalsConnectorConstants.PROP_FORCE_NEW)); + } + + // Restore the encoding + if (connection.getString(ITerminalsConnectorConstants.PROP_ENCODING) != null) { + properties.put(ITerminalsConnectorConstants.PROP_ENCODING, connection.getString(ITerminalsConnectorConstants.PROP_ENCODING)); + } + + // Get the terminal launcher delegate + String delegateId = (String)properties.get(ITerminalsConnectorConstants.PROP_DELEGATE_ID); + ILauncherDelegate delegate = delegateId != null ? LauncherDelegateManager.getInstance().getLauncherDelegate(delegateId, false) : null; + IMementoHandler mementoHandler = delegate != null ? (IMementoHandler)delegate.getAdapter(IMementoHandler.class) : null; + if (mementoHandler != null) { + // Pass on to the memento handler + mementoHandler.restoreState(connection, properties); + } + + // Restore the terminal connection + if (delegate != null && !properties.isEmpty()) { + ITerminalService.Done done = new ITerminalService.Done() { + @Override + public void done(IStatus status) { + callbacks.remove(this); + if (allProcessed.get() && callbacks.isEmpty()) { + asyncExec(runnable); + } + } + }; + callbacks.add(done); + delegate.execute(properties, done); + } + } + + allProcessed.set(true); + if (callbacks.isEmpty()) asyncExec(runnable); + } + } + + /** + * Executes the given runnable asynchronously in the display thread. + * + * @param runnable The runnable. Must not be null. + */ + /* default */ void asyncExec(Runnable runnable) { + Assert.isNotNull(runnable); + if (PlatformUI.getWorkbench() != null && PlatformUI.getWorkbench().getDisplay() != null && !PlatformUI.getWorkbench().getDisplay().isDisposed()) { + PlatformUI.getWorkbench().getDisplay().asyncExec(runnable); + } + } +} diff --git a/terminals-eclipse-4.4.x-luna.target b/terminals-eclipse-4.4.x-luna.target new file mode 100644 index 00000000000..ac4abf65112 --- /dev/null +++ b/terminals-eclipse-4.4.x-luna.target @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/terminals.psf b/terminals.psf new file mode 100644 index 00000000000..5e38d96e301 --- /dev/null +++ b/terminals.psf @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file