Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2016-08-25 11:30:48 +0000
committerAlexander Kurtakov2016-08-25 14:16:30 +0000
commit9726bf01ad3eabaedddad48df5a19a22631d812c (patch)
tree5bbf3bad28f0cce51eb23044bff07660be7b4bcc
parent1bc8f156524a98dcf41a84b237d5487c719f81ad (diff)
downloadorg.eclipse.linuxtools-9726bf01ad3eabaedddad48df5a19a22631d812c.tar.gz
org.eclipse.linuxtools-9726bf01ad3eabaedddad48df5a19a22631d812c.tar.xz
org.eclipse.linuxtools-9726bf01ad3eabaedddad48df5a19a22631d812c.zip
Bug 497027 - Man page plugin forces install of CDT
Code from LinuxtoolsProcessFactory class copied and simplified as some features are not needed to remove the dep. Practically this is pure JSch implementation. Change-Id: Ie25d5bd5243c0ca571ce51a83eafd25d85884178 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com> Reviewed-on: https://git.eclipse.org/r/79720 Reviewed-by: Mat Booth <mat.booth@redhat.com> Tested-by: Hudson CI (cherry picked from commit b4b9c1eeebda569580a4dcc470a2f3ebbfe0285d) Reviewed-on: https://git.eclipse.org/r/79726
-rw-r--r--man/org.eclipse.linuxtools.man.core/.settings/org.eclipse.jdt.core.prefs1
-rw-r--r--man/org.eclipse.linuxtools.man.core/.settings/org.eclipse.jdt.ui.prefs7
-rw-r--r--man/org.eclipse.linuxtools.man.core/META-INF/MANIFEST.MF3
-rw-r--r--man/org.eclipse.linuxtools.man.core/pom.xml2
-rw-r--r--man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/parser/ManParser.java65
5 files changed, 65 insertions, 13 deletions
diff --git a/man/org.eclipse.linuxtools.man.core/.settings/org.eclipse.jdt.core.prefs b/man/org.eclipse.linuxtools.man.core/.settings/org.eclipse.jdt.core.prefs
index dd535f8817..8d6cd3c2f1 100644
--- a/man/org.eclipse.linuxtools.man.core/.settings/org.eclipse.jdt.core.prefs
+++ b/man/org.eclipse.linuxtools.man.core/.settings/org.eclipse.jdt.core.prefs
@@ -16,6 +16,7 @@ org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annota
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
diff --git a/man/org.eclipse.linuxtools.man.core/.settings/org.eclipse.jdt.ui.prefs b/man/org.eclipse.linuxtools.man.core/.settings/org.eclipse.jdt.ui.prefs
index c43046c52c..8611630202 100644
--- a/man/org.eclipse.linuxtools.man.core/.settings/org.eclipse.jdt.ui.prefs
+++ b/man/org.eclipse.linuxtools.man.core/.settings/org.eclipse.jdt.ui.prefs
@@ -1,4 +1,3 @@
-#Wed Dec 09 21:56:11 EET 2009
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=org.eclipse.jdt.ui.default.eclipse_profile
@@ -14,15 +13,18 @@ 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=false
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_functional_interfaces=true
sp_cleanup.convert_to_enhanced_for_loop=false
sp_cleanup.correct_indentation=false
sp_cleanup.format_source_code=true
sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.insert_inferred_type_arguments=false
sp_cleanup.make_local_variable_final=false
sp_cleanup.make_parameters_final=false
sp_cleanup.make_private_fields_final=true
@@ -38,6 +40,7 @@ sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=
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_redundant_type_arguments=false
sp_cleanup.remove_trailing_whitespaces=false
sp_cleanup.remove_trailing_whitespaces_all=true
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
@@ -51,8 +54,10 @@ 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_anonymous_class_creation=false
sp_cleanup.use_blocks=false
sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=true
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
diff --git a/man/org.eclipse.linuxtools.man.core/META-INF/MANIFEST.MF b/man/org.eclipse.linuxtools.man.core/META-INF/MANIFEST.MF
index 835c7e995f..21c59602dc 100644
--- a/man/org.eclipse.linuxtools.man.core/META-INF/MANIFEST.MF
+++ b/man/org.eclipse.linuxtools.man.core/META-INF/MANIFEST.MF
@@ -2,11 +2,10 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.linuxtools.man.core;singleton:=true
-Bundle-Version: 1.4.0.qualifier
+Bundle-Version: 1.5.0.qualifier
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.jface.text,
- org.eclipse.linuxtools.tools.launch.core,
com.jcraft.jsch
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: org.eclipse.linuxtools.internal.man.parser;x-friends:="org.eclipse.linuxtools.man.help",
diff --git a/man/org.eclipse.linuxtools.man.core/pom.xml b/man/org.eclipse.linuxtools.man.core/pom.xml
index c6f01352e5..ddc5c61480 100644
--- a/man/org.eclipse.linuxtools.man.core/pom.xml
+++ b/man/org.eclipse.linuxtools.man.core/pom.xml
@@ -23,7 +23,7 @@
</parent>
<artifactId>org.eclipse.linuxtools.man.core</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.5.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>Linux Tools Man Plug-in</name>
diff --git a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/parser/ManParser.java b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/parser/ManParser.java
index c232a2a285..c0447e6893 100644
--- a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/parser/ManParser.java
+++ b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/internal/man/parser/ManParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015-2016 Red Hat Inc. and others.
+ * Copyright (c) 2009, 2016 Red Hat 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
@@ -21,6 +21,8 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
+import java.util.Properties;
+import java.util.stream.Collectors;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
@@ -28,17 +30,22 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.linuxtools.internal.man.preferences.PreferenceConstants;
-import org.eclipse.linuxtools.tools.launch.core.factory.LinuxtoolsProcessFactory;
import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkUtil;
+import com.jcraft.jsch.Channel;
+import com.jcraft.jsch.ChannelExec;
+import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.Session;
/**
* Parser for the man executable output.
*/
public class ManParser {
+ private static final int DEFAULT_SSH_PORT = 22;
+
/**
* Gets the list of paths returned when one runs "man -w" with no other
* parameters. This is the list of directories that is searched by man for
@@ -139,10 +146,7 @@ public class ManParser {
? new BufferedReader(new InputStreamReader(manContent))
: null) {
if (reader != null) {
- String line = null;
- while ((line = reader.readLine()) != null) {
- sb.append(line + "\n"); //$NON-NLS-1$
- }
+ sb.append(reader.lines().collect(Collectors.joining("\n"))); //$NON-NLS-1$
}
} catch (IOException e) {
Bundle bundle = FrameworkUtil.getBundle(this.getClass());
@@ -177,9 +181,8 @@ public class ManParser {
}
};
try {
- LinuxtoolsProcessFactory.execRemoteAndWait(
- new String[] { getManExecutable(), manPage }, out, out,
- user, host, password);
+ execRemoteAndWait(new String[] { getManExecutable(), manPage }, out,
+ out, user, host, password);
} catch (JSchException e) {
sb.setLength(0);
sb.append(Messages.ManParser_RemoteAccessError);
@@ -187,6 +190,50 @@ public class ManParser {
return sb;
}
+ private static Channel execRemoteAndWait(String[] args, OutputStream out,
+ OutputStream err, String user, String host, String password)
+ throws JSchException {
+ Channel channel = execRemote(args, out, err, user, host, password);
+
+ while (!channel.isClosed()) {
+ try {
+ Thread.sleep(250);
+ } catch (InterruptedException e) {
+ // Thread was interrupted just return.
+ return channel;
+ }
+ }
+
+ return channel;
+ }
+
+ private static Channel execRemote(String[] args, OutputStream out,
+ OutputStream err, String user, String host, String password)
+ throws JSchException {
+ JSch jsch = new JSch();
+ Session session = jsch.getSession(user, host, DEFAULT_SSH_PORT);
+ session.setPassword(password);
+ Properties config = new Properties();
+ config.put("StrictHostKeyChecking", "no"); //$NON-NLS-1$//$NON-NLS-2$
+ session.setConfig(config);
+ session.connect();
+
+ StringBuilder command = new StringBuilder();
+ for (int i = 0; i < args.length; i++) {
+ command.append(args[i] + ' ');
+ }
+
+ ChannelExec channel = (ChannelExec) session.openChannel("exec"); //$NON-NLS-1$
+ channel.setPty(true);
+ channel.setCommand(command.toString());
+ channel.setInputStream(null, true);
+ channel.setOutputStream(out, true);
+ channel.setExtOutputStream(err, true);
+ channel.connect();
+
+ return channel;
+ }
+
private static String getManExecutable() {
IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(
FrameworkUtil.getBundle(ManParser.class).getSymbolicName());

Back to the top