diff options
author | Ed Merks | 2019-08-30 09:53:38 +0000 |
---|---|---|
committer | Ed Merks | 2019-08-30 11:58:25 +0000 |
commit | bad59ca7f79216de23747df8971189a1cce54566 (patch) | |
tree | 3b826958b809ae0fca3be9bdc814e078130665ec | |
parent | a8ab10f84ff3b7080516961f6901ad1864257445 (diff) | |
download | eclipse.pde.ui-bad59ca7f79216de23747df8971189a1cce54566.tar.gz eclipse.pde.ui-bad59ca7f79216de23747df8971189a1cce54566.tar.xz eclipse.pde.ui-bad59ca7f79216de23747df8971189a1cce54566.zip |
Bug 550585 - Fix files that have ended up with CRLF in the gitS4_13_0_RC2aS4_13_0_RC2R4_13I20190916-1045I20190907-1130I20190906-1800I20190906-0940I20190906-0410I20190904-2200I20190904-1805I20190904-0605I20190903-2155I20190903-1800I20190903-1410I20190903-1110I20190903-0605I20190902-1800I20190902-0805I20190902-0600I20190901-1800I20190901-0600I20190831-1800I20190831-0600I20190830-1800R4_13_maintenance
repository
Change-Id: I5296e30039512ef1b66b0526d0bd9c731de1506c
Signed-off-by: Ed Merks <ed.merks@gmail.com>
6 files changed, 1071 insertions, 1067 deletions
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/core/target/ITargetDefinition.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/core/target/ITargetDefinition.java index cbf690207b..279ef97f75 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/core/target/ITargetDefinition.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/core/target/ITargetDefinition.java @@ -1,340 +1,340 @@ -/*******************************************************************************
- * Copyright (c) 2008, 2018 IBM Corporation and others.
+/******************************************************************************* + * Copyright (c) 2008, 2018 IBM Corporation and others. * - * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
+ * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * - * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Lucas Bullen (Red Hat Inc.) - [Bug 531602] formatting munged by editor
- *******************************************************************************/
-package org.eclipse.pde.core.target;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.osgi.service.environment.Constants;
-import org.w3c.dom.Document;
-
-/**
- * Defines a target platform. A target platform is a collection of bundles and
- * features configured for a specific environment.
- *
- * @see ITargetPlatformService Use the target platform service to work with target definitions
- *
- * @since 3.8
- * @noimplement This interface is not intended to be implemented by clients.
- * @noextend This interface is not intended to be extended by clients.
- */
-public interface ITargetDefinition {
-
- /**
- * Resolves all contents of this target definition by resolving each
- * {@link ITargetLocation} in this target definition.
- * <p>
- * Returns a {@link MultiStatus} containing any non-OK statuses produced
- * when resolving each {@link ITargetLocation}. An OK status will be
- * returned if no non-OK statuses are returned from the locations. A
- * CANCEL status will be returned if the monitor is cancelled.
- * </p><p>
- * For more information on how a target resolves, see
- * {@link ITargetLocation#resolve(ITargetDefinition, IProgressMonitor)}
- * </p>
- *
- * @param monitor progress monitor or <code>null</code>
- * @return resolution multi-status
- */
- IStatus resolve(IProgressMonitor monitor);
-
- /**
- * Returns whether all {@link ITargetLocation}s in this target currently in
- * a resolved state.
- *
- * @return <code>true</code> if all locations are currently resolved
- */
- boolean isResolved();
-
- /**
- * Sets the XML document that stores the state of this target. The document is
- * updated with each setter that has an affect on the target file source.
- *
- * @param document
- * xml document or <code>null</code>
- * @since 3.12
- */
- void setDocument(Document document);
-
- /**
- * Returns the Document that represents this target, or <code>null</code> if
- * none
- *
- * @return document or <code>null</code>
- * @since 3.12
- */
- Document getDocument();
-
- /**
- * Returns all bundles included in this target definition or <code>null</code>
- * if this container is not resolved. Takes all the bundles available from the
- * set target locations (returned by {@link #getAllBundles()} and applies
- * the filters (returned by {@link #getIncluded()})
- * to determine the final list of bundles in this target.
- * <p>
- * Some of the returned bundles may have non-OK statuses. These bundles may be
- * missing some information (location, version, source target). To get a bundle's
- * status call {@link TargetBundle#getStatus()}. Calling {@link #getStatus()}
- * will return all problems in this target definition.
- * </p>
- * @return resolved bundles or <code>null</code>
- */
- TargetBundle[] getBundles();
-
- /**
- * Returns a list of all resolved bundles in this target definition or <code>null</code>.
- * Does not filter based on any filters ({@link #getIncluded()}.
- * Returns <code>null</code> if this target has not been resolved.
- * Use {@link #getBundles()} to get the filtered list of bundles.
- * <p>
- * Some of the returned bundles may have non-OK statuses. These bundles may be
- * missing some information (location, version, source target). To get a bundle's
- * status call {@link TargetBundle#getStatus()}. Calling {@link #getStatus()}
- * will return all problems in this target definition.
- * </p>
- *
- * @return collection of resolved bundles or <code>null</code>
- */
- TargetBundle[] getAllBundles();
-
- /**
- * Returns the list of feature models available in this target or <code>null</code> if
- * this target has not been resolved.
- *
- * @return collection of feature models or <code>null</code>
- */
- TargetFeature[] getAllFeatures();
-
- /**
- * Returns a {@link MultiStatus} containing all problems with this target.
- * Returns an OK status if there are no problems. Returns <code>null</code>
- * if this target has not been resolved.
- * <p>
- * The returned status will include all non-OK statuses returned by
- * {@link #resolve(IProgressMonitor)} as well as any non-OK statuses found
- * in {@link TargetBundle}s returned by {@link #getBundles()}. For more
- * information on the statuses that can be returned see
- * {@link ITargetLocation#getStatus()} and {@link TargetBundle#getStatus()}.
- * </p>
- *
- * @return {@link MultiStatus} containing all problems with this target or
- * <code>null</code>
- */
- IStatus getStatus();
-
- /**
- * Returns a handle to this target definition.
- *
- * @return target handle
- */
- ITargetHandle getHandle();
-
- /**
- * Returns the name of this target, or <code>null</code> if none
- *
- * @return name or <code>null</code>
- */
- String getName();
-
- /**
- * Sets the name of this target.
- *
- * @param name target name or <code>null</code>
- */
- void setName(String name);
-
- /**
- * Returns the locations defined by this target, possible <code>null</code>.
- *
- * @return target locations or <code>null</code>
- */
- ITargetLocation[] getTargetLocations();
-
- /**
- * Sets the locations in this target definition or <code>null</code> if none.
- *
- * @param containers target locations or <code>null</code>
- */
- void setTargetLocations(ITargetLocation[] containers);
-
- /**
- * Returns a list of descriptors that filter the resolved plug-ins in this target. The list may include
- * both plug-ins and features. The returned descriptors will have an id, may have a version and will have
- * either {@link NameVersionDescriptor#TYPE_FEATURE} or {@link NameVersionDescriptor#TYPE_PLUGIN} as their
- * type. If the target is set to include all units (no filtering is being done), this method will return
- * <code>null</code>.
- *
- * @see #getBundles()
- * @see #setIncluded(NameVersionDescriptor[])
- * @return list of name version descriptors or <code>null</code>
- */
- NameVersionDescriptor[] getIncluded();
-
- /**
- * Sets a list of descriptors to filter the resolved plug-ins in this target. The list may include both
- * plug-ins and features. To include all plug-ins in the target, pass <code>null</code> as the argument.
- * <p>
- * The descriptions passed to this method must have an ID set. The version may be <code>null</code>
- * to include any version of the matches the ID. Only descriptors with a type of {@link NameVersionDescriptor#TYPE_FEATURE}
- * or {@link NameVersionDescriptor#TYPE_PLUGIN} will be considered.
- * </p>
- * @see #getBundles()
- * @see #getIncluded()
- * @param included list of descriptors to include in the target or <code>null</code> to include all plug-ins
- */
- void setIncluded(NameVersionDescriptor[] included);
-
- /**
- * Returns JRE container path that this target definition should be built against,
- * or <code>null</code> if the workspace default JRE should be used. JavaRuntime can be used
- * to resolve JRE's and execution environments from a container path.
- *
- * @return JRE container path or <code>null</code>
- * @see JavaRuntime
- */
- IPath getJREContainer();
-
- /**
- * Sets the JRE that this target definition should be built against, or <code>null</code>
- * to use the workspace default JRE. JavaRuntime should be used to generate and parse
- * JRE container paths.
- *
- * @param containerPath JRE container path
- * @see JavaRuntime
- */
- void setJREContainer(IPath containerPath);
-
- /**
- * Returns the identifier of the operating system this target is configured for,
- * possibly <code>null</code>.
- *
- * @return operating system identifier or <code>null</code> to default to the
- * running operating system
- */
- String getOS();
-
- /**
- * Sets the operating system this target is configured for or <code>null</code> to
- * default to the running operating system.
- *
- * @param os operating system identifier - one of the operating system constants
- * defined by {@link Constants} or <code>null</code> to default to the running
- * operating system
- */
- void setOS(String os);
-
- /**
- * Returns the identifier of the window system this target is configured for,
- * possibly <code>null</code>.
- *
- * @return window system identifier - one of the window system constants
- * defined by {@link Constants}, or <code>null</code> to default to the
- * running window system
- */
- String getWS();
-
- /**
- * Sets the window system this target is configured for or <code>null</code> to
- * default to the running window system.
- *
- * @param ws window system identifier or <code>null</code> to default to the
- * running window system
- */
- void setWS(String ws);
-
- /**
- * Returns the identifier of the architecture this target is configured for,
- * or <code>null</code> to default to the running architecture.
- *
- * @return architecture identifier - one of the architecture constants
- * defined by {@link Constants} or <code>null</code> to default to the running
- * architecture
- */
- String getArch();
-
- /**
- * Sets the architecture this target is configured for, or <code>null</code> to default
- * to the running architecture.
- *
- * @param arch architecture identifier or <code>null</code> to default to the
- * running architecture.
- */
- void setArch(String arch);
-
- /**
- * Returns the identifier of the locale this target is configured for, or <code>null</code>
- * for default.
- *
- * @return locale identifier or <code>null</code> for default
- */
- String getNL();
-
- /**
- * Sets the locale this target is configured for or <code>null</code> for default.
- *
- * @param nl locale identifier or <code>null</code> for default
- */
- void setNL(String nl);
-
- /**
- * Returns any program arguments that should be used when launching this target
- * or <code>null</code> if none.
- *
- * @return program arguments or <code>null</code> if none
- */
- String getProgramArguments();
-
- /**
- * Sets any program arguments that should be used when launching this target
- * or <code>null</code> if none.
- *
- * @param args program arguments or <code>null</code>
- */
- void setProgramArguments(String args);
-
- /**
- * Returns any VM arguments that should be used when launching this target
- * or <code>null</code> if none.
- *
- * @return VM arguments or <code>null</code> if none
- */
- String getVMArguments();
-
- /**
- * Sets any VM arguments that should be used when launching this target
- * or <code>null</code> if none.
- *
- * @param args VM arguments or <code>null</code>
- */
- void setVMArguments(String args);
-
- /**
- * Sets implicit dependencies for this target. Bundles in this collection are always
- * considered by PDE when computing plug-in dependencies. Only symbolic names need to
- * be specified in the given descriptors.
- *
- * @param bundles implicit dependencies or <code>null</code> if none
- */
- void setImplicitDependencies(NameVersionDescriptor[] bundles);
-
- /**
- * Returns the implicit dependencies set on this target or <code>null</code> if none.
- *
- * @return implicit dependencies or <code>null</code>
- */
- NameVersionDescriptor[] getImplicitDependencies();
-}
+ * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * IBM Corporation - initial API and implementation + * Lucas Bullen (Red Hat Inc.) - [Bug 531602] formatting munged by editor + *******************************************************************************/ +package org.eclipse.pde.core.target; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.jdt.launching.JavaRuntime; +import org.eclipse.osgi.service.environment.Constants; +import org.w3c.dom.Document; + +/** + * Defines a target platform. A target platform is a collection of bundles and + * features configured for a specific environment. + * + * @see ITargetPlatformService Use the target platform service to work with target definitions + * + * @since 3.8 + * @noimplement This interface is not intended to be implemented by clients. + * @noextend This interface is not intended to be extended by clients. + */ +public interface ITargetDefinition { + + /** + * Resolves all contents of this target definition by resolving each + * {@link ITargetLocation} in this target definition. + * <p> + * Returns a {@link MultiStatus} containing any non-OK statuses produced + * when resolving each {@link ITargetLocation}. An OK status will be + * returned if no non-OK statuses are returned from the locations. A + * CANCEL status will be returned if the monitor is cancelled. + * </p><p> + * For more information on how a target resolves, see + * {@link ITargetLocation#resolve(ITargetDefinition, IProgressMonitor)} + * </p> + * + * @param monitor progress monitor or <code>null</code> + * @return resolution multi-status + */ + IStatus resolve(IProgressMonitor monitor); + + /** + * Returns whether all {@link ITargetLocation}s in this target currently in + * a resolved state. + * + * @return <code>true</code> if all locations are currently resolved + */ + boolean isResolved(); + + /** + * Sets the XML document that stores the state of this target. The document is + * updated with each setter that has an affect on the target file source. + * + * @param document + * xml document or <code>null</code> + * @since 3.12 + */ + void setDocument(Document document); + + /** + * Returns the Document that represents this target, or <code>null</code> if + * none + * + * @return document or <code>null</code> + * @since 3.12 + */ + Document getDocument(); + + /** + * Returns all bundles included in this target definition or <code>null</code> + * if this container is not resolved. Takes all the bundles available from the + * set target locations (returned by {@link #getAllBundles()} and applies + * the filters (returned by {@link #getIncluded()}) + * to determine the final list of bundles in this target. + * <p> + * Some of the returned bundles may have non-OK statuses. These bundles may be + * missing some information (location, version, source target). To get a bundle's + * status call {@link TargetBundle#getStatus()}. Calling {@link #getStatus()} + * will return all problems in this target definition. + * </p> + * @return resolved bundles or <code>null</code> + */ + TargetBundle[] getBundles(); + + /** + * Returns a list of all resolved bundles in this target definition or <code>null</code>. + * Does not filter based on any filters ({@link #getIncluded()}. + * Returns <code>null</code> if this target has not been resolved. + * Use {@link #getBundles()} to get the filtered list of bundles. + * <p> + * Some of the returned bundles may have non-OK statuses. These bundles may be + * missing some information (location, version, source target). To get a bundle's + * status call {@link TargetBundle#getStatus()}. Calling {@link #getStatus()} + * will return all problems in this target definition. + * </p> + * + * @return collection of resolved bundles or <code>null</code> + */ + TargetBundle[] getAllBundles(); + + /** + * Returns the list of feature models available in this target or <code>null</code> if + * this target has not been resolved. + * + * @return collection of feature models or <code>null</code> + */ + TargetFeature[] getAllFeatures(); + + /** + * Returns a {@link MultiStatus} containing all problems with this target. + * Returns an OK status if there are no problems. Returns <code>null</code> + * if this target has not been resolved. + * <p> + * The returned status will include all non-OK statuses returned by + * {@link #resolve(IProgressMonitor)} as well as any non-OK statuses found + * in {@link TargetBundle}s returned by {@link #getBundles()}. For more + * information on the statuses that can be returned see + * {@link ITargetLocation#getStatus()} and {@link TargetBundle#getStatus()}. + * </p> + * + * @return {@link MultiStatus} containing all problems with this target or + * <code>null</code> + */ + IStatus getStatus(); + + /** + * Returns a handle to this target definition. + * + * @return target handle + */ + ITargetHandle getHandle(); + + /** + * Returns the name of this target, or <code>null</code> if none + * + * @return name or <code>null</code> + */ + String getName(); + + /** + * Sets the name of this target. + * + * @param name target name or <code>null</code> + */ + void setName(String name); + + /** + * Returns the locations defined by this target, possible <code>null</code>. + * + * @return target locations or <code>null</code> + */ + ITargetLocation[] getTargetLocations(); + + /** + * Sets the locations in this target definition or <code>null</code> if none. + * + * @param containers target locations or <code>null</code> + */ + void setTargetLocations(ITargetLocation[] containers); + + /** + * Returns a list of descriptors that filter the resolved plug-ins in this target. The list may include + * both plug-ins and features. The returned descriptors will have an id, may have a version and will have + * either {@link NameVersionDescriptor#TYPE_FEATURE} or {@link NameVersionDescriptor#TYPE_PLUGIN} as their + * type. If the target is set to include all units (no filtering is being done), this method will return + * <code>null</code>. + * + * @see #getBundles() + * @see #setIncluded(NameVersionDescriptor[]) + * @return list of name version descriptors or <code>null</code> + */ + NameVersionDescriptor[] getIncluded(); + + /** + * Sets a list of descriptors to filter the resolved plug-ins in this target. The list may include both + * plug-ins and features. To include all plug-ins in the target, pass <code>null</code> as the argument. + * <p> + * The descriptions passed to this method must have an ID set. The version may be <code>null</code> + * to include any version of the matches the ID. Only descriptors with a type of {@link NameVersionDescriptor#TYPE_FEATURE} + * or {@link NameVersionDescriptor#TYPE_PLUGIN} will be considered. + * </p> + * @see #getBundles() + * @see #getIncluded() + * @param included list of descriptors to include in the target or <code>null</code> to include all plug-ins + */ + void setIncluded(NameVersionDescriptor[] included); + + /** + * Returns JRE container path that this target definition should be built against, + * or <code>null</code> if the workspace default JRE should be used. JavaRuntime can be used + * to resolve JRE's and execution environments from a container path. + * + * @return JRE container path or <code>null</code> + * @see JavaRuntime + */ + IPath getJREContainer(); + + /** + * Sets the JRE that this target definition should be built against, or <code>null</code> + * to use the workspace default JRE. JavaRuntime should be used to generate and parse + * JRE container paths. + * + * @param containerPath JRE container path + * @see JavaRuntime + */ + void setJREContainer(IPath containerPath); + + /** + * Returns the identifier of the operating system this target is configured for, + * possibly <code>null</code>. + * + * @return operating system identifier or <code>null</code> to default to the + * running operating system + */ + String getOS(); + + /** + * Sets the operating system this target is configured for or <code>null</code> to + * default to the running operating system. + * + * @param os operating system identifier - one of the operating system constants + * defined by {@link Constants} or <code>null</code> to default to the running + * operating system + */ + void setOS(String os); + + /** + * Returns the identifier of the window system this target is configured for, + * possibly <code>null</code>. + * + * @return window system identifier - one of the window system constants + * defined by {@link Constants}, or <code>null</code> to default to the + * running window system + */ + String getWS(); + + /** + * Sets the window system this target is configured for or <code>null</code> to + * default to the running window system. + * + * @param ws window system identifier or <code>null</code> to default to the + * running window system + */ + void setWS(String ws); + + /** + * Returns the identifier of the architecture this target is configured for, + * or <code>null</code> to default to the running architecture. + * + * @return architecture identifier - one of the architecture constants + * defined by {@link Constants} or <code>null</code> to default to the running + * architecture + */ + String getArch(); + + /** + * Sets the architecture this target is configured for, or <code>null</code> to default + * to the running architecture. + * + * @param arch architecture identifier or <code>null</code> to default to the + * running architecture. + */ + void setArch(String arch); + + /** + * Returns the identifier of the locale this target is configured for, or <code>null</code> + * for default. + * + * @return locale identifier or <code>null</code> for default + */ + String getNL(); + + /** + * Sets the locale this target is configured for or <code>null</code> for default. + * + * @param nl locale identifier or <code>null</code> for default + */ + void setNL(String nl); + + /** + * Returns any program arguments that should be used when launching this target + * or <code>null</code> if none. + * + * @return program arguments or <code>null</code> if none + */ + String getProgramArguments(); + + /** + * Sets any program arguments that should be used when launching this target + * or <code>null</code> if none. + * + * @param args program arguments or <code>null</code> + */ + void setProgramArguments(String args); + + /** + * Returns any VM arguments that should be used when launching this target + * or <code>null</code> if none. + * + * @return VM arguments or <code>null</code> if none + */ + String getVMArguments(); + + /** + * Sets any VM arguments that should be used when launching this target + * or <code>null</code> if none. + * + * @param args VM arguments or <code>null</code> + */ + void setVMArguments(String args); + + /** + * Sets implicit dependencies for this target. Bundles in this collection are always + * considered by PDE when computing plug-in dependencies. Only symbolic names need to + * be specified in the given descriptors. + * + * @param bundles implicit dependencies or <code>null</code> if none + */ + void setImplicitDependencies(NameVersionDescriptor[] bundles); + + /** + * Returns the implicit dependencies set on this target or <code>null</code> if none. + * + * @return implicit dependencies or <code>null</code> + */ + NameVersionDescriptor[] getImplicitDependencies(); +} diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/core/target/TargetBundle.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/core/target/TargetBundle.java index bd8a1039a4..02327408b4 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/core/target/TargetBundle.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/core/target/TargetBundle.java @@ -1,279 +1,280 @@ -/*******************************************************************************
- * Copyright (c) 2009, 2017 IBM Corporation and others.
+/******************************************************************************* + * Copyright (c) 2009, 2017 IBM Corporation and others. * - * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
+ * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * - * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.pde.core.target;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.util.Map;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.RegistryFactory;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.spi.RegistryContributor;
-import org.eclipse.equinox.frameworkadmin.BundleInfo;
-import org.eclipse.osgi.util.ManifestElement;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.pde.internal.core.ICoreConstants;
-import org.eclipse.pde.internal.core.PDECore;
-import org.eclipse.pde.internal.core.target.Messages;
-import org.eclipse.pde.internal.core.util.ManifestUtils;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
-
-/**
- * Describes a single bundle in a target definition. Also used to represent
- * content in the target that is missing or invalid.
- *
- * @since 3.8
- */
-public class TargetBundle {
-
- /**
- * Status code indicating that this target bundle represents a required plug-in that is missing from a target definition
- */
- public static final int STATUS_PLUGIN_DOES_NOT_EXIST = 100;
-
- /**
- * Status code indicating that this target bundle represents a required feature that is missing from a target definition
- */
- public static final int STATUS_FEATURE_DOES_NOT_EXIST = 110;
-
- /**
- * Status code indicating that a required bundle version does not exist (a bundle
- * with the correct symbolic name is present, but the specified version was not
- * found).
- */
- public static final int STATUS_VERSION_DOES_NOT_EXIST = 101;
-
- /**
- * Status code indicating that a bundle's manifest could not be read, or did not exist.
- */
- public static final int STATUS_INVALID_MANIFEST = 102;
-
- protected BundleInfo fInfo;
- protected boolean fIsFragment = false;
- protected BundleInfo fSourceTarget;
- protected String fSourcePath = null;
-
- /**
- * Constructs a target bundle for a local bundle. The bundle may be a directory or
- * an archive file. The manifest of the bundle will be read to collect the additional
- * information.
- *
- * @param bundleLocation the location of the bundle (directory or archive) to open
- * @throws CoreException if there is a problem opening the bundle or its manifest
- */
- public TargetBundle(File bundleLocation) throws CoreException {
- initialize(bundleLocation);
- }
-
- /**
- * Constructs an empty target bundle with no information.
- */
- protected TargetBundle() {
- fInfo = new BundleInfo();
- }
-
- /**
- * Returns a {@link BundleInfo} object containing additional information about the bundle
- * this target bundle represents. It is not guaranteed that the bundle info will have any
- * fields set. The base implementation of {@link TargetBundle} will fill in the location,
- * symbolic name and version if that information was available in the bundle's manifest.
- *
- * @return a bundle info object with information on the bundle this target bundle represents
- */
- public BundleInfo getBundleInfo() {
- return fInfo;
- }
-
- /**
- * Returns a status object describing any problems with this target bundle. The base
- * implementation of {@link TargetBundle} will always return an OK status.
- *
- * @return status of this bundle
- */
- public IStatus getStatus() {
- // The status will always be ok as the constructor would throw an exception for any issues.
- return Status.OK_STATUS;
- }
-
- /**
- * Returns <code>true</code> if this bundle is a source bundle and
- * <code>false</code> if this bundle is an executable bundle.
- *
- * @return whether the resolved bundle is a source bundle
- */
- public boolean isSourceBundle() {
- return fSourceTarget != null;
- }
-
- /**
- * If this bundle is a source bundle this method returns a bundle info
- * representing the executable bundle that this bundle provides source for.
- * The returned bundle info may not have a symbolic name and version set if
- * this source bundle is an old style source plug-in.
- *
- * @return bundle info representing bundle this bundle provides source for or <code>null</code>
- */
- public BundleInfo getSourceTarget() {
- return fSourceTarget;
- }
-
- /**
- * Returns whether this bundle is a fragment.
- *
- * @return whether this bundle is a fragment
- */
- public boolean isFragment() {
- return fIsFragment;
- }
-
- /**
- * Returns bundle relative path to old-style source folders, or <code>null</code>
- * if not applicable.
- *
- * @return bundle relative path to old-style source folders, or <code>null</code>
- */
- public String getSourcePath() {
- return fSourcePath;
- }
-
- /**
- * Initializes the contents of this target bundle from the provided local bundle
- *
- * @param file the bundle to initialize from
- */
- private void initialize(File file) throws CoreException {
- if (file == null || !file.exists()) {
- throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, NLS.bind(Messages.TargetFeature_FileDoesNotExist, file)));
- }
- Map<String, String> manifest = ManifestUtils.loadManifest(file);
- try {
- fInfo = new BundleInfo(file.toURI());
- // Attempt to retrieve additional bundle information from the manifest
- String header = manifest.get(Constants.BUNDLE_SYMBOLICNAME);
- if (header != null) {
- ManifestElement[] elements = ManifestElement.parseHeader(Constants.BUNDLE_SYMBOLICNAME, header);
- if (elements != null) {
- String name = elements[0].getValue();
- if (name != null) {
- fInfo.setSymbolicName(name);
- header = manifest.get(Constants.BUNDLE_VERSION);
- if (header != null) {
- elements = ManifestElement.parseHeader(Constants.BUNDLE_VERSION, header);
- if (elements != null) {
- fInfo.setVersion(elements[0].getValue());
- }
- }
- }
- fSourceTarget = getProvidedSource(file, name, manifest);
- }
- }
- fIsFragment = manifest.containsKey(Constants.FRAGMENT_HOST);
- } catch (BundleException e) {
- throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, STATUS_INVALID_MANIFEST, NLS.bind(Messages.TargetBundle_ErrorReadingManifest, file.getAbsolutePath()), e));
- }
- }
-
- /**
- * If the given bundle is a source bundle, the bundle that this bundle provides source for will be returned.
- * If the given bundle is not a source bundle or there was a problem getting the source target, <code>null</code>
- * will be returned.
- *
- * @param bundle location of the bundle in the file system, can be <code>null</code> to skip searching plugin.xml
- * @param symbolicName symbolic name of the bundle, can be <code>null</code> to skip searching of plugin.xml
- * @param manifest the bundle's manifest, can be <code>null</code> to skip searching of manifest entries
- * @return bundle for provided source or <code>null</code> if not a source bundle
- */
- private BundleInfo getProvidedSource(File bundle, String symbolicName, Map<String, String> manifest) {
- fSourcePath = null;
- if (manifest != null) {
- if (manifest.containsKey(ICoreConstants.ECLIPSE_SOURCE_BUNDLE)) {
- try {
- ManifestElement[] manifestElements = ManifestElement.parseHeader(ICoreConstants.ECLIPSE_SOURCE_BUNDLE, manifest.get(ICoreConstants.ECLIPSE_SOURCE_BUNDLE));
- if (manifestElements != null) {
- for (ManifestElement element : manifestElements) {
- String binaryPluginName = element.getValue();
- String versionEntry = element.getAttribute(Constants.VERSION_ATTRIBUTE);
- // Currently the version attribute is required
- if (binaryPluginName != null && binaryPluginName.length() > 0 && versionEntry != null && versionEntry.length() > 0) {
- return new BundleInfo(binaryPluginName, versionEntry, null, BundleInfo.NO_LEVEL, false);
- }
- }
- }
- } catch (BundleException e) {
- PDECore.log(e);
- return null;
- }
- }
- // source bundles never have a class path
- if (manifest.containsKey(Constants.BUNDLE_CLASSPATH)) {
- return null;
- }
- }
-
- if (bundle != null && symbolicName != null) {
- // old source bundles were never jar'd
- if (bundle.isFile()) {
- return null;
- }
-
- // check for an "org.eclipse.pde.core.source" extension
- File pxml = new File(bundle, ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR);
- if (!pxml.exists()) {
- pxml = new File(bundle, ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR);
- }
- if (pxml.exists()) {
- IExtensionRegistry registry = RegistryFactory.createRegistry(null, this, this);
- // Contribute PDE source extension point
- String bogusDef = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<?eclipse version=\"3.2\"?>\n<plugin><extension-point id=\"source\" name=\"source\"/>\n</plugin>"; //$NON-NLS-1$
- RegistryContributor pointContributor = new RegistryContributor(PDECore.PLUGIN_ID, PDECore.PLUGIN_ID, null, null);
- registry.addContribution(new ByteArrayInputStream(bogusDef.getBytes()), pointContributor, false, null, null, this);
- // Search for extensions to the extension point
- RegistryContributor contributor = new RegistryContributor(symbolicName, symbolicName, null, null);
- try {
- registry.addContribution(new BufferedInputStream(new FileInputStream(pxml)), contributor, false, null, null, this);
- IExtension[] extensions = registry.getExtensions(contributor);
- for (IExtension extension : extensions) {
- if (ICoreConstants.EXTENSION_POINT_SOURCE.equals(extension.getExtensionPointUniqueIdentifier())) {
- IConfigurationElement[] elements = extension.getConfigurationElements();
- if (elements.length == 1) {
- fSourcePath = elements[0].getAttribute("path"); //$NON-NLS-1$
- }
- return new BundleInfo(null, null, bundle.toURI(), BundleInfo.NO_LEVEL, false);
- }
- }
- } catch (FileNotFoundException e) {
- }
- }
- }
- return null;
- }
-
- @Override
- public String toString() {
- StringBuilder result = new StringBuilder(getBundleInfo().toString());
- IStatus status = getStatus();
- if (status != null && !status.isOK()) {
- result.append(' ').append(status.toString());
- }
- return result.toString();
- }
-}
+ * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.pde.core.target; + +import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.util.Map; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.RegistryFactory; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.spi.RegistryContributor; +import org.eclipse.equinox.frameworkadmin.BundleInfo; +import org.eclipse.osgi.util.ManifestElement; +import org.eclipse.osgi.util.NLS; +import org.eclipse.pde.internal.core.ICoreConstants; +import org.eclipse.pde.internal.core.PDECore; +import org.eclipse.pde.internal.core.target.Messages; +import org.eclipse.pde.internal.core.util.ManifestUtils; +import org.osgi.framework.BundleException; +import org.osgi.framework.Constants; + +/** + * Describes a single bundle in a target definition. Also used to represent + * content in the target that is missing or invalid. + * + * @since 3.8 + */ +public class TargetBundle { + + /** + * Status code indicating that this target bundle represents a required plug-in that is missing from a target definition + */ + public static final int STATUS_PLUGIN_DOES_NOT_EXIST = 100; + + /** + * Status code indicating that this target bundle represents a required feature that is missing from a target definition + */ + public static final int STATUS_FEATURE_DOES_NOT_EXIST = 110; + + /** + * Status code indicating that a required bundle version does not exist (a bundle + * with the correct symbolic name is present, but the specified version was not + * found). + */ + public static final int STATUS_VERSION_DOES_NOT_EXIST = 101; + + /** + * Status code indicating that a bundle's manifest could not be read, or did not exist. + */ + public static final int STATUS_INVALID_MANIFEST = 102; + + protected BundleInfo fInfo; + protected boolean fIsFragment = false; + protected BundleInfo fSourceTarget; + protected String fSourcePath = null; + + /** + * Constructs a target bundle for a local bundle. The bundle may be a directory or + * an archive file. The manifest of the bundle will be read to collect the additional + * information. + * + * @param bundleLocation the location of the bundle (directory or archive) to open + * @throws CoreException if there is a problem opening the bundle or its manifest + */ + public TargetBundle(File bundleLocation) throws CoreException { + initialize(bundleLocation); + } + + /** + * Constructs an empty target bundle with no information. + */ + protected TargetBundle() { + fInfo = new BundleInfo(); + } + + /** + * Returns a {@link BundleInfo} object containing additional information about the bundle + * this target bundle represents. It is not guaranteed that the bundle info will have any + * fields set. The base implementation of {@link TargetBundle} will fill in the location, + * symbolic name and version if that information was available in the bundle's manifest. + * + * @return a bundle info object with information on the bundle this target bundle represents + */ + public BundleInfo getBundleInfo() { + return fInfo; + } + + /** + * Returns a status object describing any problems with this target bundle. The base + * implementation of {@link TargetBundle} will always return an OK status. + * + * @return status of this bundle + */ + public IStatus getStatus() { + // The status will always be ok as the constructor would throw an exception for any issues. + return Status.OK_STATUS; + } + + /** + * Returns <code>true</code> if this bundle is a source bundle and + * <code>false</code> if this bundle is an executable bundle. + * + * @return whether the resolved bundle is a source bundle + */ + public boolean isSourceBundle() { + return fSourceTarget != null; + } + + /** + * If this bundle is a source bundle this method returns a bundle info + * representing the executable bundle that this bundle provides source for. + * The returned bundle info may not have a symbolic name and version set if + * this source bundle is an old style source plug-in. + * + * @return bundle info representing bundle this bundle provides source for or <code>null</code> + */ + public BundleInfo getSourceTarget() { + return fSourceTarget; + } + + /** + * Returns whether this bundle is a fragment. + * + * @return whether this bundle is a fragment + */ + public boolean isFragment() { + return fIsFragment; + } + + /** + * Returns bundle relative path to old-style source folders, or <code>null</code> + * if not applicable. + * + * @return bundle relative path to old-style source folders, or <code>null</code> + */ + public String getSourcePath() { + return fSourcePath; + } + + /** + * Initializes the contents of this target bundle from the provided local bundle + * + * @param file the bundle to initialize from + */ + private void initialize(File file) throws CoreException { + if (file == null || !file.exists()) { + throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, NLS.bind(Messages.TargetFeature_FileDoesNotExist, file))); + } + Map<String, String> manifest = ManifestUtils.loadManifest(file); + try { + fInfo = new BundleInfo(file.toURI()); + // Attempt to retrieve additional bundle information from the manifest + String header = manifest.get(Constants.BUNDLE_SYMBOLICNAME); + if (header != null) { + ManifestElement[] elements = ManifestElement.parseHeader(Constants.BUNDLE_SYMBOLICNAME, header); + if (elements != null) { + String name = elements[0].getValue(); + if (name != null) { + fInfo.setSymbolicName(name); + header = manifest.get(Constants.BUNDLE_VERSION); + if (header != null) { + elements = ManifestElement.parseHeader(Constants.BUNDLE_VERSION, header); + if (elements != null) { + fInfo.setVersion(elements[0].getValue()); + } + } + } + fSourceTarget = getProvidedSource(file, name, manifest); + } + } + fIsFragment = manifest.containsKey(Constants.FRAGMENT_HOST); + } catch (BundleException e) { + throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, STATUS_INVALID_MANIFEST, NLS.bind(Messages.TargetBundle_ErrorReadingManifest, file.getAbsolutePath()), e)); + } + } + + /** + * If the given bundle is a source bundle, the bundle that this bundle provides source for will be returned. + * If the given bundle is not a source bundle or there was a problem getting the source target, <code>null</code> + * will be returned. + * + * @param bundle location of the bundle in the file system, can be <code>null</code> to skip searching plugin.xml + * @param symbolicName symbolic name of the bundle, can be <code>null</code> to skip searching of plugin.xml + * @param manifest the bundle's manifest, can be <code>null</code> to skip searching of manifest entries + * @return bundle for provided source or <code>null</code> if not a source bundle + */ + private BundleInfo getProvidedSource(File bundle, String symbolicName, Map<String, String> manifest) { + fSourcePath = null; + if (manifest != null) { + if (manifest.containsKey(ICoreConstants.ECLIPSE_SOURCE_BUNDLE)) { + try { + ManifestElement[] manifestElements = ManifestElement.parseHeader(ICoreConstants.ECLIPSE_SOURCE_BUNDLE, manifest.get(ICoreConstants.ECLIPSE_SOURCE_BUNDLE)); + if (manifestElements != null) { + for (ManifestElement element : manifestElements) { + String binaryPluginName = element.getValue(); + String versionEntry = element.getAttribute(Constants.VERSION_ATTRIBUTE); + // Currently the version attribute is required + if (binaryPluginName != null && binaryPluginName.length() > 0 && versionEntry != null && versionEntry.length() > 0) { + return new BundleInfo(binaryPluginName, versionEntry, null, BundleInfo.NO_LEVEL, false); + } + } + } + } catch (BundleException e) { + PDECore.log(e); + return null; + } + } + // source bundles never have a class path + if (manifest.containsKey(Constants.BUNDLE_CLASSPATH)) { + return null; + } + } + + if (bundle != null && symbolicName != null) { + // old source bundles were never jar'd + if (bundle.isFile()) { + return null; + } + + // check for an "org.eclipse.pde.core.source" extension + File pxml = new File(bundle, ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR); + if (!pxml.exists()) { + pxml = new File(bundle, ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR); + } + if (pxml.exists()) { + IExtensionRegistry registry = RegistryFactory.createRegistry(null, this, this); + // Contribute PDE source extension point + String bogusDef = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<?eclipse version=\"3.2\"?>\n<plugin><extension-point id=\"source\" name=\"source\"/>\n</plugin>"; //$NON-NLS-1$ + RegistryContributor pointContributor = new RegistryContributor(PDECore.PLUGIN_ID, PDECore.PLUGIN_ID, null, null); + registry.addContribution(new ByteArrayInputStream(bogusDef.getBytes()), pointContributor, false, null, null, this); + // Search for extensions to the extension point + RegistryContributor contributor = new RegistryContributor(symbolicName, symbolicName, null, null); + try { + registry.addContribution(new BufferedInputStream(new FileInputStream(pxml)), contributor, false, null, null, this); + IExtension[] extensions = registry.getExtensions(contributor); + for (IExtension extension : extensions) { + if (ICoreConstants.EXTENSION_POINT_SOURCE.equals(extension.getExtensionPointUniqueIdentifier())) { + IConfigurationElement[] elements = extension.getConfigurationElements(); + if (elements.length == 1) { + fSourcePath = elements[0].getAttribute("path"); //$NON-NLS-1$ + } + return new BundleInfo(null, null, bundle.toURI(), BundleInfo.NO_LEVEL, false); + } + } + } catch (FileNotFoundException e) { + } + } + } + return null; + } + + + @Override + public String toString() { + StringBuilder result = new StringBuilder(getBundleInfo().toString()); + IStatus status = getStatus(); + if (status != null && !status.isOK()) { + result.append(' ').append(status.toString()); + } + return result.toString(); + } +} diff --git a/ui/org.eclipse.pde.core/src_ant/org/eclipse/pde/internal/core/ant/TargetPlatformProvisionTask.java b/ui/org.eclipse.pde.core/src_ant/org/eclipse/pde/internal/core/ant/TargetPlatformProvisionTask.java index f3d2044643..af2b92b11e 100644 --- a/ui/org.eclipse.pde.core/src_ant/org/eclipse/pde/internal/core/ant/TargetPlatformProvisionTask.java +++ b/ui/org.eclipse.pde.core/src_ant/org/eclipse/pde/internal/core/ant/TargetPlatformProvisionTask.java @@ -1,139 +1,140 @@ -/**
- * Copyright (c) 2011, 2012 Gunnar Wagenknecht and others.
- * All rights reserved.
- *
- * This program and the accompanying materials are made available under the terms of the
- * Eclipse Public License 2.0 which accompanies this distribution, and is available at
+/** + * Copyright (c) 2011, 2012 Gunnar Wagenknecht and others. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the + * Eclipse Public License 2.0 which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * - * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Gunnar Wagenknecht - initial API and implementation
- */
-package org.eclipse.pde.internal.core.ant;
-
-import java.io.File;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.pde.core.target.ITargetDefinition;
-import org.eclipse.pde.internal.build.BundleHelper;
-import org.eclipse.pde.internal.build.tasks.TaskHelper;
-import org.eclipse.pde.internal.core.PDECore;
-import org.eclipse.pde.internal.core.PDECoreMessages;
-import org.eclipse.pde.internal.core.target.ExportTargetJob;
-import org.eclipse.pde.internal.core.target.TargetPlatformService;
-
-/**
- * Exports the bundles and plug-ins of a target definition to a directory
- */
-public class TargetPlatformProvisionTask extends Task {
-
- private File targetFile;
- private File destinationDirectory;
- private boolean clearDestination;
-
- @Override
- public void execute() throws BuildException {
-
- try {
- BundleHelper.getDefault().setLog(this);
- run();
- } catch (CoreException e) {
- throw new BuildException(TaskHelper.statusToString(e.getStatus(), null).toString());
- } finally {
- BundleHelper.getDefault().setLog(null);
- }
-
- }
-
- private void export(final ITargetDefinition targetDefinition) throws CoreException {
- // export using Job to allow progress reporting when run inside IDE
- ExportTargetJob exportTargetJob = new ExportTargetJob(targetDefinition, destinationDirectory.toURI(), clearDestination);
- exportTargetJob.schedule();
- try {
- exportTargetJob.join();
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new CoreException(Status.CANCEL_STATUS);
- }
- }
-
- private IStatus resolve(final ITargetDefinition targetDefinition) throws CoreException {
- // resolve using Job to allow progress reporting when run inside IDE
- final IStatus[] status = new IStatus[1];
- Job resolveJob = new Job(NLS.bind(PDECoreMessages.TargetPlatformProvisionTask_Resolving_X_Job, null != targetDefinition.getName() && targetDefinition.getName().length() > 0 ? targetDefinition.getName() : targetFile.getName())) {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- status[0] = targetDefinition.resolve(monitor);
- return Status.OK_STATUS;
- }
- };
- resolveJob.setPriority(Job.LONG);
- resolveJob.schedule();
- try {
- resolveJob.join();
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new CoreException(Status.CANCEL_STATUS);
- }
- return status[0];
- }
-
- private void run() throws CoreException {
- if (null == targetFile) {
- throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.TargetPlatformProvisionTask_ErrorDefinitionNotSet));
- }
- if (!targetFile.isFile() || !targetFile.canRead()) {
- throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, NLS.bind(PDECoreMessages.TargetPlatformProvisionTask_ErrorDefinitionNotFoundAtSpecifiedLocation, targetFile)));
- }
- if (null == destinationDirectory) {
- throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.TargetPlatformProvisionTask_ErrorDestinationNotSet));
- }
-
- final ITargetDefinition targetDefinition = TargetPlatformService.getDefault().getTarget(targetFile.toURI()).getTargetDefinition();
-
- log(PDECoreMessages.TargetPlatformProvisionTask_Resolving_target_status);
- IStatus status = resolve(targetDefinition);
- if (status.matches(IStatus.ERROR | IStatus.CANCEL)) {
- throw new CoreException(status);
- } else if (!status.isOK()) {
- log(TaskHelper.statusToString(status, null).toString(), Project.MSG_WARN);
- }
-
- log(PDECoreMessages.TargetPlatformProvisionTask_Exporting_target_status);
- export(targetDefinition);
- }
-
- /**
- * Set whether the destination should be cleared prior to provisioning.
- * @param clearDestination
- */
- public void setClearDestination(boolean clearDestination) {
- this.clearDestination = clearDestination;
- }
-
- /**
- * Set the folder in which the target will be provisioned.
- * @param destinationDirectory
- */
- public void setDestinationDirectory(File destinationDirectory) {
- this.destinationDirectory = destinationDirectory;
- }
-
- /**
- * Set the target file to provision
- * @param targetFile
- */
- public void setTargetFile(File targetFile) {
- this.targetFile = targetFile;
- }
-
-}
+ * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Gunnar Wagenknecht - initial API and implementation + */ +package org.eclipse.pde.internal.core.ant; + +import java.io.File; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.Task; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.osgi.util.NLS; +import org.eclipse.pde.core.target.ITargetDefinition; +import org.eclipse.pde.internal.build.BundleHelper; +import org.eclipse.pde.internal.build.tasks.TaskHelper; +import org.eclipse.pde.internal.core.PDECore; +import org.eclipse.pde.internal.core.PDECoreMessages; +import org.eclipse.pde.internal.core.target.ExportTargetJob; +import org.eclipse.pde.internal.core.target.TargetPlatformService; + +/** + * Exports the bundles and plug-ins of a target definition to a directory + */ +public class TargetPlatformProvisionTask extends Task { + + private File targetFile; + private File destinationDirectory; + private boolean clearDestination; + + + @Override + public void execute() throws BuildException { + + try { + BundleHelper.getDefault().setLog(this); + run(); + } catch (CoreException e) { + throw new BuildException(TaskHelper.statusToString(e.getStatus(), null).toString()); + } finally { + BundleHelper.getDefault().setLog(null); + } + + } + + private void export(final ITargetDefinition targetDefinition) throws CoreException { + // export using Job to allow progress reporting when run inside IDE + ExportTargetJob exportTargetJob = new ExportTargetJob(targetDefinition, destinationDirectory.toURI(), clearDestination); + exportTargetJob.schedule(); + try { + exportTargetJob.join(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new CoreException(Status.CANCEL_STATUS); + } + } + + private IStatus resolve(final ITargetDefinition targetDefinition) throws CoreException { + // resolve using Job to allow progress reporting when run inside IDE + final IStatus[] status = new IStatus[1]; + Job resolveJob = new Job(NLS.bind(PDECoreMessages.TargetPlatformProvisionTask_Resolving_X_Job, null != targetDefinition.getName() && targetDefinition.getName().length() > 0 ? targetDefinition.getName() : targetFile.getName())) { + @Override + protected IStatus run(IProgressMonitor monitor) { + status[0] = targetDefinition.resolve(monitor); + return Status.OK_STATUS; + } + }; + resolveJob.setPriority(Job.LONG); + resolveJob.schedule(); + try { + resolveJob.join(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new CoreException(Status.CANCEL_STATUS); + } + return status[0]; + } + + private void run() throws CoreException { + if (null == targetFile) { + throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.TargetPlatformProvisionTask_ErrorDefinitionNotSet)); + } + if (!targetFile.isFile() || !targetFile.canRead()) { + throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, NLS.bind(PDECoreMessages.TargetPlatformProvisionTask_ErrorDefinitionNotFoundAtSpecifiedLocation, targetFile))); + } + if (null == destinationDirectory) { + throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.TargetPlatformProvisionTask_ErrorDestinationNotSet)); + } + + final ITargetDefinition targetDefinition = TargetPlatformService.getDefault().getTarget(targetFile.toURI()).getTargetDefinition(); + + log(PDECoreMessages.TargetPlatformProvisionTask_Resolving_target_status); + IStatus status = resolve(targetDefinition); + if (status.matches(IStatus.ERROR | IStatus.CANCEL)) { + throw new CoreException(status); + } else if (!status.isOK()) { + log(TaskHelper.statusToString(status, null).toString(), Project.MSG_WARN); + } + + log(PDECoreMessages.TargetPlatformProvisionTask_Exporting_target_status); + export(targetDefinition); + } + + /** + * Set whether the destination should be cleared prior to provisioning. + * @param clearDestination + */ + public void setClearDestination(boolean clearDestination) { + this.clearDestination = clearDestination; + } + + /** + * Set the folder in which the target will be provisioned. + * @param destinationDirectory + */ + public void setDestinationDirectory(File destinationDirectory) { + this.destinationDirectory = destinationDirectory; + } + + /** + * Set the target file to provision + * @param targetFile + */ + public void setTargetFile(File targetFile) { + this.targetFile = targetFile; + } + +} diff --git a/ui/org.eclipse.pde.genericeditor.extension.tests/src/org/eclipse/pde/genericeditor/extension/tests/StringAsserts.java b/ui/org.eclipse.pde.genericeditor.extension.tests/src/org/eclipse/pde/genericeditor/extension/tests/StringAsserts.java index 67cad5241f..7588dbad9b 100644 --- a/ui/org.eclipse.pde.genericeditor.extension.tests/src/org/eclipse/pde/genericeditor/extension/tests/StringAsserts.java +++ b/ui/org.eclipse.pde.genericeditor.extension.tests/src/org/eclipse/pde/genericeditor/extension/tests/StringAsserts.java @@ -1,203 +1,203 @@ -package org.eclipse.pde.genericeditor.extension.tests;
-
-/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+package org.eclipse.pde.genericeditor.extension.tests; + +/******************************************************************************* + * Copyright (c) 2000, 2013 IBM Corporation and others. * - * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
+ * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * - * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import org.junit.Assert;
-
-/*
- * Copied from org.eclipse.jdt.ui.tests/test plugin/org/eclipse/jdt/testplugin/StringAsserts.javas
- */
-
-public class StringAsserts {
- /**
- *
- */
- public StringAsserts() {
- super();
- }
-
- private static int getDiffPos(String str1, String str2) {
- int len1 = Math.min(str1.length(), str2.length());
-
- int diffPos = -1;
- for (int i = 0; i < len1; i++) {
- if (str1.charAt(i) != str2.charAt(i)) {
- diffPos = i;
- break;
- }
- }
- if (diffPos == -1 && str1.length() != str2.length()) {
- diffPos = len1;
- }
- return diffPos;
- }
-
- private static final int printRange = 6;
-
- public static void assertEqualString(String actual, String expected) {
- if (actual == null || expected == null) {
- if (actual == expected) {
- return;
- }
- if (actual == null) {
- Assert.assertTrue("Content not as expected: is 'null' expected: " + expected, false);
- } else {
- Assert.assertTrue("Content not as expected: expected 'null' is: " + actual, false);
- }
- }
-
- int diffPos = getDiffPos(actual, expected);
- if (diffPos != -1) {
- int diffAhead = Math.max(0, diffPos - printRange);
- int diffAfter = Math.min(actual.length(), diffPos + printRange);
-
- String diffStr = actual.substring(diffAhead, diffPos) + '^' + actual.substring(diffPos, diffAfter);
-
- // use detailed message
- String message = "Content not as expected: is\n" + actual + "\nDiffers at pos " + diffPos + ": " + diffStr //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- + "\nexpected:\n" + expected; //$NON-NLS-1$
-
- Assert.assertEquals(message, expected, actual);
- }
- }
-
- public static void assertEqualStringIgnoreDelim(String actual, String expected) throws IOException {
- if (actual == null || expected == null) {
- if (actual == expected) {
- return;
- }
- if (actual == null) {
- Assert.assertTrue("Content not as expected: is 'null' expected: " + expected, false);
- } else {
- Assert.assertTrue("Content not as expected: expected 'null' is: " + actual, false);
- }
- }
-
- BufferedReader read1 = new BufferedReader(new StringReader(actual));
- BufferedReader read2 = new BufferedReader(new StringReader(expected));
-
- int line = 1;
- do {
- String s1 = read1.readLine();
- String s2 = read2.readLine();
-
- if (s1 == null || !s1.equals(s2)) {
- if (s1 == null && s2 == null) {
- return;
- }
- String diffStr = (s1 == null) ? s2 : s1;
-
- String message = "Content not as expected: Content is: \n" + actual + "\nDiffers at line " + line + ": "
- + diffStr + "\nExpected contents: \n" + expected;
- Assert.assertEquals(message, expected, actual);
- }
- line++;
- } while (true);
- }
-
- public static void assertEqualStringsIgnoreOrder(String[] actuals, String[] expecteds) {
- ArrayList<String> list1 = new ArrayList<>(Arrays.asList(actuals));
- ArrayList<String> list2 = new ArrayList<>(Arrays.asList(expecteds));
-
- for (int i = list1.size() - 1; i >= 0; i--) {
- if (list2.remove(list1.get(i))) {
- list1.remove(i);
- }
- }
-
- int n1 = list1.size();
- int n2 = list2.size();
-
- if (n1 + n2 > 0) {
- if (n1 == 1 && n2 == 1) {
- assertEqualString(list1.get(0), list2.get(0));
- }
-
- StringBuilder buf = new StringBuilder();
- for (int i = 0; i < n1; i++) {
- String s1 = list1.get(i);
- if (s1 != null) {
- buf.append(s1);
- buf.append("\n");
- }
- }
- String actual = buf.toString();
-
- buf = new StringBuilder();
- for (int i = 0; i < n2; i++) {
- String s2 = list2.get(i);
- if (s2 != null) {
- buf.append(s2);
- buf.append("\n");
- }
- }
- String expected = buf.toString();
-
- String message = "Content not as expected: Content is: \n" + actual + "\nExpected contents: \n" + expected;
- Assert.assertEquals(message, expected, actual);
- }
- }
-
- public static void assertExpectedExistInProposals(String[] actuals, String[] expecteds) {
- ArrayList<String> list1 = new ArrayList<>(Arrays.asList(actuals));
- ArrayList<String> list2 = new ArrayList<>(Arrays.asList(expecteds));
-
- for (int i = list1.size() - 1; i >= 0; i--) {
- if (list2.remove(list1.get(i))) {
- list1.remove(i);
- }
- }
-
- int n1 = list1.size();
- int n2 = list2.size();
-
- if (n2 > 0) {
- if (n1 == 1 && n2 == 1) {
- assertEqualString(list1.get(0), list2.get(0));
- }
-
- StringBuilder buf = new StringBuilder();
- for (int i = 0; i < n1; i++) {
- String s1 = list1.get(i);
- if (s1 != null) {
- buf.append(s1);
- buf.append("\n");
- }
- }
- String actual = buf.toString();
-
- buf = new StringBuilder();
- for (int i = 0; i < n2; i++) {
- String s2 = list2.get(i);
- if (s2 != null) {
- buf.append(s2);
- buf.append("\n");
- }
- }
- String expected = buf.toString();
-
- String message = "Content not as expected: Content is: \n" + actual + "\nExpected contents: \n" + expected;
- Assert.assertEquals(message, expected, actual);
- }
- }
-
-}
+ * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.StringReader; +import java.util.ArrayList; +import java.util.Arrays; + +import org.junit.Assert; + +/* + * Copied from org.eclipse.jdt.ui.tests/test plugin/org/eclipse/jdt/testplugin/StringAsserts.javas + */ + +public class StringAsserts { + /** + * + */ + public StringAsserts() { + super(); + } + + private static int getDiffPos(String str1, String str2) { + int len1 = Math.min(str1.length(), str2.length()); + + int diffPos = -1; + for (int i = 0; i < len1; i++) { + if (str1.charAt(i) != str2.charAt(i)) { + diffPos = i; + break; + } + } + if (diffPos == -1 && str1.length() != str2.length()) { + diffPos = len1; + } + return diffPos; + } + + private static final int printRange = 6; + + public static void assertEqualString(String actual, String expected) { + if (actual == null || expected == null) { + if (actual == expected) { + return; + } + if (actual == null) { + Assert.assertTrue("Content not as expected: is 'null' expected: " + expected, false); + } else { + Assert.assertTrue("Content not as expected: expected 'null' is: " + actual, false); + } + } + + int diffPos = getDiffPos(actual, expected); + if (diffPos != -1) { + int diffAhead = Math.max(0, diffPos - printRange); + int diffAfter = Math.min(actual.length(), diffPos + printRange); + + String diffStr = actual.substring(diffAhead, diffPos) + '^' + actual.substring(diffPos, diffAfter); + + // use detailed message + String message = "Content not as expected: is\n" + actual + "\nDiffers at pos " + diffPos + ": " + diffStr //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ + + "\nexpected:\n" + expected; //$NON-NLS-1$ + + Assert.assertEquals(message, expected, actual); + } + } + + public static void assertEqualStringIgnoreDelim(String actual, String expected) throws IOException { + if (actual == null || expected == null) { + if (actual == expected) { + return; + } + if (actual == null) { + Assert.assertTrue("Content not as expected: is 'null' expected: " + expected, false); + } else { + Assert.assertTrue("Content not as expected: expected 'null' is: " + actual, false); + } + } + + BufferedReader read1 = new BufferedReader(new StringReader(actual)); + BufferedReader read2 = new BufferedReader(new StringReader(expected)); + + int line = 1; + do { + String s1 = read1.readLine(); + String s2 = read2.readLine(); + + if (s1 == null || !s1.equals(s2)) { + if (s1 == null && s2 == null) { + return; + } + String diffStr = (s1 == null) ? s2 : s1; + + String message = "Content not as expected: Content is: \n" + actual + "\nDiffers at line " + line + ": " + + diffStr + "\nExpected contents: \n" + expected; + Assert.assertEquals(message, expected, actual); + } + line++; + } while (true); + } + + public static void assertEqualStringsIgnoreOrder(String[] actuals, String[] expecteds) { + ArrayList<String> list1 = new ArrayList<>(Arrays.asList(actuals)); + ArrayList<String> list2 = new ArrayList<>(Arrays.asList(expecteds)); + + for (int i = list1.size() - 1; i >= 0; i--) { + if (list2.remove(list1.get(i))) { + list1.remove(i); + } + } + + int n1 = list1.size(); + int n2 = list2.size(); + + if (n1 + n2 > 0) { + if (n1 == 1 && n2 == 1) { + assertEqualString(list1.get(0), list2.get(0)); + } + + StringBuilder buf = new StringBuilder(); + for (int i = 0; i < n1; i++) { + String s1 = list1.get(i); + if (s1 != null) { + buf.append(s1); + buf.append("\n"); + } + } + String actual = buf.toString(); + + buf = new StringBuilder(); + for (int i = 0; i < n2; i++) { + String s2 = list2.get(i); + if (s2 != null) { + buf.append(s2); + buf.append("\n"); + } + } + String expected = buf.toString(); + + String message = "Content not as expected: Content is: \n" + actual + "\nExpected contents: \n" + expected; + Assert.assertEquals(message, expected, actual); + } + } + + public static void assertExpectedExistInProposals(String[] actuals, String[] expecteds) { + ArrayList<String> list1 = new ArrayList<>(Arrays.asList(actuals)); + ArrayList<String> list2 = new ArrayList<>(Arrays.asList(expecteds)); + + for (int i = list1.size() - 1; i >= 0; i--) { + if (list2.remove(list1.get(i))) { + list1.remove(i); + } + } + + int n1 = list1.size(); + int n2 = list2.size(); + + if (n2 > 0) { + if (n1 == 1 && n2 == 1) { + assertEqualString(list1.get(0), list2.get(0)); + } + + StringBuilder buf = new StringBuilder(); + for (int i = 0; i < n1; i++) { + String s1 = list1.get(i); + if (s1 != null) { + buf.append(s1); + buf.append("\n"); + } + } + String actual = buf.toString(); + + buf = new StringBuilder(); + for (int i = 0; i < n2; i++) { + String s2 = list2.get(i); + if (s2 != null) { + buf.append(s2); + buf.append("\n"); + } + } + String expected = buf.toString(); + + String message = "Content not as expected: Content is: \n" + actual + "\nExpected contents: \n" + expected; + Assert.assertEquals(message, expected, actual); + } + } + +} diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/target/NewTargetDefinitionWizard2.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/target/NewTargetDefinitionWizard2.java index 6042b0e4c7..02d185f419 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/target/NewTargetDefinitionWizard2.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/target/NewTargetDefinitionWizard2.java @@ -1,72 +1,74 @@ -/*******************************************************************************
- * Copyright (c) 2005, 2015 IBM Corporation and others.
+/******************************************************************************* + * Copyright (c) 2005, 2015 IBM Corporation and others. * - * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
+ * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * - * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
+ * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.pde.internal.ui.wizards.target;
-
-import org.eclipse.pde.core.target.ITargetDefinition;
-
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.pde.internal.ui.PDEPluginImages;
-import org.eclipse.pde.internal.ui.PDEUIMessages;
-
-/**
- * Target definition wizard used to create a new target definition from
- * the new target platform preference page.
- */
-public class NewTargetDefinitionWizard2 extends Wizard {
-
- TargetCreationPage fPage;
- ITargetDefinition fDefinition;
-
- public NewTargetDefinitionWizard2() {
- super();
- setDefaultPageImageDescriptor(PDEPluginImages.DESC_TARGET_WIZ);
- setWindowTitle(PDEUIMessages.NewTargetProfileWizard_title);
- setNeedsProgressMonitor(true);
- }
-
- @Override
- public void addPages() {
- fPage = new TargetCreationPage("profile"); //$NON-NLS-1$
- addPage(fPage);
- addPage(new TargetDefinitionContentPage(null));
- }
-
- @Override
- public boolean canFinish() {
- return false;
- }
-
- @Override
- public boolean performFinish() {
- return true;
- }
-
- /**
- * Returns the target definition created by this wizard.
- *
- * @return target definition or <code>null</code> if none
- */
- public ITargetDefinition getTargetDefinition() {
- return fDefinition;
- }
-
- /**
- * Sets the target being edited.
- *
- * @param definition target
- */
- public void setTargetDefinition(ITargetDefinition definition) {
- fDefinition = definition;
- }
-}
+package org.eclipse.pde.internal.ui.wizards.target; + +import org.eclipse.pde.core.target.ITargetDefinition; + +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.pde.internal.ui.PDEPluginImages; +import org.eclipse.pde.internal.ui.PDEUIMessages; + +/** + * Target definition wizard used to create a new target definition from + * the new target platform preference page. + */ +public class NewTargetDefinitionWizard2 extends Wizard { + + TargetCreationPage fPage; + ITargetDefinition fDefinition; + + public NewTargetDefinitionWizard2() { + super(); + setDefaultPageImageDescriptor(PDEPluginImages.DESC_TARGET_WIZ); + setWindowTitle(PDEUIMessages.NewTargetProfileWizard_title); + setNeedsProgressMonitor(true); + } + + @Override + public void addPages() { + fPage = new TargetCreationPage("profile"); //$NON-NLS-1$ + addPage(fPage); + addPage(new TargetDefinitionContentPage(null)); + } + + + @Override + public boolean canFinish() { + return false; + } + + + @Override + public boolean performFinish() { + return true; + } + + /** + * Returns the target definition created by this wizard. + * + * @return target definition or <code>null</code> if none + */ + public ITargetDefinition getTargetDefinition() { + return fDefinition; + } + + /** + * Sets the target being edited. + * + * @param definition target + */ + public void setTargetDefinition(ITargetDefinition definition) { + fDefinition = definition; + } +} diff --git a/ui/org.eclipse.ui.trace/src/org/eclipse/ui/trace/internal/TracingComponentTreeViewer.java b/ui/org.eclipse.ui.trace/src/org/eclipse/ui/trace/internal/TracingComponentTreeViewer.java index 645f45b2ee..def46ecb11 100644 --- a/ui/org.eclipse.ui.trace/src/org/eclipse/ui/trace/internal/TracingComponentTreeViewer.java +++ b/ui/org.eclipse.ui.trace/src/org/eclipse/ui/trace/internal/TracingComponentTreeViewer.java @@ -1,53 +1,53 @@ -/*******************************************************************************
- * Copyright (c) 2011, 2012 IBM Corporation and others.
+/******************************************************************************* + * Copyright (c) 2011, 2012 IBM Corporation and others. * - * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
+ * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * - * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.trace.internal;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.dialogs.FilteredTree;
-
-/**
- * A {@link TracingComponentTreeViewer} provides a tree viewer with support for filtering the content based on user
- * input in a {@link Text} field. Filtering is done via {@link TracingComponentViewerFilter}.
- */
-public class TracingComponentTreeViewer extends FilteredTree {
-
- /**
- * Create a new {@link TracingComponentTreeViewer} instance
- *
- * @param parent
- * The parent composite
- */
- public TracingComponentTreeViewer(final Composite parent) {
-
- super(parent, SWT.NONE, new TracingComponentViewerFilter(), true);
- setInitialText(Messages.filterSearchText);
- }
-
- @Override
- protected TreeViewer doCreateTreeViewer(final Composite treeViewerParentComposite, final int style) {
-
- return new TreeViewer(treeViewerParentComposite, style | SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
- }
-
- @Override
- public void setEnabled(boolean enabled) {
-
- filterComposite.setEnabled(enabled);
- getViewer().getTree().setEnabled(enabled);
- getFilterControl().setEnabled(enabled);
- }
+ * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ui.trace.internal; + +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.dialogs.FilteredTree; + +/** + * A {@link TracingComponentTreeViewer} provides a tree viewer with support for filtering the content based on user + * input in a {@link Text} field. Filtering is done via {@link TracingComponentViewerFilter}. + */ +public class TracingComponentTreeViewer extends FilteredTree { + + /** + * Create a new {@link TracingComponentTreeViewer} instance + * + * @param parent + * The parent composite + */ + public TracingComponentTreeViewer(final Composite parent) { + + super(parent, SWT.NONE, new TracingComponentViewerFilter(), true); + setInitialText(Messages.filterSearchText); + } + + @Override + protected TreeViewer doCreateTreeViewer(final Composite treeViewerParentComposite, final int style) { + + return new TreeViewer(treeViewerParentComposite, style | SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); + } + + @Override + public void setEnabled(boolean enabled) { + + filterComposite.setEnabled(enabled); + getViewer().getTree().setEnabled(enabled); + getFilterControl().setEnabled(enabled); + } }
\ No newline at end of file |